[iOS] Throttle SVG SMIL animations to 30fps in low power mode
[WebKit-https.git] / Source / WebCore / testing / Internals.h
1 /*
2  * Copyright (C) 2012 Google Inc. All rights reserved.
3  * Copyright (C) 2013-2017 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 #pragma once
28
29 #include "CSSComputedStyleDeclaration.h"
30 #include "ContextDestructionObserver.h"
31 #include "ExceptionOr.h"
32 #include "PageConsoleClient.h"
33 #include <runtime/Float32Array.h>
34
35 #if ENABLE(MEDIA_SESSION)
36 #include "MediaSessionInterruptionProvider.h"
37 #endif
38
39 namespace WebCore {
40
41 class AudioContext;
42 class ClientRect;
43 class ClientRectList;
44 class DOMURL;
45 class DOMWindow;
46 class Document;
47 class Element;
48 class File;
49 class Frame;
50 class GCObservation;
51 class HTMLImageElement;
52 class HTMLInputElement;
53 class HTMLLinkElement;
54 class HTMLMediaElement;
55 class HTMLSelectElement;
56 class InspectorStubFrontend;
57 class InternalSettings;
58 class MallocStatistics;
59 class MediaSession;
60 class MemoryInfo;
61 class MockCDMFactory;
62 class MockContentFilterSettings;
63 class MockPageOverlay;
64 class NodeList;
65 class Page;
66 class Range;
67 class RenderedDocumentMarker;
68 class RTCPeerConnection;
69 class SVGSVGElement;
70 class SerializedScriptValue;
71 class SourceBuffer;
72 class StyleSheet;
73 class TimeRanges;
74 class TypeConversions;
75 class WebGLRenderingContextBase;
76 class XMLHttpRequest;
77
78 class Internals final : public RefCounted<Internals>, private ContextDestructionObserver {
79 public:
80     static Ref<Internals> create(Document&);
81     virtual ~Internals();
82
83     static void resetToConsistentState(Page&);
84
85     ExceptionOr<String> elementRenderTreeAsText(Element&);
86     bool hasPausedImageAnimations(Element&);
87
88     String address(Node&);
89     bool nodeNeedsStyleRecalc(Node&);
90     String styleChangeType(Node&);
91     String description(JSC::JSValue);
92
93     bool isPreloaded(const String& url);
94     bool isLoadingFromMemoryCache(const String& url);
95     String xhrResponseSource(XMLHttpRequest&);
96     bool isSharingStyleSheetContents(HTMLLinkElement&, HTMLLinkElement&);
97     bool isStyleSheetLoadingSubresources(HTMLLinkElement&);
98     enum class CachePolicy { UseProtocolCachePolicy, ReloadIgnoringCacheData, ReturnCacheDataElseLoad, ReturnCacheDataDontLoad };
99     void setOverrideCachePolicy(CachePolicy);
100     ExceptionOr<void> setCanShowModalDialogOverride(bool allow);
101     enum class ResourceLoadPriority { ResourceLoadPriorityVeryLow, ResourceLoadPriorityLow, ResourceLoadPriorityMedium, ResourceLoadPriorityHigh, ResourceLoadPriorityVeryHigh };
102     void setOverrideResourceLoadPriority(ResourceLoadPriority);
103     void setStrictRawResourceValidationPolicyDisabled(bool);
104
105     void clearMemoryCache();
106     void pruneMemoryCacheToSize(unsigned size);
107     unsigned memoryCacheSize() const;
108
109     unsigned imageFrameIndex(HTMLImageElement&);
110     void setImageFrameDecodingDuration(HTMLImageElement&, float duration);
111     void resetImageAnimation(HTMLImageElement&);
112
113     void clearPageCache();
114     unsigned pageCacheSize() const;
115
116     void disableTileSizeUpdateDelay();
117
118     Ref<CSSComputedStyleDeclaration> computedStyleIncludingVisitedInfo(Element&) const;
119
120     Node* ensureUserAgentShadowRoot(Element& host);
121     Node* shadowRoot(Element& host);
122     ExceptionOr<String> shadowRootType(const Node&) const;
123     String shadowPseudoId(Element&);
124     void setShadowPseudoId(Element&, const String&);
125
126     // CSS Deferred Parsing Testing
127     unsigned deferredStyleRulesCount(StyleSheet&);
128     unsigned deferredGroupRulesCount(StyleSheet&);
129     unsigned deferredKeyframesRulesCount(StyleSheet&);
130
131     // DOMTimers throttling testing.
132     ExceptionOr<bool> isTimerThrottled(int timeoutId);
133     bool isRequestAnimationFrameThrottled() const;
134     double requestAnimationFrameInterval() const;
135     bool areTimersThrottled() const;
136
137     enum EventThrottlingBehavior { Responsive, Unresponsive };
138     void setEventThrottlingBehaviorOverride(std::optional<EventThrottlingBehavior>);
139     std::optional<EventThrottlingBehavior> eventThrottlingBehaviorOverride() const;
140
141     // Spatial Navigation testing.
142     ExceptionOr<unsigned> lastSpatialNavigationCandidateCount() const;
143
144     // CSS Animation testing.
145     unsigned numberOfActiveAnimations() const;
146     ExceptionOr<bool> animationsAreSuspended() const;
147     ExceptionOr<void> suspendAnimations() const;
148     ExceptionOr<void> resumeAnimations() const;
149     ExceptionOr<bool> pauseAnimationAtTimeOnElement(const String& animationName, double pauseTime, Element&);
150     ExceptionOr<bool> pauseAnimationAtTimeOnPseudoElement(const String& animationName, double pauseTime, Element&, const String& pseudoId);
151
152     // CSS Transition testing.
153     ExceptionOr<bool> pauseTransitionAtTimeOnElement(const String& propertyName, double pauseTime, Element&);
154     ExceptionOr<bool> pauseTransitionAtTimeOnPseudoElement(const String& property, double pauseTime, Element&, const String& pseudoId);
155
156     Node* treeScopeRootNode(Node&);
157     Node* parentTreeScope(Node&);
158
159     String visiblePlaceholder(Element&);
160     void selectColorInColorChooser(HTMLInputElement&, const String& colorValue);
161     ExceptionOr<Vector<String>> formControlStateOfPreviousHistoryItem();
162     ExceptionOr<void> setFormControlStateOfPreviousHistoryItem(const Vector<String>&);
163
164     ExceptionOr<Ref<ClientRect>> absoluteCaretBounds();
165
166     Ref<ClientRect> boundingBox(Element&);
167
168     ExceptionOr<Ref<ClientRectList>> inspectorHighlightRects();
169     ExceptionOr<String> inspectorHighlightObject();
170
171     ExceptionOr<unsigned> markerCountForNode(Node&, const String&);
172     ExceptionOr<RefPtr<Range>> markerRangeForNode(Node&, const String& markerType, unsigned index);
173     ExceptionOr<String> markerDescriptionForNode(Node&, const String& markerType, unsigned index);
174     ExceptionOr<String> dumpMarkerRects(const String& markerType);
175     void addTextMatchMarker(const Range&, bool isActive);
176     ExceptionOr<void> setMarkedTextMatchesAreHighlighted(bool);
177
178     void invalidateFontCache();
179     ExceptionOr<void> setLowPowerModeEnabled(bool);
180
181     ExceptionOr<void> setScrollViewPosition(int x, int y);
182     
183     ExceptionOr<Ref<ClientRect>> layoutViewportRect();
184     ExceptionOr<Ref<ClientRect>> visualViewportRect();
185     
186     ExceptionOr<void> setViewBaseBackgroundColor(const String& colorValue);
187
188     ExceptionOr<void> setPagination(const String& mode, int gap, int pageLength);
189     ExceptionOr<void> setPaginationLineGridEnabled(bool);
190     ExceptionOr<String> configurationForViewport(float devicePixelRatio, int deviceWidth, int deviceHeight, int availableWidth, int availableHeight);
191
192     ExceptionOr<bool> wasLastChangeUserEdit(Element& textField);
193     bool elementShouldAutoComplete(HTMLInputElement&);
194     void setEditingValue(HTMLInputElement&, const String&);
195     void setAutofilled(HTMLInputElement&, bool enabled);
196     enum class AutoFillButtonType { AutoFillButtonTypeNone, AutoFillButtonTypeContacts, AutoFillButtonTypeCredentials };
197     void setShowAutoFillButton(HTMLInputElement&, AutoFillButtonType);
198     ExceptionOr<void> scrollElementToRect(Element&, int x, int y, int w, int h);
199
200     ExceptionOr<String> autofillFieldName(Element&);
201
202     ExceptionOr<void> paintControlTints();
203
204     RefPtr<Range> rangeFromLocationAndLength(Element& scope, int rangeLocation, int rangeLength);
205     unsigned locationFromRange(Element& scope, const Range&);
206     unsigned lengthFromRange(Element& scope, const Range&);
207     String rangeAsText(const Range&);
208     Ref<Range> subrange(Range&, int rangeLocation, int rangeLength);
209     ExceptionOr<RefPtr<Range>> rangeForDictionaryLookupAtLocation(int x, int y);
210     RefPtr<Range> rangeOfStringNearLocation(const Range&, const String&, unsigned);
211
212     ExceptionOr<void> setDelegatesScrolling(bool enabled);
213
214     ExceptionOr<int> lastSpellCheckRequestSequence();
215     ExceptionOr<int> lastSpellCheckProcessedSequence();
216
217     Vector<String> userPreferredLanguages() const;
218     void setUserPreferredLanguages(const Vector<String>&);
219
220     Vector<String> userPreferredAudioCharacteristics() const;
221     void setUserPreferredAudioCharacteristic(const String&);
222
223     ExceptionOr<unsigned> wheelEventHandlerCount();
224     ExceptionOr<unsigned> touchEventHandlerCount();
225
226     ExceptionOr<RefPtr<NodeList>> nodesFromRect(Document&, int x, int y, unsigned topPadding, unsigned rightPadding, unsigned bottomPadding, unsigned leftPadding, bool ignoreClipping, bool allowShadowContent, bool allowChildFrameContent) const;
227
228     String parserMetaData(JSC::JSValue = JSC::JSValue::JSUndefined);
229
230     void updateEditorUINowIfScheduled();
231
232     bool hasSpellingMarker(int from, int length);
233     bool hasGrammarMarker(int from, int length);
234     bool hasAutocorrectedMarker(int from, int length);
235     void setContinuousSpellCheckingEnabled(bool);
236     void setAutomaticQuoteSubstitutionEnabled(bool);
237     void setAutomaticLinkDetectionEnabled(bool);
238     void setAutomaticDashSubstitutionEnabled(bool);
239     void setAutomaticTextReplacementEnabled(bool);
240     void setAutomaticSpellingCorrectionEnabled(bool);
241
242     void handleAcceptedCandidate(const String& candidate, unsigned location, unsigned length);
243
244     bool isOverwriteModeEnabled();
245     void toggleOverwriteModeEnabled();
246
247     ExceptionOr<RefPtr<Range>> rangeOfString(const String&, RefPtr<Range>&&, const Vector<String>& findOptions);
248     ExceptionOr<unsigned> countMatchesForText(const String&, const Vector<String>& findOptions, const String& markMatches);
249     ExceptionOr<unsigned> countFindMatches(const String&, const Vector<String>& findOptions);
250
251     unsigned numberOfScrollableAreas();
252
253     ExceptionOr<bool> isPageBoxVisible(int pageNumber);
254
255     static const char* internalsId;
256
257     InternalSettings* settings() const;
258     unsigned workerThreadCount() const;
259     bool areSVGAnimationsPaused() const;
260     ExceptionOr<double> svgAnimationsInterval(SVGSVGElement&) const;
261
262     ExceptionOr<void> setDeviceProximity(const String& eventType, double value, double min, double max);
263
264     enum {
265         // Values need to be kept in sync with Internals.idl.
266         LAYER_TREE_INCLUDES_VISIBLE_RECTS = 1,
267         LAYER_TREE_INCLUDES_TILE_CACHES = 2,
268         LAYER_TREE_INCLUDES_REPAINT_RECTS = 4,
269         LAYER_TREE_INCLUDES_PAINTING_PHASES = 8,
270         LAYER_TREE_INCLUDES_CONTENT_LAYERS = 16,
271         LAYER_TREE_INCLUDES_ACCELERATES_DRAWING = 32,
272     };
273     ExceptionOr<String> layerTreeAsText(Document&, unsigned short flags) const;
274     ExceptionOr<String> repaintRectsAsText() const;
275     ExceptionOr<String> scrollingStateTreeAsText() const;
276     ExceptionOr<String> mainThreadScrollingReasons() const;
277     ExceptionOr<RefPtr<ClientRectList>> nonFastScrollableRects() const;
278
279     ExceptionOr<void> setElementUsesDisplayListDrawing(Element&, bool usesDisplayListDrawing);
280     ExceptionOr<void> setElementTracksDisplayListReplay(Element&, bool isTrackingReplay);
281
282     enum {
283         // Values need to be kept in sync with Internals.idl.
284         DISPLAY_LIST_INCLUDES_PLATFORM_OPERATIONS = 1,
285     };
286     ExceptionOr<String> displayListForElement(Element&, unsigned short flags);
287     ExceptionOr<String> replayDisplayListForElement(Element&, unsigned short flags);
288
289     ExceptionOr<void> garbageCollectDocumentResources() const;
290
291     void beginSimulatedMemoryPressure();
292     void endSimulatedMemoryPressure();
293     bool isUnderMemoryPressure();
294
295     ExceptionOr<void> insertAuthorCSS(const String&) const;
296     ExceptionOr<void> insertUserCSS(const String&) const;
297
298     unsigned numberOfLiveNodes() const;
299     unsigned numberOfLiveDocuments() const;
300
301     RefPtr<DOMWindow> openDummyInspectorFrontend(const String& url);
302     void closeDummyInspectorFrontend();
303     ExceptionOr<void> setInspectorIsUnderTest(bool);
304
305     String counterValue(Element&);
306
307     int pageNumber(Element&, float pageWidth = 800, float pageHeight = 600);
308     Vector<String> shortcutIconURLs() const;
309
310     int numberOfPages(float pageWidthInPixels = 800, float pageHeightInPixels = 600);
311     ExceptionOr<String> pageProperty(const String& propertyName, int pageNumber) const;
312     ExceptionOr<String> pageSizeAndMarginsInPixels(int pageNumber, int width, int height, int marginTop, int marginRight, int marginBottom, int marginLeft) const;
313
314     ExceptionOr<float> pageScaleFactor() const;
315
316     ExceptionOr<void> setPageScaleFactor(float scaleFactor, int x, int y);
317     ExceptionOr<void> setPageZoomFactor(float);
318     ExceptionOr<void> setTextZoomFactor(float);
319
320     ExceptionOr<void> setUseFixedLayout(bool);
321     ExceptionOr<void> setFixedLayoutSize(int width, int height);
322     ExceptionOr<void> setViewExposedRect(float left, float top, float width, float height);
323
324     void setHeaderHeight(float);
325     void setFooterHeight(float);
326
327     void setTopContentInset(float);
328
329 #if ENABLE(FULLSCREEN_API)
330     void webkitWillEnterFullScreenForElement(Element&);
331     void webkitDidEnterFullScreenForElement(Element&);
332     void webkitWillExitFullScreenForElement(Element&);
333     void webkitDidExitFullScreenForElement(Element&);
334 #endif
335
336     WEBCORE_TESTSUPPORT_EXPORT void setApplicationCacheOriginQuota(unsigned long long);
337
338     void registerURLSchemeAsBypassingContentSecurityPolicy(const String& scheme);
339     void removeURLSchemeRegisteredAsBypassingContentSecurityPolicy(const String& scheme);
340
341     void registerDefaultPortForProtocol(unsigned short port, const String& protocol);
342
343     Ref<MallocStatistics> mallocStatistics() const;
344     Ref<TypeConversions> typeConversions() const;
345     Ref<MemoryInfo> memoryInfo() const;
346
347     Vector<String> getReferencedFilePaths() const;
348
349     ExceptionOr<void> startTrackingRepaints();
350     ExceptionOr<void> stopTrackingRepaints();
351
352     ExceptionOr<void> startTrackingLayerFlushes();
353     ExceptionOr<unsigned> layerFlushCount();
354     
355     ExceptionOr<void> startTrackingStyleRecalcs();
356     ExceptionOr<unsigned> styleRecalcCount();
357     unsigned lastStyleUpdateSize() const;
358
359     ExceptionOr<void> startTrackingCompositingUpdates();
360     ExceptionOr<unsigned> compositingUpdateCount();
361
362     ExceptionOr<void> updateLayoutIgnorePendingStylesheetsAndRunPostLayoutTasks(Node*);
363     unsigned layoutCount() const;
364
365     Ref<ArrayBuffer> serializeObject(const RefPtr<SerializedScriptValue>&) const;
366     Ref<SerializedScriptValue> deserializeBuffer(ArrayBuffer&) const;
367
368     bool isFromCurrentWorld(JSC::JSValue) const;
369
370     void setUsesOverlayScrollbars(bool);
371     void setUsesMockScrollAnimator(bool);
372
373     ExceptionOr<String> getCurrentCursorInfo();
374
375     String markerTextForListItem(Element&);
376
377     String toolTipFromElement(Element&) const;
378
379     void forceReload(bool endToEnd);
380
381     void enableAutoSizeMode(bool enabled, int minimumWidth, int minimumHeight, int maximumWidth, int maximumHeight);
382
383 #if ENABLE(LEGACY_ENCRYPTED_MEDIA)
384     void initializeMockCDM();
385 #endif
386
387 #if ENABLE(ENCRYPTED_MEDIA)
388     Ref<MockCDMFactory> registerMockCDM();
389 #endif
390
391 #if ENABLE(SPEECH_SYNTHESIS)
392     void enableMockSpeechSynthesizer();
393 #endif
394
395 #if ENABLE(MEDIA_STREAM)
396     void setMockMediaCaptureDevicesEnabled(bool);
397 #endif
398
399 #if ENABLE(WEB_RTC)
400     void enableMockMediaEndpoint();
401     void emulateRTCPeerConnectionPlatformEvent(RTCPeerConnection&, const String& action);
402     void useMockRTCPeerConnectionFactory(const String&);
403     void setICECandidateFiltering(bool);
404 #endif
405
406     String getImageSourceURL(Element&);
407
408 #if ENABLE(VIDEO)
409     void simulateAudioInterruption(HTMLMediaElement&);
410     ExceptionOr<bool> mediaElementHasCharacteristic(HTMLMediaElement&, const String&);
411 #endif
412
413     bool isSelectPopupVisible(HTMLSelectElement&);
414
415     ExceptionOr<String> captionsStyleSheetOverride();
416     ExceptionOr<void> setCaptionsStyleSheetOverride(const String&);
417     ExceptionOr<void> setPrimaryAudioTrackLanguageOverride(const String&);
418     ExceptionOr<void> setCaptionDisplayMode(const String&);
419
420 #if ENABLE(VIDEO)
421     Ref<TimeRanges> createTimeRanges(Float32Array& startTimes, Float32Array& endTimes);
422     double closestTimeToTimeRanges(double time, TimeRanges&);
423 #endif
424
425     ExceptionOr<Ref<ClientRect>> selectionBounds();
426
427 #if ENABLE(VIBRATION)
428     bool isVibrating();
429 #endif
430
431     ExceptionOr<bool> isPluginUnavailabilityIndicatorObscured(Element&);
432     bool isPluginSnapshotted(Element&);
433
434 #if ENABLE(MEDIA_SOURCE)
435     WEBCORE_TESTSUPPORT_EXPORT void initializeMockMediaSource();
436     Vector<String> bufferedSamplesForTrackID(SourceBuffer&, const AtomicString&);
437     Vector<String> enqueuedSamplesForTrackID(SourceBuffer&, const AtomicString&);
438     void setShouldGenerateTimestamps(SourceBuffer&, bool);
439 #endif
440
441 #if ENABLE(VIDEO)
442     ExceptionOr<void> beginMediaSessionInterruption(const String&);
443     void endMediaSessionInterruption(const String&);
444     void applicationDidEnterForeground() const;
445     void applicationWillEnterBackground() const;
446     ExceptionOr<void> setMediaSessionRestrictions(const String& mediaType, const String& restrictions);
447     ExceptionOr<String> mediaSessionRestrictions(const String& mediaType) const;
448     void setMediaElementRestrictions(HTMLMediaElement&, const String& restrictions);
449     ExceptionOr<void> postRemoteControlCommand(const String&, float argument);
450     bool elementIsBlockingDisplaySleep(HTMLMediaElement&) const;
451 #endif
452
453 #if ENABLE(MEDIA_SESSION)
454     void sendMediaSessionStartOfInterruptionNotification(MediaSessionInterruptingCategory);
455     void sendMediaSessionEndOfInterruptionNotification(MediaSessionInterruptingCategory);
456     String mediaSessionCurrentState(MediaSession&) const;
457     double mediaElementPlayerVolume(HTMLMediaElement&) const;
458     enum class MediaControlEvent { PlayPause, NextTrack, PreviousTrack };
459     void sendMediaControlEvent(MediaControlEvent);
460 #endif
461
462 #if ENABLE(WIRELESS_PLAYBACK_TARGET)
463     void setMockMediaPlaybackTargetPickerEnabled(bool);
464     ExceptionOr<void> setMockMediaPlaybackTargetPickerState(const String& deviceName, const String& deviceState);
465 #endif
466
467 #if ENABLE(WEB_AUDIO)
468     void setAudioContextRestrictions(AudioContext&, const String& restrictions);
469 #endif
470
471     void simulateSystemSleep() const;
472     void simulateSystemWake() const;
473
474     enum class PageOverlayType { View, Document };
475     ExceptionOr<Ref<MockPageOverlay>> installMockPageOverlay(PageOverlayType);
476     ExceptionOr<String> pageOverlayLayerTreeAsText(unsigned short flags) const;
477
478     void setPageMuted(const String&);
479     String pageMediaState();
480
481     void setPageDefersLoading(bool);
482
483     RefPtr<File> createFile(const String&);
484     void queueMicroTask(int);
485     bool testPreloaderSettingViewport();
486
487 #if ENABLE(CONTENT_FILTERING)
488     MockContentFilterSettings& mockContentFilterSettings();
489 #endif
490
491 #if ENABLE(CSS_SCROLL_SNAP)
492     ExceptionOr<String> scrollSnapOffsets(Element&);
493     void setPlatformMomentumScrollingPredictionEnabled(bool);
494 #endif
495
496     ExceptionOr<String> pathStringWithShrinkWrappedRects(const Vector<double>& rectComponents, double radius);
497
498     String getCurrentMediaControlsStatusForElement(HTMLMediaElement&);
499
500     String userVisibleString(const DOMURL&);
501     void setShowAllPlugins(bool);
502
503     String resourceLoadStatisticsForOrigin(const String& origin);
504     void setResourceLoadStatisticsEnabled(bool);
505
506 #if ENABLE(READABLE_STREAM_API)
507     bool isReadableStreamDisturbed(JSC::ExecState&, JSC::JSValue);
508 #endif
509
510     String composedTreeAsText(Node&);
511     
512     bool isProcessingUserGesture();
513
514     RefPtr<GCObservation> observeGC(JSC::JSValue);
515
516     enum class UserInterfaceLayoutDirection { LTR, RTL };
517     void setUserInterfaceLayoutDirection(UserInterfaceLayoutDirection);
518
519     bool userPrefersReducedMotion() const;
520     
521     void reportBacktrace();
522
523     enum class BaseWritingDirection { Natural, Ltr, Rtl };
524     void setBaseWritingDirection(BaseWritingDirection);
525
526 #if ENABLE(POINTER_LOCK)
527     bool pageHasPendingPointerLock() const;
528     bool pageHasPointerLock() const;
529 #endif
530
531     Vector<String> accessKeyModifiers() const;
532
533 #if PLATFORM(IOS)
534     void setQuickLookPassword(const String&);
535 #endif
536
537     void setAsRunningUserScripts(Document&);
538
539 #if ENABLE(WEBGL)
540     void simulateWebGLContextChanged(WebGLRenderingContextBase&);
541 #endif
542
543 private:
544     explicit Internals(Document&);
545     Document* contextDocument() const;
546     Frame* frame() const;
547
548     ExceptionOr<RenderedDocumentMarker*> markerAt(Node&, const String& markerType, unsigned index);
549
550     std::unique_ptr<InspectorStubFrontend> m_inspectorFrontend;
551 };
552
553 } // namespace WebCore