2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * Copyright (C) 2013-2015 Apple Inc. All rights reserved.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
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.
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.
27 enum PageOverlayType {
32 // These map to ResourceRequestCachePolicy.
34 "UseProtocolCachePolicy",
35 "ReloadIgnoringCacheData",
36 "ReturnCacheDataElseLoad",
37 "ReturnCacheDataDontLoad"
40 // FIXME: Strings in an enum should not have the name of the enum as a prefix.
41 enum ResourceLoadPriority {
42 "ResourceLoadPriorityVeryLow",
43 "ResourceLoadPriorityLow",
44 "ResourceLoadPriorityMedium",
45 "ResourceLoadPriorityHigh",
46 "ResourceLoadPriorityVeryHigh"
49 [Conditional=MEDIA_SESSION] enum MediaSessionInterruptingCategory {
55 [Conditional=MEDIA_SESSION] enum MediaControlEvent {
61 // FIXME: Strings in an enum should not have the name of the enum as a prefix.
62 enum AutoFillButtonType {
63 "AutoFillButtonTypeNone",
64 "AutoFillButtonTypeContacts",
65 "AutoFillButtonTypeCredentials"
68 enum UserInterfaceLayoutDirection {
74 ExportMacro=WEBCORE_TESTSUPPORT_EXPORT,
76 ] interface Internals {
77 DOMString address(Node node);
78 boolean nodeNeedsStyleRecalc(Node node);
79 DOMString styleChangeType(Node node);
80 DOMString description(any value);
82 // Animated image pausing testing.
83 boolean hasPausedImageAnimations(Element element);
85 [MayThrowException] DOMString elementRenderTreeAsText(Element element);
86 boolean isPreloaded(DOMString url);
87 boolean isLoadingFromMemoryCache(DOMString url);
88 DOMString xhrResponseSource(XMLHttpRequest xhr);
89 boolean isSharingStyleSheetContents(HTMLLinkElement a, HTMLLinkElement b);
90 boolean isStyleSheetLoadingSubresources(HTMLLinkElement link);
91 void clearMemoryCache();
92 void pruneMemoryCacheToSize(long size);
93 long memoryCacheSize();
94 void setOverrideCachePolicy(CachePolicy policy);
95 void setOverrideResourceLoadPriority(ResourceLoadPriority priority);
96 void setStrictRawResourceValidationPolicyDisabled(boolean disabled);
98 void clearPageCache();
99 unsigned long pageCacheSize();
101 CSSStyleDeclaration computedStyleIncludingVisitedInfo(Element element);
103 [MayThrowException] Node ensureShadowRoot(Element host);
104 Node ensureUserAgentShadowRoot(Element host);
105 [MayThrowException] Node createShadowRoot(Element host);
106 Node shadowRoot(Element host);
108 [MayThrowException] DOMString shadowRootType(Node root);
109 DOMString shadowPseudoId(Element element);
110 void setShadowPseudoId(Element element, DOMString id);
111 Node treeScopeRootNode(Node node);
112 Node parentTreeScope(Node node);
114 // Spatial Navigation testing
115 [MayThrowException] unsigned long lastSpatialNavigationCandidateCount();
117 // CSS Animation testing.
118 unsigned long numberOfActiveAnimations();
119 [MayThrowException] void suspendAnimations();
120 [MayThrowException] void resumeAnimations();
121 [MayThrowException] boolean animationsAreSuspended();
122 [MayThrowException] boolean pauseAnimationAtTimeOnElement(DOMString animationName, unrestricted double pauseTime, Element element);
123 [MayThrowException] boolean pauseAnimationAtTimeOnPseudoElement(DOMString animationName, unrestricted double pauseTime, Element element, DOMString pseudoId);
125 // CSS Transition testing.
126 [MayThrowException] boolean pauseTransitionAtTimeOnElement(DOMString propertyName, unrestricted double pauseTime, Element element);
127 [MayThrowException] boolean pauseTransitionAtTimeOnPseudoElement(DOMString property, unrestricted double pauseTime, Element element, DOMString pseudoId);
129 DOMString visiblePlaceholder(Element element);
130 void selectColorInColorChooser(HTMLInputElement element, DOMString colorValue);
131 [MayThrowException] sequence<DOMString> formControlStateOfPreviousHistoryItem();
132 [MayThrowException] void setFormControlStateOfPreviousHistoryItem(sequence<DOMString> values);
134 [MayThrowException] ClientRect absoluteCaretBounds();
136 ClientRect boundingBox(Element element);
138 [MayThrowException] ClientRectList inspectorHighlightRects();
139 [MayThrowException] DOMString inspectorHighlightObject();
141 [MayThrowException] unsigned long markerCountForNode(Node node, DOMString markerType);
142 [MayThrowException] Range markerRangeForNode(Node node, DOMString markerType, unsigned long index);
143 [MayThrowException] DOMString markerDescriptionForNode(Node node, DOMString markerType, unsigned long index);
144 [MayThrowException] DOMString dumpMarkerRects(DOMString markerType);
145 void addTextMatchMarker(Range range, boolean isActive);
146 [MayThrowException] void setMarkedTextMatchesAreHighlighted(boolean flag);
148 void invalidateFontCache();
150 [MayThrowException] void setScrollViewPosition(long x, long y);
152 [MayThrowException] void setViewBaseBackgroundColor(DOMString colorValue);
154 [MayThrowException] void setPagination(DOMString mode, long gap, optional long pageLength = 0);
155 [MayThrowException] void setPaginationLineGridEnabled(boolean enabled);
157 [MayThrowException] DOMString configurationForViewport(unrestricted float devicePixelRatio, long deviceWidth, long deviceHeight, long availableWidth, long availableHeight);
159 [MayThrowException] boolean wasLastChangeUserEdit(Element textField);
160 boolean elementShouldAutoComplete(HTMLInputElement inputElement);
161 void setEditingValue(HTMLInputElement inputElement, DOMString value);
162 void setAutofilled(HTMLInputElement inputElement, boolean enabled);
163 void setShowAutoFillButton(HTMLInputElement inputElement, AutoFillButtonType autoFillButtonType);
164 unsigned long countMatchesForText(DOMString text, unsigned long findOptions, DOMString markMatches);
165 unsigned long countFindMatches(DOMString text, unsigned long findOptions);
167 [MayThrowException] DOMString autofillFieldName(Element formControlElement);
169 [MayThrowException] void paintControlTints();
171 [MayThrowException] void scrollElementToRect(Element element, long x, long y, long w, long h);
173 Range rangeFromLocationAndLength(Element scope, long rangeLocation, long rangeLength);
174 unsigned long locationFromRange(Element scope, Range range);
175 unsigned long lengthFromRange(Element scope, Range range);
176 DOMString rangeAsText(Range range);
177 Range subrange(Range range, long rangeLocation, long rangeLength);
178 [MayThrowException] Range rangeForDictionaryLookupAtLocation(long x, long y);
180 [MayThrowException] void setDelegatesScrolling(boolean enabled);
182 [MayThrowException] long lastSpellCheckRequestSequence();
183 [MayThrowException] long lastSpellCheckProcessedSequence();
185 sequence<DOMString> userPreferredLanguages();
186 void setUserPreferredLanguages(sequence<DOMString> languages);
188 sequence<DOMString> userPreferredAudioCharacteristics();
189 void setUserPreferredAudioCharacteristic(DOMString characteristic);
191 [MayThrowException] unsigned long wheelEventHandlerCount();
192 [MayThrowException] unsigned long touchEventHandlerCount();
194 [MayThrowException] NodeList nodesFromRect(Document document, long x, long y,
195 unsigned long topPadding, unsigned long rightPadding, unsigned long bottomPadding, unsigned long leftPadding,
196 boolean ignoreClipping, boolean allowShadowContent, boolean allowChildFrameContent);
198 // Calling parserMetaData() with no arguments gets the metadata for the script of the current scope.
199 DOMString parserMetaData(optional any func);
201 void updateEditorUINowIfScheduled();
203 boolean hasSpellingMarker(long from, long length);
204 boolean hasGrammarMarker(long from, long length);
205 boolean hasAutocorrectedMarker(long from, long length);
206 void setContinuousSpellCheckingEnabled(boolean enabled);
207 void setAutomaticQuoteSubstitutionEnabled(boolean enabled);
208 void setAutomaticLinkDetectionEnabled(boolean enabled);
209 void setAutomaticDashSubstitutionEnabled(boolean enabled);
210 void setAutomaticTextReplacementEnabled(boolean enabled);
211 void setAutomaticSpellingCorrectionEnabled(boolean enabled);
213 void handleAcceptedCandidate(DOMString candidate, unsigned long location, unsigned long length);
215 boolean isOverwriteModeEnabled();
216 void toggleOverwriteModeEnabled();
218 unsigned long numberOfScrollableAreas();
220 [MayThrowException] boolean isPageBoxVisible(long pageNumber);
222 unsigned long imageFrameIndex(HTMLImageElement element);
224 readonly attribute InternalSettings settings;
225 readonly attribute unsigned long workerThreadCount;
227 // Flags for layerTreeAsText.
228 const unsigned short LAYER_TREE_INCLUDES_VISIBLE_RECTS = 1;
229 const unsigned short LAYER_TREE_INCLUDES_TILE_CACHES = 2;
230 const unsigned short LAYER_TREE_INCLUDES_REPAINT_RECTS = 4;
231 const unsigned short LAYER_TREE_INCLUDES_PAINTING_PHASES = 8;
232 const unsigned short LAYER_TREE_INCLUDES_CONTENT_LAYERS = 16;
233 [MayThrowException] DOMString layerTreeAsText(Document document, optional unsigned short flags = 0);
235 [MayThrowException] DOMString scrollingStateTreeAsText();
236 [MayThrowException] DOMString mainThreadScrollingReasons(); // FIXME: rename to synchronousScrollingReasons().
237 [MayThrowException] ClientRectList nonFastScrollableRects();
239 [MayThrowException] DOMString repaintRectsAsText();
241 // These throw if the element does not have a compositing layer.
242 [MayThrowException] void setElementUsesDisplayListDrawing(Element element, boolean usesDisplayListDrawing);
243 [MayThrowException] void setElementTracksDisplayListReplay(Element element, boolean trackReplay);
245 // Flags for displayListForElement.
246 const unsigned short DISPLAY_LIST_INCLUDES_PLATFORM_OPERATIONS = 1;
247 // Returns the recorded display list.
248 [MayThrowException] DOMString displayListForElement(Element element, optional unsigned short flags = 0);
249 // Returns the display list that was actually painted.
250 [MayThrowException] DOMString replayDisplayListForElement(Element element, optional unsigned short flags = 0);
252 [MayThrowException] void garbageCollectDocumentResources();
254 [MayThrowException] void insertAuthorCSS(DOMString css);
255 [MayThrowException] void insertUserCSS(DOMString css);
257 readonly attribute boolean isUnderMemoryPressure;
258 void beginSimulatedMemoryPressure();
259 void endSimulatedMemoryPressure();
261 #if defined(ENABLE_BATTERY_STATUS) && ENABLE_BATTERY_STATUS
262 [MayThrowException] void setBatteryStatus(DOMString eventType, boolean charging, unrestricted double chargingTime, unrestricted double dischargingTime, unrestricted double level);
265 #if defined(ENABLE_PROXIMITY_EVENTS) && ENABLE_PROXIMITY_EVENTS
266 [MayThrowException] void setDeviceProximity(DOMString eventType, unrestricted double value, unrestricted double min, unrestricted double max);
269 unsigned long numberOfLiveNodes();
270 unsigned long numberOfLiveDocuments();
271 DOMWindow openDummyInspectorFrontend(DOMString url);
272 void closeDummyInspectorFrontend();
273 [MayThrowException] void setInspectorIsUnderTest(boolean isUnderTest);
275 DOMString counterValue(Element element);
276 long pageNumber(Element element, optional unrestricted float pageWidth = 800, optional unrestricted float pageHeight = 600);
277 sequence<DOMString> shortcutIconURLs();
278 long numberOfPages(optional unrestricted double pageWidthInPixels = 800, optional unrestricted double pageHeightInPixels = 600);
279 [MayThrowException] DOMString pageProperty(DOMString propertyName, long pageNumber);
280 [MayThrowException] DOMString pageSizeAndMarginsInPixels(long pageIndex, long width, long height, long marginTop, long marginRight, long marginBottom, long marginLeft);
282 [MayThrowException] void setPageScaleFactor(unrestricted float scaleFactor, long x, long y);
283 [MayThrowException] void setPageZoomFactor(unrestricted float zoomFactor);
284 [MayThrowException] void setTextZoomFactor(unrestricted float zoomFactor);
286 [MayThrowException] void setUseFixedLayout(boolean useFixedLayout);
287 [MayThrowException] void setFixedLayoutSize(long width, long height);
289 [MayThrowException] void setViewExposedRect(unrestricted float x, unrestricted float y, unrestricted float width, unrestricted float height);
291 void setHeaderHeight(unrestricted float height);
292 void setFooterHeight(unrestricted float height);
294 void setTopContentInset(unrestricted float contentInset);
296 #if defined(ENABLE_FULLSCREEN_API) && ENABLE_FULLSCREEN_API
297 void webkitWillEnterFullScreenForElement(Element element);
298 void webkitDidEnterFullScreenForElement(Element element);
299 void webkitWillExitFullScreenForElement(Element element);
300 void webkitDidExitFullScreenForElement(Element element);
303 void setApplicationCacheOriginQuota(unsigned long long quota);
305 void registerURLSchemeAsBypassingContentSecurityPolicy(DOMString scheme);
306 void removeURLSchemeRegisteredAsBypassingContentSecurityPolicy(DOMString scheme);
308 MallocStatistics mallocStatistics();
309 TypeConversions typeConversions();
310 MemoryInfo memoryInfo();
312 sequence<DOMString> getReferencedFilePaths();
314 // These functions both reset the tracked repaint rects. They are intended to be used in the following order:
315 // startTrackingRepaints, repaintRectsAsText, stopTrackingRepaints.
316 [MayThrowException] void startTrackingRepaints();
317 [MayThrowException] void stopTrackingRepaints();
319 [MayThrowException] void startTrackingLayerFlushes();
320 [MayThrowException] unsigned long layerFlushCount();
322 // Query if a timer is currently throttled, to debug timer throttling.
323 [MayThrowException] boolean isTimerThrottled(long timerHandle);
325 boolean isRequestAnimationFrameThrottled();
326 boolean areTimersThrottled();
328 [MayThrowException] void startTrackingStyleRecalcs();
329 [MayThrowException] unsigned long styleRecalcCount();
330 readonly attribute unsigned long lastStyleUpdateSize;
332 [MayThrowException] void startTrackingCompositingUpdates();
333 [MayThrowException] unsigned long compositingUpdateCount();
335 // |node| should be Document, HTMLIFrameElement, or unspecified.
336 // If |node| is an HTMLIFrameElement, it assumes node.contentDocument is
337 // specified without security checks. Unspecified or null means this document.
338 [MayThrowException] void updateLayoutIgnorePendingStylesheetsAndRunPostLayoutTasks(optional Node? node = null);
340 readonly attribute unsigned long layoutCount;
342 // Returns a string with information about the mouse cursor used at the specified client location.
343 [MayThrowException] DOMString getCurrentCursorInfo();
345 DOMString markerTextForListItem(Element element);
347 DOMString toolTipFromElement(Element element);
349 SerializedScriptValue deserializeBuffer(ArrayBuffer buffer);
350 ArrayBuffer serializeObject(SerializedScriptValue obj);
352 boolean isFromCurrentWorld(any obj);
354 void setUsesOverlayScrollbars(boolean enabled);
355 void setUsesMockScrollAnimator(boolean enabled);
357 void forceReload(boolean endToEnd);
359 void enableAutoSizeMode(boolean enabled, long minimumWidth, long minimumHeight, long maximumWidth, long maximumHeight);
361 [Conditional=VIDEO] void simulateAudioInterruption(HTMLMediaElement element);
362 [Conditional=VIDEO, MayThrowException] boolean mediaElementHasCharacteristic(HTMLMediaElement element, DOMString characteristic);
364 [Conditional=LEGACY_ENCRYPTED_MEDIA] void initializeMockCDM();
366 [Conditional=SPEECH_SYNTHESIS] void enableMockSpeechSynthesizer();
368 DOMString getImageSourceURL(Element element);
370 [Conditional=VIDEO_TRACK, MayThrowException] DOMString captionsStyleSheetOverride();
371 [Conditional=VIDEO_TRACK, MayThrowException] void setCaptionsStyleSheetOverride(DOMString override);
372 [Conditional=VIDEO_TRACK, MayThrowException] void setPrimaryAudioTrackLanguageOverride(DOMString language);
373 [Conditional=VIDEO_TRACK, MayThrowException] void setCaptionDisplayMode(DOMString mode);
375 [Conditional=VIDEO] TimeRanges createTimeRanges(Float32Array startTimes, Float32Array
377 [Conditional=VIDEO] unrestricted double closestTimeToTimeRanges(unrestricted double time, TimeRanges ranges);
379 boolean isSelectPopupVisible(HTMLSelectElement element);
381 #if defined(ENABLE_VIBRATION) && ENABLE_VIBRATION
382 boolean isVibrating();
385 [MayThrowException] boolean isPluginUnavailabilityIndicatorObscured(Element element);
386 boolean isPluginSnapshotted(Element element);
388 [MayThrowException] ClientRect selectionBounds();
390 [Conditional=MEDIA_SOURCE] void initializeMockMediaSource();
391 [Conditional=MEDIA_SOURCE] sequence<DOMString> bufferedSamplesForTrackID(SourceBuffer buffer, DOMString trackID);
392 [Conditional=MEDIA_SOURCE] sequence<DOMString> enqueuedSamplesForTrackID(SourceBuffer buffer, DOMString trackID);
393 [Conditional=MEDIA_SOURCE] void setShouldGenerateTimestamps(SourceBuffer buffer, boolean flag);
395 [Conditional=VIDEO, MayThrowException] void beginMediaSessionInterruption(DOMString interruptionType);
396 [Conditional=VIDEO] void endMediaSessionInterruption(DOMString flags);
397 [Conditional=MEDIA_SESSION] void sendMediaSessionStartOfInterruptionNotification(MediaSessionInterruptingCategory category);
398 [Conditional=MEDIA_SESSION] void sendMediaSessionEndOfInterruptionNotification(MediaSessionInterruptingCategory category);
399 [Conditional=MEDIA_SESSION] DOMString mediaSessionCurrentState(MediaSession session);
400 [Conditional=MEDIA_SESSION] double mediaElementPlayerVolume(HTMLMediaElement element);
401 [Conditional=MEDIA_SESSION] void sendMediaControlEvent(MediaControlEvent event);
402 [Conditional=VIDEO] void applicationDidEnterForeground();
403 [Conditional=VIDEO] void applicationWillEnterBackground();
404 [Conditional=VIDEO, MayThrowException] void setMediaSessionRestrictions(DOMString mediaType, DOMString restrictions);
405 [Conditional=VIDEO] void setMediaElementRestrictions(HTMLMediaElement element, DOMString restrictions);
406 [Conditional=WEB_AUDIO] void setAudioContextRestrictions(AudioContext context, DOMString restrictions);
407 [Conditional=VIDEO, MayThrowException] void postRemoteControlCommand(DOMString command, optional unrestricted float argument = 0);
408 [Conditional=WIRELESS_PLAYBACK_TARGET] void setMockMediaPlaybackTargetPickerEnabled(boolean enabled);
409 [Conditional=WIRELESS_PLAYBACK_TARGET, MayThrowException] void setMockMediaPlaybackTargetPickerState(DOMString deviceName, DOMString deviceState);
410 [Conditional=MEDIA_STREAM] void setMockMediaCaptureDevicesEnabled(boolean enabled);
411 [Conditional=WEB_RTC] void emulateRTCPeerConnectionPlatformEvent(RTCPeerConnection connection, DOMString action);
413 [Conditional=VIDEO] void simulateSystemSleep();
414 [Conditional=VIDEO] void simulateSystemWake();
415 [Conditional=VIDEO] boolean elementIsBlockingDisplaySleep(HTMLMediaElement element);
417 [MayThrowException] MockPageOverlay installMockPageOverlay(PageOverlayType type);
418 [MayThrowException] DOMString pageOverlayLayerTreeAsText();
420 void setPageMuted(DOMString mutedState);
421 boolean isPagePlayingAudio();
423 void setPageDefersLoading(boolean defersLoading);
425 File createFile(DOMString url);
426 void queueMicroTask(long testNumber);
427 boolean testPreloaderSettingViewport();
429 [Conditional=CONTENT_FILTERING] readonly attribute MockContentFilterSettings mockContentFilterSettings;
431 #if defined(ENABLE_CSS_SCROLL_SNAP) && ENABLE_CSS_SCROLL_SNAP
432 [MayThrowException] DOMString scrollSnapOffsets(Element element);
435 [MayThrowException] DOMString pathStringWithShrinkWrappedRects(sequence<double> rectComponents, double radius);
437 [Conditional=VIDEO] DOMString getCurrentMediaControlsStatusForElement(HTMLMediaElement element);
439 DOMString userVisibleString(DOMURL url);
441 void setShowAllPlugins(boolean showAll);
443 [Conditional=READABLE_STREAM_API, CallWith=ScriptState] boolean isReadableStreamDisturbed(any stream);
445 DOMString resourceLoadStatisticsForOrigin(DOMString domain);
446 void setResourceLoadStatisticsEnabled(boolean enable);
448 [MayThrowException] void setCanShowModalDialogOverride(boolean allow);
450 DOMString composedTreeAsText(Node parent);
452 void setLinkPreloadSupport(boolean scalable);
454 #if defined(ENABLE_CSS_GRID_LAYOUT) && ENABLE_CSS_GRID_LAYOUT
455 void setCSSGridLayoutEnabled(boolean enable);
458 #if defined(ENABLE_WEBGL2) && ENABLE_WEBGL2
459 boolean webGL2Enabled();
460 void setWebGL2Enabled(boolean enable);
463 void setResourceTimingSupport(boolean scalable);
465 boolean isProcessingUserGesture();
467 GCObservation observeGC(any observed);
469 void setUserInterfaceLayoutDirection(UserInterfaceLayoutDirection userInterfaceLayoutDirection);
471 boolean userPrefersReducedMotion();