[MediaStream] 'devicechange' event should not fire in frames that can't access captur...
[WebKit-https.git] / Source / WebKit / WebProcess / WebPage / WebPage.h
1 /*
2  * Copyright (C) 2010-2018 Apple Inc. All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  * 1. Redistributions of source code must retain the above copyright
8  *    notice, this list of conditions and the following disclaimer.
9  * 2. Redistributions in binary form must reproduce the above copyright
10  *    notice, this list of conditions and the following disclaimer in the
11  *    documentation and/or other materials provided with the distribution.
12  *
13  * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
14  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
15  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
17  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
23  * THE POSSIBILITY OF SUCH DAMAGE.
24  */
25
26 #pragma once
27
28 #include "APIInjectedBundleEditorClient.h"
29 #include "APIInjectedBundleFormClient.h"
30 #include "APIInjectedBundlePageContextMenuClient.h"
31 #include "APIInjectedBundlePageLoaderClient.h"
32 #include "APIInjectedBundlePageResourceLoadClient.h"
33 #include "APIInjectedBundlePageUIClient.h"
34 #include "APIObject.h"
35 #include "CallbackID.h"
36 #include "DrawingAreaInfo.h"
37 #include "EditingRange.h"
38 #include "InjectedBundlePageContextMenuClient.h"
39 #include "InjectedBundlePageFullScreenClient.h"
40 #include "InjectedBundlePagePolicyClient.h"
41 #include "LayerTreeContext.h"
42 #include "MessageReceiver.h"
43 #include "MessageSender.h"
44 #include "OptionalCallbackID.h"
45 #include "Plugin.h"
46 #include "SandboxExtension.h"
47 #include "ShareSheetCallbackID.h"
48 #include "SharedMemory.h"
49 #include "UserData.h"
50 #include "WebBackForwardListProxy.h"
51 #include "WebURLSchemeHandler.h"
52 #include "WebUserContentController.h"
53 #include <JavaScriptCore/InspectorFrontendChannel.h>
54 #include <WebCore/ActivityState.h>
55 #include <WebCore/DictionaryPopupInfo.h>
56 #include <WebCore/DisabledAdaptations.h>
57 #include <WebCore/FrameLoaderTypes.h>
58 #include <WebCore/HTMLMenuElement.h>
59 #include <WebCore/HTMLMenuItemElement.h>
60 #include <WebCore/IntRect.h>
61 #include <WebCore/IntSizeHash.h>
62 #include <WebCore/Page.h>
63 #include <WebCore/PageOverlay.h>
64 #include <WebCore/PluginData.h>
65 #include <WebCore/SecurityPolicyViolationEvent.h>
66 #include <WebCore/ShareData.h>
67 #include <WebCore/UserActivity.h>
68 #include <WebCore/UserContentTypes.h>
69 #include <WebCore/UserInterfaceLayoutDirection.h>
70 #include <WebCore/UserScriptTypes.h>
71 #include <WebCore/VisibilityState.h>
72 #include <WebCore/WebCoreKeyboardUIMode.h>
73 #include <memory>
74 #include <pal/HysteresisActivity.h>
75 #include <wtf/HashMap.h>
76 #include <wtf/MonotonicTime.h>
77 #include <wtf/RefPtr.h>
78 #include <wtf/RunLoop.h>
79 #include <wtf/Seconds.h>
80 #include <wtf/WallTime.h>
81 #include <wtf/text/WTFString.h>
82
83 #if HAVE(ACCESSIBILITY) && PLATFORM(GTK)
84 #include "WebPageAccessibilityObject.h"
85 #include <wtf/glib/GRefPtr.h>
86 #endif
87
88 #if PLATFORM(GTK)
89 #include "ArgumentCodersGtk.h"
90 #include "WebPrintOperationGtk.h"
91 #endif
92
93 #if PLATFORM(IOS_FAMILY)
94 #include "GestureTypes.h"
95 #include "WebPageMessages.h"
96 #include <WebCore/IntPointHash.h>
97 #include <WebCore/ViewportConfiguration.h>
98 #endif
99
100 #if ENABLE(APPLICATION_MANIFEST)
101 #include <WebCore/ApplicationManifest.h>
102 #endif
103
104 #if ENABLE(IOS_TOUCH_EVENTS)
105 #include <WebKitAdditions/PlatformTouchEventIOS.h>
106 #elif ENABLE(TOUCH_EVENTS)
107 #include <WebCore/PlatformTouchEvent.h>
108 #endif
109
110 #if ENABLE(DATA_DETECTION)
111 #include <WebCore/DataDetection.h>
112 #endif
113
114 #if ENABLE(MAC_GESTURE_EVENTS)
115 #include <WebKitAdditions/PlatformGestureEventMac.h>
116 #endif
117
118 #if PLATFORM(COCOA)
119 #include "DynamicViewportSizeUpdate.h"
120 #include <WebCore/VisibleSelection.h>
121 #include <wtf/RetainPtr.h>
122 OBJC_CLASS CALayer;
123 OBJC_CLASS NSArray;
124 OBJC_CLASS NSDictionary;
125 OBJC_CLASS NSObject;
126 OBJC_CLASS WKAccessibilityWebPageObject;
127 #endif
128
129 namespace API {
130 class Array;
131 }
132
133 namespace IPC {
134 class Connection;
135 class Decoder;
136 class FormDataReference;
137 }
138
139 namespace WebCore {
140
141 class CaptureDevice;
142 class DocumentLoader;
143 class DragData;
144 class FontAttributeChanges;
145 class FontChanges;
146 class Frame;
147 class FrameSelection;
148 class FrameView;
149 class GraphicsContext;
150 class HTMLMenuElement;
151 class HTMLMenuItemElement;
152 class HTMLPlugInElement;
153 class HTMLPlugInImageElement;
154 class IntPoint;
155 class KeyboardEvent;
156 class MediaPlaybackTargetContext;
157 class MediaPlayerRequestInstallMissingPluginsCallback;
158 class Page;
159 class PrintContext;
160 class Range;
161 class ResourceRequest;
162 class ResourceResponse;
163 class SelectionRect;
164 class SharedBuffer;
165 class SubstituteData;
166 class TextCheckingRequest;
167 class VisiblePosition;
168
169 enum SyntheticClickType : int8_t;
170 enum class ShouldTreatAsContinuingLoad : bool;
171 enum class TextIndicatorPresentationTransition : uint8_t;
172 enum class WritingDirection : uint8_t;
173
174 struct BackForwardItemIdentifier;
175 struct CompositionUnderline;
176 struct DictationAlternative;
177 struct GlobalFrameIdentifier;
178 struct GlobalWindowIdentifier;
179 struct Highlight;
180 struct KeypressCommand;
181 struct PromisedAttachmentInfo;
182 struct TextCheckingResult;
183 struct ViewportArguments;
184
185 #if ENABLE(ATTACHMENT_ELEMENT)
186 class HTMLAttachmentElement;
187 #endif
188 }
189
190 namespace WebKit {
191
192 class DataReference;
193 class DrawingArea;
194 class DownloadID;
195 class FindController;
196 class GamepadData;
197 class GeolocationPermissionRequestManager;
198 class MediaDeviceSandboxExtensions;
199 class NotificationPermissionRequestManager;
200 class PDFPlugin;
201 class PageBanner;
202 class PluginView;
203 class RemoteWebInspectorUI;
204 class UserMediaPermissionRequestManager;
205 class ViewGestureGeometryCollector;
206 class VisibleContentRectUpdateInfo;
207 class WebColorChooser;
208 class WebContextMenu;
209 class WebContextMenuItemData;
210 class WebDataListSuggestionPicker;
211 class WebDocumentLoader;
212 class WebEvent;
213 class PlaybackSessionManager;
214 class VideoFullscreenManager;
215 class WebFrame;
216 class WebFullScreenManager;
217 class WebGestureEvent;
218 class WebImage;
219 class WebInspector;
220 class WebInspectorClient;
221 class WebInspectorUI;
222 class WebKeyboardEvent;
223 class WebMouseEvent;
224 class WebNotificationClient;
225 class WebOpenPanelResultListener;
226 class WebPageGroupProxy;
227 class WebPageInspectorTargetController;
228 class WebPageOverlay;
229 class WebPopupMenu;
230 class WebTouchEvent;
231 class WebURLSchemeHandlerProxy;
232 class WebUndoStep;
233 class WebUserContentController;
234 class WebWheelEvent;
235 class RemoteLayerTreeTransaction;
236
237 enum FindOptions : uint16_t;
238 enum class DragControllerAction : uint8_t;
239
240 struct AssistedNodeInformation;
241 struct AttributedString;
242 struct DataDetectionResult;
243 struct BackForwardListItemState;
244 struct EditorState;
245 struct InteractionInformationAtPosition;
246 struct InteractionInformationRequest;
247 struct LoadParameters;
248 struct PrintInfo;
249 struct WebPageCreationParameters;
250 struct WebPreferencesStore;
251 struct WebSelectionData;
252 struct WebsitePoliciesData;
253
254 using SnapshotOptions = uint32_t;
255 using WKEventModifiers = uint32_t;
256
257 class WebPage : public API::ObjectImpl<API::Object::Type::BundlePage>, public IPC::MessageReceiver, public IPC::MessageSender, public CanMakeWeakPtr<WebPage> {
258 public:
259     static Ref<WebPage> create(uint64_t pageID, WebPageCreationParameters&&);
260     virtual ~WebPage();
261
262     void reinitializeWebPage(WebPageCreationParameters&&);
263
264     void close();
265
266     static WebPage* fromCorePage(WebCore::Page*);
267
268     WebCore::Page* corePage() const { return m_page.get(); }
269     uint64_t pageID() const { return m_pageID; }
270     PAL::SessionID sessionID() const { return m_page->sessionID(); }
271     bool usesEphemeralSession() const { return m_page->usesEphemeralSession(); }
272
273     void setSessionID(PAL::SessionID);
274
275     void setSize(const WebCore::IntSize&);
276     const WebCore::IntSize& size() const { return m_viewSize; }
277     WebCore::IntRect bounds() const { return WebCore::IntRect(WebCore::IntPoint(), size()); }
278
279     DrawingArea* drawingArea() const { return m_drawingArea.get(); }
280
281 #if ENABLE(ASYNC_SCROLLING)
282     WebCore::ScrollingCoordinator* scrollingCoordinator() const;
283 #endif
284
285     WebPageGroupProxy* pageGroup() const { return m_pageGroup.get(); }
286
287     void scrollMainFrameIfNotAtMaxScrollPosition(const WebCore::IntSize& scrollOffset);
288
289     bool scrollBy(uint32_t scrollDirection, uint32_t scrollGranularity);
290
291     void centerSelectionInVisibleArea();
292
293 #if PLATFORM(COCOA)
294     void willCommitLayerTree(RemoteLayerTreeTransaction&);
295     void didFlushLayerTreeAtTime(MonotonicTime);
296 #endif
297
298     void willDisplayPage();
299
300     enum class LazyCreationPolicy { UseExistingOnly, CreateIfNeeded };
301
302     WebInspector* inspector(LazyCreationPolicy = LazyCreationPolicy::CreateIfNeeded);
303     WebInspectorUI* inspectorUI();
304     RemoteWebInspectorUI* remoteInspectorUI();
305     bool isInspectorPage() { return !!m_inspectorUI || !!m_remoteInspectorUI; }
306
307     void inspectorFrontendCountChanged(unsigned);
308
309 #if PLATFORM(IOS_FAMILY) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))
310     PlaybackSessionManager& playbackSessionManager();
311     VideoFullscreenManager& videoFullscreenManager();
312     void videoControlsManagerDidChange();
313 #endif
314
315 #if PLATFORM(IOS_FAMILY)
316     void setAllowsMediaDocumentInlinePlayback(bool);
317     bool allowsMediaDocumentInlinePlayback() const { return m_allowsMediaDocumentInlinePlayback; }
318 #endif
319
320 #if ENABLE(FULLSCREEN_API)
321     WebFullScreenManager* fullScreenManager();
322 #endif
323
324     void addConsoleMessage(uint64_t frameID, MessageSource, MessageLevel, const String&, uint64_t requestID = 0);
325     void sendCSPViolationReport(uint64_t frameID, const URL& reportURL, IPC::FormDataReference&&);
326     void enqueueSecurityPolicyViolationEvent(uint64_t frameID, WebCore::SecurityPolicyViolationEvent::Init&&);
327
328     // -- Called by the DrawingArea.
329     // FIXME: We could genericize these into a DrawingArea client interface. Would that be beneficial?
330     void drawRect(WebCore::GraphicsContext&, const WebCore::IntRect&);
331     void layoutIfNeeded();
332
333     // -- Called from WebCore clients.
334     bool handleEditingKeyboardEvent(WebCore::KeyboardEvent*);
335
336     void didStartPageTransition();
337     void didCompletePageTransition();
338     void didCommitLoad(WebFrame*);
339     void willReplaceMultipartContent(const WebFrame&);
340     void didReplaceMultipartContent(const WebFrame&);
341     void didFinishLoad(WebFrame*);
342     void show();
343     String userAgent(const URL&) const;
344     String userAgent(WebFrame*, const URL&) const;
345     String platformUserAgent(const URL&) const;
346     WebCore::KeyboardUIMode keyboardUIMode();
347
348     void didInsertMenuElement(WebCore::HTMLMenuElement&);
349     void didRemoveMenuElement(WebCore::HTMLMenuElement&);
350     void didInsertMenuItemElement(WebCore::HTMLMenuItemElement&);
351     void didRemoveMenuItemElement(WebCore::HTMLMenuItemElement&);
352
353     const String& overrideContentSecurityPolicy() const { return m_overrideContentSecurityPolicy; }
354
355     WebUndoStep* webUndoStep(uint64_t);
356     void addWebUndoStep(uint64_t, WebUndoStep*);
357     void removeWebEditCommand(uint64_t);
358     bool isInRedo() const { return m_isInRedo; }
359
360     bool isAlwaysOnLoggingAllowed() const;
361     void setActivePopupMenu(WebPopupMenu*);
362
363     void setHiddenPageDOMTimerThrottlingIncreaseLimit(Seconds limit)
364     {
365         m_page->setDOMTimerAlignmentIntervalIncreaseLimit(limit);
366     }
367
368 #if ENABLE(INPUT_TYPE_COLOR)
369     WebColorChooser* activeColorChooser() const { return m_activeColorChooser; }
370     void setActiveColorChooser(WebColorChooser*);
371     void didChooseColor(const WebCore::Color&);
372     void didEndColorPicker();
373 #endif
374
375 #if ENABLE(DATALIST_ELEMENT)
376     void setActiveDataListSuggestionPicker(WebDataListSuggestionPicker*);
377     void didSelectDataListOption(const String&);
378     void didCloseSuggestions();
379 #endif
380
381     WebOpenPanelResultListener* activeOpenPanelResultListener() const { return m_activeOpenPanelResultListener.get(); }
382     void setActiveOpenPanelResultListener(Ref<WebOpenPanelResultListener>&&);
383
384     void didReceiveMessage(IPC::Connection&, IPC::Decoder&) override;
385     void didReceiveSyncMessage(IPC::Connection&, IPC::Decoder&, std::unique_ptr<IPC::Encoder>&) override;
386
387     // -- InjectedBundle methods
388 #if ENABLE(CONTEXT_MENUS)
389     void setInjectedBundleContextMenuClient(std::unique_ptr<API::InjectedBundle::PageContextMenuClient>&&);
390 #endif
391     void setInjectedBundleEditorClient(std::unique_ptr<API::InjectedBundle::EditorClient>&&);
392     void setInjectedBundleFormClient(std::unique_ptr<API::InjectedBundle::FormClient>&&);
393     void setInjectedBundlePageLoaderClient(std::unique_ptr<API::InjectedBundle::PageLoaderClient>&&);
394     void initializeInjectedBundlePolicyClient(WKBundlePagePolicyClientBase*);
395     void setInjectedBundleResourceLoadClient(std::unique_ptr<API::InjectedBundle::ResourceLoadClient>&&);
396     void setInjectedBundleUIClient(std::unique_ptr<API::InjectedBundle::PageUIClient>&&);
397 #if ENABLE(FULLSCREEN_API)
398     void initializeInjectedBundleFullScreenClient(WKBundlePageFullScreenClientBase*);
399 #endif
400
401 #if ENABLE(CONTEXT_MENUS)
402     API::InjectedBundle::PageContextMenuClient& injectedBundleContextMenuClient() { return *m_contextMenuClient; }
403 #endif
404     API::InjectedBundle::EditorClient& injectedBundleEditorClient() { return *m_editorClient; }
405     API::InjectedBundle::FormClient& injectedBundleFormClient() { return *m_formClient; }
406     API::InjectedBundle::PageLoaderClient& injectedBundleLoaderClient() { return *m_loaderClient; }
407     InjectedBundlePagePolicyClient& injectedBundlePolicyClient() { return m_policyClient; }
408     API::InjectedBundle::ResourceLoadClient& injectedBundleResourceLoadClient() { return *m_resourceLoadClient; }
409     API::InjectedBundle::PageUIClient& injectedBundleUIClient() { return *m_uiClient; }
410 #if ENABLE(FULLSCREEN_API)
411     InjectedBundlePageFullScreenClient& injectedBundleFullScreenClient() { return m_fullScreenClient; }
412 #endif
413
414     bool findStringFromInjectedBundle(const String&, FindOptions);
415     void findStringMatchesFromInjectedBundle(const String&, FindOptions);
416     void replaceStringMatchesFromInjectedBundle(const Vector<uint32_t>& matchIndices, const String& replacementText, bool selectionOnly);
417
418     WebFrame* mainWebFrame() const { return m_mainFrame.get(); }
419
420     WebCore::Frame* mainFrame() const; // May return nullptr.
421     WebCore::FrameView* mainFrameView() const; // May return nullptr.
422
423     RefPtr<WebCore::Range> currentSelectionAsRange();
424
425 #if ENABLE(NETSCAPE_PLUGIN_API)
426     RefPtr<Plugin> createPlugin(WebFrame*, WebCore::HTMLPlugInElement*, const Plugin::Parameters&, String& newMIMEType);
427 #endif
428
429 #if ENABLE(WEBGL)
430     WebCore::WebGLLoadPolicy webGLPolicyForURL(WebFrame*, const URL&);
431     WebCore::WebGLLoadPolicy resolveWebGLPolicyForURL(WebFrame*, const URL&);
432 #endif
433     
434     enum class IncludePostLayoutDataHint { No, Yes };
435     EditorState editorState(IncludePostLayoutDataHint = IncludePostLayoutDataHint::Yes) const;
436     void updateEditorStateAfterLayoutIfEditabilityChanged();
437
438     String renderTreeExternalRepresentation() const;
439     String renderTreeExternalRepresentationForPrinting() const;
440     uint64_t renderTreeSize() const;
441
442     void setTracksRepaints(bool);
443     bool isTrackingRepaints() const;
444     void resetTrackedRepaints();
445     Ref<API::Array> trackedRepaintRects();
446
447     void executeEditingCommand(const String& commandName, const String& argument);
448     bool isEditingCommandEnabled(const String& commandName);
449     void clearMainFrameName();
450     void sendClose();
451
452     void sendSetWindowFrame(const WebCore::FloatRect&);
453
454     double textZoomFactor() const;
455     void setTextZoomFactor(double);
456     double pageZoomFactor() const;
457     void setPageZoomFactor(double);
458     void setPageAndTextZoomFactors(double pageZoomFactor, double textZoomFactor);
459     void windowScreenDidChange(uint32_t);
460     String dumpHistoryForTesting(const String& directory);
461     void clearHistory();
462
463     void accessibilitySettingsDidChange();
464 #if ENABLE(ACCESSIBILITY_EVENTS)
465     void updateAccessibilityEventsEnabled(bool);
466 #endif
467
468     void scalePage(double scale, const WebCore::IntPoint& origin);
469     void scalePageInViewCoordinates(double scale, WebCore::IntPoint centerInViewCoordinates);
470     double pageScaleFactor() const;
471     double totalScaleFactor() const;
472     double viewScaleFactor() const;
473     void scaleView(double scale);
474
475     void setUseFixedLayout(bool);
476     bool useFixedLayout() const { return m_useFixedLayout; }
477     bool setFixedLayoutSize(const WebCore::IntSize&);
478     WebCore::IntSize fixedLayoutSize() const;
479
480     void listenForLayoutMilestones(OptionSet<WebCore::LayoutMilestone>);
481
482     void setSuppressScrollbarAnimations(bool);
483     
484     void setEnableVerticalRubberBanding(bool);
485     void setEnableHorizontalRubberBanding(bool);
486     
487     void setBackgroundExtendsBeyondPage(bool);
488
489     void setPaginationMode(uint32_t /* WebCore::Pagination::Mode */);
490     void setPaginationBehavesLikeColumns(bool);
491     void setPageLength(double);
492     void setGapBetweenPages(double);
493     void setPaginationLineGridEnabled(bool);
494     
495     void postInjectedBundleMessage(const String& messageName, const UserData&);
496
497     bool drawsBackground() const { return m_drawsBackground; }
498
499     void setUnderlayColor(const WebCore::Color& color) { m_underlayColor = color; }
500     WebCore::Color underlayColor() const { return m_underlayColor; }
501
502     void stopLoading();
503     void stopLoadingFrame(uint64_t frameID);
504     bool defersLoading() const;
505     void setDefersLoading(bool deferLoading);
506
507     void enterAcceleratedCompositingMode(WebCore::GraphicsLayer*);
508     void exitAcceleratedCompositingMode();
509
510     void addPluginView(PluginView*);
511     void removePluginView(PluginView*);
512
513     bool isVisible() const { return m_activityState.contains(WebCore::ActivityState::IsVisible); }
514     bool isVisibleOrOccluded() const { return m_activityState.contains(WebCore::ActivityState::IsVisibleOrOccluded); }
515
516     LayerHostingMode layerHostingMode() const { return m_layerHostingMode; }
517     void setLayerHostingMode(LayerHostingMode);
518
519 #if PLATFORM(COCOA)
520     void updatePluginsActiveAndFocusedState();
521     const WebCore::FloatRect& windowFrameInScreenCoordinates() const { return m_windowFrameInScreenCoordinates; }
522     const WebCore::FloatRect& windowFrameInUnflippedScreenCoordinates() const { return m_windowFrameInUnflippedScreenCoordinates; }
523     const WebCore::FloatRect& viewFrameInWindowCoordinates() const { return m_viewFrameInWindowCoordinates; }
524
525     bool hasCachedWindowFrame() const { return m_hasCachedWindowFrame; }
526
527     void updateHeaderAndFooterLayersForDeviceScaleChange(float scaleFactor);
528 #endif
529
530 #if PLATFORM(MAC)
531     void setTopOverhangImage(WebImage*);
532     void setBottomOverhangImage(WebImage*);
533     
534     void setUseSystemAppearance(bool);
535     void setUseDarkAppearance(bool);
536 #endif
537
538     bool windowIsFocused() const;
539     bool windowAndWebPageAreFocused() const;
540
541 #if !PLATFORM(IOS_FAMILY)
542     void setHeaderPageBanner(PageBanner*);
543     PageBanner* headerPageBanner();
544     void setFooterPageBanner(PageBanner*);
545     PageBanner* footerPageBanner();
546
547     void hidePageBanners();
548     void showPageBanners();
549     
550     void setHeaderBannerHeightForTesting(int);
551     void setFooterBannerHeightForTesting(int);
552 #endif
553
554     WebCore::IntPoint screenToRootView(const WebCore::IntPoint&);
555     WebCore::IntRect rootViewToScreen(const WebCore::IntRect&);
556     
557 #if PLATFORM(IOS_FAMILY)
558     WebCore::IntPoint accessibilityScreenToRootView(const WebCore::IntPoint&);
559     WebCore::IntRect rootViewToAccessibilityScreen(const WebCore::IntRect&);
560 #endif
561     
562     RefPtr<WebImage> scaledSnapshotWithOptions(const WebCore::IntRect&, double additionalScaleFactor, SnapshotOptions);
563
564     static const WebEvent* currentEvent();
565
566     FindController& findController() { return m_findController.get(); }
567
568 #if ENABLE(GEOLOCATION)
569     GeolocationPermissionRequestManager& geolocationPermissionRequestManager() { return m_geolocationPermissionRequestManager.get(); }
570 #endif
571
572 #if PLATFORM(IOS_FAMILY)
573     void savePageState(WebCore::HistoryItem&);
574     void restorePageState(const WebCore::HistoryItem&);
575 #endif
576
577 #if ENABLE(MEDIA_STREAM)
578     UserMediaPermissionRequestManager& userMediaPermissionRequestManager() { return *m_userMediaPermissionRequestManager; }
579     void prepareToSendUserMediaPermissionRequest();
580     void captureDevicesChanged();
581 #endif
582
583     void elementDidFocus(WebCore::Node*);
584     void elementDidBlur(WebCore::Node*);
585     void resetAssistedNodeForFrame(WebFrame*);
586
587     void disabledAdaptationsDidChange(const OptionSet<WebCore::DisabledAdaptations>&);
588     void viewportPropertiesDidChange(const WebCore::ViewportArguments&);
589     void executeEditCommandWithCallback(const String&, const String& argument, CallbackID);
590
591 #if PLATFORM(IOS_FAMILY)
592     WebCore::FloatSize screenSize() const;
593     WebCore::FloatSize availableScreenSize() const;
594     WebCore::FloatSize overrideScreenSize() const;
595     int32_t deviceOrientation() const { return m_deviceOrientation; }
596     void didReceiveMobileDocType(bool);
597
598     void setUseTestingViewportConfiguration(bool useTestingViewport) { m_useTestingViewportConfiguration = useTestingViewport; }
599     bool isUsingTestingViewportConfiguration() const { return m_useTestingViewportConfiguration; }
600
601     double minimumPageScaleFactor() const;
602     double maximumPageScaleFactor() const;
603     double maximumPageScaleFactorIgnoringAlwaysScalable() const;
604     bool allowsUserScaling() const;
605     bool hasStablePageScaleFactor() const { return m_hasStablePageScaleFactor; }
606
607     void handleTap(const WebCore::IntPoint&, uint64_t lastLayerTreeTransactionId);
608     void potentialTapAtPosition(uint64_t requestID, const WebCore::FloatPoint&);
609     void commitPotentialTap(uint64_t lastLayerTreeTransactionId);
610     void commitPotentialTapFailed();
611     void cancelPotentialTap();
612     void cancelPotentialTapInFrame(WebFrame&);
613     void tapHighlightAtPosition(uint64_t requestID, const WebCore::FloatPoint&);
614
615     void inspectorNodeSearchMovedToPosition(const WebCore::FloatPoint&);
616     void inspectorNodeSearchEndedAtPosition(const WebCore::FloatPoint&);
617
618     void blurAssistedNode();
619     void requestAssistedNodeInformation(CallbackID);
620     void selectWithGesture(const WebCore::IntPoint&, uint32_t granularity, uint32_t gestureType, uint32_t gestureState, bool isInteractingWithAssistedNode, CallbackID);
621     void updateSelectionWithTouches(const WebCore::IntPoint&, uint32_t touches, bool baseIsStart, CallbackID);
622     void selectWithTwoTouches(const WebCore::IntPoint& from, const WebCore::IntPoint& to, uint32_t gestureType, uint32_t gestureState, CallbackID);
623     void extendSelection(uint32_t granularity);
624     void selectWordBackward();
625     void moveSelectionByOffset(int32_t offset, CallbackID);
626     void selectTextWithGranularityAtPoint(const WebCore::IntPoint&, uint32_t granularity, bool isInteractingWithAssistedNode, CallbackID);
627     void selectPositionAtBoundaryWithDirection(const WebCore::IntPoint&, uint32_t granularity, uint32_t direction, bool isInteractingWithAssistedNode, CallbackID);
628     void moveSelectionAtBoundaryWithDirection(uint32_t granularity, uint32_t direction, CallbackID);
629     void selectPositionAtPoint(const WebCore::IntPoint&, bool isInteractingWithAssistedNode, CallbackID);
630     void beginSelectionInDirection(uint32_t direction, CallbackID);
631     void updateSelectionWithExtentPoint(const WebCore::IntPoint&, bool isInteractingWithAssistedNode, CallbackID);
632     void updateSelectionWithExtentPointAndBoundary(const WebCore::IntPoint&, uint32_t granularity, bool isInteractingWithAssistedNode, CallbackID);
633
634     void requestDictationContext(CallbackID);
635     void replaceDictatedText(const String& oldText, const String& newText);
636     void replaceSelectedText(const String& oldText, const String& newText);
637     void requestAutocorrectionData(const String& textForAutocorrection, CallbackID);
638     void applyAutocorrection(const String& correction, const String& originalText, CallbackID);
639     void syncApplyAutocorrection(const String& correction, const String& originalText, bool& correctionApplied);
640     void requestAutocorrectionContext(CallbackID);
641     void getAutocorrectionContext(String& beforeText, String& markedText, String& selectedText, String& afterText, uint64_t& location, uint64_t& length);
642     void getPositionInformation(const InteractionInformationRequest&, InteractionInformationAtPosition&);
643     void requestPositionInformation(const InteractionInformationRequest&);
644     void startInteractionWithElementAtPosition(const WebCore::IntPoint&);
645     void stopInteraction();
646     void performActionOnElement(uint32_t action);
647     void focusNextAssistedNode(bool isForward, CallbackID);
648     void autofillLoginCredentials(const String&, const String&);
649     void setAssistedNodeValue(const String&);
650     void setAssistedNodeValueAsNumber(double);
651     void setAssistedNodeSelectedIndex(uint32_t index, bool allowMultipleSelection);
652     WebCore::IntRect rectForElementAtInteractionLocation();
653     void updateSelectionAppearance();
654     void getSelectionContext(CallbackID);
655     void handleTwoFingerTapAtPoint(const WebCore::IntPoint&, uint64_t requestID);
656     void handleStylusSingleTapAtPoint(const WebCore::IntPoint&, uint64_t requestID);
657     void getRectsForGranularityWithSelectionOffset(uint32_t, int32_t, CallbackID);
658     void getRectsAtSelectionOffsetWithText(int32_t, const String&, CallbackID);
659     void storeSelectionForAccessibility(bool);
660     void startAutoscrollAtPosition(const WebCore::FloatPoint&);
661     void cancelAutoscroll();
662
663     void contentSizeCategoryDidChange(const String&);
664
665     Seconds eventThrottlingDelay() const;
666
667     void showInspectorHighlight(const WebCore::Highlight&);
668     void hideInspectorHighlight();
669
670     void showInspectorIndication();
671     void hideInspectorIndication();
672
673     void enableInspectorNodeSearch();
674     void disableInspectorNodeSearch();
675
676     bool forceAlwaysUserScalable() const { return m_forceAlwaysUserScalable; }
677     void setForceAlwaysUserScalable(bool);
678 #endif
679
680 #if PLATFORM(IOS_FAMILY) && ENABLE(IOS_TOUCH_EVENTS)
681     void dispatchAsynchronousTouchEvents(const Vector<WebTouchEvent, 1>& queue);
682 #endif
683
684     bool hasRichlyEditableSelection() const;
685
686     enum class LayerTreeFreezeReason {
687         PageTransition          = 1 << 0,
688         BackgroundApplication   = 1 << 1,
689         ProcessSuspended        = 1 << 2,
690         PageSuspended           = 1 << 3,
691         Printing                = 1 << 4,
692     };
693     void freezeLayerTree(LayerTreeFreezeReason);
694     void unfreezeLayerTree(LayerTreeFreezeReason);
695
696     void markLayersVolatile(WTF::Function<void (bool)>&& completionHandler = { });
697     void cancelMarkLayersVolatile();
698
699     NotificationPermissionRequestManager* notificationPermissionRequestManager();
700
701     void pageDidScroll();
702
703 #if ENABLE(CONTEXT_MENUS)
704     WebContextMenu* contextMenu();
705     WebContextMenu* contextMenuAtPointInWindow(const WebCore::IntPoint&);
706 #endif
707
708     bool hasLocalDataForURL(const URL&);
709
710     static bool canHandleRequest(const WebCore::ResourceRequest&);
711
712     class SandboxExtensionTracker {
713     public:
714         ~SandboxExtensionTracker();
715
716         void invalidate();
717
718         void beginLoad(WebFrame*, SandboxExtension::Handle&&);
719         void beginReload(WebFrame*, SandboxExtension::Handle&&);
720         void willPerformLoadDragDestinationAction(RefPtr<SandboxExtension>&& pendingDropSandboxExtension);
721         void didStartProvisionalLoad(WebFrame*);
722         void didCommitProvisionalLoad(WebFrame*);
723         void didFailProvisionalLoad(WebFrame*);
724
725     private:
726         void setPendingProvisionalSandboxExtension(RefPtr<SandboxExtension>&&);
727
728         RefPtr<SandboxExtension> m_pendingProvisionalSandboxExtension;
729         RefPtr<SandboxExtension> m_provisionalSandboxExtension;
730         RefPtr<SandboxExtension> m_committedSandboxExtension;
731     };
732
733     SandboxExtensionTracker& sandboxExtensionTracker() { return m_sandboxExtensionTracker; }
734
735 #if PLATFORM(GTK)
736     void setComposition(const String& text, const Vector<WebCore::CompositionUnderline>& underlines, uint64_t selectionStart, uint64_t selectionEnd, uint64_t replacementRangeStart, uint64_t replacementRangeLength);
737     void confirmComposition(const String& text, int64_t selectionStart, int64_t selectionLength);
738     void cancelComposition();
739
740     void collapseSelectionInFrame(uint64_t frameID);
741 #endif
742
743 #if PLATFORM (GTK) && HAVE(GTK_GESTURES)
744     void getCenterForZoomGesture(const WebCore::IntPoint& centerInViewCoordinates, WebCore::IntPoint& result);
745 #endif
746
747     void didApplyStyle();
748     void didChangeSelection();
749     void didChangeContents();
750     void discardedComposition();
751     void canceledComposition();
752     void didUpdateComposition();
753     void didEndUserTriggeredSelectionChanges();
754
755 #if PLATFORM(COCOA)
756     void registerUIProcessAccessibilityTokens(const IPC::DataReference& elemenToken, const IPC::DataReference& windowToken);
757     WKAccessibilityWebPageObject* accessibilityRemoteObject();
758     NSObject *accessibilityObjectForMainFramePlugin();
759     const WebCore::FloatPoint& accessibilityPosition() const { return m_accessibilityPosition; }
760     
761     void sendComplexTextInputToPlugin(uint64_t pluginComplexTextInputIdentifier, const String& textInput);
762
763     void setTextAsync(const String&);
764     void insertTextAsync(const String& text, const EditingRange& replacementRange, bool registerUndoGroup = false, uint32_t editingRangeIsRelativeTo = (uint32_t)EditingRangeIsRelativeTo::EditableRoot, bool suppressSelectionUpdate = false);
765     void getMarkedRangeAsync(CallbackID);
766     void getSelectedRangeAsync(CallbackID);
767     void characterIndexForPointAsync(const WebCore::IntPoint&, CallbackID);
768     void firstRectForCharacterRangeAsync(const EditingRange&, CallbackID);
769     void setCompositionAsync(const String& text, const Vector<WebCore::CompositionUnderline>& underlines, const EditingRange& selectionRange, const EditingRange& replacementRange);
770     void confirmCompositionAsync();
771
772     void readSelectionFromPasteboard(const WTF::String& pasteboardName, bool& result);
773     void getStringSelectionForPasteboard(WTF::String& stringValue);
774     void getDataSelectionForPasteboard(const WTF::String pasteboardType, SharedMemory::Handle& handle, uint64_t& size);
775     void shouldDelayWindowOrderingEvent(const WebKit::WebMouseEvent&, bool& result);
776     void acceptsFirstMouse(int eventNumber, const WebKit::WebMouseEvent&, bool& result);
777     bool performNonEditingBehaviorForSelector(const String&, WebCore::KeyboardEvent*);
778 #endif
779
780 #if PLATFORM(MAC)
781     void insertDictatedTextAsync(const String& text, const EditingRange& replacementRange, const Vector<WebCore::DictationAlternative>& dictationAlternativeLocations, bool registerUndoGroup = false);
782     void attributedSubstringForCharacterRangeAsync(const EditingRange&, CallbackID);
783     void fontAtSelection(CallbackID);
784 #endif
785
786 #if PLATFORM(COCOA) && ENABLE(SERVICE_CONTROLS)
787     void replaceSelectionWithPasteboardData(const Vector<String>& types, const IPC::DataReference&);
788 #endif
789
790 #if HAVE(ACCESSIBILITY) && PLATFORM(GTK)
791     void updateAccessibilityTree();
792 #endif
793
794     void setCompositionForTesting(const String& compositionString, uint64_t from, uint64_t length, bool suppressUnderline);
795     bool hasCompositionForTesting();
796     void confirmCompositionForTesting(const String& compositionString);
797
798 #if PLATFORM(COCOA)
799     bool isSpeaking();
800     void speak(const String&);
801     void stopSpeaking();
802
803     void performDictionaryLookupForSelection(WebCore::Frame&, const WebCore::VisibleSelection&, WebCore::TextIndicatorPresentationTransition);
804 #endif
805
806     bool isSmartInsertDeleteEnabled();
807     void setSmartInsertDeleteEnabled(bool);
808
809     bool isSelectTrailingWhitespaceEnabled() const;
810     void setSelectTrailingWhitespaceEnabled(bool);
811
812     void replaceSelectionWithText(WebCore::Frame*, const String&);
813     void clearSelection();
814     void restoreSelectionInFocusedEditableElement();
815
816 #if ENABLE(DRAG_SUPPORT) && PLATFORM(GTK)
817     void performDragControllerAction(DragControllerAction, const WebCore::IntPoint& clientPosition, const WebCore::IntPoint& globalPosition, uint64_t draggingSourceOperationMask, WebSelectionData&&, uint32_t flags);
818 #endif
819
820 #if ENABLE(DRAG_SUPPORT) && !PLATFORM(GTK)
821     void performDragControllerAction(DragControllerAction, const WebCore::DragData&, SandboxExtension::Handle&&, SandboxExtension::HandleArray&&);
822 #endif
823
824 #if ENABLE(DRAG_SUPPORT)
825     void dragEnded(WebCore::IntPoint clientPosition, WebCore::IntPoint globalPosition, uint64_t operation);
826
827     void willPerformLoadDragDestinationAction();
828     void mayPerformUploadDragDestinationAction();
829
830     void willStartDrag() { ASSERT(!m_isStartingDrag); m_isStartingDrag = true; }
831     void didStartDrag();
832     void dragCancelled();
833 #endif
834
835     void beginPrinting(uint64_t frameID, const PrintInfo&);
836     void endPrinting();
837     void computePagesForPrinting(uint64_t frameID, const PrintInfo&, CallbackID);
838     void computePagesForPrintingImpl(uint64_t frameID, const PrintInfo&, Vector<WebCore::IntRect>& pageRects, double& totalScaleFactor);
839
840 #if PLATFORM(COCOA)
841     void drawRectToImage(uint64_t frameID, const PrintInfo&, const WebCore::IntRect&, const WebCore::IntSize&, CallbackID);
842     void drawPagesToPDF(uint64_t frameID, const PrintInfo&, uint32_t first, uint32_t count, CallbackID);
843     void drawPagesToPDFImpl(uint64_t frameID, const PrintInfo&, uint32_t first, uint32_t count, RetainPtr<CFMutableDataRef>& pdfPageData);
844 #endif
845
846 #if PLATFORM(IOS_FAMILY)
847     void computePagesForPrintingAndDrawToPDF(uint64_t frameID, const PrintInfo&, CallbackID, Messages::WebPage::ComputePagesForPrintingAndDrawToPDF::DelayedReply&&);
848 #endif
849
850 #if PLATFORM(GTK)
851     void drawPagesForPrinting(uint64_t frameID, const PrintInfo&, CallbackID);
852     void didFinishPrintOperation(const WebCore::ResourceError&, CallbackID);
853 #endif
854
855     void addResourceRequest(unsigned long, const WebCore::ResourceRequest&);
856     void removeResourceRequest(unsigned long);
857
858     void setMediaVolume(float);
859     void setMuted(WebCore::MediaProducer::MutedStateFlags);
860     void setMayStartMediaWhenInWindow(bool);
861     void stopMediaCapture();
862
863 #if ENABLE(MEDIA_SESSION)
864     void handleMediaEvent(uint32_t /* WebCore::MediaEventType */);
865     void setVolumeOfMediaElement(double, uint64_t);
866 #endif
867
868     void updateMainFrameScrollOffsetPinning();
869
870     bool mainFrameHasCustomContentProvider() const;
871     void addMIMETypeWithCustomContentProvider(const String&);
872
873     void mainFrameDidLayout();
874
875     bool canRunBeforeUnloadConfirmPanel() const { return m_canRunBeforeUnloadConfirmPanel; }
876     void setCanRunBeforeUnloadConfirmPanel(bool canRunBeforeUnloadConfirmPanel) { m_canRunBeforeUnloadConfirmPanel = canRunBeforeUnloadConfirmPanel; }
877
878     bool canRunModal() const { return m_canRunModal; }
879     void setCanRunModal(bool canRunModal) { m_canRunModal = canRunModal; }
880
881     void runModal();
882
883     void setDeviceScaleFactor(float);
884     float deviceScaleFactor() const;
885
886     void forceRepaintWithoutCallback();
887
888     void unmarkAllMisspellings();
889     void unmarkAllBadGrammar();
890
891 #if PLATFORM(COCOA)
892     void handleAlternativeTextUIResult(const String&);
893 #endif
894
895     // For testing purpose.
896     void simulateMouseDown(int button, WebCore::IntPoint, int clickCount, WKEventModifiers, WallTime);
897     void simulateMouseUp(int button, WebCore::IntPoint, int clickCount, WKEventModifiers, WallTime);
898     void simulateMouseMotion(WebCore::IntPoint, WallTime);
899
900 #if ENABLE(CONTEXT_MENUS)
901     void contextMenuShowing() { m_isShowingContextMenu = true; }
902 #endif
903
904     void wheelEvent(const WebWheelEvent&);
905
906     void wheelEventHandlersChanged(bool);
907     void recomputeShortCircuitHorizontalWheelEventsState();
908
909 #if ENABLE(MAC_GESTURE_EVENTS)
910     void gestureEvent(const WebGestureEvent&);
911 #endif
912
913     void updateVisibilityState(bool isInitialState = false);
914
915 #if PLATFORM(IOS_FAMILY)
916     void setViewportConfigurationViewLayoutSize(const WebCore::FloatSize&, double scaleFactor, double minimumEffectiveDeviceWidth);
917     void setMaximumUnobscuredSize(const WebCore::FloatSize&);
918     void setDeviceOrientation(int32_t);
919     void setOverrideViewportArguments(const std::optional<WebCore::ViewportArguments>&);
920     void dynamicViewportSizeUpdate(const WebCore::FloatSize& viewLayoutSize, const WebCore::FloatSize& maximumUnobscuredSize, const WebCore::FloatRect& targetExposedContentRect, const WebCore::FloatRect& targetUnobscuredRect, const WebCore::FloatRect& targetUnobscuredRectInScrollViewCoordinates, const WebCore::FloatBoxExtent& targetUnobscuredSafeAreaInsets, double scale, int32_t deviceOrientation, DynamicViewportSizeUpdateID);
921     std::optional<float> scaleFromUIProcess(const VisibleContentRectUpdateInfo&) const;
922     void updateVisibleContentRects(const VisibleContentRectUpdateInfo&, MonotonicTime oldestTimestamp);
923     bool scaleWasSetByUIProcess() const { return m_scaleWasSetByUIProcess; }
924     void willStartUserTriggeredZooming();
925     void applicationWillResignActive();
926     void applicationDidEnterBackground(bool isSuspendedUnderLock);
927     void applicationDidFinishSnapshottingAfterEnteringBackground();
928     void applicationWillEnterForeground(bool isSuspendedUnderLock);
929     void applicationDidBecomeActive();
930     void completePendingSyntheticClickForContentChangeObserver();
931
932     bool platformPrefersTextLegibilityBasedZoomScaling() const;
933     const WebCore::ViewportConfiguration& viewportConfiguration() const { return m_viewportConfiguration; }
934
935     void hardwareKeyboardAvailabilityChanged();
936 #endif
937
938 #if ENABLE(IOS_TOUCH_EVENTS)
939     void dispatchTouchEvent(const WebTouchEvent&, bool& handled);
940 #endif
941
942 #if PLATFORM(GTK) && USE(TEXTURE_MAPPER_GL)
943     uint64_t nativeWindowHandle() { return m_nativeWindowHandle; }
944 #endif
945
946     bool shouldUseCustomContentProviderForResponse(const WebCore::ResourceResponse&);
947
948     bool asynchronousPluginInitializationEnabled() const { return m_asynchronousPluginInitializationEnabled; }
949     void setAsynchronousPluginInitializationEnabled(bool enabled) { m_asynchronousPluginInitializationEnabled = enabled; }
950     bool asynchronousPluginInitializationEnabledForAllPlugins() const { return m_asynchronousPluginInitializationEnabledForAllPlugins; }
951     void setAsynchronousPluginInitializationEnabledForAllPlugins(bool enabled) { m_asynchronousPluginInitializationEnabledForAllPlugins = enabled; }
952     bool artificialPluginInitializationDelayEnabled() const { return m_artificialPluginInitializationDelayEnabled; }
953     void setArtificialPluginInitializationDelayEnabled(bool enabled) { m_artificialPluginInitializationDelayEnabled = enabled; }
954     void setTabToLinksEnabled(bool enabled) { m_tabToLinks = enabled; }
955     bool tabToLinksEnabled() const { return m_tabToLinks; }
956
957     bool scrollingPerformanceLoggingEnabled() const { return m_scrollingPerformanceLoggingEnabled; }
958     void setScrollingPerformanceLoggingEnabled(bool);
959
960 #if PLATFORM(COCOA)
961     bool shouldUsePDFPlugin() const;
962     bool pdfPluginEnabled() const { return m_pdfPluginEnabled; }
963     void setPDFPluginEnabled(bool enabled) { m_pdfPluginEnabled = enabled; }
964
965     NSDictionary *dataDetectionContext() const { return m_dataDetectionContext.get(); }
966 #endif
967
968     void savePDFToFileInDownloadsFolder(const String& suggestedFilename, const URL& originatingURL, const uint8_t* data, unsigned long size);
969
970 #if PLATFORM(COCOA)
971     void savePDFToTemporaryFolderAndOpenWithNativeApplication(const String& suggestedFilename, const String& originatingURLString, const uint8_t* data, unsigned long size, const String& pdfUUID);
972 #endif
973
974     bool mainFrameIsScrollable() const { return m_mainFrameIsScrollable; }
975
976     void setAlwaysShowsHorizontalScroller(bool);
977     void setAlwaysShowsVerticalScroller(bool);
978
979     bool alwaysShowsHorizontalScroller() const { return m_alwaysShowsHorizontalScroller; };
980     bool alwaysShowsVerticalScroller() const { return m_alwaysShowsVerticalScroller; };
981
982     void setViewLayoutSize(const WebCore::IntSize&);
983     WebCore::IntSize viewLayoutSize() const { return m_viewLayoutSize; }
984
985     void setAutoSizingShouldExpandToViewHeight(bool shouldExpand);
986     bool autoSizingShouldExpandToViewHeight() { return m_autoSizingShouldExpandToViewHeight; }
987
988     void setViewportSizeForCSSViewportUnits(std::optional<WebCore::IntSize>);
989     std::optional<WebCore::IntSize> viewportSizeForCSSViewportUnits() const { return m_viewportSizeForCSSViewportUnits; }
990
991     bool canShowMIMEType(const String& MIMEType) const;
992     bool canShowResponse(const WebCore::ResourceResponse&) const;
993
994     void addTextCheckingRequest(uint64_t requestID, Ref<WebCore::TextCheckingRequest>&&);
995     void didFinishCheckingText(uint64_t requestID, const Vector<WebCore::TextCheckingResult>&);
996     void didCancelCheckingText(uint64_t requestID);
997
998 #if ENABLE(PRIMARY_SNAPSHOTTED_PLUGIN_HEURISTIC)
999     void determinePrimarySnapshottedPlugIn();
1000     void determinePrimarySnapshottedPlugInTimerFired();
1001     void resetPrimarySnapshottedPlugIn();
1002     bool matchesPrimaryPlugIn(const String& pageOrigin, const String& pluginOrigin, const String& mimeType) const;
1003     bool plugInIntersectsSearchRect(WebCore::HTMLPlugInImageElement& pluginImageElement);
1004     bool plugInIsPrimarySize(WebCore::HTMLPlugInImageElement& pluginImageElement, unsigned &pluginArea);
1005 #endif
1006
1007 #if ENABLE(DATA_DETECTION)
1008     void setDataDetectionResults(NSArray *);
1009     void detectDataInAllFrames(uint64_t, CompletionHandler<void(const DataDetectionResult&)>&&);
1010     void removeDataDetectedLinks(CompletionHandler<void(const DataDetectionResult&)>&&);
1011 #endif
1012
1013     unsigned extendIncrementalRenderingSuppression();
1014     void stopExtendingIncrementalRenderingSuppression(unsigned token);
1015     bool shouldExtendIncrementalRenderingSuppression() { return !m_activeRenderingSuppressionTokens.isEmpty(); }
1016
1017     WebCore::ScrollPinningBehavior scrollPinningBehavior() { return m_scrollPinningBehavior; }
1018     void setScrollPinningBehavior(uint32_t /* WebCore::ScrollPinningBehavior */ pinning);
1019
1020     std::optional<WebCore::ScrollbarOverlayStyle> scrollbarOverlayStyle() { return m_scrollbarOverlayStyle; }
1021     void setScrollbarOverlayStyle(std::optional<uint32_t /* WebCore::ScrollbarOverlayStyle */> scrollbarStyle);
1022
1023     Ref<WebCore::DocumentLoader> createDocumentLoader(WebCore::Frame&, const WebCore::ResourceRequest&, const WebCore::SubstituteData&);
1024     void updateCachedDocumentLoader(WebDocumentLoader&, WebCore::Frame&);
1025
1026     void getBytecodeProfile(CallbackID);
1027     void getSamplingProfilerOutput(CallbackID);
1028     
1029 #if ENABLE(SERVICE_CONTROLS) || ENABLE(TELEPHONE_NUMBER_DETECTION)
1030     void handleTelephoneNumberClick(const String& number, const WebCore::IntPoint&);
1031     void handleSelectionServiceClick(WebCore::FrameSelection&, const Vector<String>& telephoneNumbers, const WebCore::IntPoint&);
1032 #endif
1033
1034     void didChangeScrollOffsetForFrame(WebCore::Frame*);
1035
1036     void setMainFrameProgressCompleted(bool completed) { m_mainFrameProgressCompleted = completed; }
1037     bool shouldDispatchFakeMouseMoveEvents() const { return m_shouldDispatchFakeMouseMoveEvents; }
1038
1039     void postMessage(const String& messageName, API::Object* messageBody);
1040     void postSynchronousMessageForTesting(const String& messageName, API::Object* messageBody, RefPtr<API::Object>& returnData);
1041     void postMessageIgnoringFullySynchronousMode(const String& messageName, API::Object* messageBody);
1042
1043 #if PLATFORM(GTK)
1044     void setInputMethodState(bool);
1045 #endif
1046
1047     void imageOrMediaDocumentSizeChanged(const WebCore::IntSize&);
1048
1049 #if ENABLE(VIDEO) && USE(GSTREAMER)
1050     void requestInstallMissingMediaPlugins(const String& details, const String& description, WebCore::MediaPlayerRequestInstallMissingPluginsCallback&);
1051 #endif
1052
1053     void addUserScript(String&& source, WebCore::UserContentInjectedFrames, WebCore::UserScriptInjectionTime);
1054     void addUserStyleSheet(const String& source, WebCore::UserContentInjectedFrames);
1055     void removeAllUserContent();
1056
1057     void dispatchDidReachLayoutMilestone(OptionSet<WebCore::LayoutMilestone>);
1058
1059     void didRestoreScrollPosition();
1060
1061     bool isControlledByAutomation() const;
1062     void setControlledByAutomation(bool);
1063
1064     void connectInspector(const String& targetId, Inspector::FrontendChannel::ConnectionType);
1065     void disconnectInspector(const String& targetId);
1066     void sendMessageToTargetBackend(const String& targetId, const String& message);
1067
1068     void insertNewlineInQuotedContent();
1069
1070 #if USE(OS_STATE)
1071     WallTime loadCommitTime() const { return m_loadCommitTime; }
1072 #endif
1073
1074 #if ENABLE(GAMEPAD)
1075     void gamepadActivity(const Vector<GamepadData>&, bool shouldMakeGamepadsVisible);
1076 #endif
1077     
1078 #if ENABLE(POINTER_LOCK)
1079     void didAcquirePointerLock();
1080     void didNotAcquirePointerLock();
1081     void didLosePointerLock();
1082 #endif
1083
1084     void didGetLoadDecisionForIcon(bool decision, CallbackID loadIdentifier, OptionalCallbackID);
1085     void setUseIconLoadingClient(bool);
1086
1087 #if ENABLE(DATA_INTERACTION)
1088     void didConcludeEditDataInteraction();
1089 #endif
1090
1091     WebURLSchemeHandlerProxy* urlSchemeHandlerForScheme(const String&);
1092     void stopAllURLSchemeTasks();
1093
1094     std::optional<double> cpuLimit() const { return m_cpuLimit; }
1095
1096     static PluginView* pluginViewForFrame(WebCore::Frame*);
1097
1098     void sendPartialEditorStateAndSchedulePostLayoutUpdate();
1099     void flushPendingEditorStateUpdate();
1100
1101 #if ENABLE(RESOURCE_LOAD_STATISTICS)
1102     void hasStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, CompletionHandler<void(bool)>&& callback);
1103     void requestStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, CompletionHandler<void(bool)>&& callback);
1104     void storageAccessResponse(bool wasGranted, uint64_t contextId);
1105 #endif
1106
1107     void showShareSheet(WebCore::ShareDataWithParsedURL&, WTF::CompletionHandler<void(bool)>&& callback);
1108     void didCompleteShareSheet(bool wasCompleted, ShareSheetCallbackID contextId);
1109     
1110 #if ENABLE(ATTACHMENT_ELEMENT)
1111     void insertAttachment(const String& identifier, std::optional<uint64_t>&& fileSize, const String& fileName, const String& contentType, CallbackID);
1112     void updateAttachmentAttributes(const String& identifier, std::optional<uint64_t>&& fileSize, const String& contentType, const String& fileName, const IPC::DataReference& enclosingImageData, CallbackID);
1113 #endif
1114
1115 #if ENABLE(APPLICATION_MANIFEST)
1116     void getApplicationManifest(CallbackID);
1117     void didFinishLoadingApplicationManifest(uint64_t, const std::optional<WebCore::ApplicationManifest>&);
1118 #endif
1119
1120     void updateCurrentModifierState(OptionSet<WebCore::PlatformEvent::Modifier> modifiers);
1121
1122     UserContentControllerIdentifier userContentControllerIdentifier() const { return m_userContentController->identifier(); }
1123
1124     WebCore::UserInterfaceLayoutDirection userInterfaceLayoutDirection() const { return m_userInterfaceLayoutDirection; }
1125
1126     bool isSuspended() const { return m_isSuspended; }
1127
1128     void didReceiveWebPageMessage(IPC::Connection&, IPC::Decoder&);
1129
1130 private:
1131     WebPage(uint64_t pageID, WebPageCreationParameters&&);
1132
1133     void updateThrottleState();
1134     void updateUserActivity();
1135
1136     // IPC::MessageSender
1137     IPC::Connection* messageSenderConnection() override;
1138     uint64_t messageSenderDestinationID() override;
1139
1140     void platformInitialize();
1141     void platformDetach();
1142     void platformEditorState(WebCore::Frame&, EditorState& result, IncludePostLayoutDataHint) const;
1143     void sendEditorStateUpdate();
1144
1145 #if PLATFORM(COCOA)
1146     void sendTouchBarMenuDataAddedUpdate(WebCore::HTMLMenuElement&);
1147     void sendTouchBarMenuDataRemovedUpdate(WebCore::HTMLMenuElement&);
1148     void sendTouchBarMenuItemDataAddedUpdate(WebCore::HTMLMenuItemElement&);
1149     void sendTouchBarMenuItemDataRemovedUpdate(WebCore::HTMLMenuItemElement&);
1150 #endif
1151
1152     void didReceiveSyncWebPageMessage(IPC::Connection&, IPC::Decoder&, std::unique_ptr<IPC::Encoder>&);
1153
1154 #if PLATFORM(IOS_FAMILY)
1155     void resetViewportDefaultConfiguration(WebFrame* mainFrame, bool hasMobileDocType = false);
1156     enum class ZoomToInitialScale { No, Yes };
1157     void viewportConfigurationChanged(ZoomToInitialScale = ZoomToInitialScale::No);
1158     void updateViewportSizeForCSSViewportUnits();
1159
1160     static void convertSelectionRectsToRootView(WebCore::FrameView*, Vector<WebCore::SelectionRect>&);
1161     RefPtr<WebCore::Range> rangeForWebSelectionAtPosition(const WebCore::IntPoint&, const WebCore::VisiblePosition&, SelectionFlags&);
1162     void getAssistedNodeInformation(AssistedNodeInformation&);
1163     void platformInitializeAccessibility();
1164     void handleSyntheticClick(WebCore::Node* nodeRespondingToClick, const WebCore::FloatPoint& location);
1165     void completeSyntheticClick(WebCore::Node* nodeRespondingToClick, const WebCore::FloatPoint& location, WebCore::SyntheticClickType);
1166     void sendTapHighlightForNodeIfNecessary(uint64_t requestID, WebCore::Node*);
1167     void resetTextAutosizing();
1168     WebCore::VisiblePosition visiblePositionInFocusedNodeForPoint(const WebCore::Frame&, const WebCore::IntPoint&, bool isInteractingWithAssistedNode);
1169     RefPtr<WebCore::Range> rangeForGranularityAtPoint(WebCore::Frame&, const WebCore::IntPoint&, uint32_t granularity, bool isInteractingWithAssistedNode);
1170 #endif
1171
1172 #if PLATFORM(IOS_FAMILY) && ENABLE(DATA_INTERACTION)
1173     void requestStartDataInteraction(const WebCore::IntPoint& clientPosition, const WebCore::IntPoint& globalPosition);
1174     void requestAdditionalItemsForDragSession(const WebCore::IntPoint& clientPosition, const WebCore::IntPoint& globalPosition);
1175 #endif
1176
1177 #if !PLATFORM(COCOA) && !PLATFORM(WPE)
1178     static const char* interpretKeyEvent(const WebCore::KeyboardEvent*);
1179 #endif
1180
1181     bool performDefaultBehaviorForKeyEvent(const WebKeyboardEvent&);
1182
1183 #if PLATFORM(MAC)
1184     bool executeKeypressCommandsInternal(const Vector<WebCore::KeypressCommand>&, WebCore::KeyboardEvent*);
1185 #endif
1186
1187     void updateDrawingAreaLayerTreeFreezeState();
1188     bool markLayersVolatileImmediatelyIfPossible();
1189     void layerVolatilityTimerFired();
1190     void callVolatilityCompletionHandlers(bool succeeded);
1191
1192     String sourceForFrame(WebFrame*);
1193
1194     void loadDataImpl(uint64_t navigationID, Ref<WebCore::SharedBuffer>&&, const String& MIMEType, const String& encodingName, const URL& baseURL, const URL& failingURL, const UserData&);
1195
1196     // Actions
1197     void tryClose();
1198     void platformDidReceiveLoadParameters(const LoadParameters&);
1199     void loadRequest(LoadParameters&&);
1200     void loadData(LoadParameters&&);
1201     void loadAlternateHTML(const LoadParameters&);
1202     void navigateToPDFLinkWithSimulatedClick(const String& url, WebCore::IntPoint documentPoint, WebCore::IntPoint screenPoint);
1203     void reload(uint64_t navigationID, uint32_t reloadOptions, SandboxExtension::Handle&&);
1204     void goToBackForwardItem(uint64_t navigationID, const WebCore::BackForwardItemIdentifier&, WebCore::FrameLoadType, WebCore::ShouldTreatAsContinuingLoad);
1205     void tryRestoreScrollPosition();
1206     void setInitialFocus(bool forward, bool isKeyboardEventValid, const WebKeyboardEvent&, CallbackID);
1207     void updateIsInWindow(bool isInitialState = false);
1208     void visibilityDidChange();
1209     void setActivityState(OptionSet<WebCore::ActivityState::Flag>, ActivityStateChangeID, const Vector<CallbackID>& callbackIDs);
1210     void validateCommand(const String&, CallbackID);
1211     void executeEditCommand(const String&, const String&);
1212     void setEditable(bool);
1213
1214     void increaseListLevel();
1215     void decreaseListLevel();
1216     void changeListType();
1217
1218     void setBaseWritingDirection(WebCore::WritingDirection);
1219
1220     void setNeedsFontAttributes(bool);
1221
1222     void mouseEvent(const WebMouseEvent&);
1223     void keyEvent(const WebKeyboardEvent&);
1224
1225 #if ENABLE(IOS_TOUCH_EVENTS)
1226     void touchEventSync(const WebTouchEvent&, bool& handled);
1227     void updatePotentialTapSecurityOrigin(const WebTouchEvent&, bool wasHandled);
1228 #elif ENABLE(TOUCH_EVENTS)
1229     void touchEvent(const WebTouchEvent&);
1230 #endif
1231
1232 #if ENABLE(CONTEXT_MENUS)
1233     void contextMenuHidden() { m_isShowingContextMenu = false; }
1234     void contextMenuForKeyEvent();
1235 #endif
1236
1237     static bool scroll(WebCore::Page*, WebCore::ScrollDirection, WebCore::ScrollGranularity);
1238     static bool logicalScroll(WebCore::Page*, WebCore::ScrollLogicalDirection, WebCore::ScrollGranularity);
1239
1240     void loadURLInFrame(URL&&, uint64_t frameID);
1241
1242     enum class WasRestoredByAPIRequest { No, Yes };
1243     void restoreSessionInternal(const Vector<BackForwardListItemState>&, WasRestoredByAPIRequest, WebBackForwardListProxy::OverwriteExistingItem);
1244     void restoreSession(const Vector<BackForwardListItemState>&);
1245     void didRemoveBackForwardItem(const WebCore::BackForwardItemIdentifier&);
1246     void updateBackForwardListForReattach(const Vector<WebKit::BackForwardListItemState>&);
1247     void setCurrentHistoryItemForReattach(WebKit::BackForwardListItemState&&);
1248
1249     void requestFontAttributesAtSelectionStart(CallbackID);
1250
1251 #if ENABLE(REMOTE_INSPECTOR)
1252     void setIndicating(bool);
1253 #endif
1254
1255     void setDrawsBackground(bool);
1256
1257 #if PLATFORM(COCOA)
1258     void setTopContentInsetFenced(float, IPC::Attachment);
1259 #endif
1260     void setTopContentInset(float);
1261
1262     void viewWillStartLiveResize();
1263     void viewWillEndLiveResize();
1264
1265     void getContentsAsString(CallbackID);
1266 #if ENABLE(MHTML)
1267     void getContentsAsMHTMLData(CallbackID);
1268 #endif
1269     void getMainResourceDataOfFrame(uint64_t frameID, CallbackID);
1270     void getResourceDataFromFrame(uint64_t frameID, const String& resourceURL, CallbackID);
1271     void getRenderTreeExternalRepresentation(CallbackID);
1272     void getSelectionOrContentsAsString(CallbackID);
1273     void getSelectionAsWebArchiveData(CallbackID);
1274     void getSourceForFrame(uint64_t frameID, CallbackID);
1275     void getWebArchiveOfFrame(uint64_t frameID, CallbackID);
1276     void runJavaScript(const String&, bool forceUserGesture, std::optional<String> worldName, CallbackID);
1277     void runJavaScriptInMainFrame(const String&, bool forceUserGesture, CallbackID);
1278     void runJavaScriptInMainFrameScriptWorld(const String&, bool forceUserGesture, const String& worldName, CallbackID);
1279     void forceRepaint(CallbackID);
1280     void takeSnapshot(WebCore::IntRect snapshotRect, WebCore::IntSize bitmapSize, uint32_t options, CallbackID);
1281
1282     void preferencesDidChange(const WebPreferencesStore&);
1283     void updatePreferences(const WebPreferencesStore&);
1284     void updatePreferencesGenerated(const WebPreferencesStore&);
1285
1286 #if PLATFORM(IOS_FAMILY)
1287     bool parentProcessHasServiceWorkerEntitlement() const;
1288 #else
1289     bool parentProcessHasServiceWorkerEntitlement() const { return true; }
1290 #endif
1291
1292     void didReceivePolicyDecision(uint64_t frameID, uint64_t listenerID, WebCore::PolicyAction, uint64_t navigationID, const DownloadID&, std::optional<WebsitePoliciesData>&&);
1293     void continueWillSubmitForm(uint64_t frameID, uint64_t listenerID);
1294     void setUserAgent(const String&);
1295     void setCustomTextEncodingName(const String&);
1296     void suspendActiveDOMObjectsAndAnimations();
1297     void resumeActiveDOMObjectsAndAnimations();
1298
1299 #if PLATFORM(COCOA)
1300     void performDictionaryLookupAtLocation(const WebCore::FloatPoint&);
1301     void performDictionaryLookupOfCurrentSelection();
1302     void performDictionaryLookupForRange(WebCore::Frame&, WebCore::Range&, NSDictionary *options, WebCore::TextIndicatorPresentationTransition);
1303     WebCore::DictionaryPopupInfo dictionaryPopupInfoForRange(WebCore::Frame&, WebCore::Range&, NSDictionary *options, WebCore::TextIndicatorPresentationTransition);
1304 #if ENABLE(PDFKIT_PLUGIN)
1305     WebCore::DictionaryPopupInfo dictionaryPopupInfoForSelectionInPDFPlugin(PDFSelection *, PDFPlugin&, NSDictionary *options, WebCore::TextIndicatorPresentationTransition);
1306 #endif
1307
1308     void windowAndViewFramesChanged(const WebCore::FloatRect& windowFrameInScreenCoordinates, const WebCore::FloatRect& windowFrameInUnflippedScreenCoordinates, const WebCore::FloatRect& viewFrameInWindowCoordinates, const WebCore::FloatPoint& accessibilityViewCoordinates);
1309
1310     RetainPtr<PDFDocument> pdfDocumentForPrintingFrame(WebCore::Frame*);
1311     void computePagesForPrintingPDFDocument(uint64_t frameID, const PrintInfo&, Vector<WebCore::IntRect>& resultPageRects);
1312     void drawPDFDocument(CGContextRef, PDFDocument *, const PrintInfo&, const WebCore::IntRect&);
1313     void drawPagesToPDFFromPDFDocument(CGContextRef, PDFDocument *, const PrintInfo&, uint32_t first, uint32_t count);
1314 #endif
1315
1316     void setMainFrameIsScrollable(bool);
1317
1318     void unapplyEditCommand(uint64_t commandID);
1319     void reapplyEditCommand(uint64_t commandID);
1320     void didRemoveEditCommand(uint64_t commandID);
1321
1322     void findString(const String&, uint32_t findOptions, uint32_t maxMatchCount);
1323     void findStringMatches(const String&, uint32_t findOptions, uint32_t maxMatchCount);
1324     void getImageForFindMatch(uint32_t matchIndex);
1325     void selectFindMatch(uint32_t matchIndex);
1326     void hideFindUI();
1327     void countStringMatches(const String&, uint32_t findOptions, uint32_t maxMatchCount);
1328     void replaceMatches(const Vector<uint32_t>& matchIndices, const String& replacementText, bool selectionOnly, CallbackID);
1329
1330 #if USE(COORDINATED_GRAPHICS)
1331     void sendViewportAttributesChanged(const WebCore::ViewportArguments&);
1332 #endif
1333
1334     void didChangeSelectedIndexForActivePopupMenu(int32_t newIndex);
1335     void setTextForActivePopupMenu(int32_t index);
1336
1337 #if PLATFORM(GTK)
1338     void failedToShowPopupMenu();
1339 #endif
1340
1341     void didChooseFilesForOpenPanel(const Vector<String>&);
1342     void didCancelForOpenPanel();
1343
1344 #if PLATFORM(IOS_FAMILY)
1345     void didChooseFilesForOpenPanelWithDisplayStringAndIcon(const Vector<String>&, const String& displayString, const IPC::DataReference& iconData);
1346 #endif
1347
1348 #if ENABLE(SANDBOX_EXTENSIONS)
1349     void extendSandboxForFilesFromOpenPanel(SandboxExtension::HandleArray&&);
1350 #endif
1351
1352     void didReceiveGeolocationPermissionDecision(uint64_t geolocationID, bool allowed);
1353
1354     void didReceiveNotificationPermissionDecision(uint64_t notificationID, bool allowed);
1355
1356 #if ENABLE(MEDIA_STREAM)
1357     void userMediaAccessWasGranted(uint64_t userMediaID, WebCore::CaptureDevice&& audioDeviceUID, WebCore::CaptureDevice&& videoDeviceUID, String&& mediaDeviceIdentifierHashSalt);
1358     void userMediaAccessWasDenied(uint64_t userMediaID, uint64_t reason, String&& invalidConstraint);
1359
1360     void didCompleteMediaDeviceEnumeration(uint64_t userMediaID, const Vector<WebCore::CaptureDevice>& devices, String&& deviceIdentifierHashSalt, bool originHasPersistentAccess);
1361 #endif
1362
1363 #if ENABLE(MEDIA_STREAM) && ENABLE(SANDBOX_EXTENSIONS)
1364     void grantUserMediaDeviceSandboxExtensions(MediaDeviceSandboxExtensions&&);
1365     void revokeUserMediaDeviceSandboxExtensions(const Vector<String>&);
1366 #endif
1367
1368 #if ENABLE(WEB_RTC)
1369     void disableICECandidateFiltering();
1370     void enableICECandidateFiltering();
1371 #endif
1372
1373 #if ENABLE(WEB_RTC) && USE(LIBWEBRTC)
1374     void disableEnumeratingAllNetworkInterfaces();
1375     void enableEnumeratingAllNetworkInterfaces();
1376 #endif
1377
1378     void advanceToNextMisspelling(bool startBeforeSelection);
1379     void changeSpellingToWord(const String& word);
1380
1381 #if USE(APPKIT)
1382     void uppercaseWord();
1383     void lowercaseWord();
1384     void capitalizeWord();
1385 #endif
1386
1387 #if ENABLE(CONTEXT_MENUS)
1388     void didSelectItemFromActiveContextMenu(const WebContextMenuItemData&);
1389 #endif
1390
1391     void changeSelectedIndex(int32_t index);
1392     void setCanStartMediaTimerFired();
1393
1394     static bool platformCanHandleRequest(const WebCore::ResourceRequest&);
1395
1396     static PluginView* focusedPluginViewForFrame(WebCore::Frame&);
1397
1398     static RefPtr<WebCore::Range> rangeFromEditingRange(WebCore::Frame&, const EditingRange&, EditingRangeIsRelativeTo = EditingRangeIsRelativeTo::EditableRoot);
1399
1400     void reportUsedFeatures();
1401
1402     void updateWebsitePolicies(WebsitePoliciesData&&);
1403
1404     void changeFont(WebCore::FontChanges&&);
1405     void changeFontAttributes(WebCore::FontAttributeChanges&&);
1406
1407 #if PLATFORM(MAC)
1408     void performImmediateActionHitTestAtLocation(WebCore::FloatPoint);
1409     std::tuple<RefPtr<WebCore::Range>, NSDictionary *> lookupTextAtLocation(WebCore::FloatPoint);
1410     void immediateActionDidUpdate();
1411     void immediateActionDidCancel();
1412     void immediateActionDidComplete();
1413
1414     void dataDetectorsDidPresentUI(WebCore::PageOverlay::PageOverlayID);
1415     void dataDetectorsDidChangeUI(WebCore::PageOverlay::PageOverlayID);
1416     void dataDetectorsDidHideUI(WebCore::PageOverlay::PageOverlayID);
1417
1418     void handleAcceptedCandidate(WebCore::TextCheckingResult);
1419 #endif
1420
1421 #if PLATFORM(COCOA)
1422     void requestActiveNowPlayingSessionInfo(CallbackID);
1423 #endif
1424
1425     void setShouldDispatchFakeMouseMoveEvents(bool dispatch) { m_shouldDispatchFakeMouseMoveEvents = dispatch; }
1426
1427 #if ENABLE(WIRELESS_PLAYBACK_TARGET) && !PLATFORM(IOS_FAMILY)
1428     void playbackTargetSelected(uint64_t, const WebCore::MediaPlaybackTargetContext& outputDevice) const;
1429     void playbackTargetAvailabilityDidChange(uint64_t, bool);
1430     void setShouldPlayToPlaybackTarget(uint64_t, bool);
1431 #endif
1432
1433     void clearWheelEventTestTrigger();
1434
1435     void setShouldScaleViewToFitDocument(bool);
1436
1437     void pageStoppedScrolling();
1438
1439 #if ENABLE(VIDEO) && USE(GSTREAMER)
1440     void didEndRequestInstallMissingMediaPlugins(uint32_t result);
1441 #endif
1442
1443     void setResourceCachingDisabled(bool);
1444     void setUserInterfaceLayoutDirection(uint32_t);
1445
1446     bool canPluginHandleResponse(const WebCore::ResourceResponse&);
1447
1448 #if USE(QUICK_LOOK)
1449     void didReceivePasswordForQuickLookDocument(const String&);
1450 #endif
1451
1452     void frameBecameRemote(uint64_t frameID, WebCore::GlobalFrameIdentifier&& remoteFrameIdentifier, WebCore::GlobalWindowIdentifier&& remoteWindowIdentifier);
1453
1454     void registerURLSchemeHandler(uint64_t identifier, const String& scheme);
1455
1456     void urlSchemeTaskDidPerformRedirection(uint64_t handlerIdentifier, uint64_t taskIdentifier, WebCore::ResourceResponse&&, WebCore::ResourceRequest&&);
1457     void urlSchemeTaskDidReceiveResponse(uint64_t handlerIdentifier, uint64_t taskIdentifier, const WebCore::ResourceResponse&);
1458     void urlSchemeTaskDidReceiveData(uint64_t handlerIdentifier, uint64_t taskIdentifier, const IPC::DataReference&);
1459     void urlSchemeTaskDidComplete(uint64_t handlerIdentifier, uint64_t taskIdentifier, const WebCore::ResourceError&);
1460
1461     void setIsSuspended(bool);
1462
1463     RefPtr<WebImage> snapshotAtSize(const WebCore::IntRect&, const WebCore::IntSize& bitmapSize, SnapshotOptions);
1464     RefPtr<WebImage> snapshotNode(WebCore::Node&, SnapshotOptions, unsigned maximumPixelCount = std::numeric_limits<unsigned>::max());
1465 #if USE(CF)
1466     RetainPtr<CFDataRef> pdfSnapshotAtSize(const WebCore::IntRect&, const WebCore::IntSize& bitmapSize, SnapshotOptions);
1467 #endif
1468
1469 #if ENABLE(ATTACHMENT_ELEMENT)
1470     RefPtr<WebCore::HTMLAttachmentElement> attachmentElementWithIdentifier(const String& identifier) const;
1471 #endif
1472
1473     bool canShowMIMEType(const String&, const Function<bool(const String&, WebCore::PluginData::AllowedPluginTypes)>& supportsPlugin) const;
1474
1475     uint64_t m_pageID;
1476
1477     std::unique_ptr<WebCore::Page> m_page;
1478     RefPtr<WebFrame> m_mainFrame;
1479
1480     RefPtr<WebPageGroupProxy> m_pageGroup;
1481
1482     String m_userAgent;
1483
1484     WebCore::IntSize m_viewSize;
1485     std::unique_ptr<DrawingArea> m_drawingArea;
1486     bool m_shouldResetDrawingAreaAfterSuspend { false };
1487
1488     HashSet<PluginView*> m_pluginViews;
1489     bool m_hasSeenPlugin { false };
1490
1491     HashMap<uint64_t, RefPtr<WebCore::TextCheckingRequest>> m_pendingTextCheckingRequestMap;
1492
1493     bool m_useFixedLayout { false };
1494     bool m_drawsBackground { true };
1495
1496     WebCore::Color m_underlayColor;
1497
1498     bool m_isInRedo { false };
1499     bool m_isClosed { false };
1500     bool m_tabToLinks { false };
1501     
1502     bool m_asynchronousPluginInitializationEnabled { false };
1503     bool m_asynchronousPluginInitializationEnabledForAllPlugins { false };
1504     bool m_artificialPluginInitializationDelayEnabled { false };
1505     bool m_scrollingPerformanceLoggingEnabled { false };
1506     bool m_mainFrameIsScrollable { true };
1507
1508     bool m_alwaysShowsHorizontalScroller { false };
1509     bool m_alwaysShowsVerticalScroller { false };
1510
1511 #if PLATFORM(IOS_FAMILY)
1512     bool m_ignoreViewportScalingConstraints { false };
1513 #endif
1514
1515 #if ENABLE(PRIMARY_SNAPSHOTTED_PLUGIN_HEURISTIC)
1516     bool m_readyToFindPrimarySnapshottedPlugin { false };
1517     bool m_didFindPrimarySnapshottedPlugin { false };
1518     unsigned m_numberOfPrimarySnapshotDetectionAttempts { 0 };
1519     String m_primaryPlugInPageOrigin;
1520     String m_primaryPlugInOrigin;
1521     String m_primaryPlugInMimeType;
1522     RunLoop::Timer<WebPage> m_determinePrimarySnapshottedPlugInTimer;
1523 #endif
1524
1525     // The layer hosting mode.
1526     LayerHostingMode m_layerHostingMode;
1527
1528 #if PLATFORM(COCOA)
1529     bool m_pdfPluginEnabled { false };
1530     bool m_hasCachedWindowFrame { false };
1531
1532     // The frame of the containing window in screen coordinates.
1533     WebCore::FloatRect m_windowFrameInScreenCoordinates;
1534
1535     // The frame of the containing window in unflipped screen coordinates.
1536     WebCore::FloatRect m_windowFrameInUnflippedScreenCoordinates;
1537
1538     // The frame of the view in window coordinates.
1539     WebCore::FloatRect m_viewFrameInWindowCoordinates;
1540
1541     // The accessibility position of the view.
1542     WebCore::FloatPoint m_accessibilityPosition;
1543     
1544     RetainPtr<WKAccessibilityWebPageObject> m_mockAccessibilityElement;
1545
1546     UniqueRef<ViewGestureGeometryCollector> m_viewGestureGeometryCollector;
1547
1548     RetainPtr<NSDictionary> m_dataDetectionContext;
1549 #endif
1550
1551 #if HAVE(ACCESSIBILITY) && PLATFORM(GTK)
1552     GRefPtr<WebPageAccessibilityObject> m_accessibilityObject;
1553 #endif
1554
1555 #if PLATFORM(GTK) && USE(TEXTURE_MAPPER_GL)
1556     // Our view's window in the UI process.
1557     uint64_t m_nativeWindowHandle { 0 };
1558 #endif
1559
1560 #if !PLATFORM(IOS_FAMILY)
1561     RefPtr<PageBanner> m_headerBanner;
1562     RefPtr<PageBanner> m_footerBanner;
1563 #endif
1564
1565     RunLoop::Timer<WebPage> m_setCanStartMediaTimer;
1566     bool m_mayStartMediaWhenInWindow { false };
1567
1568     HashMap<uint64_t, RefPtr<WebUndoStep>> m_undoStepMap;
1569
1570 #if ENABLE(CONTEXT_MENUS)
1571     std::unique_ptr<API::InjectedBundle::PageContextMenuClient> m_contextMenuClient;
1572 #endif
1573     std::unique_ptr<API::InjectedBundle::EditorClient> m_editorClient;
1574     std::unique_ptr<API::InjectedBundle::FormClient> m_formClient;
1575     std::unique_ptr<API::InjectedBundle::PageLoaderClient> m_loaderClient;
1576     InjectedBundlePagePolicyClient m_policyClient;
1577     std::unique_ptr<API::InjectedBundle::ResourceLoadClient> m_resourceLoadClient;
1578     std::unique_ptr<API::InjectedBundle::PageUIClient> m_uiClient;
1579 #if ENABLE(FULLSCREEN_API)
1580     InjectedBundlePageFullScreenClient m_fullScreenClient;
1581 #endif
1582
1583     UniqueRef<FindController> m_findController;
1584
1585     RefPtr<WebInspector> m_inspector;
1586     RefPtr<WebInspectorUI> m_inspectorUI;
1587     RefPtr<RemoteWebInspectorUI> m_remoteInspectorUI;
1588     std::unique_ptr<WebPageInspectorTargetController> m_inspectorTargetController;
1589
1590 #if (PLATFORM(IOS_FAMILY) && HAVE(AVKIT)) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))
1591     RefPtr<PlaybackSessionManager> m_playbackSessionManager;
1592     RefPtr<VideoFullscreenManager> m_videoFullscreenManager;
1593 #endif
1594
1595 #if PLATFORM(IOS_FAMILY)
1596     bool m_allowsMediaDocumentInlinePlayback { false };
1597     RefPtr<WebCore::Range> m_startingGestureRange;
1598 #endif
1599
1600 #if ENABLE(FULLSCREEN_API)
1601     RefPtr<WebFullScreenManager> m_fullScreenManager;
1602 #endif
1603
1604     RefPtr<WebPopupMenu> m_activePopupMenu;
1605
1606 #if ENABLE(CONTEXT_MENUS)
1607     RefPtr<WebContextMenu> m_contextMenu;
1608 #endif
1609
1610 #if ENABLE(INPUT_TYPE_COLOR)
1611     WebColorChooser* m_activeColorChooser { nullptr };
1612 #endif
1613
1614 #if ENABLE(DATALIST_ELEMENT)
1615     WebDataListSuggestionPicker* m_activeDataListSuggestionPicker { nullptr };
1616 #endif
1617
1618     RefPtr<WebOpenPanelResultListener> m_activeOpenPanelResultListener;
1619     RefPtr<NotificationPermissionRequestManager> m_notificationPermissionRequestManager;
1620
1621     Ref<WebUserContentController> m_userContentController;
1622
1623 #if ENABLE(GEOLOCATION)
1624     UniqueRef<GeolocationPermissionRequestManager> m_geolocationPermissionRequestManager;
1625 #endif
1626
1627 #if ENABLE(MEDIA_STREAM)
1628     std::unique_ptr<UserMediaPermissionRequestManager> m_userMediaPermissionRequestManager;
1629 #endif
1630
1631     std::unique_ptr<WebCore::PrintContext> m_printContext;
1632 #if PLATFORM(GTK)
1633     RefPtr<WebPrintOperationGtk> m_printOperation;
1634 #endif
1635
1636     SandboxExtensionTracker m_sandboxExtensionTracker;
1637
1638     RefPtr<SandboxExtension> m_pendingDropSandboxExtension;
1639     Vector<RefPtr<SandboxExtension>> m_pendingDropExtensionsForFileUpload;
1640
1641     PAL::HysteresisActivity m_pageScrolledHysteresis;
1642
1643     bool m_canRunBeforeUnloadConfirmPanel { false };
1644
1645     bool m_canRunModal { false };
1646     bool m_isRunningModal { false };
1647
1648 #if ENABLE(DRAG_SUPPORT)
1649     bool m_isStartingDrag { false };
1650 #endif
1651
1652     bool m_cachedMainFrameIsPinnedToLeftSide { true };
1653     bool m_cachedMainFrameIsPinnedToRightSide { true };
1654     bool m_cachedMainFrameIsPinnedToTopSide { true };
1655     bool m_cachedMainFrameIsPinnedToBottomSide { true };
1656     bool m_canShortCircuitHorizontalWheelEvents { false };
1657     bool m_hasWheelEventHandlers { false };
1658
1659     unsigned m_cachedPageCount { 0 };
1660
1661     HashSet<unsigned long> m_trackedNetworkResourceRequestIdentifiers;
1662
1663     WebCore::IntSize m_viewLayoutSize;
1664     bool m_autoSizingShouldExpandToViewHeight { false };
1665     std::optional<WebCore::IntSize> m_viewportSizeForCSSViewportUnits;
1666
1667     bool m_userIsInteracting { false };
1668     bool m_isAssistingNodeDueToUserInteraction { false };
1669     bool m_hasEverFocusedElementDueToUserInteractionSincePageTransition { false };
1670     bool m_needsHiddenContentEditableQuirk { false };
1671     bool m_needsPlainTextQuirk { false };
1672     bool m_changingActivityState { false };
1673
1674 #if ENABLE(CONTEXT_MENUS)
1675     bool m_isShowingContextMenu { false };
1676 #endif
1677
1678     RefPtr<WebCore::Node> m_assistedNode;
1679     bool m_hasPendingBlurNotification { false };
1680     bool m_hasPendingEditorStateUpdate { false };
1681     
1682 #if PLATFORM(IOS_FAMILY)
1683     RefPtr<WebCore::Range> m_currentWordRange;
1684     RefPtr<WebCore::Node> m_interactionNode;
1685     WebCore::IntPoint m_lastInteractionLocation;
1686     
1687     enum SelectionAnchor { Start, End };
1688     SelectionAnchor m_selectionAnchor { Start };
1689
1690     RefPtr<WebCore::Node> m_potentialTapNode;
1691     WebCore::FloatPoint m_potentialTapLocation;
1692     RefPtr<WebCore::SecurityOrigin> m_potentialTapSecurityOrigin;
1693
1694     WebCore::ViewportConfiguration m_viewportConfiguration;
1695     bool m_hasReceivedVisibleContentRectsAfterDidCommitLoad { false };
1696     bool m_scaleWasSetByUIProcess { false };
1697     bool m_userHasChangedPageScaleFactor { false };
1698     bool m_hasStablePageScaleFactor { true };
1699     bool m_useTestingViewportConfiguration { false };
1700     bool m_isInStableState { true };
1701     bool m_forceAlwaysUserScalable { false };
1702     MonotonicTime m_oldestNonStableUpdateVisibleContentRectsTimestamp;
1703     Seconds m_estimatedLatency { 0 };
1704     WebCore::FloatSize m_screenSize;
1705     WebCore::FloatSize m_availableScreenSize;
1706     WebCore::FloatSize m_overrideScreenSize;
1707     RefPtr<WebCore::Range> m_currentBlockSelection;
1708     WebCore::IntRect m_blockRectForTextSelection;
1709
1710     RefPtr<WebCore::Range> m_initialSelection;
1711     WebCore::VisibleSelection m_storedSelectionForAccessibility { WebCore::VisibleSelection() };
1712     WebCore::IntSize m_blockSelectionDesiredSize;
1713     WebCore::FloatSize m_maximumUnobscuredSize;
1714     int32_t m_deviceOrientation { 0 };
1715     bool m_inDynamicSizeUpdate { false };
1716     HashMap<std::pair<WebCore::IntSize, double>, WebCore::IntPoint> m_dynamicSizeUpdateHistory;
1717     RefPtr<WebCore::Node> m_pendingSyntheticClickNode;
1718     WebCore::FloatPoint m_pendingSyntheticClickLocation;
1719     WebCore::FloatRect m_previousExposedContentRect;
1720     uint64_t m_currentAssistedNodeIdentifier { 0 };
1721     std::optional<DynamicViewportSizeUpdateID> m_pendingDynamicViewportSizeUpdateID;
1722     double m_lastTransactionPageScaleFactor { 0 };
1723     uint64_t m_lastTransactionIDWithScaleChange { 0 };
1724 #endif
1725
1726     WebCore::Timer m_layerVolatilityTimer;
1727     Vector<WTF::Function<void (bool)>> m_markLayersAsVolatileCompletionHandlers;
1728     bool m_isSuspendedUnderLock { false };
1729
1730     HashSet<String, ASCIICaseInsensitiveHash> m_mimeTypesWithCustomContentProviders;
1731     WebCore::Color m_backgroundColor { WebCore::Color::white };
1732
1733     HashSet<unsigned> m_activeRenderingSuppressionTokens;
1734     unsigned m_maximumRenderingSuppressionToken { 0 };
1735     
1736     WebCore::ScrollPinningBehavior m_scrollPinningBehavior { WebCore::DoNotPin };
1737     std::optional<WebCore::ScrollbarOverlayStyle> m_scrollbarOverlayStyle;
1738
1739     bool m_useAsyncScrolling { false };
1740
1741     OptionSet<WebCore::ActivityState::Flag> m_activityState;
1742
1743     bool m_processSuppressionEnabled;
1744     UserActivity m_userActivity;
1745     PAL::HysteresisActivity m_userActivityHysteresis;
1746
1747     uint64_t m_pendingNavigationID { 0 };
1748
1749     bool m_mainFrameProgressCompleted { false };
1750     bool m_shouldDispatchFakeMouseMoveEvents { true };
1751     bool m_isEditorStateMissingPostLayoutData { false };
1752     bool m_isSelectingTextWhileInsertingAsynchronously { false };
1753
1754     enum class EditorStateIsContentEditable { No, Yes, Unset };
1755     mutable EditorStateIsContentEditable m_lastEditorStateWasContentEditable { EditorStateIsContentEditable::Unset };
1756
1757 #if PLATFORM(GTK)
1758     bool m_inputMethodEnabled { false };
1759 #endif
1760
1761 #if ENABLE(VIDEO) && USE(GSTREAMER)
1762     RefPtr<WebCore::MediaPlayerRequestInstallMissingPluginsCallback> m_installMediaPluginsCallback;
1763 #endif
1764
1765 #if USE(OS_STATE)
1766     WallTime m_loadCommitTime;
1767 #endif
1768
1769     WebCore::UserInterfaceLayoutDirection m_userInterfaceLayoutDirection { WebCore::UserInterfaceLayoutDirection::LTR };
1770
1771     const String m_overrideContentSecurityPolicy;
1772     const std::optional<double> m_cpuLimit;
1773
1774     HashMap<String, RefPtr<WebURLSchemeHandlerProxy>> m_schemeToURLSchemeHandlerProxyMap;
1775     HashMap<uint64_t, WebURLSchemeHandlerProxy*> m_identifierToURLSchemeHandlerProxyMap;
1776
1777     HashMap<uint64_t, WTF::Function<void(bool granted)>> m_storageAccessResponseCallbackMap;
1778     HashMap<ShareSheetCallbackID, WTF::Function<void(bool completed)>> m_shareSheetResponseCallbackMap;
1779
1780 #if ENABLE(APPLICATION_MANIFEST)
1781     HashMap<uint64_t, uint64_t> m_applicationManifestFetchCallbackMap;
1782 #endif
1783
1784     OptionSet<LayerTreeFreezeReason> m_LayerTreeFreezeReasons;
1785     bool m_isSuspended { false };
1786     bool m_needsFontAttributes { false };
1787 #if PLATFORM(MAC)
1788     bool m_shouldAttachDrawingAreaOnPageTransition { false };
1789 #endif
1790 };
1791
1792 } // namespace WebKit
1793