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