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