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    void setStyleResolverStatsEnabled(boolean enabled);
41    [RaisesException] DOMString styleResolverStatsReport();
42    [RaisesException] DOMString styleResolverStatsTotalsReport();
43
44    [RaisesException] unsigned long numberOfScopedHTMLStyleChildren(Node scope);
45    [RaisesException] CSSStyleDeclaration computedStyleIncludingVisitedInfo(Node node);
46
47    [RaisesException] ShadowRoot ensureShadowRoot(Element host);
48    [RaisesException] ShadowRoot shadowRoot(Element host);
49    [RaisesException] ShadowRoot youngestShadowRoot(Element host);
50    [RaisesException] ShadowRoot oldestShadowRoot(Element host);
51    [RaisesException] ShadowRoot youngerShadowRoot(Node root);
52    [RaisesException] ShadowRoot olderShadowRoot(Node root);
53
54    [RaisesException] DOMString shadowRootType(Node root);
55    [RaisesException] boolean hasShadowInsertionPoint(Node root);
56    [RaisesException] boolean hasContentElement(Node root);
57    [RaisesException] unsigned long countElementShadow(Node Root);
58    [RaisesException] DOMString shadowPseudoId(Element element);
59    [RaisesException] void setShadowPseudoId(Element element, DOMString id);
60    [RaisesException] Element createContentElement();
61    [RaisesException] boolean isValidContentSelect(Element contentElement);
62    [RaisesException] Node treeScopeRootNode(Node node);
63    [RaisesException] Node parentTreeScope(Node node);
64    [RaisesException] boolean hasSelectorForIdInShadow(Element host, DOMString id);
65    [RaisesException] boolean hasSelectorForClassInShadow(Element host, DOMString className);
66    [RaisesException] boolean hasSelectorForAttributeInShadow(Element host, DOMString attributeName);
67    [RaisesException] boolean hasSelectorForPseudoClassInShadow(Element host, DOMString pseudoClass);
68    [RaisesException] unsigned short compareTreeScopePosition(Node treeScope1, Node treeScope2);
69    [RaisesException] unsigned long updateStyleAndReturnAffectedElementCount();
70
71    // CSS Animation and Transition testing.
72    unsigned long numberOfActiveAnimations();
73    [RaisesException] void pauseAnimations(double pauseTime);
74
75    [RaisesException] Node nextSiblingByWalker(Node node);
76    [RaisesException] Node firstChildByWalker(Node node);
77    [RaisesException] Node lastChildByWalker(Node node);
78    [RaisesException] Node nextNodeByWalker(Node node);
79    [RaisesException] Node previousNodeByWalker(Node node);
80
81    DOMString visiblePlaceholder(Element element);
82
83    void selectColorInColorChooser(Element element, DOMString colorValue);
84
85    [RaisesException] DOMString[] formControlStateOfHistoryItem();
86    [RaisesException] void setFormControlStateOfHistoryItem(sequence<DOMString> values);
87    [RaisesException] void setEnableMockPagePopup(boolean enabled);
88    readonly attribute PagePopupController pagePopupController;
89
90    [RaisesException] ClientRect unscaledViewportRect();
91
92    [RaisesException] ClientRect absoluteCaretBounds();
93
94    [RaisesException] ClientRect boundingBox(Element element);
95
96    [RaisesException] ClientRectList inspectorHighlightRects(Document document);
97
98    [RaisesException] unsigned long markerCountForNode(Node node, DOMString markerType);
99    [RaisesException] unsigned long activeMarkerCountForNode(Node node);
100    [RaisesException] Range markerRangeForNode(Node node, DOMString markerType, unsigned long index);
101    [RaisesException] DOMString markerDescriptionForNode(Node node, DOMString markerType, unsigned long index);
102    void addTextMatchMarker(Range range, boolean isActive);
103    [RaisesException] void setMarkersActive(Node node, unsigned long startOffset, unsigned long endOffset, boolean active);
104
105    [RaisesException] void setScrollViewPosition(Document document, long x, long y);
106
107    [RaisesException] void setPagination(Document document, DOMString mode, long gap, optional long pageLength);
108
109    [RaisesException] DOMString viewportAsText(Document document,
110                                               float devicePixelRatio,
111                                               long availableWidth,
112                                               long availableHeight);
113
114    [RaisesException] boolean wasLastChangeUserEdit(Element textField);
115    [RaisesException] boolean elementShouldAutoComplete(Element inputElement);
116    [RaisesException] DOMString suggestedValue(Element inputElement);
117    [RaisesException] void setSuggestedValue(Element inputElement, DOMString value);
118    [RaisesException] void setEditingValue(Element inputElement, DOMString value);
119    [RaisesException] void setAutofilled(Element inputElement, boolean enabled);
120
121    [RaisesException] void paintControlTints(Document document);
122
123    [RaisesException] void scrollElementToRect(Element element, long x, long y, long w, long h);
124
125    [RaisesException] Range rangeFromLocationAndLength(Element scope, long rangeLocation, long rangeLength);
126    [RaisesException] unsigned long locationFromRange(Element scope, Range range);
127    [RaisesException] unsigned long lengthFromRange(Element scope, Range range);
128    [RaisesException] DOMString rangeAsText(Range range);
129
130    [RaisesException] WebKitPoint touchPositionAdjustedToBestClickableNode(long x, long y, long width, long height, Document document);
131    [RaisesException] Node touchNodeAdjustedToBestClickableNode(long x, long y, long width, long height, Document document);
132    [RaisesException] WebKitPoint touchPositionAdjustedToBestContextMenuNode(long x, long y, long width, long height, Document document);
133    [RaisesException] Node touchNodeAdjustedToBestContextMenuNode(long x, long y, long width, long height, Document document);
134    [RaisesException] ClientRect bestZoomableAreaForTouchPoint(long x, long y, long width, long height, Document document);
135
136    [RaisesException] long lastSpellCheckRequestSequence(Document document);
137    [RaisesException] long lastSpellCheckProcessedSequence(Document document);
138
139    sequence<DOMString> userPreferredLanguages();
140    void setUserPreferredLanguages(sequence<DOMString> languages);
141
142    [RaisesException] unsigned long wheelEventHandlerCount(Document document);
143    [RaisesException] unsigned long touchEventHandlerCount(Document document);
144    [RaisesException] LayerRectList touchEventTargetLayerRects(Document document);
145
146
147    [RaisesException] NodeList nodesFromRect(Document document, long x, long y,
148        unsigned long topPadding, unsigned long rightPadding, unsigned long bottomPadding, unsigned long leftPadding,
149        boolean ignoreClipping, boolean allowShadowContent, boolean allowChildFrameContent);
150
151    void emitInspectorDidBeginFrame(optional long frameId);
152    void emitInspectorDidCancelFrame();
153
154    [RaisesException] boolean hasSpellingMarker(Document document, long from, long length);
155    [RaisesException] boolean hasGrammarMarker(Document document, long from, long length);
156    [RaisesException] void setContinuousSpellCheckingEnabled(boolean enabled);
157
158    [RaisesException] boolean isOverwriteModeEnabled(Document document);
159    [RaisesException] void toggleOverwriteModeEnabled(Document document);
160
161    [RaisesException] unsigned long numberOfScrollableAreas(Document document);
162
163    [RaisesException] boolean isPageBoxVisible(Document document, long pageNumber);
164
165    readonly attribute InternalSettings settings;
166    readonly attribute InternalProfilers profilers;
167    readonly attribute InternalRuntimeFlags runtimeFlags;
168    readonly attribute unsigned long workerThreadCount;
169
170    // Flags for layerTreeAsText.
171    // The values of these constants must be kept in sync with the values of LayerTreeAsTextBehaviorFlags in GraphicsLayerClient.h.
172    const unsigned short LAYER_TREE_INCLUDES_REPAINT_RECTS = 2;
173    const unsigned short LAYER_TREE_INCLUDES_PAINTING_PHASES = 4;
174    const unsigned short LAYER_TREE_INCLUDES_ROOT_LAYER = 8;
175    const unsigned short LAYER_TREE_INCLUDES_CLIP_AND_SCROLL_PARENTS = 16;
176    [RaisesException] DOMString layerTreeAsText(Document document, optional unsigned short flags);
177    [RaisesException] DOMString elementLayerTreeAsText(Element element, optional unsigned short flags);
178
179    [RaisesException] NodeList paintOrderListBeforePromote(Element element);
180    [RaisesException] NodeList paintOrderListAfterPromote(Element element);
181
182    [RaisesException] boolean scrollsWithRespectTo(Element element1, Element element2);
183    [RaisesException] boolean isUnclippedDescendant(Element element);
184    [RaisesException] boolean needsCompositedScrolling(Element element);
185
186    // The values of these constants must be kept in sync with those in RenderLayer.
187    const unsigned short DO_NOT_FORCE_COMPOSITED_SCROLLING = 0;
188    const unsigned short COMPOSITED_SCROLLING_ALWAYS_ON = 1;
189    const unsigned short COMPOSITED_SCROLLING_ALWAYS_OFF = 2;
190    [RaisesException] void setNeedsCompositedScrolling(Element element, unsigned short value);
191
192    [RaisesException] DOMString scrollingStateTreeAsText(Document document);
193    [RaisesException] DOMString mainThreadScrollingReasons(Document document);
194    [RaisesException] ClientRectList nonFastScrollableRects(Document document);
195
196    [RaisesException] DOMString repaintRectsAsText(Document document);
197    [RaisesException] ClientRectList repaintRects(Element element);
198
199    [RaisesException] void garbageCollectDocumentResources(Document document);
200    void evictAllResources();
201
202    void allowRoundingHacks();
203
204    unsigned long numberOfLiveNodes();
205    unsigned long numberOfLiveDocuments();
206    DOMString dumpRefCountedInstanceCounts();
207    sequence<DOMString> consoleMessageArgumentCounts(Document document);
208    Window openDummyInspectorFrontend(DOMString url);
209    void closeDummyInspectorFrontend();
210    unsigned long[] setMemoryCacheCapacities(unsigned long minDeadBytes, unsigned long maxDeadBytes, unsigned long totalBytes);
211    [RaisesException] void setInspectorResourcesDataSizeLimits(long maximumResourcesContentSize, long maximumSingleResourceContentSize);
212
213    DOMString counterValue(Element element);
214    long pageNumber(Element element, optional float pageWidth, optional float pageHeight);
215    DOMString[] shortcutIconURLs(Document document);
216    DOMString[] allIconURLs(Document document);
217    long numberOfPages(optional double pageWidthInPixels, optional double pageHeightInPixels);
218    [RaisesException] DOMString pageProperty(DOMString propertyName, long pageNumber);
219    [RaisesException] DOMString pageSizeAndMarginsInPixels(long pageIndex, long width, long height, long marginTop, long marginRight, long marginBottom, long marginLeft);
220
221    [RaisesException] void setDeviceScaleFactor(float scaleFactor);
222
223    [RaisesException] void setIsCursorVisible(Document document, boolean isVisible);
224
225    void webkitWillEnterFullScreenForElement(Document document, Element element);
226    void webkitDidEnterFullScreenForElement(Document document, Element element);
227    void webkitWillExitFullScreenForElement(Document document, Element element);
228    void webkitDidExitFullScreenForElement(Document document, Element element);
229
230    void registerURLSchemeAsBypassingContentSecurityPolicy(DOMString scheme);
231    void removeURLSchemeRegisteredAsBypassingContentSecurityPolicy(DOMString scheme);
232
233    MallocStatistics mallocStatistics();
234    TypeConversions typeConversions();
235
236    DOMString[] getReferencedFilePaths();
237
238    // These functions both reset the tracked repaint rects. They are inteded to be used in the following order:
239    //  startTrackingRepaints, repaintRectsAsText, stopTrackingRepaints.
240    [RaisesException] void startTrackingRepaints(Document document);
241    [RaisesException] void stopTrackingRepaints(Document document);
242
243    // |node| should be Document, HTMLIFrameElement, or unspecified.
244    // If |node| is an HTMLIFrameElement, it assumes node.contentDocument is
245    // specified without security checks. Unspecified means this document.
246    [RaisesException] void updateLayoutIgnorePendingStylesheetsAndRunPostLayoutTasks(optional Node node);
247
248    // Returns a list of draggable/non-draggable regions in the document.
249    [RaisesException] ClientRectList draggableRegions(Document document);
250    [RaisesException] ClientRectList nonDraggableRegions(Document document);
251
252    // Returns a string with information about the mouse cursor used at the specified client location.
253    [RaisesException] DOMString getCurrentCursorInfo(Document document);
254
255    [RaisesException] DOMString markerTextForListItem(Element element);
256
257    [RaisesException] DOMString baseURL(Document document);
258
259    SerializedScriptValue deserializeBuffer(ArrayBuffer buffer);
260    ArrayBuffer serializeObject(SerializedScriptValue obj);
261
262    void forceReload(boolean endToEnd);
263
264    [RaisesException] DOMString getImageSourceURL(Element element);
265
266    boolean isSelectPopupVisible(Node node);
267
268    [RaisesException] ClientRect selectionBounds();
269
270    boolean loseSharedGraphicsContext3D();
271
272    [RaisesException] void forceCompositingUpdate(Document document);
273    [RaisesException] boolean isCompositorFramePending(Document document);
274
275    void setZoomFactor(float factor);
276};
277