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