Internals.h 4 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
/*
 * Copyright (C) 2011 Google Inc. All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * 1.  Redistributions of source code must retain the above copyright
 *     notice, this list of conditions and the following disclaimer.
 * 2.  Redistributions in binary form must reproduce the above copyright
 *     notice, this list of conditions and the following disclaimer in the
 *     documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

#ifndef Internals_h
#define Internals_h

29
#include "ExceptionCode.h"
30
#include "PlatformString.h"
31 32
#include <wtf/PassRefPtr.h>
#include <wtf/RefCounted.h>
33
#include <wtf/text/WTFString.h>
34 35 36

namespace WebCore {

37
class ClientRect;
38 39
class Document;
class Element;
40
class Node;
41
class Range;
42

43 44 45 46
class Internals : public RefCounted<Internals> {
public:
    static PassRefPtr<Internals> create();
    virtual ~Internals();
47 48 49

    void reset(Document*);

50 51
    String elementRenderTreeAsText(Element*, ExceptionCode&);

52
    bool isPreloaded(Document*, const String& url);
53

54 55 56
    Node* ensureShadowRoot(Element* host, ExceptionCode&);
    Node* shadowRoot(Element* host, ExceptionCode&);
    void removeShadowRoot(Element* host, ExceptionCode&);
57
    Element* includerFor(Node*, ExceptionCode&);
58
    String shadowPseudoId(Element*, ExceptionCode&);
59
    PassRefPtr<Element> createShadowContentElement(Document*, ExceptionCode&);
60
    Element* getElementByIdInShadowRoot(Node* shadowRoot, const String& id, ExceptionCode&);
61
    void disableMemoryCache(bool disabled);
62

63 64 65 66 67
#if ENABLE(INPUT_COLOR)
    bool connectColorChooserClient(Element*);
    void selectColorInColorChooser(const String& colorValue);
#endif

68 69
#if ENABLE(INSPECTOR)
    void setInspectorResourcesDataSizeLimits(Document*, int maximumResourcesContentSize, int maximumSingleResourceContentSize, ExceptionCode&);
70 71
#else
    void setInspectorResourcesDataSizeLimits(Document*, int maximumResourcesContentSize, int maximumSingleResourceContentSize, ExceptionCode&) { }
72 73
#endif

74 75
    PassRefPtr<ClientRect> boundingBox(Element*, ExceptionCode&);

76 77 78
    unsigned markerCountForNode(Node*, ExceptionCode&);
    PassRefPtr<Range> markerRangeForNode(Node*, unsigned, ExceptionCode&);

79
    void setForceCompositingMode(Document*, bool enabled, ExceptionCode&);
80
    void setZoomAnimatorScale(Document*, double scale, ExceptionCode&);
81

82 83 84
    void setPasswordEchoEnabled(Document*, bool enabled, ExceptionCode&);
    void setPasswordEchoDurationInSeconds(Document*, double durationInSeconds, ExceptionCode&);

85 86
    void setScrollViewPosition(Document*, long x, long y, ExceptionCode&);

87
    bool wasLastChangeUserEdit(Element* textField, ExceptionCode&);
88 89
    String suggestedValue(Element* inputElement, ExceptionCode&);
    void setSuggestedValue(Element* inputElement, const String&, ExceptionCode&);
90
    void scrollElementToRect(Element*, long x, long y, long w, long h, ExceptionCode&);
91

92
    static const char* internalsId;
93

94 95
    void paintControlTints(Document*, ExceptionCode&);

96 97
private:
    Internals();
98 99 100 101 102

    double passwordEchoDurationInSecondsBackup;
    bool passwordEchoEnabledBackup : 1;
    bool passwordEchoDurationInSecondsBackedUp : 1;
    bool passwordEchoEnabledBackedUp : 1;
103 104 105 106 107
};

} // namespace WebCore

#endif