Unreviewed, rolling out r238047.
[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(OptionSet<WebCore::LayoutMilestone>);
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(OptionSet<WebCore::LayoutMilestone>);
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     void updateCurrentModifierState(OptionSet<WebCore::PlatformEvent::Modifier> modifiers);
1095
1096     UserContentControllerIdentifier userContentControllerIdentifier() const { return m_userContentController->identifier(); }
1097
1098     WebCore::UserInterfaceLayoutDirection userInterfaceLayoutDirection() const { return m_userInterfaceLayoutDirection; }
1099
1100     bool isSuspended() const { return m_isSuspended; }
1101
1102     void didReceiveWebPageMessage(IPC::Connection&, IPC::Decoder&);
1103
1104 private:
1105     WebPage(uint64_t pageID, WebPageCreationParameters&&);
1106
1107     void updateThrottleState();
1108     void updateUserActivity();
1109
1110     // IPC::MessageSender
1111     IPC::Connection* messageSenderConnection() override;
1112     uint64_t messageSenderDestinationID() override;
1113
1114     void platformInitialize();
1115     void platformDetach();
1116     void platformEditorState(WebCore::Frame&, EditorState& result, IncludePostLayoutDataHint) const;
1117     void sendEditorStateUpdate();
1118
1119 #if PLATFORM(COCOA)
1120     void sendTouchBarMenuDataAddedUpdate(WebCore::HTMLMenuElement&);
1121     void sendTouchBarMenuDataRemovedUpdate(WebCore::HTMLMenuElement&);
1122     void sendTouchBarMenuItemDataAddedUpdate(WebCore::HTMLMenuItemElement&);
1123     void sendTouchBarMenuItemDataRemovedUpdate(WebCore::HTMLMenuItemElement&);
1124 #endif
1125
1126     void didReceiveSyncWebPageMessage(IPC::Connection&, IPC::Decoder&, std::unique_ptr<IPC::Encoder>&);
1127
1128 #if PLATFORM(IOS_FAMILY)
1129     void resetViewportDefaultConfiguration(WebFrame* mainFrame, bool hasMobileDocType = false);
1130     enum class ZoomToInitialScale { No, Yes };
1131     void viewportConfigurationChanged(ZoomToInitialScale = ZoomToInitialScale::No);
1132     void updateViewportSizeForCSSViewportUnits();
1133
1134     static void convertSelectionRectsToRootView(WebCore::FrameView*, Vector<WebCore::SelectionRect>&);
1135     RefPtr<WebCore::Range> rangeForWebSelectionAtPosition(const WebCore::IntPoint&, const WebCore::VisiblePosition&, SelectionFlags&);
1136     void getAssistedNodeInformation(AssistedNodeInformation&);
1137     void platformInitializeAccessibility();
1138     void handleSyntheticClick(WebCore::Node* nodeRespondingToClick, const WebCore::FloatPoint& location);
1139     void completeSyntheticClick(WebCore::Node* nodeRespondingToClick, const WebCore::FloatPoint& location, WebCore::SyntheticClickType);
1140     void sendTapHighlightForNodeIfNecessary(uint64_t requestID, WebCore::Node*);
1141     void resetTextAutosizing();
1142     WebCore::VisiblePosition visiblePositionInFocusedNodeForPoint(const WebCore::Frame&, const WebCore::IntPoint&, bool isInteractingWithAssistedNode);
1143     RefPtr<WebCore::Range> rangeForGranularityAtPoint(WebCore::Frame&, const WebCore::IntPoint&, uint32_t granularity, bool isInteractingWithAssistedNode);
1144 #endif
1145
1146 #if PLATFORM(IOS_FAMILY) && ENABLE(DATA_INTERACTION)
1147     void requestStartDataInteraction(const WebCore::IntPoint& clientPosition, const WebCore::IntPoint& globalPosition);
1148     void requestAdditionalItemsForDragSession(const WebCore::IntPoint& clientPosition, const WebCore::IntPoint& globalPosition);
1149 #endif
1150
1151 #if !PLATFORM(COCOA) && !PLATFORM(WPE)
1152     static const char* interpretKeyEvent(const WebCore::KeyboardEvent*);
1153 #endif
1154
1155     bool performDefaultBehaviorForKeyEvent(const WebKeyboardEvent&);
1156
1157 #if PLATFORM(MAC)
1158     bool executeKeypressCommandsInternal(const Vector<WebCore::KeypressCommand>&, WebCore::KeyboardEvent*);
1159 #endif
1160
1161     bool markLayersVolatileImmediatelyIfPossible();
1162     void layerVolatilityTimerFired();
1163     void callVolatilityCompletionHandlers(bool succeeded);
1164
1165     String sourceForFrame(WebFrame*);
1166
1167     void loadDataImpl(uint64_t navigationID, Ref<WebCore::SharedBuffer>&&, const String& MIMEType, const String& encodingName, const WebCore::URL& baseURL, const WebCore::URL& failingURL, const UserData&);
1168
1169     // Actions
1170     void tryClose();
1171     void platformDidReceiveLoadParameters(const LoadParameters&);
1172     void loadRequest(LoadParameters&&);
1173     void loadData(LoadParameters&&);
1174     void loadAlternateHTML(const LoadParameters&);
1175     void navigateToPDFLinkWithSimulatedClick(const String& url, WebCore::IntPoint documentPoint, WebCore::IntPoint screenPoint);
1176     void reload(uint64_t navigationID, uint32_t reloadOptions, SandboxExtension::Handle&&);
1177     void goToBackForwardItem(uint64_t navigationID, const WebCore::BackForwardItemIdentifier&, WebCore::FrameLoadType, WebCore::ShouldTreatAsContinuingLoad);
1178     void tryRestoreScrollPosition();
1179     void setInitialFocus(bool forward, bool isKeyboardEventValid, const WebKeyboardEvent&, CallbackID);
1180     void updateIsInWindow(bool isInitialState = false);
1181     void visibilityDidChange();
1182     void setActivityState(OptionSet<WebCore::ActivityState::Flag>, ActivityStateChangeID, const Vector<CallbackID>& callbackIDs);
1183     void validateCommand(const String&, CallbackID);
1184     void executeEditCommand(const String&, const String&);
1185     void setEditable(bool);
1186
1187     void increaseListLevel();
1188     void decreaseListLevel();
1189     void changeListType();
1190
1191     void setNeedsFontAttributes(bool);
1192
1193     void mouseEvent(const WebMouseEvent&);
1194     void keyEvent(const WebKeyboardEvent&);
1195
1196 #if ENABLE(IOS_TOUCH_EVENTS)
1197     void touchEventSync(const WebTouchEvent&, bool& handled);
1198     void updatePotentialTapSecurityOrigin(const WebTouchEvent&, bool wasHandled);
1199 #elif ENABLE(TOUCH_EVENTS)
1200     void touchEvent(const WebTouchEvent&);
1201 #endif
1202
1203 #if ENABLE(CONTEXT_MENUS)
1204     void contextMenuHidden() { m_isShowingContextMenu = false; }
1205     void contextMenuForKeyEvent();
1206 #endif
1207
1208     static bool scroll(WebCore::Page*, WebCore::ScrollDirection, WebCore::ScrollGranularity);
1209     static bool logicalScroll(WebCore::Page*, WebCore::ScrollLogicalDirection, WebCore::ScrollGranularity);
1210
1211     void loadURLInFrame(WebCore::URL&&, uint64_t frameID);
1212
1213     enum class WasRestoredByAPIRequest { No, Yes };
1214     void restoreSessionInternal(const Vector<BackForwardListItemState>&, WasRestoredByAPIRequest, WebBackForwardListProxy::OverwriteExistingItem);
1215     void restoreSession(const Vector<BackForwardListItemState>&);
1216     void didRemoveBackForwardItem(const WebCore::BackForwardItemIdentifier&);
1217     void updateBackForwardListForReattach(const Vector<WebKit::BackForwardListItemState>&);
1218     void setCurrentHistoryItemForReattach(WebKit::BackForwardListItemState&&);
1219
1220     void requestFontAttributesAtSelectionStart(CallbackID);
1221
1222 #if ENABLE(REMOTE_INSPECTOR)
1223     void setAllowsRemoteInspection(bool);
1224     void setRemoteInspectionNameOverride(const String&);
1225 #endif
1226
1227     void setDrawsBackground(bool);
1228
1229 #if PLATFORM(COCOA)
1230     void setTopContentInsetFenced(float, IPC::Attachment);
1231 #endif
1232     void setTopContentInset(float);
1233
1234     void viewWillStartLiveResize();
1235     void viewWillEndLiveResize();
1236
1237     void getContentsAsString(CallbackID);
1238 #if ENABLE(MHTML)
1239     void getContentsAsMHTMLData(CallbackID);
1240 #endif
1241     void getMainResourceDataOfFrame(uint64_t frameID, CallbackID);
1242     void getResourceDataFromFrame(uint64_t frameID, const String& resourceURL, CallbackID);
1243     void getRenderTreeExternalRepresentation(CallbackID);
1244     void getSelectionOrContentsAsString(CallbackID);
1245     void getSelectionAsWebArchiveData(CallbackID);
1246     void getSourceForFrame(uint64_t frameID, CallbackID);
1247     void getWebArchiveOfFrame(uint64_t frameID, CallbackID);
1248     void runJavaScript(const String&, bool forceUserGesture, std::optional<String> worldName, CallbackID);
1249     void runJavaScriptInMainFrame(const String&, bool forceUserGesture, CallbackID);
1250     void runJavaScriptInMainFrameScriptWorld(const String&, bool forceUserGesture, const String& worldName, CallbackID);
1251     void forceRepaint(CallbackID);
1252     void takeSnapshot(WebCore::IntRect snapshotRect, WebCore::IntSize bitmapSize, uint32_t options, CallbackID);
1253
1254     void preferencesDidChange(const WebPreferencesStore&);
1255     void updatePreferences(const WebPreferencesStore&);
1256     void updatePreferencesGenerated(const WebPreferencesStore&);
1257
1258 #if PLATFORM(IOS_FAMILY)
1259     bool parentProcessHasServiceWorkerEntitlement() const;
1260 #else
1261     bool parentProcessHasServiceWorkerEntitlement() const { return true; }
1262 #endif
1263
1264     void didReceivePolicyDecision(uint64_t frameID, uint64_t listenerID, WebCore::PolicyAction, uint64_t navigationID, const DownloadID&, std::optional<WebsitePoliciesData>&&);
1265     void continueWillSubmitForm(uint64_t frameID, uint64_t listenerID);
1266     void setUserAgent(const String&);
1267     void setCustomTextEncodingName(const String&);
1268     void suspendActiveDOMObjectsAndAnimations();
1269     void resumeActiveDOMObjectsAndAnimations();
1270
1271 #if PLATFORM(COCOA)
1272     void performDictionaryLookupAtLocation(const WebCore::FloatPoint&);
1273     void performDictionaryLookupOfCurrentSelection();
1274     void performDictionaryLookupForRange(WebCore::Frame&, WebCore::Range&, NSDictionary *options, WebCore::TextIndicatorPresentationTransition);
1275     WebCore::DictionaryPopupInfo dictionaryPopupInfoForRange(WebCore::Frame&, WebCore::Range&, NSDictionary *options, WebCore::TextIndicatorPresentationTransition);
1276 #if ENABLE(PDFKIT_PLUGIN)
1277     WebCore::DictionaryPopupInfo dictionaryPopupInfoForSelectionInPDFPlugin(PDFSelection *, PDFPlugin&, NSDictionary *options, WebCore::TextIndicatorPresentationTransition);
1278 #endif
1279
1280     void windowAndViewFramesChanged(const WebCore::FloatRect& windowFrameInScreenCoordinates, const WebCore::FloatRect& windowFrameInUnflippedScreenCoordinates, const WebCore::FloatRect& viewFrameInWindowCoordinates, const WebCore::FloatPoint& accessibilityViewCoordinates);
1281
1282     RetainPtr<PDFDocument> pdfDocumentForPrintingFrame(WebCore::Frame*);
1283     void computePagesForPrintingPDFDocument(uint64_t frameID, const PrintInfo&, Vector<WebCore::IntRect>& resultPageRects);
1284     void drawPDFDocument(CGContextRef, PDFDocument *, const PrintInfo&, const WebCore::IntRect&);
1285     void drawPagesToPDFFromPDFDocument(CGContextRef, PDFDocument *, const PrintInfo&, uint32_t first, uint32_t count);
1286 #endif
1287
1288     void setMainFrameIsScrollable(bool);
1289
1290     void unapplyEditCommand(uint64_t commandID);
1291     void reapplyEditCommand(uint64_t commandID);
1292     void didRemoveEditCommand(uint64_t commandID);
1293
1294     void findString(const String&, uint32_t findOptions, uint32_t maxMatchCount);
1295     void findStringMatches(const String&, uint32_t findOptions, uint32_t maxMatchCount);
1296     void getImageForFindMatch(uint32_t matchIndex);
1297     void selectFindMatch(uint32_t matchIndex);
1298     void hideFindUI();
1299     void countStringMatches(const String&, uint32_t findOptions, uint32_t maxMatchCount);
1300
1301 #if USE(COORDINATED_GRAPHICS)
1302     void sendViewportAttributesChanged(const WebCore::ViewportArguments&);
1303 #endif
1304
1305     void didChangeSelectedIndexForActivePopupMenu(int32_t newIndex);
1306     void setTextForActivePopupMenu(int32_t index);
1307
1308 #if PLATFORM(GTK)
1309     void failedToShowPopupMenu();
1310 #endif
1311
1312     void didChooseFilesForOpenPanel(const Vector<String>&);
1313     void didCancelForOpenPanel();
1314
1315 #if PLATFORM(IOS_FAMILY)
1316     void didChooseFilesForOpenPanelWithDisplayStringAndIcon(const Vector<String>&, const String& displayString, const IPC::DataReference& iconData);
1317 #endif
1318
1319 #if ENABLE(SANDBOX_EXTENSIONS)
1320     void extendSandboxForFilesFromOpenPanel(SandboxExtension::HandleArray&&);
1321 #endif
1322
1323     void didReceiveGeolocationPermissionDecision(uint64_t geolocationID, bool allowed);
1324
1325     void didReceiveNotificationPermissionDecision(uint64_t notificationID, bool allowed);
1326
1327 #if ENABLE(MEDIA_STREAM)
1328     void userMediaAccessWasGranted(uint64_t userMediaID, WebCore::CaptureDevice&& audioDeviceUID, WebCore::CaptureDevice&& videoDeviceUID, String&& mediaDeviceIdentifierHashSalt);
1329     void userMediaAccessWasDenied(uint64_t userMediaID, uint64_t reason, String&& invalidConstraint);
1330
1331     void didCompleteMediaDeviceEnumeration(uint64_t userMediaID, const Vector<WebCore::CaptureDevice>& devices, String&& deviceIdentifierHashSalt, bool originHasPersistentAccess);
1332 #endif
1333
1334 #if ENABLE(MEDIA_STREAM) && ENABLE(SANDBOX_EXTENSIONS)
1335     void grantUserMediaDeviceSandboxExtensions(MediaDeviceSandboxExtensions&&);
1336     void revokeUserMediaDeviceSandboxExtensions(const Vector<String>&);
1337 #endif
1338
1339 #if ENABLE(WEB_RTC)
1340     void disableICECandidateFiltering();
1341     void enableICECandidateFiltering();
1342 #endif
1343
1344 #if ENABLE(WEB_RTC) && USE(LIBWEBRTC)
1345     void disableEnumeratingAllNetworkInterfaces();
1346     void enableEnumeratingAllNetworkInterfaces();
1347 #endif
1348
1349     void advanceToNextMisspelling(bool startBeforeSelection);
1350     void changeSpellingToWord(const String& word);
1351
1352 #if USE(APPKIT)
1353     void uppercaseWord();
1354     void lowercaseWord();
1355     void capitalizeWord();
1356 #endif
1357
1358 #if ENABLE(CONTEXT_MENUS)
1359     void didSelectItemFromActiveContextMenu(const WebContextMenuItemData&);
1360 #endif
1361
1362     void changeSelectedIndex(int32_t index);
1363     void setCanStartMediaTimerFired();
1364
1365     static bool platformCanHandleRequest(const WebCore::ResourceRequest&);
1366
1367     static PluginView* focusedPluginViewForFrame(WebCore::Frame&);
1368
1369     static RefPtr<WebCore::Range> rangeFromEditingRange(WebCore::Frame&, const EditingRange&, EditingRangeIsRelativeTo = EditingRangeIsRelativeTo::EditableRoot);
1370
1371     void reportUsedFeatures();
1372
1373     void updateWebsitePolicies(WebsitePoliciesData&&);
1374
1375     void changeFont(WebCore::FontChanges&&);
1376     void changeFontAttributes(WebCore::FontAttributeChanges&&);
1377
1378 #if PLATFORM(MAC)
1379     void performImmediateActionHitTestAtLocation(WebCore::FloatPoint);
1380     std::tuple<RefPtr<WebCore::Range>, NSDictionary *> lookupTextAtLocation(WebCore::FloatPoint);
1381     void immediateActionDidUpdate();
1382     void immediateActionDidCancel();
1383     void immediateActionDidComplete();
1384
1385     void dataDetectorsDidPresentUI(WebCore::PageOverlay::PageOverlayID);
1386     void dataDetectorsDidChangeUI(WebCore::PageOverlay::PageOverlayID);
1387     void dataDetectorsDidHideUI(WebCore::PageOverlay::PageOverlayID);
1388
1389     void handleAcceptedCandidate(WebCore::TextCheckingResult);
1390 #endif
1391
1392 #if PLATFORM(COCOA)
1393     void requestActiveNowPlayingSessionInfo(CallbackID);
1394 #endif
1395
1396     void setShouldDispatchFakeMouseMoveEvents(bool dispatch) { m_shouldDispatchFakeMouseMoveEvents = dispatch; }
1397
1398 #if ENABLE(WIRELESS_PLAYBACK_TARGET) && !PLATFORM(IOS_FAMILY)
1399     void playbackTargetSelected(uint64_t, const WebCore::MediaPlaybackTargetContext& outputDevice) const;
1400     void playbackTargetAvailabilityDidChange(uint64_t, bool);
1401     void setShouldPlayToPlaybackTarget(uint64_t, bool);
1402 #endif
1403
1404     void clearWheelEventTestTrigger();
1405
1406     void setShouldScaleViewToFitDocument(bool);
1407
1408     void pageStoppedScrolling();
1409
1410 #if ENABLE(VIDEO) && USE(GSTREAMER)
1411     void didEndRequestInstallMissingMediaPlugins(uint32_t result);
1412 #endif
1413
1414     void setResourceCachingDisabled(bool);
1415     void setUserInterfaceLayoutDirection(uint32_t);
1416
1417     bool canPluginHandleResponse(const WebCore::ResourceResponse&);
1418
1419 #if USE(QUICK_LOOK)
1420     void didReceivePasswordForQuickLookDocument(const String&);
1421 #endif
1422
1423     void frameBecameRemote(uint64_t frameID, WebCore::GlobalFrameIdentifier&& remoteFrameIdentifier, WebCore::GlobalWindowIdentifier&& remoteWindowIdentifier);
1424
1425     void registerURLSchemeHandler(uint64_t identifier, const String& scheme);
1426
1427     void urlSchemeTaskDidPerformRedirection(uint64_t handlerIdentifier, uint64_t taskIdentifier, WebCore::ResourceResponse&&, WebCore::ResourceRequest&&);
1428     void urlSchemeTaskDidReceiveResponse(uint64_t handlerIdentifier, uint64_t taskIdentifier, const WebCore::ResourceResponse&);
1429     void urlSchemeTaskDidReceiveData(uint64_t handlerIdentifier, uint64_t taskIdentifier, const IPC::DataReference&);
1430     void urlSchemeTaskDidComplete(uint64_t handlerIdentifier, uint64_t taskIdentifier, const WebCore::ResourceError&);
1431
1432     void setIsSuspended(bool);
1433
1434     RefPtr<WebImage> snapshotAtSize(const WebCore::IntRect&, const WebCore::IntSize& bitmapSize, SnapshotOptions);
1435     RefPtr<WebImage> snapshotNode(WebCore::Node&, SnapshotOptions, unsigned maximumPixelCount = std::numeric_limits<unsigned>::max());
1436 #if USE(CF)
1437     RetainPtr<CFDataRef> pdfSnapshotAtSize(const WebCore::IntRect&, const WebCore::IntSize& bitmapSize, SnapshotOptions);
1438 #endif
1439
1440 #if ENABLE(ATTACHMENT_ELEMENT)
1441     RefPtr<WebCore::HTMLAttachmentElement> attachmentElementWithIdentifier(const String& identifier) const;
1442 #endif
1443
1444     bool canShowMIMEType(const String&, const Function<bool(const String&, WebCore::PluginData::AllowedPluginTypes)>& supportsPlugin) const;
1445
1446     uint64_t m_pageID;
1447
1448     std::unique_ptr<WebCore::Page> m_page;
1449     RefPtr<WebFrame> m_mainFrame;
1450
1451     RefPtr<WebPageGroupProxy> m_pageGroup;
1452
1453     String m_userAgent;
1454
1455     WebCore::IntSize m_viewSize;
1456     std::unique_ptr<DrawingArea> m_drawingArea;
1457     bool m_shouldResetDrawingArea { false };
1458
1459     HashSet<PluginView*> m_pluginViews;
1460     bool m_hasSeenPlugin { false };
1461
1462     HashMap<uint64_t, RefPtr<WebCore::TextCheckingRequest>> m_pendingTextCheckingRequestMap;
1463
1464     bool m_useFixedLayout { false };
1465     bool m_drawsBackground { true };
1466
1467     WebCore::Color m_underlayColor;
1468
1469     bool m_isInRedo { false };
1470     bool m_isClosed { false };
1471     bool m_tabToLinks { false };
1472     
1473     bool m_asynchronousPluginInitializationEnabled { false };
1474     bool m_asynchronousPluginInitializationEnabledForAllPlugins { false };
1475     bool m_artificialPluginInitializationDelayEnabled { false };
1476     bool m_scrollingPerformanceLoggingEnabled { false };
1477     bool m_mainFrameIsScrollable { true };
1478
1479     bool m_alwaysShowsHorizontalScroller { false };
1480     bool m_alwaysShowsVerticalScroller { false };
1481
1482 #if PLATFORM(IOS_FAMILY)
1483     bool m_ignoreViewportScalingConstraints { false };
1484 #endif
1485
1486 #if ENABLE(PRIMARY_SNAPSHOTTED_PLUGIN_HEURISTIC)
1487     bool m_readyToFindPrimarySnapshottedPlugin { false };
1488     bool m_didFindPrimarySnapshottedPlugin { false };
1489     unsigned m_numberOfPrimarySnapshotDetectionAttempts { 0 };
1490     String m_primaryPlugInPageOrigin;
1491     String m_primaryPlugInOrigin;
1492     String m_primaryPlugInMimeType;
1493     RunLoop::Timer<WebPage> m_determinePrimarySnapshottedPlugInTimer;
1494 #endif
1495
1496     // The layer hosting mode.
1497     LayerHostingMode m_layerHostingMode;
1498
1499 #if PLATFORM(COCOA)
1500     bool m_pdfPluginEnabled { false };
1501     bool m_hasCachedWindowFrame { false };
1502
1503     // The frame of the containing window in screen coordinates.
1504     WebCore::FloatRect m_windowFrameInScreenCoordinates;
1505
1506     // The frame of the containing window in unflipped screen coordinates.
1507     WebCore::FloatRect m_windowFrameInUnflippedScreenCoordinates;
1508
1509     // The frame of the view in window coordinates.
1510     WebCore::FloatRect m_viewFrameInWindowCoordinates;
1511
1512     // The accessibility position of the view.
1513     WebCore::FloatPoint m_accessibilityPosition;
1514     
1515     RetainPtr<WKAccessibilityWebPageObject> m_mockAccessibilityElement;
1516
1517     UniqueRef<ViewGestureGeometryCollector> m_viewGestureGeometryCollector;
1518
1519     RetainPtr<NSDictionary> m_dataDetectionContext;
1520 #endif
1521
1522 #if HAVE(ACCESSIBILITY) && PLATFORM(GTK)
1523     GRefPtr<WebPageAccessibilityObject> m_accessibilityObject;
1524 #endif
1525
1526 #if PLATFORM(GTK) && USE(TEXTURE_MAPPER_GL)
1527     // Our view's window in the UI process.
1528     uint64_t m_nativeWindowHandle { 0 };
1529 #endif
1530
1531 #if !PLATFORM(IOS_FAMILY)
1532     RefPtr<PageBanner> m_headerBanner;
1533     RefPtr<PageBanner> m_footerBanner;
1534 #endif
1535
1536     RunLoop::Timer<WebPage> m_setCanStartMediaTimer;
1537     bool m_mayStartMediaWhenInWindow { false };
1538
1539     HashMap<uint64_t, RefPtr<WebUndoStep>> m_undoStepMap;
1540
1541 #if ENABLE(CONTEXT_MENUS)
1542     std::unique_ptr<API::InjectedBundle::PageContextMenuClient> m_contextMenuClient;
1543 #endif
1544     std::unique_ptr<API::InjectedBundle::EditorClient> m_editorClient;
1545     std::unique_ptr<API::InjectedBundle::FormClient> m_formClient;
1546     std::unique_ptr<API::InjectedBundle::PageLoaderClient> m_loaderClient;
1547     InjectedBundlePagePolicyClient m_policyClient;
1548     std::unique_ptr<API::InjectedBundle::ResourceLoadClient> m_resourceLoadClient;
1549     std::unique_ptr<API::InjectedBundle::PageUIClient> m_uiClient;
1550 #if ENABLE(FULLSCREEN_API)
1551     InjectedBundlePageFullScreenClient m_fullScreenClient;
1552 #endif
1553
1554     UniqueRef<FindController> m_findController;
1555
1556     RefPtr<WebInspector> m_inspector;
1557     RefPtr<WebInspectorUI> m_inspectorUI;
1558     RefPtr<RemoteWebInspectorUI> m_remoteInspectorUI;
1559
1560 #if (PLATFORM(IOS_FAMILY) && HAVE(AVKIT)) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))
1561     RefPtr<PlaybackSessionManager> m_playbackSessionManager;
1562     RefPtr<VideoFullscreenManager> m_videoFullscreenManager;
1563 #endif
1564
1565 #if PLATFORM(IOS_FAMILY)
1566     bool m_allowsMediaDocumentInlinePlayback { false };
1567     RefPtr<WebCore::Range> m_startingGestureRange;
1568 #endif
1569
1570 #if ENABLE(FULLSCREEN_API)
1571     RefPtr<WebFullScreenManager> m_fullScreenManager;
1572 #endif
1573
1574     RefPtr<WebPopupMenu> m_activePopupMenu;
1575
1576 #if ENABLE(CONTEXT_MENUS)
1577     RefPtr<WebContextMenu> m_contextMenu;
1578 #endif
1579
1580 #if ENABLE(INPUT_TYPE_COLOR)
1581     WebColorChooser* m_activeColorChooser { nullptr };
1582 #endif
1583
1584 #if ENABLE(DATALIST_ELEMENT)
1585     WebDataListSuggestionPicker* m_activeDataListSuggestionPicker { nullptr };
1586 #endif
1587
1588     RefPtr<WebOpenPanelResultListener> m_activeOpenPanelResultListener;
1589     RefPtr<NotificationPermissionRequestManager> m_notificationPermissionRequestManager;
1590
1591     Ref<WebUserContentController> m_userContentController;
1592
1593 #if ENABLE(GEOLOCATION)
1594     UniqueRef<GeolocationPermissionRequestManager> m_geolocationPermissionRequestManager;
1595 #endif
1596
1597 #if ENABLE(MEDIA_STREAM)
1598     std::unique_ptr<UserMediaPermissionRequestManager> m_userMediaPermissionRequestManager;
1599 #endif
1600
1601     std::unique_ptr<WebCore::PrintContext> m_printContext;
1602 #if PLATFORM(GTK)
1603     RefPtr<WebPrintOperationGtk> m_printOperation;
1604 #endif
1605
1606     SandboxExtensionTracker m_sandboxExtensionTracker;
1607
1608     RefPtr<SandboxExtension> m_pendingDropSandboxExtension;
1609     Vector<RefPtr<SandboxExtension>> m_pendingDropExtensionsForFileUpload;
1610
1611     PAL::HysteresisActivity m_pageScrolledHysteresis;
1612
1613     bool m_canRunBeforeUnloadConfirmPanel { false };
1614
1615     bool m_canRunModal { false };
1616     bool m_isRunningModal { false };
1617
1618 #if ENABLE(DRAG_SUPPORT)
1619     bool m_isStartingDrag { false };
1620 #endif
1621
1622     bool m_cachedMainFrameIsPinnedToLeftSide { true };
1623     bool m_cachedMainFrameIsPinnedToRightSide { true };
1624     bool m_cachedMainFrameIsPinnedToTopSide { true };
1625     bool m_cachedMainFrameIsPinnedToBottomSide { true };
1626     bool m_canShortCircuitHorizontalWheelEvents { false };
1627     bool m_hasWheelEventHandlers { false };
1628
1629     unsigned m_cachedPageCount { 0 };
1630
1631     HashSet<unsigned long> m_trackedNetworkResourceRequestIdentifiers;
1632
1633     WebCore::IntSize m_viewLayoutSize;
1634     bool m_autoSizingShouldExpandToViewHeight { false };
1635     std::optional<WebCore::IntSize> m_viewportSizeForCSSViewportUnits;
1636
1637     bool m_userIsInteracting { false };
1638     bool m_isAssistingNodeDueToUserInteraction { false };
1639     bool m_hasEverFocusedElementDueToUserInteractionSincePageTransition { false };
1640     bool m_needsHiddenContentEditableQuirk { false };
1641     bool m_needsPlainTextQuirk { false };
1642     bool m_changingActivityState { false };
1643
1644 #if ENABLE(CONTEXT_MENUS)
1645     bool m_isShowingContextMenu { false };
1646 #endif
1647
1648     RefPtr<WebCore::Node> m_assistedNode;
1649     bool m_hasPendingBlurNotification { false };
1650     bool m_hasPendingEditorStateUpdate { false };
1651     
1652 #if PLATFORM(IOS_FAMILY)
1653     RefPtr<WebCore::Range> m_currentWordRange;
1654     RefPtr<WebCore::Node> m_interactionNode;
1655     WebCore::IntPoint m_lastInteractionLocation;
1656     
1657     enum SelectionAnchor { Start, End };
1658     SelectionAnchor m_selectionAnchor { Start };
1659
1660     RefPtr<WebCore::Node> m_potentialTapNode;
1661     WebCore::FloatPoint m_potentialTapLocation;
1662     RefPtr<WebCore::SecurityOrigin> m_potentialTapSecurityOrigin;
1663
1664     WebCore::ViewportConfiguration m_viewportConfiguration;
1665     bool m_hasReceivedVisibleContentRectsAfterDidCommitLoad { false };
1666     bool m_scaleWasSetByUIProcess { false };
1667     bool m_userHasChangedPageScaleFactor { false };
1668     bool m_hasStablePageScaleFactor { true };
1669     bool m_useTestingViewportConfiguration { false };
1670     bool m_isInStableState { true };
1671     bool m_forceAlwaysUserScalable { false };
1672     MonotonicTime m_oldestNonStableUpdateVisibleContentRectsTimestamp;
1673     Seconds m_estimatedLatency { 0 };
1674     WebCore::FloatSize m_screenSize;
1675     WebCore::FloatSize m_availableScreenSize;
1676     WebCore::FloatSize m_overrideScreenSize;
1677     RefPtr<WebCore::Range> m_currentBlockSelection;
1678     WebCore::IntRect m_blockRectForTextSelection;
1679
1680     RefPtr<WebCore::Range> m_initialSelection;
1681     WebCore::VisibleSelection m_storedSelectionForAccessibility { WebCore::VisibleSelection() };
1682     WebCore::IntSize m_blockSelectionDesiredSize;
1683     WebCore::FloatSize m_maximumUnobscuredSize;
1684     int32_t m_deviceOrientation { 0 };
1685     bool m_inDynamicSizeUpdate { false };
1686     HashMap<std::pair<WebCore::IntSize, double>, WebCore::IntPoint> m_dynamicSizeUpdateHistory;
1687     RefPtr<WebCore::Node> m_pendingSyntheticClickNode;
1688     WebCore::FloatPoint m_pendingSyntheticClickLocation;
1689     WebCore::FloatRect m_previousExposedContentRect;
1690     uint64_t m_currentAssistedNodeIdentifier { 0 };
1691     std::optional<DynamicViewportSizeUpdateID> m_pendingDynamicViewportSizeUpdateID;
1692     double m_lastTransactionPageScaleFactor { 0 };
1693     uint64_t m_lastTransactionIDWithScaleChange { 0 };
1694 #endif
1695
1696     WebCore::Timer m_layerVolatilityTimer;
1697     Vector<WTF::Function<void (bool)>> m_markLayersAsVolatileCompletionHandlers;
1698     bool m_isSuspendedUnderLock { false };
1699
1700     HashSet<String, ASCIICaseInsensitiveHash> m_mimeTypesWithCustomContentProviders;
1701     WebCore::Color m_backgroundColor { WebCore::Color::white };
1702
1703     HashSet<unsigned> m_activeRenderingSuppressionTokens;
1704     unsigned m_maximumRenderingSuppressionToken { 0 };
1705     
1706     WebCore::ScrollPinningBehavior m_scrollPinningBehavior { WebCore::DoNotPin };
1707     std::optional<WebCore::ScrollbarOverlayStyle> m_scrollbarOverlayStyle;
1708
1709     bool m_useAsyncScrolling { false };
1710
1711     OptionSet<WebCore::ActivityState::Flag> m_activityState;
1712
1713     bool m_processSuppressionEnabled;
1714     UserActivity m_userActivity;
1715     PAL::HysteresisActivity m_userActivityHysteresis;
1716
1717     uint64_t m_pendingNavigationID { 0 };
1718
1719     bool m_mainFrameProgressCompleted { false };
1720     bool m_shouldDispatchFakeMouseMoveEvents { true };
1721     bool m_isEditorStateMissingPostLayoutData { false };
1722     bool m_isSelectingTextWhileInsertingAsynchronously { false };
1723
1724     enum class EditorStateIsContentEditable { No, Yes, Unset };
1725     mutable EditorStateIsContentEditable m_lastEditorStateWasContentEditable { EditorStateIsContentEditable::Unset };
1726
1727 #if PLATFORM(GTK)
1728     bool m_inputMethodEnabled { false };
1729 #endif
1730
1731 #if ENABLE(VIDEO) && USE(GSTREAMER)
1732     RefPtr<WebCore::MediaPlayerRequestInstallMissingPluginsCallback> m_installMediaPluginsCallback;
1733 #endif
1734
1735 #if USE(OS_STATE)
1736     WallTime m_loadCommitTime;
1737 #endif
1738
1739     WebCore::UserInterfaceLayoutDirection m_userInterfaceLayoutDirection { WebCore::UserInterfaceLayoutDirection::LTR };
1740
1741     const String m_overrideContentSecurityPolicy;
1742     const std::optional<double> m_cpuLimit;
1743
1744     HashMap<String, RefPtr<WebURLSchemeHandlerProxy>> m_schemeToURLSchemeHandlerProxyMap;
1745     HashMap<uint64_t, WebURLSchemeHandlerProxy*> m_identifierToURLSchemeHandlerProxyMap;
1746
1747     HashMap<uint64_t, WTF::Function<void(bool granted)>> m_storageAccessResponseCallbackMap;
1748     HashMap<ShareSheetCallbackID, WTF::Function<void(bool completed)>> m_shareSheetResponseCallbackMap;
1749
1750 #if ENABLE(APPLICATION_MANIFEST)
1751     HashMap<uint64_t, uint64_t> m_applicationManifestFetchCallbackMap;
1752 #endif
1753
1754     bool m_isSuspended { false };
1755     bool m_needsFontAttributes { false };
1756 #if PLATFORM(MAC)
1757     bool m_shouldAttachDrawingAreaOnPageTransition { false };
1758 #endif
1759 };
1760
1761 } // namespace WebKit
1762