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