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 NoInterfaceObject, 29] interface Internals { 30 DOMString address(Node node); 31 32 [RaisesException] DOMString elementRenderTreeAsText(Element element); 33 boolean isPreloaded(DOMString url); 34 boolean isLoadingFromMemoryCache(DOMString url); 35 36 [RaisesException] CSSStyleDeclaration computedStyleIncludingVisitedInfo(Node node); 37 38 [RaisesException] Node ensureShadowRoot(Element host); 39 [RaisesException] Node createShadowRoot(Element host); 40 [RaisesException] Node shadowRoot(Element host); 41 42 [RaisesException] DOMString shadowRootType(Node root); 43 [RaisesException] Element includerFor(Node node); 44 [RaisesException] DOMString shadowPseudoId(Element element); 45 [RaisesException] void setShadowPseudoId(Element element, DOMString id); 46 [RaisesException] Node treeScopeRootNode(Node node); 47 [RaisesException] Node parentTreeScope(Node node); 48 49 // Spatial Navigation testing 50 [RaisesException] unsigned long lastSpatialNavigationCandidateCount(); 51 52 // CSS Animation testing. 53 unsigned long numberOfActiveAnimations(); 54 [RaisesException] void suspendAnimations(); 55 [RaisesException] void resumeAnimations(); 56 [RaisesException] boolean animationsAreSuspended(); 57 [RaisesException] boolean pauseAnimationAtTimeOnElement(DOMString animationName, unrestricted double pauseTime, Element element); 58 [RaisesException] boolean pauseAnimationAtTimeOnPseudoElement(DOMString animationName, unrestricted double pauseTime, Element element, DOMString pseudoId); 59 60 // CSS Transition testing. 61 [RaisesException] boolean pauseTransitionAtTimeOnElement(DOMString propertyName, unrestricted double pauseTime, Element element); 62 [RaisesException] boolean pauseTransitionAtTimeOnPseudoElement(DOMString property, unrestricted double pauseTime, Element element, DOMString pseudoId); 63 64 [RaisesException] boolean attached(Node node); 65 66 DOMString visiblePlaceholder(Element element); 67#if defined(ENABLE_INPUT_TYPE_COLOR) && ENABLE_INPUT_TYPE_COLOR 68 void selectColorInColorChooser(Element element, DOMString colorValue); 69#endif 70 [RaisesException] DOMString[] formControlStateOfPreviousHistoryItem(); 71 [RaisesException] void setFormControlStateOfPreviousHistoryItem(sequence<DOMString> values); 72 73 [RaisesException] ClientRect absoluteCaretBounds(); 74 75 [RaisesException] ClientRect boundingBox(Element element); 76 77 [RaisesException] ClientRectList inspectorHighlightRects(); 78 [RaisesException] DOMString inspectorHighlightObject(); 79 80 [RaisesException] unsigned long markerCountForNode(Node node, DOMString markerType); 81 [RaisesException] Range markerRangeForNode(Node node, DOMString markerType, unsigned long index); 82 [RaisesException] DOMString markerDescriptionForNode(Node node, DOMString markerType, unsigned long index); 83 void addTextMatchMarker(Range range, boolean isActive); 84 [RaisesException] void setMarkedTextMatchesAreHighlighted(boolean flag); 85 86 [RaisesException] void setScrollViewPosition(long x, long y); 87 88 [RaisesException] void setPagination(DOMString mode, long gap, optional long pageLength); 89 90 [RaisesException] DOMString configurationForViewport(unrestricted float devicePixelRatio, 91 long deviceWidth, 92 long deviceHeight, 93 long availableWidth, 94 long availableHeight); 95 96 [RaisesException] boolean wasLastChangeUserEdit(Element textField); 97 [RaisesException] boolean elementShouldAutoComplete(Element inputElement); 98 [RaisesException] DOMString suggestedValue(Element inputElement); 99 [RaisesException] void setSuggestedValue(Element inputElement, DOMString value); 100 [RaisesException] void setEditingValue(Element inputElement, DOMString value); 101 [RaisesException] void setAutofilled(Element inputElement, boolean enabled); 102 [RaisesException] unsigned long countMatchesForText(DOMString text, unsigned long findOptions, DOMString markMatches); 103 104 [RaisesException] void paintControlTints(); 105 106 [RaisesException] void scrollElementToRect(Element element, long x, long y, long w, long h); 107 108 [RaisesException] Range rangeFromLocationAndLength(Element scope, long rangeLocation, long rangeLength); 109 [RaisesException] unsigned long locationFromRange(Element scope, Range range); 110 [RaisesException] unsigned long lengthFromRange(Element scope, Range range); 111 [RaisesException] DOMString rangeAsText(Range range); 112 113 [RaisesException] void setDelegatesScrolling(boolean enabled); 114 115 [RaisesException] long lastSpellCheckRequestSequence(); 116 [RaisesException] long lastSpellCheckProcessedSequence(); 117 118 sequence<DOMString> userPreferredLanguages(); 119 void setUserPreferredLanguages(sequence<DOMString> languages); 120 121 [RaisesException] unsigned long wheelEventHandlerCount(); 122 [RaisesException] unsigned long touchEventHandlerCount(); 123 124 [RaisesException] NodeList nodesFromRect(Document document, long x, long y, 125 unsigned long topPadding, unsigned long rightPadding, unsigned long bottomPadding, unsigned long leftPadding, 126 boolean ignoreClipping, boolean allowShadowContent, boolean allowChildFrameContent); 127 128 // Calling parserMetaData() with no arguments gets the metadata for the script of the current scope. 129 DOMString parserMetaData(optional any func); 130 131 void updateEditorUINowIfScheduled(); 132 133 Node findEditingDeleteButton(); 134 135 [RaisesException] boolean hasSpellingMarker(long from, long length); 136 [RaisesException] boolean hasGrammarMarker(long from, long length); 137 [RaisesException] boolean hasAutocorrectedMarker(long from, long length); 138 [RaisesException] void setContinuousSpellCheckingEnabled(boolean enabled); 139 [RaisesException] void setAutomaticQuoteSubstitutionEnabled(boolean enabled); 140 [RaisesException] void setAutomaticLinkDetectionEnabled(boolean enabled); 141 [RaisesException] void setAutomaticDashSubstitutionEnabled(boolean enabled); 142 [RaisesException] void setAutomaticTextReplacementEnabled(boolean enabled); 143 [RaisesException] void setAutomaticSpellingCorrectionEnabled(boolean enabled); 144 145 [RaisesException] boolean isOverwriteModeEnabled(); 146 [RaisesException] void toggleOverwriteModeEnabled(); 147 148 [RaisesException] unsigned long numberOfScrollableAreas(); 149 150 [RaisesException] boolean isPageBoxVisible(long pageNumber); 151 152 readonly attribute InternalSettings settings; 153 readonly attribute unsigned long workerThreadCount; 154 155 // Flags for layerTreeAsText. 156 const unsigned short LAYER_TREE_INCLUDES_VISIBLE_RECTS = 1; 157 const unsigned short LAYER_TREE_INCLUDES_TILE_CACHES = 2; 158 const unsigned short LAYER_TREE_INCLUDES_REPAINT_RECTS = 4; 159 const unsigned short LAYER_TREE_INCLUDES_PAINTING_PHASES = 8; 160 const unsigned short LAYER_TREE_INCLUDES_CONTENT_LAYERS = 16; 161 [RaisesException] DOMString layerTreeAsText(Document document, optional unsigned short flags); 162 163 [RaisesException] DOMString scrollingStateTreeAsText(); 164 [RaisesException] DOMString mainThreadScrollingReasons(); // FIXME: rename to synchronousScrollingReasons(). 165 [RaisesException] ClientRectList nonFastScrollableRects(); 166 167 [RaisesException] DOMString repaintRectsAsText(); 168 169 [RaisesException] void garbageCollectDocumentResources(); 170 171 void allowRoundingHacks(); 172 173 [RaisesException] void insertAuthorCSS(DOMString css); 174 [RaisesException] void insertUserCSS(DOMString css); 175 176#if defined(ENABLE_BATTERY_STATUS) && ENABLE_BATTERY_STATUS 177 [RaisesException] void setBatteryStatus(DOMString eventType, boolean charging, unrestricted double chargingTime, unrestricted double dischargingTime, unrestricted double level); 178#endif 179 180#if defined(ENABLE_PROXIMITY_EVENTS) && ENABLE_PROXIMITY_EVENTS 181 [RaisesException] void setDeviceProximity(DOMString eventType, unrestricted double value, unrestricted double min, unrestricted double max); 182#endif 183 184 // As per spec: http://www.w3.org/TR/WebIDL/#idl-sequence 185 // "Sequences must not be used as the type of an attribute, constant or exception field." 186 // FIXME: this will lead to BUG interals.consoleProfiles !== interals.consoleProfiles as profile will always returns new array. 187 readonly attribute ScriptProfile[] consoleProfiles; 188 189 unsigned long numberOfLiveNodes(); 190 unsigned long numberOfLiveDocuments(); 191 [Conditional=INSPECTOR] sequence<DOMString> consoleMessageArgumentCounts(); 192 [Conditional=INSPECTOR] DOMWindow openDummyInspectorFrontend(DOMString url); 193 [Conditional=INSPECTOR] void closeDummyInspectorFrontend(); 194 [Conditional=INSPECTOR, RaisesException] void setJavaScriptProfilingEnabled(boolean creates); 195 [Conditional=INSPECTOR, RaisesException] void setInspectorIsUnderTest(boolean isUnderTest); 196 197 DOMString counterValue(Element element); 198 long pageNumber(Element element, optional unrestricted float pageWidth, optional unrestricted float pageHeight); 199 DOMString[] shortcutIconURLs(); 200 DOMString[] allIconURLs(); 201 long numberOfPages(optional unrestricted double pageWidthInPixels, optional unrestricted double pageHeightInPixels); 202 [RaisesException] DOMString pageProperty(DOMString propertyName, long pageNumber); 203 [RaisesException] DOMString pageSizeAndMarginsInPixels(long pageIndex, long width, long height, long marginTop, long marginRight, long marginBottom, long marginLeft); 204 205 [RaisesException] void setPageScaleFactor(unrestricted float scaleFactor, long x, long y); 206 [RaisesException] void setPageZoomFactor(unrestricted float zoomFactor); 207 208 void setHeaderHeight(unrestricted float height); 209 void setFooterHeight(unrestricted float height); 210 211 void setTopContentInset(unrestricted float contentInset); 212 213#if defined(ENABLE_FULLSCREEN_API) && ENABLE_FULLSCREEN_API 214 void webkitWillEnterFullScreenForElement(Element element); 215 void webkitDidEnterFullScreenForElement(Element element); 216 void webkitWillExitFullScreenForElement(Element element); 217 void webkitDidExitFullScreenForElement(Element element); 218#endif 219 220 void setApplicationCacheOriginQuota(unsigned long long quota); 221 222 void registerURLSchemeAsBypassingContentSecurityPolicy(DOMString scheme); 223 void removeURLSchemeRegisteredAsBypassingContentSecurityPolicy(DOMString scheme); 224 225 MallocStatistics mallocStatistics(); 226 TypeConversions typeConversions(); 227 MemoryInfo memoryInfo(); 228 229 DOMString[] getReferencedFilePaths(); 230 231 // These functions both reset the tracked repaint rects. They are inteded to be used in the following order: 232 // startTrackingRepaints, repaintRectsAsText, stopTrackingRepaints. 233 [RaisesException] void startTrackingRepaints(); 234 [RaisesException] void stopTrackingRepaints(); 235 236 // |node| should be Document, HTMLIFrameElement, or unspecified. 237 // If |node| is an HTMLIFrameElement, it assumes node.contentDocument is 238 // specified without security checks. Unspecified means this document. 239 [RaisesException] void updateLayoutIgnorePendingStylesheetsAndRunPostLayoutTasks(optional Node node); 240 241 // Returns a string with information about the mouse cursor used at the specified client location. 242 [RaisesException] DOMString getCurrentCursorInfo(); 243 244 [RaisesException] DOMString markerTextForListItem(Element element); 245 246 SerializedScriptValue deserializeBuffer(ArrayBuffer buffer); 247 ArrayBuffer serializeObject(SerializedScriptValue obj); 248 249 void setUsesOverlayScrollbars(boolean enabled); 250 251 void forceReload(boolean endToEnd); 252 253 [Conditional=VIDEO] void simulateAudioInterruption(Node node); 254 255 [Conditional=ENCRYPTED_MEDIA_V2] void initializeMockCDM(); 256 257 [Conditional=SPEECH_SYNTHESIS] void enableMockSpeechSynthesizer(); 258 259 [RaisesException] DOMString getImageSourceURL(Element element); 260 261 [Conditional=VIDEO_TRACK, RaisesException] DOMString captionsStyleSheetOverride(); 262 [Conditional=VIDEO_TRACK, RaisesException] void setCaptionsStyleSheetOverride(DOMString override); 263 [Conditional=VIDEO_TRACK, RaisesException] void setPrimaryAudioTrackLanguageOverride(DOMString language); 264 [Conditional=VIDEO_TRACK, RaisesException] void setCaptionDisplayMode(DOMString mode); 265 266 [Conditional=VIDEO] TimeRanges createTimeRanges(Float32Array startTimes, Float32Array 267 endTimes); 268 [Conditional=VIDEO] unrestricted double closestTimeToTimeRanges(unrestricted double time, TimeRanges ranges); 269 270 boolean isSelectPopupVisible(Node node); 271 272#if defined(ENABLE_VIBRATION) && ENABLE_VIBRATION 273 boolean isVibrating(); 274#endif 275 276 [RaisesException] boolean isPluginUnavailabilityIndicatorObscured(Element element); 277 [RaisesException] boolean isPluginSnapshotted(Element element); 278 279 [RaisesException] ClientRect selectionBounds(); 280 281 [Conditional=MEDIA_SOURCE] void initializeMockMediaSource(); 282 [Conditional=MEDIA_SOURCE] DOMString[] bufferedSamplesForTrackID(SourceBuffer buffer, DOMString trackID); 283 284 [Conditional=VIDEO] void beginMediaSessionInterruption(); 285 [Conditional=VIDEO] void endMediaSessionInterruption(DOMString flags); 286 [Conditional=VIDEO] void applicationWillEnterForeground(); 287 [Conditional=VIDEO] void applicationWillEnterBackground(); 288 [Conditional=VIDEO, RaisesException] void setMediaSessionRestrictions(DOMString mediaType, DOMString restrictions); 289 [Conditional=VIDEO, RaisesException] void postRemoteControlCommand(DOMString command); 290 291 [Conditional=VIDEO] void simulateSystemSleep(); 292 [Conditional=VIDEO] void simulateSystemWake(); 293}; 294