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