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