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