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