2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * Copyright (C) 2013-2017 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.
29 #include "CSSComputedStyleDeclaration.h"
30 #include "ContextDestructionObserver.h"
31 #include "ExceptionOr.h"
32 #include "JSDOMPromiseDeferred.h"
33 #include "OrientationNotifier.h"
34 #include "PageConsoleClient.h"
35 #include "RealtimeMediaSource.h"
36 #include <runtime/Float32Array.h>
37 #include <wtf/Optional.h>
39 #if ENABLE(MEDIA_SESSION)
40 #include "MediaSessionInterruptionProvider.h"
45 class AnimationTimeline;
47 class CacheStorageConnection;
54 class ExtendableEvent;
60 class HTMLImageElement;
61 class HTMLInputElement;
62 class HTMLLinkElement;
63 class HTMLMediaElement;
64 class HTMLSelectElement;
66 class InspectorStubFrontend;
67 class InternalSettings;
68 class MallocStatistics;
71 class MediaStreamTrack;
74 class MockContentFilterSettings;
75 class MockPageOverlay;
76 class MockPaymentCoordinator;
80 class RenderedDocumentMarker;
81 class RTCPeerConnection;
83 class SerializedScriptValue;
88 class TypeConversions;
89 class WebGLRenderingContext;
92 class Internals final : public RefCounted<Internals>, private ContextDestructionObserver
93 #if ENABLE(MEDIA_STREAM)
94 , private RealtimeMediaSource::Observer
98 static Ref<Internals> create(Document&);
101 static void resetToConsistentState(Page&);
103 ExceptionOr<String> elementRenderTreeAsText(Element&);
104 bool hasPausedImageAnimations(Element&);
106 String address(Node&);
107 bool nodeNeedsStyleRecalc(Node&);
108 String styleChangeType(Node&);
109 String description(JSC::JSValue);
111 bool isPreloaded(const String& url);
112 bool isLoadingFromMemoryCache(const String& url);
113 String fetchResponseSource(FetchResponse&);
114 String xhrResponseSource(XMLHttpRequest&);
115 bool isSharingStyleSheetContents(HTMLLinkElement&, HTMLLinkElement&);
116 bool isStyleSheetLoadingSubresources(HTMLLinkElement&);
117 enum class CachePolicy { UseProtocolCachePolicy, ReloadIgnoringCacheData, ReturnCacheDataElseLoad, ReturnCacheDataDontLoad };
118 void setOverrideCachePolicy(CachePolicy);
119 ExceptionOr<void> setCanShowModalDialogOverride(bool allow);
120 enum class ResourceLoadPriority { ResourceLoadPriorityVeryLow, ResourceLoadPriorityLow, ResourceLoadPriorityMedium, ResourceLoadPriorityHigh, ResourceLoadPriorityVeryHigh };
121 void setOverrideResourceLoadPriority(ResourceLoadPriority);
122 void setStrictRawResourceValidationPolicyDisabled(bool);
124 void clearMemoryCache();
125 void pruneMemoryCacheToSize(unsigned size);
126 void destroyDecodedDataForAllImages();
127 unsigned memoryCacheSize() const;
129 unsigned imageFrameIndex(HTMLImageElement&);
130 void setImageFrameDecodingDuration(HTMLImageElement&, float duration);
131 void resetImageAnimation(HTMLImageElement&);
132 bool isImageAnimating(HTMLImageElement&);
133 void setClearDecoderAfterAsyncFrameRequestForTesting(HTMLImageElement&, bool enabled);
134 unsigned imageDecodeCount(HTMLImageElement&);
135 void setLargeImageAsyncDecodingEnabledForTesting(HTMLImageElement&, bool enabled);
137 void setGridMaxTracksLimit(unsigned);
139 void clearPageCache();
140 unsigned pageCacheSize() const;
142 void disableTileSizeUpdateDelay();
144 void setSpeculativeTilingDelayDisabledForTesting(bool);
146 Ref<CSSComputedStyleDeclaration> computedStyleIncludingVisitedInfo(Element&) const;
148 Node* ensureUserAgentShadowRoot(Element& host);
149 Node* shadowRoot(Element& host);
150 ExceptionOr<String> shadowRootType(const Node&) const;
151 String shadowPseudoId(Element&);
152 void setShadowPseudoId(Element&, const String&);
154 // CSS Deferred Parsing Testing
155 unsigned deferredStyleRulesCount(StyleSheet&);
156 unsigned deferredGroupRulesCount(StyleSheet&);
157 unsigned deferredKeyframesRulesCount(StyleSheet&);
159 // DOMTimers throttling testing.
160 ExceptionOr<bool> isTimerThrottled(int timeoutId);
161 bool isRequestAnimationFrameThrottled() const;
162 double requestAnimationFrameInterval() const;
163 bool scriptedAnimationsAreSuspended() const;
164 bool areTimersThrottled() const;
166 enum EventThrottlingBehavior { Responsive, Unresponsive };
167 void setEventThrottlingBehaviorOverride(std::optional<EventThrottlingBehavior>);
168 std::optional<EventThrottlingBehavior> eventThrottlingBehaviorOverride() const;
170 // Spatial Navigation testing.
171 ExceptionOr<unsigned> lastSpatialNavigationCandidateCount() const;
173 // CSS Animation testing.
174 unsigned numberOfActiveAnimations() const;
175 ExceptionOr<bool> animationsAreSuspended() const;
176 ExceptionOr<void> suspendAnimations() const;
177 ExceptionOr<void> resumeAnimations() const;
178 ExceptionOr<bool> pauseAnimationAtTimeOnElement(const String& animationName, double pauseTime, Element&);
179 ExceptionOr<bool> pauseAnimationAtTimeOnPseudoElement(const String& animationName, double pauseTime, Element&, const String& pseudoId);
180 double animationsInterval() const;
182 // CSS Transition testing.
183 ExceptionOr<bool> pauseTransitionAtTimeOnElement(const String& propertyName, double pauseTime, Element&);
184 ExceptionOr<bool> pauseTransitionAtTimeOnPseudoElement(const String& property, double pauseTime, Element&, const String& pseudoId);
186 Node* treeScopeRootNode(Node&);
187 Node* parentTreeScope(Node&);
189 String visiblePlaceholder(Element&);
190 void selectColorInColorChooser(HTMLInputElement&, const String& colorValue);
191 ExceptionOr<Vector<String>> formControlStateOfPreviousHistoryItem();
192 ExceptionOr<void> setFormControlStateOfPreviousHistoryItem(const Vector<String>&);
194 ExceptionOr<Ref<DOMRect>> absoluteCaretBounds();
196 Ref<DOMRect> boundingBox(Element&);
198 ExceptionOr<Ref<DOMRectList>> inspectorHighlightRects();
199 ExceptionOr<String> inspectorHighlightObject();
201 ExceptionOr<unsigned> markerCountForNode(Node&, const String&);
202 ExceptionOr<RefPtr<Range>> markerRangeForNode(Node&, const String& markerType, unsigned index);
203 ExceptionOr<String> markerDescriptionForNode(Node&, const String& markerType, unsigned index);
204 ExceptionOr<String> dumpMarkerRects(const String& markerType);
205 void addTextMatchMarker(const Range&, bool isActive);
206 ExceptionOr<void> setMarkedTextMatchesAreHighlighted(bool);
208 void invalidateFontCache();
209 void setFontSmoothingEnabled(bool);
211 ExceptionOr<void> setLowPowerModeEnabled(bool);
213 ExceptionOr<void> setScrollViewPosition(int x, int y);
214 ExceptionOr<void> unconstrainedScrollTo(Element&, double x, double y);
216 ExceptionOr<Ref<DOMRect>> layoutViewportRect();
217 ExceptionOr<Ref<DOMRect>> visualViewportRect();
219 ExceptionOr<void> setViewBaseBackgroundColor(const String& colorValue);
221 ExceptionOr<void> setPagination(const String& mode, int gap, int pageLength);
222 ExceptionOr<void> setPaginationLineGridEnabled(bool);
223 ExceptionOr<String> configurationForViewport(float devicePixelRatio, int deviceWidth, int deviceHeight, int availableWidth, int availableHeight);
225 ExceptionOr<bool> wasLastChangeUserEdit(Element& textField);
226 bool elementShouldAutoComplete(HTMLInputElement&);
227 void setEditingValue(HTMLInputElement&, const String&);
228 void setAutofilled(HTMLInputElement&, bool enabled);
229 enum class AutoFillButtonType { AutoFillButtonTypeNone, AutoFillButtonTypeContacts, AutoFillButtonTypeCredentials };
230 void setShowAutoFillButton(HTMLInputElement&, AutoFillButtonType);
231 ExceptionOr<void> scrollElementToRect(Element&, int x, int y, int w, int h);
233 ExceptionOr<String> autofillFieldName(Element&);
235 ExceptionOr<void> paintControlTints();
237 RefPtr<Range> rangeFromLocationAndLength(Element& scope, int rangeLocation, int rangeLength);
238 unsigned locationFromRange(Element& scope, const Range&);
239 unsigned lengthFromRange(Element& scope, const Range&);
240 String rangeAsText(const Range&);
241 Ref<Range> subrange(Range&, int rangeLocation, int rangeLength);
242 ExceptionOr<RefPtr<Range>> rangeForDictionaryLookupAtLocation(int x, int y);
243 RefPtr<Range> rangeOfStringNearLocation(const Range&, const String&, unsigned);
245 ExceptionOr<void> setDelegatesScrolling(bool enabled);
247 ExceptionOr<int> lastSpellCheckRequestSequence();
248 ExceptionOr<int> lastSpellCheckProcessedSequence();
250 Vector<String> userPreferredLanguages() const;
251 void setUserPreferredLanguages(const Vector<String>&);
253 Vector<String> userPreferredAudioCharacteristics() const;
254 void setUserPreferredAudioCharacteristic(const String&);
256 ExceptionOr<unsigned> wheelEventHandlerCount();
257 ExceptionOr<unsigned> touchEventHandlerCount();
259 ExceptionOr<Ref<DOMRectList>> touchEventRectsForEvent(const String&);
260 ExceptionOr<Ref<DOMRectList>> passiveTouchEventListenerRects();
262 ExceptionOr<RefPtr<NodeList>> nodesFromRect(Document&, int x, int y, unsigned topPadding, unsigned rightPadding, unsigned bottomPadding, unsigned leftPadding, bool ignoreClipping, bool allowUserAgentShadowContent, bool allowChildFrameContent) const;
264 String parserMetaData(JSC::JSValue = JSC::JSValue::JSUndefined);
266 void updateEditorUINowIfScheduled();
268 bool hasSpellingMarker(int from, int length);
269 bool hasGrammarMarker(int from, int length);
270 bool hasAutocorrectedMarker(int from, int length);
271 void setContinuousSpellCheckingEnabled(bool);
272 void setAutomaticQuoteSubstitutionEnabled(bool);
273 void setAutomaticLinkDetectionEnabled(bool);
274 void setAutomaticDashSubstitutionEnabled(bool);
275 void setAutomaticTextReplacementEnabled(bool);
276 void setAutomaticSpellingCorrectionEnabled(bool);
278 void handleAcceptedCandidate(const String& candidate, unsigned location, unsigned length);
280 bool isOverwriteModeEnabled();
281 void toggleOverwriteModeEnabled();
283 ExceptionOr<RefPtr<Range>> rangeOfString(const String&, RefPtr<Range>&&, const Vector<String>& findOptions);
284 ExceptionOr<unsigned> countMatchesForText(const String&, const Vector<String>& findOptions, const String& markMatches);
285 ExceptionOr<unsigned> countFindMatches(const String&, const Vector<String>& findOptions);
287 unsigned numberOfScrollableAreas();
289 ExceptionOr<bool> isPageBoxVisible(int pageNumber);
291 static const char* internalsId;
293 InternalSettings* settings() const;
294 unsigned workerThreadCount() const;
295 ExceptionOr<bool> areSVGAnimationsPaused() const;
296 ExceptionOr<double> svgAnimationsInterval(SVGSVGElement&) const;
299 // Values need to be kept in sync with Internals.idl.
300 LAYER_TREE_INCLUDES_VISIBLE_RECTS = 1,
301 LAYER_TREE_INCLUDES_TILE_CACHES = 2,
302 LAYER_TREE_INCLUDES_REPAINT_RECTS = 4,
303 LAYER_TREE_INCLUDES_PAINTING_PHASES = 8,
304 LAYER_TREE_INCLUDES_CONTENT_LAYERS = 16,
305 LAYER_TREE_INCLUDES_ACCELERATES_DRAWING = 32,
306 LAYER_TREE_INCLUDES_BACKING_STORE_ATTACHED = 64,
308 ExceptionOr<String> layerTreeAsText(Document&, unsigned short flags) const;
309 ExceptionOr<uint64_t> layerIDForElement(Element&);
310 ExceptionOr<String> repaintRectsAsText() const;
311 ExceptionOr<String> scrollingStateTreeAsText() const;
312 ExceptionOr<String> mainThreadScrollingReasons() const;
313 ExceptionOr<Ref<DOMRectList>> nonFastScrollableRects() const;
315 ExceptionOr<void> setElementUsesDisplayListDrawing(Element&, bool usesDisplayListDrawing);
316 ExceptionOr<void> setElementTracksDisplayListReplay(Element&, bool isTrackingReplay);
319 // Values need to be kept in sync with Internals.idl.
320 DISPLAY_LIST_INCLUDES_PLATFORM_OPERATIONS = 1,
322 ExceptionOr<String> displayListForElement(Element&, unsigned short flags);
323 ExceptionOr<String> replayDisplayListForElement(Element&, unsigned short flags);
325 ExceptionOr<void> garbageCollectDocumentResources() const;
327 void beginSimulatedMemoryPressure();
328 void endSimulatedMemoryPressure();
329 bool isUnderMemoryPressure();
331 ExceptionOr<void> insertAuthorCSS(const String&) const;
332 ExceptionOr<void> insertUserCSS(const String&) const;
334 unsigned numberOfLiveNodes() const;
335 unsigned numberOfLiveDocuments() const;
336 unsigned referencingNodeCount(const Document&) const;
338 RefPtr<DOMWindow> openDummyInspectorFrontend(const String& url);
339 void closeDummyInspectorFrontend();
340 ExceptionOr<void> setInspectorIsUnderTest(bool);
342 String counterValue(Element&);
344 int pageNumber(Element&, float pageWidth = 800, float pageHeight = 600);
345 Vector<String> shortcutIconURLs() const;
347 int numberOfPages(float pageWidthInPixels = 800, float pageHeightInPixels = 600);
348 ExceptionOr<String> pageProperty(const String& propertyName, int pageNumber) const;
349 ExceptionOr<String> pageSizeAndMarginsInPixels(int pageNumber, int width, int height, int marginTop, int marginRight, int marginBottom, int marginLeft) const;
351 ExceptionOr<float> pageScaleFactor() const;
353 ExceptionOr<void> setPageScaleFactor(float scaleFactor, int x, int y);
354 ExceptionOr<void> setPageZoomFactor(float);
355 ExceptionOr<void> setTextZoomFactor(float);
357 ExceptionOr<void> setUseFixedLayout(bool);
358 ExceptionOr<void> setFixedLayoutSize(int width, int height);
359 ExceptionOr<void> setViewExposedRect(float left, float top, float width, float height);
360 void setPrinting(int width, int height);
362 void setHeaderHeight(float);
363 void setFooterHeight(float);
365 void setTopContentInset(float);
367 #if ENABLE(FULLSCREEN_API)
368 void webkitWillEnterFullScreenForElement(Element&);
369 void webkitDidEnterFullScreenForElement(Element&);
370 void webkitWillExitFullScreenForElement(Element&);
371 void webkitDidExitFullScreenForElement(Element&);
374 WEBCORE_TESTSUPPORT_EXPORT void setApplicationCacheOriginQuota(unsigned long long);
376 void registerURLSchemeAsBypassingContentSecurityPolicy(const String& scheme);
377 void removeURLSchemeRegisteredAsBypassingContentSecurityPolicy(const String& scheme);
379 void registerDefaultPortForProtocol(unsigned short port, const String& protocol);
381 Ref<MallocStatistics> mallocStatistics() const;
382 Ref<TypeConversions> typeConversions() const;
383 Ref<MemoryInfo> memoryInfo() const;
385 Vector<String> getReferencedFilePaths() const;
387 ExceptionOr<void> startTrackingRepaints();
388 ExceptionOr<void> stopTrackingRepaints();
390 ExceptionOr<void> startTrackingLayerFlushes();
391 ExceptionOr<unsigned> layerFlushCount();
393 ExceptionOr<void> startTrackingStyleRecalcs();
394 ExceptionOr<unsigned> styleRecalcCount();
395 unsigned lastStyleUpdateSize() const;
397 ExceptionOr<void> startTrackingCompositingUpdates();
398 ExceptionOr<unsigned> compositingUpdateCount();
400 ExceptionOr<void> updateLayoutIgnorePendingStylesheetsAndRunPostLayoutTasks(Node*);
401 unsigned layoutCount() const;
403 Ref<ArrayBuffer> serializeObject(const RefPtr<SerializedScriptValue>&) const;
404 Ref<SerializedScriptValue> deserializeBuffer(ArrayBuffer&) const;
406 bool isFromCurrentWorld(JSC::JSValue) const;
408 void setUsesOverlayScrollbars(bool);
409 void setUsesMockScrollAnimator(bool);
411 ExceptionOr<String> getCurrentCursorInfo();
413 String markerTextForListItem(Element&);
415 String toolTipFromElement(Element&) const;
417 void forceReload(bool endToEnd);
418 void reloadExpiredOnly();
420 void enableAutoSizeMode(bool enabled, int minimumWidth, int minimumHeight, int maximumWidth, int maximumHeight);
422 #if ENABLE(LEGACY_ENCRYPTED_MEDIA)
423 void initializeMockCDM();
426 #if ENABLE(ENCRYPTED_MEDIA)
427 Ref<MockCDMFactory> registerMockCDM();
430 #if ENABLE(SPEECH_SYNTHESIS)
431 void enableMockSpeechSynthesizer();
434 #if ENABLE(MEDIA_STREAM)
435 void setMockMediaCaptureDevicesEnabled(bool);
439 void emulateRTCPeerConnectionPlatformEvent(RTCPeerConnection&, const String& action);
440 void useMockRTCPeerConnectionFactory(const String&);
441 void setICECandidateFiltering(bool);
442 void setEnumeratingAllNetworkInterfacesEnabled(bool);
443 void stopPeerConnection(RTCPeerConnection&);
444 void applyRotationForOutgoingVideoSources(RTCPeerConnection&);
447 String getImageSourceURL(Element&);
450 Vector<String> mediaResponseSources(HTMLMediaElement&);
451 Vector<String> mediaResponseContentRanges(HTMLMediaElement&);
452 void simulateAudioInterruption(HTMLMediaElement&);
453 ExceptionOr<bool> mediaElementHasCharacteristic(HTMLMediaElement&, const String&);
456 bool isSelectPopupVisible(HTMLSelectElement&);
458 ExceptionOr<String> captionsStyleSheetOverride();
459 ExceptionOr<void> setCaptionsStyleSheetOverride(const String&);
460 ExceptionOr<void> setPrimaryAudioTrackLanguageOverride(const String&);
461 ExceptionOr<void> setCaptionDisplayMode(const String&);
464 Ref<TimeRanges> createTimeRanges(Float32Array& startTimes, Float32Array& endTimes);
465 double closestTimeToTimeRanges(double time, TimeRanges&);
468 ExceptionOr<Ref<DOMRect>> selectionBounds();
470 ExceptionOr<bool> isPluginUnavailabilityIndicatorObscured(Element&);
471 bool isPluginSnapshotted(Element&);
473 #if ENABLE(MEDIA_SOURCE)
474 WEBCORE_TESTSUPPORT_EXPORT void initializeMockMediaSource();
475 Vector<String> bufferedSamplesForTrackID(SourceBuffer&, const AtomicString&);
476 Vector<String> enqueuedSamplesForTrackID(SourceBuffer&, const AtomicString&);
477 void setShouldGenerateTimestamps(SourceBuffer&, bool);
481 ExceptionOr<void> beginMediaSessionInterruption(const String&);
482 void endMediaSessionInterruption(const String&);
483 void applicationWillBecomeInactive();
484 void applicationDidBecomeActive();
485 void applicationWillEnterForeground(bool suspendedUnderLock) const;
486 void applicationDidEnterBackground(bool suspendedUnderLock) const;
487 ExceptionOr<void> setMediaSessionRestrictions(const String& mediaType, StringView restrictionsString);
488 ExceptionOr<String> mediaSessionRestrictions(const String& mediaType) const;
489 void setMediaElementRestrictions(HTMLMediaElement&, StringView restrictionsString);
490 ExceptionOr<void> postRemoteControlCommand(const String&, float argument);
491 bool elementIsBlockingDisplaySleep(HTMLMediaElement&) const;
494 #if ENABLE(MEDIA_SESSION)
495 void sendMediaSessionStartOfInterruptionNotification(MediaSessionInterruptingCategory);
496 void sendMediaSessionEndOfInterruptionNotification(MediaSessionInterruptingCategory);
497 String mediaSessionCurrentState(MediaSession&) const;
498 double mediaElementPlayerVolume(HTMLMediaElement&) const;
499 enum class MediaControlEvent { PlayPause, NextTrack, PreviousTrack };
500 void sendMediaControlEvent(MediaControlEvent);
503 #if ENABLE(WIRELESS_PLAYBACK_TARGET)
504 void setMockMediaPlaybackTargetPickerEnabled(bool);
505 ExceptionOr<void> setMockMediaPlaybackTargetPickerState(const String& deviceName, const String& deviceState);
508 #if ENABLE(WEB_AUDIO)
509 void setAudioContextRestrictions(AudioContext&, StringView restrictionsString);
512 void simulateSystemSleep() const;
513 void simulateSystemWake() const;
515 enum class PageOverlayType { View, Document };
516 ExceptionOr<Ref<MockPageOverlay>> installMockPageOverlay(PageOverlayType);
517 ExceptionOr<String> pageOverlayLayerTreeAsText(unsigned short flags) const;
519 void setPageMuted(StringView);
520 String pageMediaState();
522 void setPageDefersLoading(bool);
524 RefPtr<File> createFile(const String&);
525 void queueMicroTask(int);
526 bool testPreloaderSettingViewport();
528 #if ENABLE(CONTENT_FILTERING)
529 MockContentFilterSettings& mockContentFilterSettings();
532 #if ENABLE(CSS_SCROLL_SNAP)
533 ExceptionOr<String> scrollSnapOffsets(Element&);
534 void setPlatformMomentumScrollingPredictionEnabled(bool);
537 ExceptionOr<String> pathStringWithShrinkWrappedRects(const Vector<double>& rectComponents, double radius);
539 String getCurrentMediaControlsStatusForElement(HTMLMediaElement&);
541 String userVisibleString(const DOMURL&);
542 void setShowAllPlugins(bool);
544 String resourceLoadStatisticsForOrigin(const String& origin);
545 void setResourceLoadStatisticsEnabled(bool);
546 void setUserGrantsStorageAccess(bool);
548 #if ENABLE(STREAMS_API)
549 bool isReadableStreamDisturbed(JSC::ExecState&, JSC::JSValue);
550 JSC::JSValue cloneArrayBuffer(JSC::ExecState&, JSC::JSValue, JSC::JSValue, JSC::JSValue);
553 String composedTreeAsText(Node&);
555 bool isProcessingUserGesture();
556 double lastHandledUserGestureTimestamp();
558 RefPtr<GCObservation> observeGC(JSC::JSValue);
560 enum class UserInterfaceLayoutDirection { LTR, RTL };
561 void setUserInterfaceLayoutDirection(UserInterfaceLayoutDirection);
563 bool userPrefersReducedMotion() const;
565 void reportBacktrace();
567 enum class BaseWritingDirection { Natural, Ltr, Rtl };
568 void setBaseWritingDirection(BaseWritingDirection);
570 #if ENABLE(POINTER_LOCK)
571 bool pageHasPendingPointerLock() const;
572 bool pageHasPointerLock() const;
575 Vector<String> accessKeyModifiers() const;
577 void setQuickLookPassword(const String&);
579 void setAsRunningUserScripts(Document&);
582 void simulateWebGLContextChanged(WebGLRenderingContext&);
583 void failNextGPUStatusCheck(WebGLRenderingContext&);
586 void setPageVisibility(bool isVisible);
589 void setH264HardwareEncoderAllowed(bool allowed);
592 #if ENABLE(MEDIA_STREAM)
593 void setCameraMediaStreamTrackOrientation(MediaStreamTrack&, int orientation);
594 ExceptionOr<void> setMediaDeviceState(const String& id, const String& property, bool value);
595 unsigned long trackAudioSampleCount() const { return m_trackAudioSampleCount; }
596 unsigned long trackVideoSampleCount() const { return m_trackVideoSampleCount; }
597 void observeMediaStreamTrack(MediaStreamTrack&);
598 using TrackFramePromise = DOMPromiseDeferred<IDLInterface<ImageData>>;
599 void grabNextMediaStreamTrackFrame(TrackFramePromise&&);
600 void delayMediaStreamTrackSamples(MediaStreamTrack&, float);
601 void setMediaStreamTrackMuted(MediaStreamTrack&, bool);
602 void removeMediaStreamTrack(MediaStream&, MediaStreamTrack&);
603 void simulateMediaStreamTrackCaptureSourceFailure(MediaStreamTrack&);
606 String audioSessionCategory() const;
608 void clearCacheStorageMemoryRepresentation(DOMPromiseDeferred<void>&&);
609 void cacheStorageEngineRepresentation(DOMPromiseDeferred<IDLDOMString>&&);
610 void setResponseSizeWithPadding(FetchResponse&, uint64_t size);
611 uint64_t responseSizeWithPadding(FetchResponse&) const;
613 void setConsoleMessageListener(RefPtr<StringCallback>&&);
615 #if ENABLE(SERVICE_WORKER)
616 void waitForFetchEventToFinish(FetchEvent&, DOMPromiseDeferred<IDLInterface<FetchResponse>>&&);
617 void waitForExtendableEventToFinish(ExtendableEvent&, DOMPromiseDeferred<void>&&);
618 Ref<FetchEvent> createBeingDispatchedFetchEvent(ScriptExecutionContext&);
619 Ref<ExtendableEvent> createTrustedExtendableEvent();
620 using HasRegistrationPromise = DOMPromiseDeferred<IDLBoolean>;
621 void hasServiceWorkerRegistration(const String& clientURL, HasRegistrationPromise&&);
624 bool hasServiceWorkerRegisteredForOrigin(const String&);
626 #if ENABLE(APPLE_PAY)
627 MockPaymentCoordinator& mockPaymentCoordinator() const;
630 String timelineDescription(AnimationTimeline&);
631 void pauseTimeline(AnimationTimeline&);
632 void setTimelineCurrentTime(AnimationTimeline&, double);
635 explicit Internals(Document&);
636 Document* contextDocument() const;
637 Frame* frame() const;
639 ExceptionOr<RenderedDocumentMarker*> markerAt(Node&, const String& markerType, unsigned index);
641 // RealtimeMediaSource::Observer API
642 #if ENABLE(MEDIA_STREAM)
643 void videoSampleAvailable(MediaSample&) final;
644 void audioSamplesAvailable(const MediaTime&, const PlatformAudioData&, const AudioStreamDescription&, size_t) final { m_trackAudioSampleCount++; }
646 OrientationNotifier m_orientationNotifier;
647 unsigned long m_trackVideoSampleCount { 0 };
648 unsigned long m_trackAudioSampleCount { 0 };
649 RefPtr<MediaStreamTrack> m_track;
650 std::optional<TrackFramePromise> m_nextTrackFramePromise;
653 std::unique_ptr<InspectorStubFrontend> m_inspectorFrontend;
654 RefPtr<CacheStorageConnection> m_cacheStorageConnection;
656 #if ENABLE(APPLE_PAY)
657 MockPaymentCoordinator* m_mockPaymentCoordinator { nullptr };
661 } // namespace WebCore