1/*
2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * Copyright (C) 2013 Apple Inc. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * 1.  Redistributions of source code must retain the above copyright
10 *     notice, this list of conditions and the following disclaimer.
11 * 2.  Redistributions in binary form must reproduce the above copyright
12 *     notice, this list of conditions and the following disclaimer in the
13 *     documentation and/or other materials provided with the distribution.
14 *
15 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
16 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
19 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 */
26
27[
28    DoNotCheckConstants
29] interface Internals {
30    DOMString address(Node node);
31
32    GCObservation observeGC(any observed);
33
34    [RaisesException] DOMString elementRenderTreeAsText(Element element);
35    boolean isPreloaded(DOMString url);
36    boolean isLoadingFromMemoryCache(DOMString url);
37
38    void crash();
39
40    [RaisesException] unsigned long numberOfScopedHTMLStyleChildren(Node scope);
41    [RaisesException] CSSStyleDeclaration computedStyleIncludingVisitedInfo(Node node);
42
43    [RaisesException] ShadowRoot ensureShadowRoot(Element host);
44    [RaisesException] ShadowRoot shadowRoot(Element host);
45    [RaisesException] ShadowRoot youngestShadowRoot(Element host);
46    [RaisesException] ShadowRoot oldestShadowRoot(Element host);
47    [RaisesException] ShadowRoot youngerShadowRoot(Node root);
48    [RaisesException] ShadowRoot olderShadowRoot(Node root);
49
50    [RaisesException] DOMString shadowRootType(Node root);
51    [RaisesException] boolean hasShadowInsertionPoint(Node root);
52    [RaisesException] boolean hasContentElement(Node root);
53    [RaisesException] unsigned long countElementShadow(Node Root);
54    [RaisesException] Element includerFor(Node node);
55    [RaisesException] DOMString shadowPseudoId(Element element);
56    [RaisesException] void setShadowPseudoId(Element element, DOMString id);
57    [RaisesException] Element createContentElement();
58    [RaisesException] boolean isValidContentSelect(Element contentElement);
59    [RaisesException] Node treeScopeRootNode(Node node);
60    [RaisesException] Node parentTreeScope(Node node);
61    [RaisesException] boolean hasSelectorForIdInShadow(Element host, DOMString id);
62    [RaisesException] boolean hasSelectorForClassInShadow(Element host, DOMString className);
63    [RaisesException] boolean hasSelectorForAttributeInShadow(Element host, DOMString attributeName);
64    [RaisesException] boolean hasSelectorForPseudoClassInShadow(Element host, DOMString pseudoClass);
65    [RaisesException] unsigned short compareTreeScopePosition(Node treeScope1, Node treeScope2);
66
67    // CSS Animation and Transition testing.
68    unsigned long numberOfActiveAnimations();
69    [RaisesException] void suspendAnimations(Document document);
70    [RaisesException] void resumeAnimations(Document document);
71    [RaisesException] void pauseAnimations(double pauseTime);
72
73    [RaisesException] Node nextSiblingByWalker(Node node);
74    [RaisesException] Node firstChildByWalker(Node node);
75    [RaisesException] Node lastChildByWalker(Node node);
76    [RaisesException] Node nextNodeByWalker(Node node);
77    [RaisesException] Node previousNodeByWalker(Node node);
78
79    [RaisesException] boolean attached(Node node);
80
81    DOMString visiblePlaceholder(Element element);
82
83    void selectColorInColorChooser(Element element, DOMString colorValue);
84
85    [RaisesException] DOMString[] formControlStateOfPreviousHistoryItem();
86    [RaisesException] void setFormControlStateOfPreviousHistoryItem(sequence<DOMString> values);
87    [RaisesException] void setEnableMockPagePopup(boolean enabled);
88    readonly attribute PagePopupController pagePopupController;
89
90    [RaisesException] ClientRect absoluteCaretBounds();
91
92    [RaisesException] ClientRect boundingBox(Element element);
93
94    [RaisesException] ClientRectList inspectorHighlightRects(Document document);
95
96    [RaisesException] unsigned long markerCountForNode(Node node, DOMString markerType);
97    [RaisesException] Range markerRangeForNode(Node node, DOMString markerType, unsigned long index);
98    [RaisesException] DOMString markerDescriptionForNode(Node node, DOMString markerType, unsigned long index);
99    void addTextMatchMarker(Range range, boolean isActive);
100
101    [RaisesException] void setScrollViewPosition(Document document, long x, long y);
102
103    [RaisesException] void setPagination(Document document, DOMString mode, long gap, optional long pageLength);
104
105    [RaisesException] DOMString configurationForViewport(Document document,
106                                       float devicePixelRatio,
107                                       long deviceWidth,
108                                       long deviceHeight,
109                                       long availableWidth,
110                                       long availableHeight);
111
112    [RaisesException] boolean wasLastChangeUserEdit(Element textField);
113    [RaisesException] boolean elementShouldAutoComplete(Element inputElement);
114    [RaisesException] DOMString suggestedValue(Element inputElement);
115    [RaisesException] void setSuggestedValue(Element inputElement, DOMString value);
116    [RaisesException] void setEditingValue(Element inputElement, DOMString value);
117    [RaisesException] void setAutofilled(Element inputElement, boolean enabled);
118
119    [RaisesException] void paintControlTints(Document document);
120
121    [RaisesException] void scrollElementToRect(Element element, long x, long y, long w, long h);
122
123    [RaisesException] Range rangeFromLocationAndLength(Element scope, long rangeLocation, long rangeLength);
124    [RaisesException] unsigned long locationFromRange(Element scope, Range range);
125    [RaisesException] unsigned long lengthFromRange(Element scope, Range range);
126    [RaisesException] DOMString rangeAsText(Range range);
127
128    [RaisesException] WebKitPoint touchPositionAdjustedToBestClickableNode(long x, long y, long width, long height, Document document);
129    [RaisesException] Node touchNodeAdjustedToBestClickableNode(long x, long y, long width, long height, Document document);
130    [RaisesException] WebKitPoint touchPositionAdjustedToBestContextMenuNode(long x, long y, long width, long height, Document document);
131    [RaisesException] Node touchNodeAdjustedToBestContextMenuNode(long x, long y, long width, long height, Document document);
132    [RaisesException] ClientRect bestZoomableAreaForTouchPoint(long x, long y, long width, long height, Document document);
133
134    [RaisesException] long lastSpellCheckRequestSequence(Document document);
135    [RaisesException] long lastSpellCheckProcessedSequence(Document document);
136
137    sequence<DOMString> userPreferredLanguages();
138    void setUserPreferredLanguages(sequence<DOMString> languages);
139
140    [RaisesException] unsigned long wheelEventHandlerCount(Document document);
141    [RaisesException] unsigned long touchEventHandlerCount(Document document);
142    [RaisesException] LayerRectList touchEventTargetLayerRects(Document document);
143    [RaisesException] unsigned long touchEventTargetLayerRectsUpdateCount(Document document);
144
145    [RaisesException] NodeList nodesFromRect(Document document, long x, long y,
146        unsigned long topPadding, unsigned long rightPadding, unsigned long bottomPadding, unsigned long leftPadding,
147        boolean ignoreClipping, boolean allowShadowContent, boolean allowChildFrameContent);
148
149    void emitInspectorDidBeginFrame();
150    void emitInspectorDidCancelFrame();
151
152    [RaisesException] boolean hasSpellingMarker(Document document, long from, long length);
153    [RaisesException] boolean hasGrammarMarker(Document document, long from, long length);
154    [RaisesException] void setContinuousSpellCheckingEnabled(boolean enabled);
155
156    [RaisesException] boolean isOverwriteModeEnabled(Document document);
157    [RaisesException] void toggleOverwriteModeEnabled(Document document);
158
159    [RaisesException] unsigned long numberOfScrollableAreas(Document document);
160
161    [RaisesException] boolean isPageBoxVisible(Document document, long pageNumber);
162
163    readonly attribute InternalSettings settings;
164    readonly attribute InternalProfilers profilers;
165    readonly attribute InternalRuntimeFlags runtimeFlags;
166    readonly attribute unsigned long workerThreadCount;
167
168    // Flags for layerTreeAsText.
169    // The values of these constants must be kept in sync with the values of LayerTreeAsTextBehaviorFlags in GraphicsLayerClient.h.
170    const unsigned short LAYER_TREE_INCLUDES_REPAINT_RECTS = 2;
171    const unsigned short LAYER_TREE_INCLUDES_PAINTING_PHASES = 4;
172    const unsigned short LAYER_TREE_INCLUDES_ROOT_LAYER = 8;
173    [RaisesException] DOMString layerTreeAsText(Document document, optional unsigned short flags);
174    [RaisesException] DOMString elementLayerTreeAsText(Element element, optional unsigned short flags);
175
176    [RaisesException] NodeList paintOrderListBeforePromote(Element element);
177    [RaisesException] NodeList paintOrderListAfterPromote(Element element);
178
179    // The values of these constants must be kept in sync with those in RenderLayer.
180    const unsigned short DO_NOT_FORCE_COMPOSITED_SCROLLING = 0;
181    const unsigned short COMPOSITED_SCROLLING_ALWAYS_ON = 1;
182    const unsigned short COMPOSITED_SCROLLING_ALWAYS_OFF = 2;
183    [RaisesException] void setNeedsCompositedScrolling(Element element, unsigned short value);
184
185    [RaisesException] DOMString scrollingStateTreeAsText(Document document);
186    [RaisesException] DOMString mainThreadScrollingReasons(Document document);
187    [RaisesException] ClientRectList nonFastScrollableRects(Document document);
188
189    [RaisesException] DOMString repaintRectsAsText(Document document);
190
191    [RaisesException] void garbageCollectDocumentResources(Document document);
192    void evictAllResources();
193
194    void allowRoundingHacks();
195
196    void insertAuthorCSS(Document document, DOMString css);
197    void insertUserCSS(Document document, DOMString css);
198
199    unsigned long numberOfLiveNodes();
200    unsigned long numberOfLiveDocuments();
201    sequence<DOMString> consoleMessageArgumentCounts(Document document);
202    Window openDummyInspectorFrontend(DOMString url);
203    void closeDummyInspectorFrontend();
204    unsigned long[] setMemoryCacheCapacities(unsigned long minDeadBytes, unsigned long maxDeadBytes, unsigned long totalBytes);
205    [RaisesException] void setInspectorResourcesDataSizeLimits(long maximumResourcesContentSize, long maximumSingleResourceContentSize);
206
207    DOMString counterValue(Element element);
208    long pageNumber(Element element, optional float pageWidth, optional float pageHeight);
209    DOMString[] shortcutIconURLs(Document document);
210    DOMString[] allIconURLs(Document document);
211    long numberOfPages(optional double pageWidthInPixels, optional double pageHeightInPixels);
212    [RaisesException] DOMString pageProperty(DOMString propertyName, long pageNumber);
213    [RaisesException] DOMString pageSizeAndMarginsInPixels(long pageIndex, long width, long height, long marginTop, long marginRight, long marginBottom, long marginLeft);
214
215    [RaisesException] void setDeviceScaleFactor(float scaleFactor);
216
217    [RaisesException] void setIsCursorVisible(Document document, boolean isVisible);
218
219    void webkitWillEnterFullScreenForElement(Document document, Element element);
220    void webkitDidEnterFullScreenForElement(Document document, Element element);
221    void webkitWillExitFullScreenForElement(Document document, Element element);
222    void webkitDidExitFullScreenForElement(Document document, Element element);
223
224    void registerURLSchemeAsBypassingContentSecurityPolicy(DOMString scheme);
225    void removeURLSchemeRegisteredAsBypassingContentSecurityPolicy(DOMString scheme);
226
227    MallocStatistics mallocStatistics();
228    TypeConversions typeConversions();
229
230    DOMString[] getReferencedFilePaths();
231
232    // These functions both reset the tracked repaint rects. They are inteded to be used in the following order:
233    //  startTrackingRepaints, repaintRectsAsText, stopTrackingRepaints.
234    [RaisesException] void startTrackingRepaints(Document document);
235    [RaisesException] void stopTrackingRepaints(Document document);
236
237    // Returns a string with information about the mouse cursor used at the specified client location.
238    [RaisesException] DOMString getCurrentCursorInfo(Document document);
239
240    [RaisesException] DOMString markerTextForListItem(Element element);
241
242    [RaisesException] DOMString baseURL(Document document);
243
244    SerializedScriptValue deserializeBuffer(ArrayBuffer buffer);
245    ArrayBuffer serializeObject(SerializedScriptValue obj);
246
247    void setUsesOverlayScrollbars(boolean enabled);
248
249    void forceReload(boolean endToEnd);
250
251    void enableMockSpeechSynthesizer();
252
253    [RaisesException] DOMString getImageSourceURL(Element element);
254
255    boolean isSelectPopupVisible(Node node);
256
257    [RaisesException] ClientRect selectionBounds();
258
259    boolean loseSharedGraphicsContext3D();
260};
261