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