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;
79 class RenderedDocumentMarker;
80 class RTCPeerConnection;
82 class SerializedScriptValue;
87 class TypeConversions;
88 class WebGLRenderingContext;
91 class Internals final : public RefCounted<Internals>, private ContextDestructionObserver
92 #if ENABLE(MEDIA_STREAM)
93 , private RealtimeMediaSource::Observer
97 static Ref<Internals> create(Document&);
100 static void resetToConsistentState(Page&);
102 ExceptionOr<String> elementRenderTreeAsText(Element&);
103 bool hasPausedImageAnimations(Element&);
105 String address(Node&);
106 bool nodeNeedsStyleRecalc(Node&);
107 String styleChangeType(Node&);
108 String description(JSC::JSValue);
110 bool isPreloaded(const String& url);
111 bool isLoadingFromMemoryCache(const String& url);
112 String fetchResponseSource(FetchResponse&);
113 String xhrResponseSource(XMLHttpRequest&);
114 bool isSharingStyleSheetContents(HTMLLinkElement&, HTMLLinkElement&);
115 bool isStyleSheetLoadingSubresources(HTMLLinkElement&);
116 enum class CachePolicy { UseProtocolCachePolicy, ReloadIgnoringCacheData, ReturnCacheDataElseLoad, ReturnCacheDataDontLoad };
117 void setOverrideCachePolicy(CachePolicy);
118 ExceptionOr<void> setCanShowModalDialogOverride(bool allow);
119 enum class ResourceLoadPriority { ResourceLoadPriorityVeryLow, ResourceLoadPriorityLow, ResourceLoadPriorityMedium, ResourceLoadPriorityHigh, ResourceLoadPriorityVeryHigh };
120 void setOverrideResourceLoadPriority(ResourceLoadPriority);
121 void setStrictRawResourceValidationPolicyDisabled(bool);
123 void clearMemoryCache();
124 void pruneMemoryCacheToSize(unsigned size);
125 void destroyDecodedDataForAllImages();
126 unsigned memoryCacheSize() const;
128 unsigned imageFrameIndex(HTMLImageElement&);
129 void setImageFrameDecodingDuration(HTMLImageElement&, float duration);
130 void resetImageAnimation(HTMLImageElement&);
131 bool isImageAnimating(HTMLImageElement&);
132 void setClearDecoderAfterAsyncFrameRequestForTesting(HTMLImageElement&, bool enabled);
133 unsigned imageDecodeCount(HTMLImageElement&);
134 void setLargeImageAsyncDecodingEnabledForTesting(HTMLImageElement&, bool enabled);
136 void setGridMaxTracksLimit(unsigned);
138 void clearPageCache();
139 unsigned pageCacheSize() const;
141 void disableTileSizeUpdateDelay();
143 void setSpeculativeTilingDelayDisabledForTesting(bool);
145 Ref<CSSComputedStyleDeclaration> computedStyleIncludingVisitedInfo(Element&) const;
147 Node* ensureUserAgentShadowRoot(Element& host);
148 Node* shadowRoot(Element& host);
149 ExceptionOr<String> shadowRootType(const Node&) const;
150 String shadowPseudoId(Element&);
151 void setShadowPseudoId(Element&, const String&);
153 // CSS Deferred Parsing Testing
154 unsigned deferredStyleRulesCount(StyleSheet&);
155 unsigned deferredGroupRulesCount(StyleSheet&);
156 unsigned deferredKeyframesRulesCount(StyleSheet&);
158 // DOMTimers throttling testing.
159 ExceptionOr<bool> isTimerThrottled(int timeoutId);
160 bool isRequestAnimationFrameThrottled() const;
161 double requestAnimationFrameInterval() const;
162 bool scriptedAnimationsAreSuspended() const;
163 bool areTimersThrottled() const;
165 enum EventThrottlingBehavior { Responsive, Unresponsive };
166 void setEventThrottlingBehaviorOverride(std::optional<EventThrottlingBehavior>);
167 std::optional<EventThrottlingBehavior> eventThrottlingBehaviorOverride() const;
169 // Spatial Navigation testing.
170 ExceptionOr<unsigned> lastSpatialNavigationCandidateCount() const;
172 // CSS Animation testing.
173 unsigned numberOfActiveAnimations() const;
174 ExceptionOr<bool> animationsAreSuspended() const;
175 ExceptionOr<void> suspendAnimations() const;
176 ExceptionOr<void> resumeAnimations() const;
177 ExceptionOr<bool> pauseAnimationAtTimeOnElement(const String& animationName, double pauseTime, Element&);
178 ExceptionOr<bool> pauseAnimationAtTimeOnPseudoElement(const String& animationName, double pauseTime, Element&, const String& pseudoId);
179 double animationsInterval() const;
181 // CSS Transition testing.
182 ExceptionOr<bool> pauseTransitionAtTimeOnElement(const String& propertyName, double pauseTime, Element&);
183 ExceptionOr<bool> pauseTransitionAtTimeOnPseudoElement(const String& property, double pauseTime, Element&, const String& pseudoId);
185 Node* treeScopeRootNode(Node&);
186 Node* parentTreeScope(Node&);
188 String visiblePlaceholder(Element&);
189 void selectColorInColorChooser(HTMLInputElement&, const String& colorValue);
190 ExceptionOr<Vector<String>> formControlStateOfPreviousHistoryItem();
191 ExceptionOr<void> setFormControlStateOfPreviousHistoryItem(const Vector<String>&);
193 ExceptionOr<Ref<DOMRect>> absoluteCaretBounds();
195 Ref<DOMRect> boundingBox(Element&);
197 ExceptionOr<Ref<DOMRectList>> inspectorHighlightRects();
198 ExceptionOr<String> inspectorHighlightObject();
200 ExceptionOr<unsigned> markerCountForNode(Node&, const String&);
201 ExceptionOr<RefPtr<Range>> markerRangeForNode(Node&, const String& markerType, unsigned index);
202 ExceptionOr<String> markerDescriptionForNode(Node&, const String& markerType, unsigned index);
203 ExceptionOr<String> dumpMarkerRects(const String& markerType);
204 void addTextMatchMarker(const Range&, bool isActive);
205 ExceptionOr<void> setMarkedTextMatchesAreHighlighted(bool);
207 void invalidateFontCache();
208 void setFontSmoothingEnabled(bool);
210 ExceptionOr<void> setLowPowerModeEnabled(bool);
212 ExceptionOr<void> setScrollViewPosition(int x, int y);
214 ExceptionOr<Ref<DOMRect>> layoutViewportRect();
215 ExceptionOr<Ref<DOMRect>> visualViewportRect();
217 ExceptionOr<void> setViewBaseBackgroundColor(const String& colorValue);
219 ExceptionOr<void> setPagination(const String& mode, int gap, int pageLength);
220 ExceptionOr<void> setPaginationLineGridEnabled(bool);
221 ExceptionOr<String> configurationForViewport(float devicePixelRatio, int deviceWidth, int deviceHeight, int availableWidth, int availableHeight);
223 ExceptionOr<bool> wasLastChangeUserEdit(Element& textField);
224 bool elementShouldAutoComplete(HTMLInputElement&);
225 void setEditingValue(HTMLInputElement&, const String&);
226 void setAutofilled(HTMLInputElement&, bool enabled);
227 enum class AutoFillButtonType { AutoFillButtonTypeNone, AutoFillButtonTypeContacts, AutoFillButtonTypeCredentials };
228 void setShowAutoFillButton(HTMLInputElement&, AutoFillButtonType);
229 ExceptionOr<void> scrollElementToRect(Element&, int x, int y, int w, int h);
231 ExceptionOr<String> autofillFieldName(Element&);
233 ExceptionOr<void> paintControlTints();
235 RefPtr<Range> rangeFromLocationAndLength(Element& scope, int rangeLocation, int rangeLength);
236 unsigned locationFromRange(Element& scope, const Range&);
237 unsigned lengthFromRange(Element& scope, const Range&);
238 String rangeAsText(const Range&);
239 Ref<Range> subrange(Range&, int rangeLocation, int rangeLength);
240 ExceptionOr<RefPtr<Range>> rangeForDictionaryLookupAtLocation(int x, int y);
241 RefPtr<Range> rangeOfStringNearLocation(const Range&, const String&, unsigned);
243 ExceptionOr<void> setDelegatesScrolling(bool enabled);
245 ExceptionOr<int> lastSpellCheckRequestSequence();
246 ExceptionOr<int> lastSpellCheckProcessedSequence();
248 Vector<String> userPreferredLanguages() const;
249 void setUserPreferredLanguages(const Vector<String>&);
251 Vector<String> userPreferredAudioCharacteristics() const;
252 void setUserPreferredAudioCharacteristic(const String&);
254 ExceptionOr<unsigned> wheelEventHandlerCount();
255 ExceptionOr<unsigned> touchEventHandlerCount();
257 ExceptionOr<Ref<DOMRectList>> touchEventRectsForEvent(const String&);
258 ExceptionOr<Ref<DOMRectList>> passiveTouchEventListenerRects();
260 ExceptionOr<RefPtr<NodeList>> nodesFromRect(Document&, int x, int y, unsigned topPadding, unsigned rightPadding, unsigned bottomPadding, unsigned leftPadding, bool ignoreClipping, bool allowUserAgentShadowContent, bool allowChildFrameContent) const;
262 String parserMetaData(JSC::JSValue = JSC::JSValue::JSUndefined);
264 void updateEditorUINowIfScheduled();
266 bool hasSpellingMarker(int from, int length);
267 bool hasGrammarMarker(int from, int length);
268 bool hasAutocorrectedMarker(int from, int length);
269 void setContinuousSpellCheckingEnabled(bool);
270 void setAutomaticQuoteSubstitutionEnabled(bool);
271 void setAutomaticLinkDetectionEnabled(bool);
272 void setAutomaticDashSubstitutionEnabled(bool);
273 void setAutomaticTextReplacementEnabled(bool);
274 void setAutomaticSpellingCorrectionEnabled(bool);
276 void handleAcceptedCandidate(const String& candidate, unsigned location, unsigned length);
278 bool isOverwriteModeEnabled();
279 void toggleOverwriteModeEnabled();
281 ExceptionOr<RefPtr<Range>> rangeOfString(const String&, RefPtr<Range>&&, const Vector<String>& findOptions);
282 ExceptionOr<unsigned> countMatchesForText(const String&, const Vector<String>& findOptions, const String& markMatches);
283 ExceptionOr<unsigned> countFindMatches(const String&, const Vector<String>& findOptions);
285 unsigned numberOfScrollableAreas();
287 ExceptionOr<bool> isPageBoxVisible(int pageNumber);
289 static const char* internalsId;
291 InternalSettings* settings() const;
292 unsigned workerThreadCount() const;
293 ExceptionOr<bool> areSVGAnimationsPaused() const;
294 ExceptionOr<double> svgAnimationsInterval(SVGSVGElement&) const;
297 // Values need to be kept in sync with Internals.idl.
298 LAYER_TREE_INCLUDES_VISIBLE_RECTS = 1,
299 LAYER_TREE_INCLUDES_TILE_CACHES = 2,
300 LAYER_TREE_INCLUDES_REPAINT_RECTS = 4,
301 LAYER_TREE_INCLUDES_PAINTING_PHASES = 8,
302 LAYER_TREE_INCLUDES_CONTENT_LAYERS = 16,
303 LAYER_TREE_INCLUDES_ACCELERATES_DRAWING = 32,
304 LAYER_TREE_INCLUDES_BACKING_STORE_ATTACHED = 64,
306 ExceptionOr<String> layerTreeAsText(Document&, unsigned short flags) const;
307 ExceptionOr<uint64_t> layerIDForElement(Element&);
308 ExceptionOr<String> repaintRectsAsText() const;
309 ExceptionOr<String> scrollingStateTreeAsText() const;
310 ExceptionOr<String> mainThreadScrollingReasons() const;
311 ExceptionOr<Ref<DOMRectList>> nonFastScrollableRects() const;
313 ExceptionOr<void> setElementUsesDisplayListDrawing(Element&, bool usesDisplayListDrawing);
314 ExceptionOr<void> setElementTracksDisplayListReplay(Element&, bool isTrackingReplay);
317 // Values need to be kept in sync with Internals.idl.
318 DISPLAY_LIST_INCLUDES_PLATFORM_OPERATIONS = 1,
320 ExceptionOr<String> displayListForElement(Element&, unsigned short flags);
321 ExceptionOr<String> replayDisplayListForElement(Element&, unsigned short flags);
323 ExceptionOr<void> garbageCollectDocumentResources() const;
325 void beginSimulatedMemoryPressure();
326 void endSimulatedMemoryPressure();
327 bool isUnderMemoryPressure();
329 ExceptionOr<void> insertAuthorCSS(const String&) const;
330 ExceptionOr<void> insertUserCSS(const String&) const;
332 unsigned numberOfLiveNodes() const;
333 unsigned numberOfLiveDocuments() const;
334 unsigned referencingNodeCount(const Document&) const;
336 RefPtr<DOMWindow> openDummyInspectorFrontend(const String& url);
337 void closeDummyInspectorFrontend();
338 ExceptionOr<void> setInspectorIsUnderTest(bool);
340 String counterValue(Element&);
342 int pageNumber(Element&, float pageWidth = 800, float pageHeight = 600);
343 Vector<String> shortcutIconURLs() const;
345 int numberOfPages(float pageWidthInPixels = 800, float pageHeightInPixels = 600);
346 ExceptionOr<String> pageProperty(const String& propertyName, int pageNumber) const;
347 ExceptionOr<String> pageSizeAndMarginsInPixels(int pageNumber, int width, int height, int marginTop, int marginRight, int marginBottom, int marginLeft) const;
349 ExceptionOr<float> pageScaleFactor() const;
351 ExceptionOr<void> setPageScaleFactor(float scaleFactor, int x, int y);
352 ExceptionOr<void> setPageZoomFactor(float);
353 ExceptionOr<void> setTextZoomFactor(float);
355 ExceptionOr<void> setUseFixedLayout(bool);
356 ExceptionOr<void> setFixedLayoutSize(int width, int height);
357 ExceptionOr<void> setViewExposedRect(float left, float top, float width, float height);
358 void setPrinting(int width, int height);
360 void setHeaderHeight(float);
361 void setFooterHeight(float);
363 void setTopContentInset(float);
365 #if ENABLE(FULLSCREEN_API)
366 void webkitWillEnterFullScreenForElement(Element&);
367 void webkitDidEnterFullScreenForElement(Element&);
368 void webkitWillExitFullScreenForElement(Element&);
369 void webkitDidExitFullScreenForElement(Element&);
372 WEBCORE_TESTSUPPORT_EXPORT void setApplicationCacheOriginQuota(unsigned long long);
374 void registerURLSchemeAsBypassingContentSecurityPolicy(const String& scheme);
375 void removeURLSchemeRegisteredAsBypassingContentSecurityPolicy(const String& scheme);
377 void registerDefaultPortForProtocol(unsigned short port, const String& protocol);
379 Ref<MallocStatistics> mallocStatistics() const;
380 Ref<TypeConversions> typeConversions() const;
381 Ref<MemoryInfo> memoryInfo() const;
383 Vector<String> getReferencedFilePaths() const;
385 ExceptionOr<void> startTrackingRepaints();
386 ExceptionOr<void> stopTrackingRepaints();
388 ExceptionOr<void> startTrackingLayerFlushes();
389 ExceptionOr<unsigned> layerFlushCount();
391 ExceptionOr<void> startTrackingStyleRecalcs();
392 ExceptionOr<unsigned> styleRecalcCount();
393 unsigned lastStyleUpdateSize() const;
395 ExceptionOr<void> startTrackingCompositingUpdates();
396 ExceptionOr<unsigned> compositingUpdateCount();
398 ExceptionOr<void> updateLayoutIgnorePendingStylesheetsAndRunPostLayoutTasks(Node*);
399 unsigned layoutCount() const;
401 Ref<ArrayBuffer> serializeObject(const RefPtr<SerializedScriptValue>&) const;
402 Ref<SerializedScriptValue> deserializeBuffer(ArrayBuffer&) const;
404 bool isFromCurrentWorld(JSC::JSValue) const;
406 void setUsesOverlayScrollbars(bool);
407 void setUsesMockScrollAnimator(bool);
409 ExceptionOr<String> getCurrentCursorInfo();
411 String markerTextForListItem(Element&);
413 String toolTipFromElement(Element&) const;
415 void forceReload(bool endToEnd);
416 void reloadExpiredOnly();
418 void enableAutoSizeMode(bool enabled, int minimumWidth, int minimumHeight, int maximumWidth, int maximumHeight);
420 #if ENABLE(LEGACY_ENCRYPTED_MEDIA)
421 void initializeMockCDM();
424 #if ENABLE(ENCRYPTED_MEDIA)
425 Ref<MockCDMFactory> registerMockCDM();
428 #if ENABLE(SPEECH_SYNTHESIS)
429 void enableMockSpeechSynthesizer();
432 #if ENABLE(MEDIA_STREAM)
433 void setMockMediaCaptureDevicesEnabled(bool);
437 void emulateRTCPeerConnectionPlatformEvent(RTCPeerConnection&, const String& action);
438 void useMockRTCPeerConnectionFactory(const String&);
439 void setICECandidateFiltering(bool);
440 void setEnumeratingAllNetworkInterfacesEnabled(bool);
441 void stopPeerConnection(RTCPeerConnection&);
442 void applyRotationForOutgoingVideoSources(RTCPeerConnection&);
445 String getImageSourceURL(Element&);
448 Vector<String> mediaResponseSources(HTMLMediaElement&);
449 Vector<String> mediaResponseContentRanges(HTMLMediaElement&);
450 void simulateAudioInterruption(HTMLMediaElement&);
451 ExceptionOr<bool> mediaElementHasCharacteristic(HTMLMediaElement&, const String&);
454 bool isSelectPopupVisible(HTMLSelectElement&);
456 ExceptionOr<String> captionsStyleSheetOverride();
457 ExceptionOr<void> setCaptionsStyleSheetOverride(const String&);
458 ExceptionOr<void> setPrimaryAudioTrackLanguageOverride(const String&);
459 ExceptionOr<void> setCaptionDisplayMode(const String&);
462 Ref<TimeRanges> createTimeRanges(Float32Array& startTimes, Float32Array& endTimes);
463 double closestTimeToTimeRanges(double time, TimeRanges&);
466 ExceptionOr<Ref<DOMRect>> selectionBounds();
468 ExceptionOr<bool> isPluginUnavailabilityIndicatorObscured(Element&);
469 bool isPluginSnapshotted(Element&);
471 #if ENABLE(MEDIA_SOURCE)
472 WEBCORE_TESTSUPPORT_EXPORT void initializeMockMediaSource();
473 Vector<String> bufferedSamplesForTrackID(SourceBuffer&, const AtomicString&);
474 Vector<String> enqueuedSamplesForTrackID(SourceBuffer&, const AtomicString&);
475 void setShouldGenerateTimestamps(SourceBuffer&, bool);
479 ExceptionOr<void> beginMediaSessionInterruption(const String&);
480 void endMediaSessionInterruption(const String&);
481 void applicationWillBecomeInactive();
482 void applicationDidBecomeActive();
483 void applicationWillEnterForeground(bool suspendedUnderLock) const;
484 void applicationDidEnterBackground(bool suspendedUnderLock) const;
485 ExceptionOr<void> setMediaSessionRestrictions(const String& mediaType, StringView restrictionsString);
486 ExceptionOr<String> mediaSessionRestrictions(const String& mediaType) const;
487 void setMediaElementRestrictions(HTMLMediaElement&, StringView restrictionsString);
488 ExceptionOr<void> postRemoteControlCommand(const String&, float argument);
489 bool elementIsBlockingDisplaySleep(HTMLMediaElement&) const;
492 #if ENABLE(MEDIA_SESSION)
493 void sendMediaSessionStartOfInterruptionNotification(MediaSessionInterruptingCategory);
494 void sendMediaSessionEndOfInterruptionNotification(MediaSessionInterruptingCategory);
495 String mediaSessionCurrentState(MediaSession&) const;
496 double mediaElementPlayerVolume(HTMLMediaElement&) const;
497 enum class MediaControlEvent { PlayPause, NextTrack, PreviousTrack };
498 void sendMediaControlEvent(MediaControlEvent);
501 #if ENABLE(WIRELESS_PLAYBACK_TARGET)
502 void setMockMediaPlaybackTargetPickerEnabled(bool);
503 ExceptionOr<void> setMockMediaPlaybackTargetPickerState(const String& deviceName, const String& deviceState);
506 #if ENABLE(WEB_AUDIO)
507 void setAudioContextRestrictions(AudioContext&, StringView restrictionsString);
510 void simulateSystemSleep() const;
511 void simulateSystemWake() const;
513 enum class PageOverlayType { View, Document };
514 ExceptionOr<Ref<MockPageOverlay>> installMockPageOverlay(PageOverlayType);
515 ExceptionOr<String> pageOverlayLayerTreeAsText(unsigned short flags) const;
517 void setPageMuted(StringView);
518 String pageMediaState();
520 void setPageDefersLoading(bool);
522 RefPtr<File> createFile(const String&);
523 void queueMicroTask(int);
524 bool testPreloaderSettingViewport();
526 #if ENABLE(CONTENT_FILTERING)
527 MockContentFilterSettings& mockContentFilterSettings();
530 #if ENABLE(CSS_SCROLL_SNAP)
531 ExceptionOr<String> scrollSnapOffsets(Element&);
532 void setPlatformMomentumScrollingPredictionEnabled(bool);
535 ExceptionOr<String> pathStringWithShrinkWrappedRects(const Vector<double>& rectComponents, double radius);
537 String getCurrentMediaControlsStatusForElement(HTMLMediaElement&);
539 String userVisibleString(const DOMURL&);
540 void setShowAllPlugins(bool);
542 String resourceLoadStatisticsForOrigin(const String& origin);
543 void setResourceLoadStatisticsEnabled(bool);
544 void setUserGrantsStorageAccess(bool);
546 #if ENABLE(STREAMS_API)
547 bool isReadableStreamDisturbed(JSC::ExecState&, JSC::JSValue);
548 JSC::JSValue cloneArrayBuffer(JSC::ExecState&, JSC::JSValue, JSC::JSValue, JSC::JSValue);
551 String composedTreeAsText(Node&);
553 bool isProcessingUserGesture();
554 double lastHandledUserGestureTimestamp();
556 RefPtr<GCObservation> observeGC(JSC::JSValue);
558 enum class UserInterfaceLayoutDirection { LTR, RTL };
559 void setUserInterfaceLayoutDirection(UserInterfaceLayoutDirection);
561 bool userPrefersReducedMotion() const;
563 void reportBacktrace();
565 enum class BaseWritingDirection { Natural, Ltr, Rtl };
566 void setBaseWritingDirection(BaseWritingDirection);
568 #if ENABLE(POINTER_LOCK)
569 bool pageHasPendingPointerLock() const;
570 bool pageHasPointerLock() const;
573 Vector<String> accessKeyModifiers() const;
575 void setQuickLookPassword(const String&);
577 void setAsRunningUserScripts(Document&);
580 void simulateWebGLContextChanged(WebGLRenderingContext&);
581 void failNextGPUStatusCheck(WebGLRenderingContext&);
584 void setPageVisibility(bool isVisible);
587 void setH264HardwareEncoderAllowed(bool allowed);
590 #if ENABLE(MEDIA_STREAM)
591 void setCameraMediaStreamTrackOrientation(MediaStreamTrack&, int orientation);
592 ExceptionOr<void> setMediaDeviceState(const String& id, const String& property, bool value);
593 unsigned long trackAudioSampleCount() const { return m_trackAudioSampleCount; }
594 unsigned long trackVideoSampleCount() const { return m_trackVideoSampleCount; }
595 void observeMediaStreamTrack(MediaStreamTrack&);
596 using TrackFramePromise = DOMPromiseDeferred<IDLInterface<ImageData>>;
597 void grabNextMediaStreamTrackFrame(TrackFramePromise&&);
598 void delayMediaStreamTrackSamples(MediaStreamTrack&, float);
599 void setMediaStreamTrackMuted(MediaStreamTrack&, bool);
600 void removeMediaStreamTrack(MediaStream&, MediaStreamTrack&);
601 void simulateMediaStreamTrackCaptureSourceFailure(MediaStreamTrack&);
604 String audioSessionCategory() const;
606 void clearCacheStorageMemoryRepresentation(DOMPromiseDeferred<void>&&);
607 void cacheStorageEngineRepresentation(DOMPromiseDeferred<IDLDOMString>&&);
608 void setResponseSizeWithPadding(FetchResponse&, uint64_t size);
609 uint64_t responseSizeWithPadding(FetchResponse&) const;
611 void setConsoleMessageListener(RefPtr<StringCallback>&&);
613 #if ENABLE(SERVICE_WORKER)
614 void waitForFetchEventToFinish(FetchEvent&, DOMPromiseDeferred<IDLInterface<FetchResponse>>&&);
615 void waitForExtendableEventToFinish(ExtendableEvent&, DOMPromiseDeferred<void>&&);
616 Ref<ExtendableEvent> createTrustedExtendableEvent();
619 bool hasServiceWorkerRegisteredForOrigin(const String&);
621 String timelineDescription(AnimationTimeline&);
624 explicit Internals(Document&);
625 Document* contextDocument() const;
626 Frame* frame() const;
628 ExceptionOr<RenderedDocumentMarker*> markerAt(Node&, const String& markerType, unsigned index);
630 // RealtimeMediaSource::Observer API
631 #if ENABLE(MEDIA_STREAM)
632 void videoSampleAvailable(MediaSample&) final;
633 void audioSamplesAvailable(const MediaTime&, const PlatformAudioData&, const AudioStreamDescription&, size_t) final { m_trackAudioSampleCount++; }
635 OrientationNotifier m_orientationNotifier;
636 unsigned long m_trackVideoSampleCount { 0 };
637 unsigned long m_trackAudioSampleCount { 0 };
638 RefPtr<MediaStreamTrack> m_track;
639 std::optional<TrackFramePromise> m_nextTrackFramePromise;
642 std::unique_ptr<InspectorStubFrontend> m_inspectorFrontend;
643 RefPtr<CacheStorageConnection> m_cacheStorageConnection;
646 } // namespace WebCore