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