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