Add globally-unique HistoryItem identifiers (and have WebKit2 adopt them).
[WebKit-https.git] / Source / WebKit / UIProcess / WebPageProxy.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 "APIObject.h"
29 #include "AssistedNodeInformation.h"
30 #include "AutoCorrectionCallback.h"
31 #include "Connection.h"
32 #include "ContextMenuContextData.h"
33 #include "DownloadID.h"
34 #include "DragControllerAction.h"
35 #include "EditingRange.h"
36 #include "EditorState.h"
37 #include "GeolocationPermissionRequestManagerProxy.h"
38 #include "HiddenPageThrottlingAutoIncreasesCounter.h"
39 #include "LayerTreeContext.h"
40 #include "MessageSender.h"
41 #include "NotificationPermissionRequestManagerProxy.h"
42 #include "PageLoadState.h"
43 #include "ProcessTerminationReason.h"
44 #include "ProcessThrottler.h"
45 #include "SandboxExtension.h"
46 #include "ShareableBitmap.h"
47 #include "SuspendedPageProxy.h"
48 #include "SystemPreviewController.h"
49 #include "UserMediaPermissionRequestManagerProxy.h"
50 #include "VisibleContentRectUpdateInfo.h"
51 #include "VisibleWebPageCounter.h"
52 #include "WKBase.h"
53 #include "WKPagePrivate.h"
54 #include "WebColorPicker.h"
55 #include "WebContextMenuItemData.h"
56 #include "WebCoreArgumentCoders.h"
57 #include "WebFrameProxy.h"
58 #include "WebPageCreationParameters.h"
59 #include "WebPageDiagnosticLoggingClient.h"
60 #include "WebPageInjectedBundleClient.h"
61 #include "WebPaymentCoordinatorProxy.h"
62 #include "WebPreferences.h"
63 #include <WebCore/AlternativeTextClient.h> // FIXME: Needed by WebPageProxyMessages.h for DICTATION_ALTERNATIVES.
64 #include "WebPageProxyMessages.h"
65 #include "WebPopupMenuProxy.h"
66 #include "WebProcessLifetimeTracker.h"
67 #include "WebsitePoliciesData.h"
68 #include <WebCore/ActivityState.h>
69 #include <WebCore/AutoplayEvent.h>
70 #include <WebCore/Color.h>
71 #include <WebCore/DragActions.h>
72 #include <WebCore/EventTrackingRegions.h>
73 #include <WebCore/FrameLoaderTypes.h>
74 #include <WebCore/FrameView.h> // FIXME: Move LayoutViewportConstraint to its own file and stop including this.
75 #include <WebCore/LayoutPoint.h>
76 #include <WebCore/LayoutSize.h>
77 #include <WebCore/MediaPlaybackTargetContext.h>
78 #include <WebCore/MediaProducer.h>
79 #include <WebCore/PlatformScreen.h>
80 #include <WebCore/ScrollTypes.h>
81 #include <WebCore/SearchPopupMenu.h>
82 #include <WebCore/TextChecking.h>
83 #include <WebCore/TextGranularity.h>
84 #include <WebCore/URL.h>
85 #include <WebCore/UserInterfaceLayoutDirection.h>
86 #include <memory>
87 #include <wtf/CompletionHandler.h>
88 #include <wtf/HashMap.h>
89 #include <wtf/HashSet.h>
90 #include <wtf/MonotonicTime.h>
91 #include <wtf/Optional.h>
92 #include <wtf/ProcessID.h>
93 #include <wtf/Ref.h>
94 #include <wtf/RefPtr.h>
95 #include <wtf/Vector.h>
96 #include <wtf/text/WTFString.h>
97
98 OBJC_CLASS NSView;
99 OBJC_CLASS _WKRemoteObjectRegistry;
100
101 #if ENABLE(DRAG_SUPPORT)
102 #include <WebCore/DragActions.h>
103 #endif
104
105 #if ENABLE(TOUCH_EVENTS)
106 #include "NativeWebTouchEvent.h"
107 #endif
108
109 #if PLATFORM(COCOA)
110 #include "LayerRepresentation.h"
111 #include "TouchBarMenuData.h"
112 #include "TouchBarMenuItemData.h"
113 #endif
114
115 #if PLATFORM(GTK)
116 #include "ArgumentCodersGtk.h"
117 #endif
118
119 #if ENABLE(WIRELESS_PLAYBACK_TARGET) && !PLATFORM(IOS)
120 #include <WebCore/MediaPlaybackTargetPicker.h>
121 #include <WebCore/WebMediaSessionManagerClient.h>
122 #endif
123
124 #if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101400
125 #include "DisplayLink.h"
126 #endif
127
128 #if ENABLE(MEDIA_SESSION)
129 namespace WebCore {
130 class MediaSessionMetadata;
131 }
132 #endif
133
134 namespace API {
135 class ContextMenuClient;
136 class FindClient;
137 class FindMatchesClient;
138 class FormClient;
139 class FullscreenClient;
140 class HistoryClient;
141 class IconLoadingClient;
142 class LoaderClient;
143 class Navigation;
144 class NavigationClient;
145 class PolicyClient;
146 class UIClient;
147 class URLRequest;
148 }
149
150 namespace IPC {
151 class Decoder;
152 class Connection;
153 }
154
155 namespace WebCore {
156 class AuthenticationChallenge;
157 class Cursor;
158 class DragData;
159 class FloatRect;
160 class GraphicsLayer;
161 class IntSize;
162 class ProtectionSpace;
163 class RunLoopObserver;
164 class SharedBuffer;
165 class TextIndicator;
166 class ValidationBubble;
167
168 enum SelectionDirection : uint8_t;
169
170 enum class AutoplayEvent;
171 enum class HasInsecureContent;
172 enum class NavigationPolicyCheck;
173 enum class NotificationDirection;
174 enum class ShouldSample;
175
176 struct ApplicationManifest;
177 struct BackForwardItemIdentifier;
178 struct DictionaryPopupInfo;
179 struct ExceptionDetails;
180 struct FileChooserSettings;
181 struct GlobalWindowIdentifier;
182 struct MediaStreamRequest;
183 struct SecurityOriginData;
184 struct TextAlternativeWithRange;
185 struct TextCheckingResult;
186 struct ViewportAttributes;
187 struct WindowFeatures;
188
189 template <typename> class RectEdges;
190 using FloatBoxExtent = RectEdges<float>;
191 }
192
193 #if ENABLE(ATTACHMENT_ELEMENT)
194 namespace WebCore {
195 struct AttachmentDisplayOptions;
196 struct AttachmentInfo;
197 }
198 #endif
199
200 #if PLATFORM(GTK)
201 typedef GtkWidget* PlatformWidget;
202 #endif
203
204 #if PLATFORM(GTK) || PLATFORM(WPE)
205 typedef struct OpaqueJSContext* JSGlobalContextRef;
206 #endif
207
208 namespace WebKit {
209 class CertificateInfo;
210 class DrawingAreaProxy;
211 class NativeWebGestureEvent;
212 class NativeWebKeyboardEvent;
213 class NativeWebMouseEvent;
214 class NativeWebWheelEvent;
215 class PageClient;
216 class RemoteLayerTreeScrollingPerformanceData;
217 class RemoteLayerTreeTransaction;
218 class RemoteScrollingCoordinatorProxy;
219 class UserData;
220 class ViewSnapshot;
221 class VisitedLinkStore;
222 class WebBackForwardList;
223 class WebBackForwardListItem;
224 class WebContextMenuProxy;
225 class WebEditCommandProxy;
226 class WebFullScreenManagerProxy;
227 class PlaybackSessionManagerProxy;
228 class WebNavigationState;
229 class VideoFullscreenManagerProxy;
230 class WebCredentialsMessengerProxy;
231 class WebKeyboardEvent;
232 class WebURLSchemeHandler;
233 class WebMouseEvent;
234 class WebOpenPanelResultListenerProxy;
235 class WebPageGroup;
236 class WebProcessProxy;
237 class WebUserContentControllerProxy;
238 class WebWheelEvent;
239 class WebsiteDataStore;
240 class GamepadData;
241
242 struct AttributedString;
243 struct ColorSpaceData;
244 struct EditingRange;
245 struct EditorState;
246 struct FrameInfoData;
247 struct InteractionInformationRequest;
248 struct LoadParameters;
249 struct PlatformPopupMenuData;
250 struct PrintInfo;
251 struct WebPopupItem;
252 struct URLSchemeTaskParameters;
253
254 #if USE(QUICK_LOOK)
255 class QuickLookDocumentData;
256 #endif
257
258 typedef GenericCallback<uint64_t> UnsignedCallback;
259 typedef GenericCallback<EditingRange> EditingRangeCallback;
260 typedef GenericCallback<const String&> StringCallback;
261 typedef GenericCallback<API::SerializedScriptValue*, bool, const WebCore::ExceptionDetails&> ScriptValueCallback;
262
263 #if ENABLE(ATTACHMENT_ELEMENT)
264 typedef GenericCallback<const WebCore::AttachmentInfo&> AttachmentInfoCallback;
265 #endif
266
267 #if PLATFORM(GTK)
268 typedef GenericCallback<API::Error*> PrintFinishedCallback;
269 #endif
270
271 #if ENABLE(TOUCH_EVENTS)
272 struct QueuedTouchEvents {
273     QueuedTouchEvents(const NativeWebTouchEvent& event)
274         : forwardedEvent(event)
275     {
276     }
277     NativeWebTouchEvent forwardedEvent;
278     Vector<NativeWebTouchEvent> deferredTouchEvents;
279 };
280 #endif
281
282 typedef GenericCallback<const String&, bool, int32_t> ValidateCommandCallback;
283 typedef GenericCallback<const WebCore::IntRect&, const EditingRange&> RectForCharacterRangeCallback;
284
285 #if ENABLE(APPLICATION_MANIFEST)
286 typedef GenericCallback<const std::optional<WebCore::ApplicationManifest>&> ApplicationManifestCallback;
287 #endif
288
289 #if PLATFORM(MAC)
290 typedef GenericCallback<const AttributedString&, const EditingRange&> AttributedStringForCharacterRangeCallback;
291 typedef GenericCallback<const String&, double, bool> FontAtSelectionCallback;
292 #endif
293
294 #if PLATFORM(IOS)
295 typedef GenericCallback<const WebCore::IntPoint&, uint32_t, uint32_t, uint32_t> GestureCallback;
296 typedef GenericCallback<const WebCore::IntPoint&, uint32_t, uint32_t> TouchesCallback;
297 typedef GenericCallback<const Vector<WebCore::SelectionRect>&> SelectionRectsCallback;
298 typedef GenericCallback<const AssistedNodeInformation&> AssistedNodeInformationCallback;
299 struct NodeAssistanceArguments {
300     AssistedNodeInformation m_nodeInformation;
301     bool m_userIsInteracting;
302     bool m_blurPreviousNode;
303     bool m_changingActivityState;
304     RefPtr<API::Object> m_userData;
305 };
306
307 using DrawToPDFCallback = GenericCallback<const IPC::DataReference&>;
308 #endif
309
310 #if PLATFORM(COCOA)
311 typedef GenericCallback<const WTF::MachSendRight&> MachSendRightCallback;
312 typedef GenericCallback<bool, bool, String, double, double, uint64_t> NowPlayingInfoCallback;
313 #endif
314
315 class WebPageProxy : public API::ObjectImpl<API::Object::Type::Page>
316 #if ENABLE(INPUT_TYPE_COLOR)
317     , public WebColorPicker::Client
318 #endif
319 #if ENABLE(WIRELESS_PLAYBACK_TARGET) && !PLATFORM(IOS)
320     , public WebCore::WebMediaSessionManagerClient
321 #endif
322     , public WebPopupMenuProxy::Client
323     , public IPC::MessageReceiver
324     , public IPC::MessageSender {
325 public:
326     static Ref<WebPageProxy> create(PageClient&, WebProcessProxy&, uint64_t pageID, Ref<API::PageConfiguration>&&);
327     virtual ~WebPageProxy();
328
329     const API::PageConfiguration& configuration() const;
330
331     uint64_t pageID() const { return m_pageID; }
332
333     PAL::SessionID sessionID() const;
334
335     WebFrameProxy* mainFrame() const { return m_mainFrame.get(); }
336     WebFrameProxy* focusedFrame() const { return m_focusedFrame.get(); }
337     WebFrameProxy* frameSetLargestFrame() const { return m_frameSetLargestFrame.get(); }
338
339     DrawingAreaProxy* drawingArea() const { return m_drawingArea.get(); }
340
341     WebNavigationState& navigationState() { return *m_navigationState.get(); }
342
343     WebsiteDataStore& websiteDataStore() { return m_websiteDataStore; }
344     void changeWebsiteDataStore(WebsiteDataStore&);
345
346 #if ENABLE(DATA_DETECTION)
347     NSArray *dataDetectionResults() { return m_dataDetectionResults.get(); }
348 #endif
349         
350 #if ENABLE(ASYNC_SCROLLING)
351     RemoteScrollingCoordinatorProxy* scrollingCoordinatorProxy() const { return m_scrollingCoordinatorProxy.get(); }
352 #endif
353
354     WebBackForwardList& backForwardList() { return m_backForwardList; }
355
356     bool addsVisitedLinks() const { return m_addsVisitedLinks; }
357     void setAddsVisitedLinks(bool addsVisitedLinks) { m_addsVisitedLinks = addsVisitedLinks; }
358
359     void fullscreenMayReturnToInline();
360     void didEnterFullscreen();
361     void didExitFullscreen();
362
363     WebInspectorProxy* inspector() const;
364
365     bool isControlledByAutomation() const { return m_controlledByAutomation; }
366     void setControlledByAutomation(bool);
367
368 #if ENABLE(REMOTE_INSPECTOR)
369     bool allowsRemoteInspection() const { return m_allowsRemoteInspection; }
370     void setAllowsRemoteInspection(bool);
371     String remoteInspectionNameOverride() const { return m_remoteInspectionNameOverride; }
372     void setRemoteInspectionNameOverride(const String&);
373 #endif
374
375 #if ENABLE(FULLSCREEN_API)
376     WebFullScreenManagerProxy* fullScreenManager();
377
378     API::FullscreenClient& fullscreenClient() const { return *m_fullscreenClient; }
379     void setFullscreenClient(std::unique_ptr<API::FullscreenClient>&&);
380 #endif
381 #if (PLATFORM(IOS) && HAVE(AVKIT)) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))
382     PlaybackSessionManagerProxy* playbackSessionManager();
383     VideoFullscreenManagerProxy* videoFullscreenManager();
384 #endif
385
386 #if PLATFORM(IOS)
387     bool allowsMediaDocumentInlinePlayback() const;
388     void setAllowsMediaDocumentInlinePlayback(bool);
389 #endif
390
391     SystemPreviewController* systemPreviewController() { return m_systemPreviewController.get(); }
392
393 #if ENABLE(CONTEXT_MENUS)
394     API::ContextMenuClient& contextMenuClient() { return *m_contextMenuClient; }
395     void setContextMenuClient(std::unique_ptr<API::ContextMenuClient>&&);
396 #endif
397     API::FindClient& findClient() { return *m_findClient; }
398     void setFindClient(std::unique_ptr<API::FindClient>&&);
399     API::FindMatchesClient& findMatchesClient() { return *m_findMatchesClient; }
400     void setFindMatchesClient(std::unique_ptr<API::FindMatchesClient>&&);
401     API::DiagnosticLoggingClient* diagnosticLoggingClient() { return m_diagnosticLoggingClient.get(); }
402     void setDiagnosticLoggingClient(std::unique_ptr<API::DiagnosticLoggingClient>&&);
403     void setFormClient(std::unique_ptr<API::FormClient>&&);
404     void setNavigationClient(std::unique_ptr<API::NavigationClient>&&);
405     void setHistoryClient(std::unique_ptr<API::HistoryClient>&&);
406     void setLoaderClient(std::unique_ptr<API::LoaderClient>&&);
407     void setPolicyClient(std::unique_ptr<API::PolicyClient>&&);
408     void setInjectedBundleClient(const WKPageInjectedBundleClientBase*);
409     WebPageInjectedBundleClient* injectedBundleClient() { return m_injectedBundleClient.get(); }
410
411     API::UIClient& uiClient() { return *m_uiClient; }
412     void setUIClient(std::unique_ptr<API::UIClient>&&);
413
414     API::IconLoadingClient& iconLoadingClient() { return *m_iconLoadingClient; }
415     void setIconLoadingClient(std::unique_ptr<API::IconLoadingClient>&&);
416
417     void initializeWebPage();
418
419     void close();
420     bool tryClose();
421     bool isClosed() const { return m_isClosed; }
422
423     void setIsUsingHighPerformanceWebGL(bool value) { m_isUsingHighPerformanceWebGL = value; }
424     bool isUsingHighPerformanceWebGL() const { return m_isUsingHighPerformanceWebGL; }
425
426     void didExceedInactiveMemoryLimitWhileActive();
427     void didExceedBackgroundCPULimitWhileInForeground();
428
429     void closePage(bool stopResponsivenessTimer);
430
431     void addPlatformLoadParameters(LoadParameters&);
432     RefPtr<API::Navigation> loadRequest(WebCore::ResourceRequest&&, WebCore::ShouldOpenExternalURLsPolicy = WebCore::ShouldOpenExternalURLsPolicy::ShouldAllowExternalSchemes, API::Object* userData = nullptr);
433     RefPtr<API::Navigation> loadFile(const String& fileURL, const String& resourceDirectoryURL, API::Object* userData = nullptr);
434     RefPtr<API::Navigation> loadData(API::Data*, const String& MIMEType, const String& encoding, const String& baseURL, API::Object* userData = nullptr);
435     RefPtr<API::Navigation> loadHTMLString(const String& htmlString, const String& baseURL, API::Object* userData = nullptr);
436     void loadAlternateHTMLString(const String& htmlString, const WebCore::URL& baseURL, const WebCore::URL& unreachableURL, API::Object* userData = nullptr);
437     void loadPlainTextString(const String&, API::Object* userData = nullptr);
438     void loadWebArchiveData(API::Data*, API::Object* userData = nullptr);
439     void navigateToPDFLinkWithSimulatedClick(const String& url, WebCore::IntPoint documentPoint, WebCore::IntPoint screenPoint);
440
441     void stopLoading();
442     RefPtr<API::Navigation> reload(OptionSet<WebCore::ReloadOption>);
443
444     RefPtr<API::Navigation> goForward();
445     RefPtr<API::Navigation> goBack();
446
447     RefPtr<API::Navigation> goToBackForwardItem(WebBackForwardListItem&);
448     void tryRestoreScrollPosition();
449     void didChangeBackForwardList(WebBackForwardListItem* addedItem, Vector<Ref<WebBackForwardListItem>>&& removed);
450     void willGoToBackForwardListItem(const WebCore::BackForwardItemIdentifier&, bool inPageCache, const UserData&);
451
452     bool shouldKeepCurrentBackForwardListItemInList(WebBackForwardListItem&);
453
454     bool willHandleHorizontalScrollEvents() const;
455
456     void updateWebsitePolicies(WebsitePoliciesData&&);
457
458     bool canShowMIMEType(const String& mimeType);
459
460     bool drawsBackground() const { return m_drawsBackground; }
461     void setDrawsBackground(bool);
462
463     String currentURL() const;
464
465     float topContentInset() const { return m_topContentInset; }
466     void setTopContentInset(float);
467
468     WebCore::Color underlayColor() const { return m_underlayColor; }
469     void setUnderlayColor(const WebCore::Color&);
470
471     // At this time, m_pageExtendedBackgroundColor can be set via pageExtendedBackgroundColorDidChange() which is a message
472     // from the UIProcess, or by didCommitLayerTree(). When PLATFORM(MAC) adopts UI side compositing, we should get rid of
473     // the message entirely.
474     WebCore::Color pageExtendedBackgroundColor() const { return m_pageExtendedBackgroundColor; }
475
476     void viewWillStartLiveResize();
477     void viewWillEndLiveResize();
478
479     void setInitialFocus(bool forward, bool isKeyboardEventValid, const WebKeyboardEvent&, WTF::Function<void (CallbackBase::Error)>&&);
480     
481     void clearSelection();
482     void restoreSelectionInFocusedEditableElement();
483
484     void setViewNeedsDisplay(const WebCore::Region&);
485     void requestScroll(const WebCore::FloatPoint& scrollPosition, const WebCore::IntPoint& scrollOrigin, bool isProgrammaticScroll);
486     
487     WebCore::FloatPoint viewScrollPosition() const;
488
489     void setDelegatesScrolling(bool delegatesScrolling) { m_delegatesScrolling = delegatesScrolling; }
490     bool delegatesScrolling() const { return m_delegatesScrolling; }
491
492     enum class ActivityStateChangeDispatchMode { Deferrable, Immediate };
493     void activityStateDidChange(WebCore::ActivityState::Flags mayHaveChanged, bool wantsSynchronousReply = false, ActivityStateChangeDispatchMode = ActivityStateChangeDispatchMode::Deferrable);
494     bool isInWindow() const { return m_activityState & WebCore::ActivityState::IsInWindow; }
495     void waitForDidUpdateActivityState();
496     void didUpdateActivityState() { m_waitingForDidUpdateActivityState = false; }
497
498     void layerHostingModeDidChange();
499
500     WebCore::IntSize viewSize() const;
501     bool isViewVisible() const { return m_activityState & WebCore::ActivityState::IsVisible; }
502     bool isViewFocused() const { return m_activityState & WebCore::ActivityState::IsFocused; }
503     bool isViewWindowActive() const { return m_activityState & WebCore::ActivityState::WindowIsActive; }
504
505     void addMIMETypeWithCustomContentProvider(const String& mimeType);
506
507     void executeEditCommand(const String& commandName, const String& argument = String());
508     void validateCommand(const String& commandName, WTF::Function<void (const String&, bool, int32_t, CallbackBase::Error)>&&);
509
510     const EditorState& editorState() const { return m_editorState; }
511     bool canDelete() const { return hasSelectedRange() && isContentEditable(); }
512     bool hasSelectedRange() const { return m_editorState.selectionIsRange; }
513     bool isContentEditable() const { return m_editorState.isContentEditable; }
514
515 #if PLATFORM(COCOA)
516     const TouchBarMenuData& touchBarMenuData() const { return m_touchBarMenuData; }
517 #endif
518
519     bool maintainsInactiveSelection() const;
520     void setMaintainsInactiveSelection(bool);
521     void setEditable(bool);
522     bool isEditable() const { return m_isEditable; }
523
524     void activateMediaStreamCaptureInPage();
525     bool isMediaStreamCaptureMuted() const { return m_mutedState & WebCore::MediaProducer::CaptureDevicesAreMuted; }
526     void setMediaStreamCaptureMuted(bool);
527     void executeEditCommand(const String& commandName, const String& argument, WTF::Function<void(CallbackBase::Error)>&&);
528         
529 #if PLATFORM(IOS)
530     double displayedContentScale() const { return m_lastVisibleContentRectUpdate.scale(); }
531     const WebCore::FloatRect& exposedContentRect() const { return m_lastVisibleContentRectUpdate.exposedContentRect(); }
532     const WebCore::FloatRect& unobscuredContentRect() const { return m_lastVisibleContentRectUpdate.unobscuredContentRect(); }
533     bool inStableState() const { return m_lastVisibleContentRectUpdate.inStableState(); }
534     const WebCore::FloatRect& unobscuredContentRectRespectingInputViewBounds() const { return m_lastVisibleContentRectUpdate.unobscuredContentRectRespectingInputViewBounds(); }
535     // When visual viewports are enabled, this is the layout viewport rect.
536     const WebCore::FloatRect& customFixedPositionRect() const { return m_lastVisibleContentRectUpdate.customFixedPositionRect(); }
537
538     void updateVisibleContentRects(const VisibleContentRectUpdateInfo&);
539     void resendLastVisibleContentRects();
540
541     WebCore::FloatRect computeCustomFixedPositionRect(const WebCore::FloatRect& unobscuredContentRect, const WebCore::FloatRect& unobscuredContentRectRespectingInputViewBounds, const WebCore::FloatRect& currentCustomFixedPositionRect, double displayedContentScale, WebCore::FrameView::LayoutViewportConstraint = WebCore::FrameView::LayoutViewportConstraint::Unconstrained, bool visualViewportEnabled = false) const;
542
543     void overflowScrollViewWillStartPanGesture();
544     void overflowScrollViewDidScroll();
545     void overflowScrollWillStartScroll();
546     void overflowScrollDidEndScroll();
547
548     void dynamicViewportSizeUpdate(const WebCore::FloatSize& minimumLayoutSize, const WebCore::FloatSize& viewSize, const WebCore::FloatSize& maximumUnobscuredSize, const WebCore::FloatRect& targetExposedContentRect, const WebCore::FloatRect& targetUnobscuredRect, const WebCore::FloatRect& targetUnobscuredRectInScrollViewCoordinates, const WebCore::FloatBoxExtent& unobscuredSafeAreaInsets, double targetScale, int32_t deviceOrientation);
549     void synchronizeDynamicViewportUpdate();
550
551     void setViewportConfigurationMinimumLayoutSize(const WebCore::FloatSize&, const WebCore::FloatSize& viewSize);
552     void setMaximumUnobscuredSize(const WebCore::FloatSize&);
553     void setDeviceOrientation(int32_t);
554     int32_t deviceOrientation() const { return m_deviceOrientation; }
555     void willCommitLayerTree(uint64_t transactionID);
556
557     void selectWithGesture(const WebCore::IntPoint, WebCore::TextGranularity, uint32_t gestureType, uint32_t gestureState, bool isInteractingWithAssistedNode, WTF::Function<void (const WebCore::IntPoint&, uint32_t, uint32_t, uint32_t, CallbackBase::Error)>&&);
558     void updateSelectionWithTouches(const WebCore::IntPoint, uint32_t touches, bool baseIsStart, WTF::Function<void (const WebCore::IntPoint&, uint32_t, uint32_t, CallbackBase::Error)>&&);
559     void selectWithTwoTouches(const WebCore::IntPoint from, const WebCore::IntPoint to, uint32_t gestureType, uint32_t gestureState, WTF::Function<void (const WebCore::IntPoint&, uint32_t, uint32_t, uint32_t, CallbackBase::Error)>&&);
560     void extendSelection(WebCore::TextGranularity);
561     void selectWordBackward();
562     void moveSelectionByOffset(int32_t offset, WTF::Function<void (CallbackBase::Error)>&&);
563     void selectTextWithGranularityAtPoint(const WebCore::IntPoint, WebCore::TextGranularity, bool isInteractingWithAssistedNode, WTF::Function<void (CallbackBase::Error)>&&);
564     void selectPositionAtPoint(const WebCore::IntPoint, bool isInteractingWithAssistedNode, WTF::Function<void (CallbackBase::Error)>&&);
565     void selectPositionAtBoundaryWithDirection(const WebCore::IntPoint, WebCore::TextGranularity, WebCore::SelectionDirection, bool isInteractingWithAssistedNode, WTF::Function<void (CallbackBase::Error)>&&);
566     void moveSelectionAtBoundaryWithDirection(WebCore::TextGranularity, WebCore::SelectionDirection, WTF::Function<void(CallbackBase::Error)>&&);
567     void beginSelectionInDirection(WebCore::SelectionDirection, WTF::Function<void (uint64_t, CallbackBase::Error)>&&);
568     void updateSelectionWithExtentPoint(const WebCore::IntPoint, bool isInteractingWithAssistedNode, WTF::Function<void (uint64_t, CallbackBase::Error)>&&);
569     void updateSelectionWithExtentPointAndBoundary(const WebCore::IntPoint, WebCore::TextGranularity, bool isInteractingWithAssistedNode, WTF::Function<void(uint64_t, CallbackBase::Error)>&&);
570     void requestAutocorrectionData(const String& textForAutocorrection, WTF::Function<void (const Vector<WebCore::FloatRect>&, const String&, double, uint64_t, CallbackBase::Error)>&&);
571     void applyAutocorrection(const String& correction, const String& originalText, WTF::Function<void (const String&, CallbackBase::Error)>&&);
572     bool applyAutocorrection(const String& correction, const String& originalText);
573     void requestAutocorrectionContext(WTF::Function<void (const String&, const String&, const String&, const String&, uint64_t, uint64_t, CallbackBase::Error)>&&);
574     void getAutocorrectionContext(String& contextBefore, String& markedText, String& selectedText, String& contextAfter, uint64_t& location, uint64_t& length);
575     void requestDictationContext(WTF::Function<void (const String&, const String&, const String&, CallbackBase::Error)>&&);
576     void replaceDictatedText(const String& oldText, const String& newText);
577     void replaceSelectedText(const String& oldText, const String& newText);
578     void didReceivePositionInformation(const InteractionInformationAtPosition&);
579     void requestPositionInformation(const InteractionInformationRequest&);
580     void startInteractionWithElementAtPosition(const WebCore::IntPoint&);
581     void stopInteraction();
582     void performActionOnElement(uint32_t action);
583     void saveImageToLibrary(const SharedMemory::Handle& imageHandle, uint64_t imageSize);
584     void focusNextAssistedNode(bool isForward, WTF::Function<void (CallbackBase::Error)>&& = [] (auto) { });
585     void setAssistedNodeValue(const String&);
586     void setAssistedNodeValueAsNumber(double);
587     void setAssistedNodeSelectedIndex(uint32_t index, bool allowMultipleSelection = false);
588     void applicationDidEnterBackground();
589     void applicationDidFinishSnapshottingAfterEnteringBackground();
590     void applicationWillEnterForeground();
591     void applicationWillResignActive();
592     void applicationDidBecomeActive();
593     void commitPotentialTapFailed();
594     void didNotHandleTapAsClick(const WebCore::IntPoint&);
595     void didCompleteSyntheticClick();
596     void disableDoubleTapGesturesDuringTapIfNecessary(uint64_t requestID);
597     void contentSizeCategoryDidChange(const String& contentSizeCategory);
598     void getSelectionContext(WTF::Function<void(const String&, const String&, const String&, CallbackBase::Error)>&&);
599     void handleTwoFingerTapAtPoint(const WebCore::IntPoint&, uint64_t requestID);
600     void setForceAlwaysUserScalable(bool);
601     void setIsScrollingOrZooming(bool);
602     void requestRectsForGranularityWithSelectionOffset(WebCore::TextGranularity, uint32_t offset, WTF::Function<void(const Vector<WebCore::SelectionRect>&, CallbackBase::Error)>&&);
603     void requestRectsAtSelectionOffsetWithText(int32_t offset, const String&, WTF::Function<void(const Vector<WebCore::SelectionRect>&, CallbackBase::Error)>&&);
604     void autofillLoginCredentials(const String& username, const String& password);
605     void storeSelectionForAccessibility(bool);
606     void startAutoscrollAtPosition(const WebCore::FloatPoint& positionInWindow);
607     void cancelAutoscroll();
608 #if ENABLE(DATA_INTERACTION)
609     void didPerformDataInteractionControllerOperation(bool handled);
610     void didHandleStartDataInteractionRequest(bool started);
611     void didHandleAdditionalDragItemsRequest(bool added);
612     void requestStartDataInteraction(const WebCore::IntPoint& clientPosition, const WebCore::IntPoint& globalPosition);
613     void requestAdditionalItemsForDragSession(const WebCore::IntPoint& clientPosition, const WebCore::IntPoint& globalPosition);
614     void didConcludeEditDataInteraction(std::optional<WebCore::TextIndicatorData>);
615 #endif
616 #endif
617 #if ENABLE(DATA_DETECTION)
618     void setDataDetectionResult(const DataDetectionResult&);
619 #endif
620     void didCommitLayerTree(const WebKit::RemoteLayerTreeTransaction&);
621     void layerTreeCommitComplete();
622
623     bool updateLayoutViewportParameters(const WebKit::RemoteLayerTreeTransaction&);
624
625 #if PLATFORM(GTK)
626     void setComposition(const String& text, Vector<WebCore::CompositionUnderline> underlines, uint64_t selectionStart, uint64_t selectionEnd, uint64_t replacementRangeStart, uint64_t replacementRangeEnd);
627     void confirmComposition(const String& compositionString, int64_t selectionStart, int64_t selectionLength);
628     void cancelComposition();
629 #endif
630
631 #if PLATFORM(GTK)
632     void setInputMethodState(bool enabled);
633 #endif
634
635 #if PLATFORM (GTK) && HAVE(GTK_GESTURES)
636     void getCenterForZoomGesture(const WebCore::IntPoint& centerInViewCoordinates, WebCore::IntPoint& center);
637 #endif
638
639 #if PLATFORM(COCOA)
640     void windowAndViewFramesChanged(const WebCore::FloatRect& viewFrameInWindowCoordinates, const WebCore::FloatPoint& accessibilityViewCoordinates);
641     void setMainFrameIsScrollable(bool);
642
643     void sendComplexTextInputToPlugin(uint64_t pluginComplexTextInputIdentifier, const String& textInput);
644     bool shouldDelayWindowOrderingForEvent(const WebMouseEvent&);
645     bool acceptsFirstMouse(int eventNumber, const WebMouseEvent&);
646
647     void setAcceleratedCompositingRootLayer(LayerOrView*);
648     LayerOrView* acceleratedCompositingRootLayer() const;
649
650     void setTextAsync(const String&);
651     void insertTextAsync(const String& text, const EditingRange& replacementRange, bool registerUndoGroup = false, EditingRangeIsRelativeTo = EditingRangeIsRelativeTo::EditableRoot, bool suppressSelectionUpdate = false);
652     void getMarkedRangeAsync(WTF::Function<void (EditingRange, CallbackBase::Error)>&&);
653     void getSelectedRangeAsync(WTF::Function<void (EditingRange, CallbackBase::Error)>&&);
654     void characterIndexForPointAsync(const WebCore::IntPoint&, WTF::Function<void (uint64_t, CallbackBase::Error)>&&);
655     void firstRectForCharacterRangeAsync(const EditingRange&, WTF::Function<void (const WebCore::IntRect&, const EditingRange&, CallbackBase::Error)>&&);
656     void setCompositionAsync(const String& text, const Vector<WebCore::CompositionUnderline>& underlines, const EditingRange& selectionRange, const EditingRange& replacementRange);
657     void confirmCompositionAsync();
658
659     void setScrollPerformanceDataCollectionEnabled(bool);
660     bool scrollPerformanceDataCollectionEnabled() const { return m_scrollPerformanceDataCollectionEnabled; }
661     RemoteLayerTreeScrollingPerformanceData* scrollingPerformanceData() { return m_scrollingPerformanceData.get(); }
662 #endif // PLATFORM(COCOA)
663
664 #if PLATFORM(MAC)
665     void insertDictatedTextAsync(const String& text, const EditingRange& replacementRange, const Vector<WebCore::TextAlternativeWithRange>& dictationAlternatives, bool registerUndoGroup);
666     void attributedSubstringForCharacterRangeAsync(const EditingRange&, WTF::Function<void (const AttributedString&, const EditingRange&, CallbackBase::Error)>&&);
667     void setFont(const String& fontFamily, double fontSize, uint64_t fontTraits);
668     void fontAtSelection(WTF::Function<void (const String&, double, bool, CallbackBase::Error)>&&);
669
670     void startWindowDrag();
671     NSWindow *platformWindow();
672     void rootViewToWindow(const WebCore::IntRect& viewRect, WebCore::IntRect& windowRect);
673
674 #if WK_API_ENABLED
675     NSView *inspectorAttachmentView();
676     _WKRemoteObjectRegistry *remoteObjectRegistry();
677 #endif
678
679     void intrinsicContentSizeDidChange(const WebCore::IntSize& intrinsicContentSize);
680     CGRect boundsOfLayerInLayerBackedWindowCoordinates(CALayer *) const;
681 #endif // PLATFORM(MAC)
682
683 #if PLATFORM(GTK)
684     PlatformWidget viewWidget();
685     const WebCore::Color& backgroundColor() const { return m_backgroundColor; }
686     void setBackgroundColor(const WebCore::Color& color) { m_backgroundColor = color; }
687 #endif
688
689     void handleMouseEvent(const NativeWebMouseEvent&);
690     void handleWheelEvent(const NativeWebWheelEvent&);
691     void handleKeyboardEvent(const NativeWebKeyboardEvent&);
692
693 #if ENABLE(MAC_GESTURE_EVENTS)
694     void handleGestureEvent(const NativeWebGestureEvent&);
695 #endif
696
697 #if ENABLE(IOS_TOUCH_EVENTS)
698     void handleTouchEventSynchronously(NativeWebTouchEvent&);
699     void handleTouchEventAsynchronously(const NativeWebTouchEvent&);
700
701 #elif ENABLE(TOUCH_EVENTS)
702     void handleTouchEvent(const NativeWebTouchEvent&);
703 #endif
704
705     void scrollBy(WebCore::ScrollDirection, WebCore::ScrollGranularity);
706     void centerSelectionInVisibleArea();
707
708     const String& toolTip() const { return m_toolTip; }
709
710     const String& userAgent() const { return m_userAgent; }
711     void setApplicationNameForUserAgent(const String&);
712     const String& applicationNameForUserAgent() const { return m_applicationNameForUserAgent; }
713     void setCustomUserAgent(const String&);
714     const String& customUserAgent() const { return m_customUserAgent; }
715     static String standardUserAgent(const String& applicationName = String());
716
717     bool supportsTextEncoding() const;
718     void setCustomTextEncodingName(const String&);
719     String customTextEncodingName() const { return m_customTextEncodingName; }
720
721     bool areActiveDOMObjectsAndAnimationsSuspended() const { return m_isPageSuspended; }
722     void resumeActiveDOMObjectsAndAnimations();
723     void suspendActiveDOMObjectsAndAnimations();
724
725     double estimatedProgress() const;
726
727     SessionState sessionState(WTF::Function<bool (WebBackForwardListItem&)>&& = nullptr) const;
728     RefPtr<API::Navigation> restoreFromSessionState(SessionState, bool navigate);
729
730     bool supportsTextZoom() const;
731     double textZoomFactor() const { return m_textZoomFactor; }
732     void setTextZoomFactor(double);
733     double pageZoomFactor() const;
734     void setPageZoomFactor(double);
735     void setPageAndTextZoomFactors(double pageZoomFactor, double textZoomFactor);
736
737     void scalePage(double scale, const WebCore::IntPoint& origin);
738     void scalePageInViewCoordinates(double scale, const WebCore::IntPoint& centerInViewCoordinates);
739     double pageScaleFactor() const;
740     double viewScaleFactor() const { return m_viewScaleFactor; }
741     void scaleView(double scale);
742     void setShouldScaleViewToFitDocument(bool);
743     
744     float deviceScaleFactor() const;
745     void setIntrinsicDeviceScaleFactor(float);
746     void setCustomDeviceScaleFactor(float);
747     void windowScreenDidChange(WebCore::PlatformDisplayID);
748     void accessibilitySettingsDidChange();
749 #if ENABLE(ACCESSIBILITY_EVENTS)
750     void updateAccessibilityEventsEnabled(bool);
751 #endif
752
753     void setUseFixedLayout(bool);
754     void setFixedLayoutSize(const WebCore::IntSize&);
755     bool useFixedLayout() const { return m_useFixedLayout; };
756     const WebCore::IntSize& fixedLayoutSize() const { return m_fixedLayoutSize; };
757
758     void setAlwaysShowsHorizontalScroller(bool);
759     void setAlwaysShowsVerticalScroller(bool);
760     bool alwaysShowsHorizontalScroller() const { return m_alwaysShowsHorizontalScroller; }
761     bool alwaysShowsVerticalScroller() const { return m_alwaysShowsVerticalScroller; }
762
763     void listenForLayoutMilestones(WebCore::LayoutMilestones);
764
765     bool hasHorizontalScrollbar() const { return m_mainFrameHasHorizontalScrollbar; }
766     bool hasVerticalScrollbar() const { return m_mainFrameHasVerticalScrollbar; }
767
768     void setSuppressScrollbarAnimations(bool);
769     bool areScrollbarAnimationsSuppressed() const { return m_suppressScrollbarAnimations; }
770
771     bool isPinnedToLeftSide() const { return m_mainFrameIsPinnedToLeftSide; }
772     bool isPinnedToRightSide() const { return m_mainFrameIsPinnedToRightSide; }
773     bool isPinnedToTopSide() const { return m_mainFrameIsPinnedToTopSide; }
774     bool isPinnedToBottomSide() const { return m_mainFrameIsPinnedToBottomSide; }
775
776     bool rubberBandsAtLeft() const;
777     void setRubberBandsAtLeft(bool);
778     bool rubberBandsAtRight() const;
779     void setRubberBandsAtRight(bool);
780     bool rubberBandsAtTop() const;
781     void setRubberBandsAtTop(bool);
782     bool rubberBandsAtBottom() const;
783     void setRubberBandsAtBottom(bool);
784
785     void setShouldUseImplicitRubberBandControl(bool shouldUseImplicitRubberBandControl) { m_shouldUseImplicitRubberBandControl = shouldUseImplicitRubberBandControl; }
786     bool shouldUseImplicitRubberBandControl() const { return m_shouldUseImplicitRubberBandControl; }
787         
788     void setEnableVerticalRubberBanding(bool);
789     bool verticalRubberBandingIsEnabled() const;
790     void setEnableHorizontalRubberBanding(bool);
791     bool horizontalRubberBandingIsEnabled() const;
792         
793     void setBackgroundExtendsBeyondPage(bool);
794     bool backgroundExtendsBeyondPage() const;
795
796     void setPaginationMode(WebCore::Pagination::Mode);
797     WebCore::Pagination::Mode paginationMode() const { return m_paginationMode; }
798     void setPaginationBehavesLikeColumns(bool);
799     bool paginationBehavesLikeColumns() const { return m_paginationBehavesLikeColumns; }
800     void setPageLength(double);
801     double pageLength() const { return m_pageLength; }
802     void setGapBetweenPages(double);
803     double gapBetweenPages() const { return m_gapBetweenPages; }
804     void setPaginationLineGridEnabled(bool);
805     bool paginationLineGridEnabled() const { return m_paginationLineGridEnabled; }
806     unsigned pageCount() const { return m_pageCount; }
807         
808 #if PLATFORM(MAC)
809     void setUseSystemAppearance(bool);
810     bool useSystemAppearance() const { return m_useSystemAppearance; }
811     void setDefaultAppearance(bool);
812     bool defaultAppearance() const { return m_defaultAppearance; }
813 #endif
814
815 #if PLATFORM(COCOA)
816     // Called by the web process through a message.
817     void registerWebProcessAccessibilityToken(const IPC::DataReference&);
818     // Called by the UI process when it is ready to send its tokens to the web process.
819     void registerUIProcessAccessibilityTokens(const IPC::DataReference& elemenToken, const IPC::DataReference& windowToken);
820     bool readSelectionFromPasteboard(const String& pasteboardName);
821     String stringSelectionForPasteboard();
822     RefPtr<WebCore::SharedBuffer> dataSelectionForPasteboard(const String& pasteboardType);
823     void makeFirstResponder();
824     void assistiveTechnologyMakeFirstResponder();
825
826     ColorSpaceData colorSpace();
827 #endif
828
829 #if ENABLE(SERVICE_CONTROLS)
830     void replaceSelectionWithPasteboardData(const Vector<String>& types, const IPC::DataReference&);
831 #endif
832
833     void pageScaleFactorDidChange(double);
834     void pluginScaleFactorDidChange(double);
835     void pluginZoomFactorDidChange(double);
836
837     // Find.
838     void findString(const String&, FindOptions, unsigned maxMatchCount);
839     void findStringMatches(const String&, FindOptions, unsigned maxMatchCount);
840     void getImageForFindMatch(int32_t matchIndex);
841     void selectFindMatch(int32_t matchIndex);
842     void didGetImageForFindMatch(const ShareableBitmap::Handle& contentImageHandle, uint32_t matchIndex);
843     void hideFindUI();
844     void countStringMatches(const String&, FindOptions, unsigned maxMatchCount);
845     void didCountStringMatches(const String&, uint32_t matchCount);
846     void setTextIndicator(const WebCore::TextIndicatorData&, uint64_t /* WebCore::TextIndicatorWindowLifetime */ lifetime = 0 /* Permanent */);
847     void setTextIndicatorAnimationProgress(float);
848     void clearTextIndicator();
849     void didFindString(const String&, const Vector<WebCore::IntRect>&, uint32_t matchCount, int32_t matchIndex, bool didWrapAround);
850     void didFailToFindString(const String&);
851     void didFindStringMatches(const String&, const Vector<Vector<WebCore::IntRect>>& matchRects, int32_t firstIndexAfterSelection);
852
853     void getContentsAsString(WTF::Function<void (const String&, CallbackBase::Error)>&&);
854     void getBytecodeProfile(WTF::Function<void (const String&, CallbackBase::Error)>&&);
855     void getSamplingProfilerOutput(WTF::Function<void (const String&, CallbackBase::Error)>&&);
856     void isWebProcessResponsive(WTF::Function<void (bool isWebProcessResponsive)>&&);
857
858 #if ENABLE(MHTML)
859     void getContentsAsMHTMLData(Function<void (API::Data*, CallbackBase::Error)>&&);
860 #endif
861     void getMainResourceDataOfFrame(WebFrameProxy*, Function<void (API::Data*, CallbackBase::Error)>&&);
862     void getResourceDataFromFrame(WebFrameProxy*, API::URL*, Function<void (API::Data*, CallbackBase::Error)>&&);
863     void getRenderTreeExternalRepresentation(WTF::Function<void (const String&, CallbackBase::Error)>&&);
864     void getSelectionOrContentsAsString(WTF::Function<void (const String&, CallbackBase::Error)>&&);
865     void getSelectionAsWebArchiveData(Function<void (API::Data*, CallbackBase::Error)>&&);
866     void getSourceForFrame(WebFrameProxy*, WTF::Function<void (const String&, CallbackBase::Error)>&&);
867     void getWebArchiveOfFrame(WebFrameProxy*, Function<void (API::Data*, CallbackBase::Error)>&&);
868     void runJavaScriptInMainFrame(const String&, bool, WTF::Function<void (API::SerializedScriptValue*, bool hadException, const WebCore::ExceptionDetails&, CallbackBase::Error)>&& callbackFunction);
869     void forceRepaint(RefPtr<VoidCallback>&&);
870
871     float headerHeight(WebFrameProxy&);
872     float footerHeight(WebFrameProxy&);
873     void drawHeader(WebFrameProxy&, WebCore::FloatRect&&);
874     void drawFooter(WebFrameProxy&, WebCore::FloatRect&&);
875
876 #if PLATFORM(COCOA)
877     // Dictionary.
878     void performDictionaryLookupAtLocation(const WebCore::FloatPoint&);
879     void performDictionaryLookupOfCurrentSelection();
880 #endif
881
882     void receivedPolicyDecision(WebCore::PolicyAction, WebFrameProxy&, uint64_t listenerID, API::Navigation* navigationID, std::optional<WebsitePoliciesData>&&);
883
884     void backForwardRemovedItem(const WebCore::BackForwardItemIdentifier&);
885
886 #if ENABLE(DRAG_SUPPORT)    
887     // Drag and drop support.
888     void dragEntered(WebCore::DragData&, const String& dragStorageName = String());
889     void dragUpdated(WebCore::DragData&, const String& dragStorageName = String());
890     void dragExited(WebCore::DragData&, const String& dragStorageName = String());
891     void performDragOperation(WebCore::DragData&, const String& dragStorageName, SandboxExtension::Handle&&, SandboxExtension::HandleArray&&);
892
893     void didPerformDragControllerAction(uint64_t dragOperation, bool mouseIsOverFileInput, unsigned numberOfItemsToBeAccepted, const WebCore::IntRect& insertionRect);
894     void dragEnded(const WebCore::IntPoint& clientPosition, const WebCore::IntPoint& globalPosition, uint64_t operation);
895     void didStartDrag();
896     void dragCancelled();
897     void setDragCaretRect(const WebCore::IntRect&);
898 #if PLATFORM(COCOA)
899     void startDrag(const WebCore::DragItem&, const ShareableBitmap::Handle& dragImageHandle);
900     void setPromisedDataForImage(const String& pasteboardName, const SharedMemory::Handle& imageHandle, uint64_t imageSize, const String& filename, const String& extension,
901                          const String& title, const String& url, const String& visibleURL, const SharedMemory::Handle& archiveHandle, uint64_t archiveSize);
902 #endif
903 #if PLATFORM(GTK)
904     void startDrag(WebSelectionData&&, uint64_t dragOperation, const ShareableBitmap::Handle& dragImage);
905 #endif
906 #endif
907
908     void processDidBecomeUnresponsive();
909     void processDidBecomeResponsive();
910     void processDidTerminate(ProcessTerminationReason);
911     void willChangeProcessIsResponsive();
912     void didChangeProcessIsResponsive();
913
914 #if PLATFORM(IOS)
915     void processWillBecomeSuspended();
916     void processWillBecomeForeground();
917 #endif
918
919     virtual void enterAcceleratedCompositingMode(const LayerTreeContext&);
920     virtual void exitAcceleratedCompositingMode();
921     virtual void updateAcceleratedCompositingMode(const LayerTreeContext&);
922
923     enum UndoOrRedo { Undo, Redo };
924     void addEditCommand(WebEditCommandProxy*);
925     void removeEditCommand(WebEditCommandProxy*);
926     bool isValidEditCommand(WebEditCommandProxy*);
927     void registerEditCommand(Ref<WebEditCommandProxy>&&, UndoOrRedo);
928
929     bool canUndo();
930     bool canRedo();
931
932 #if PLATFORM(COCOA)
933     void registerKeypressCommandName(const String& name) { m_knownKeypressCommandNames.add(name); }
934     bool isValidKeypressCommandName(const String& name) const { return m_knownKeypressCommandNames.contains(name); }
935 #endif
936
937     WebProcessProxy& process() { return m_process; }
938     ProcessID processIdentifier() const;
939
940     WebPreferences& preferences() { return m_preferences; }
941     void setPreferences(WebPreferences&);
942
943     WebPageGroup& pageGroup() { return m_pageGroup; }
944
945     bool isValid() const;
946
947 #if ENABLE(DRAG_SUPPORT)
948     WebCore::DragOperation currentDragOperation() const { return m_currentDragOperation; }
949     bool currentDragIsOverFileInput() const { return m_currentDragIsOverFileInput; }
950     unsigned currentDragNumberOfFilesToBeAccepted() const { return m_currentDragNumberOfFilesToBeAccepted; }
951     WebCore::IntRect currentDragCaretRect() const { return m_currentDragCaretRect; }
952     void resetCurrentDragInformation();
953     void didEndDragging();
954 #endif
955
956     void preferencesDidChange();
957
958 #if ENABLE(CONTEXT_MENUS)
959     // Called by the WebContextMenuProxy.
960     void contextMenuItemSelected(const WebContextMenuItemData&);
961     void handleContextMenuKeyEvent();
962 #endif
963
964     // Called by the WebOpenPanelResultListenerProxy.
965 #if PLATFORM(IOS)
966     void didChooseFilesForOpenPanelWithDisplayStringAndIcon(const Vector<String>&, const String& displayString, const API::Data* iconData);
967 #endif
968     void didChooseFilesForOpenPanel(const Vector<String>&);
969     void didCancelForOpenPanel();
970
971     WebPageCreationParameters creationParameters();
972
973     void handleDownloadRequest(DownloadProxy*);
974
975     void advanceToNextMisspelling(bool startBeforeSelection);
976     void changeSpellingToWord(const String& word);
977 #if USE(APPKIT)
978     void uppercaseWord();
979     void lowercaseWord();
980     void capitalizeWord();
981 #endif
982
983 #if PLATFORM(COCOA)
984     bool isSmartInsertDeleteEnabled() const { return m_isSmartInsertDeleteEnabled; }
985     void setSmartInsertDeleteEnabled(bool);
986 #endif
987
988 #if PLATFORM(GTK)
989     String accessibilityPlugID() const { return m_accessibilityPlugID; }
990 #endif
991
992     void setCanRunModal(bool);
993     bool canRunModal();
994
995     void beginPrinting(WebFrameProxy*, const PrintInfo&);
996     void endPrinting();
997     void computePagesForPrinting(WebFrameProxy*, const PrintInfo&, Ref<ComputedPagesCallback>&&);
998 #if PLATFORM(COCOA)
999     void drawRectToImage(WebFrameProxy*, const PrintInfo&, const WebCore::IntRect&, const WebCore::IntSize&, Ref<ImageCallback>&&);
1000     void drawPagesToPDF(WebFrameProxy*, const PrintInfo&, uint32_t first, uint32_t count, Ref<DataCallback>&&);
1001 #if PLATFORM(IOS)
1002     uint32_t computePagesForPrintingAndDrawToPDF(uint64_t frameID, const PrintInfo&, DrawToPDFCallback::CallbackFunction&&);
1003     void drawToPDFCallback(const IPC::DataReference& pdfData, WebKit::CallbackID);
1004 #endif
1005 #elif PLATFORM(GTK)
1006     void drawPagesForPrinting(WebFrameProxy*, const PrintInfo&, Ref<PrintFinishedCallback>&&);
1007 #endif
1008
1009     PageLoadState& pageLoadState() { return m_pageLoadState; }
1010
1011 #if PLATFORM(COCOA)
1012     void handleAlternativeTextUIResult(const String& result);
1013 #endif
1014
1015     void saveDataToFileInDownloadsFolder(String&& suggestedFilename, String&& mimeType, WebCore::URL&& originatingURL, API::Data&);
1016     void savePDFToFileInDownloadsFolder(String&& suggestedFilename, WebCore::URL&& originatingURL, const IPC::DataReference&);
1017 #if PLATFORM(COCOA)
1018     void savePDFToTemporaryFolderAndOpenWithNativeApplicationRaw(const String& suggestedFilename, const String& originatingURLString, const uint8_t* data, unsigned long size, const String& pdfUUID);
1019     void savePDFToTemporaryFolderAndOpenWithNativeApplication(const String& suggestedFilename, const String& originatingURLString, const IPC::DataReference&, const String& pdfUUID);
1020     void openPDFFromTemporaryFolderWithNativeApplication(const String& pdfUUID);
1021 #endif
1022
1023     WebCore::IntRect visibleScrollerThumbRect() const { return m_visibleScrollerThumbRect; }
1024
1025     uint64_t renderTreeSize() const { return m_renderTreeSize; }
1026
1027     void printMainFrame();
1028     
1029     void setMediaVolume(float);
1030     void setMuted(WebCore::MediaProducer::MutedStateFlags);
1031     void setMayStartMediaWhenInWindow(bool);
1032     bool mayStartMediaWhenInWindow() const { return m_mayStartMediaWhenInWindow; }
1033     void setMediaCaptureEnabled(bool);
1034     bool mediaCaptureEnabled() const { return m_mediaCaptureEnabled; }
1035     void stopMediaCapture();
1036
1037 #if ENABLE(MEDIA_SESSION)
1038     bool hasMediaSessionWithActiveMediaElements() const { return m_hasMediaSessionWithActiveMediaElements; }
1039     void handleMediaEvent(WebCore::MediaEventType);
1040     void setVolumeOfMediaElement(double, uint64_t);
1041 #endif
1042         
1043 #if ENABLE(POINTER_LOCK)
1044     void didAllowPointerLock();
1045     void didDenyPointerLock();
1046 #endif
1047
1048     // WebPopupMenuProxy::Client
1049     NativeWebMouseEvent* currentlyProcessedMouseDownEvent() override;
1050
1051     void setSuppressVisibilityUpdates(bool flag);
1052     bool suppressVisibilityUpdates() { return m_suppressVisibilityUpdates; }
1053
1054 #if PLATFORM(IOS)
1055     void willStartUserTriggeredZooming();
1056
1057     void potentialTapAtPosition(const WebCore::FloatPoint&, uint64_t& requestID);
1058     void commitPotentialTap(uint64_t layerTreeTransactionIdAtLastTouchStart);
1059     void cancelPotentialTap();
1060     void tapHighlightAtPosition(const WebCore::FloatPoint&, uint64_t& requestID);
1061     void handleTap(const WebCore::FloatPoint&, uint64_t layerTreeTransactionIdAtLastTouchStart);
1062
1063     void inspectorNodeSearchMovedToPosition(const WebCore::FloatPoint&);
1064     void inspectorNodeSearchEndedAtPosition(const WebCore::FloatPoint&);
1065
1066     void blurAssistedNode();
1067 #endif
1068
1069     void postMessageToInjectedBundle(const String& messageName, API::Object* messageBody);
1070
1071 #if ENABLE(INPUT_TYPE_COLOR)
1072     void setColorPickerColor(const WebCore::Color&);
1073     void endColorPicker();
1074 #endif
1075
1076     WebCore::IntSize minimumLayoutSize() const { return m_minimumLayoutSize; }
1077     void setMinimumLayoutSize(const WebCore::IntSize&);
1078
1079     bool autoSizingShouldExpandToViewHeight() const { return m_autoSizingShouldExpandToViewHeight; }
1080     void setAutoSizingShouldExpandToViewHeight(bool);
1081
1082     void setViewportSizeForCSSViewportUnits(const WebCore::IntSize&);
1083     WebCore::IntSize viewportSizeForCSSViewportUnits() const { return m_viewportSizeForCSSViewportUnits.value_or(WebCore::IntSize()); }
1084
1085     void didReceiveAuthenticationChallengeProxy(uint64_t frameID, Ref<AuthenticationChallengeProxy>&&);
1086
1087     int64_t spellDocumentTag();
1088     void didFinishCheckingText(uint64_t requestID, const Vector<WebCore::TextCheckingResult>&);
1089     void didCancelCheckingText(uint64_t requestID);
1090
1091     void connectionWillOpen(IPC::Connection&);
1092     void webProcessWillShutDown();
1093
1094     void processDidFinishLaunching();
1095
1096     void didSaveToPageCache();
1097         
1098     void setScrollPinningBehavior(WebCore::ScrollPinningBehavior);
1099     WebCore::ScrollPinningBehavior scrollPinningBehavior() const { return m_scrollPinningBehavior; }
1100
1101     void setOverlayScrollbarStyle(std::optional<WebCore::ScrollbarOverlayStyle>);
1102     std::optional<WebCore::ScrollbarOverlayStyle> overlayScrollbarStyle() const { return m_scrollbarOverlayStyle; }
1103
1104     bool shouldRecordNavigationSnapshots() const { return m_shouldRecordNavigationSnapshots; }
1105     void setShouldRecordNavigationSnapshots(bool shouldRecordSnapshots) { m_shouldRecordNavigationSnapshots = shouldRecordSnapshots; }
1106     void recordAutomaticNavigationSnapshot();
1107     void recordNavigationSnapshot(WebBackForwardListItem&);
1108     void requestAssistedNodeInformation(Function<void(const AssistedNodeInformation&, CallbackBase::Error)>&&);
1109
1110 #if PLATFORM(COCOA)
1111     RefPtr<ViewSnapshot> takeViewSnapshot();
1112 #endif
1113
1114 #if ENABLE(SUBTLE_CRYPTO)
1115     void wrapCryptoKey(const Vector<uint8_t>&, bool& succeeded, Vector<uint8_t>&);
1116     void unwrapCryptoKey(const Vector<uint8_t>&, bool& succeeded, Vector<uint8_t>&);
1117 #endif
1118
1119     void takeSnapshot(WebCore::IntRect, WebCore::IntSize bitmapSize, SnapshotOptions, WTF::Function<void (const ShareableBitmap::Handle&, CallbackBase::Error)>&&);
1120
1121     void navigationGestureDidBegin();
1122     void navigationGestureWillEnd(bool willNavigate, WebBackForwardListItem&);
1123     void navigationGestureDidEnd(bool willNavigate, WebBackForwardListItem&);
1124     void navigationGestureDidEnd();
1125     void navigationGestureSnapshotWasRemoved();
1126     void willRecordNavigationSnapshot(WebBackForwardListItem&);
1127
1128     bool isShowingNavigationGestureSnapshot() const { return m_isShowingNavigationGestureSnapshot; }
1129
1130     bool isPlayingAudio() const { return !!(m_mediaState & WebCore::MediaProducer::IsPlayingAudio); }
1131     void isPlayingMediaDidChange(WebCore::MediaProducer::MediaStateFlags, uint64_t);
1132     bool hasActiveAudioStream() const { return m_mediaState & WebCore::MediaProducer::HasActiveAudioCaptureDevice; }
1133     bool hasActiveVideoStream() const { return m_mediaState & WebCore::MediaProducer::HasActiveVideoCaptureDevice; }
1134     WebCore::MediaProducer::MediaStateFlags mediaStateFlags() const { return m_mediaState; }
1135     void handleAutoplayEvent(WebCore::AutoplayEvent, OptionSet<WebCore::AutoplayEventFlags>);
1136
1137     void videoControlsManagerDidChange();
1138     bool hasActiveVideoForControlsManager() const;
1139     void requestControlledElementID() const;
1140     void handleControlledElementIDResponse(const String&) const;
1141     bool isPlayingVideoInEnhancedFullscreen() const;
1142
1143 #if PLATFORM(COCOA)
1144     void requestActiveNowPlayingSessionInfo(Ref<NowPlayingInfoCallback>&&);
1145     void nowPlayingInfoCallback(bool, bool, const String&, double, double, uint64_t, CallbackID);
1146 #endif
1147
1148 #if ENABLE(MEDIA_SESSION)
1149     void hasMediaSessionWithActiveMediaElementsDidChange(bool);
1150     void mediaSessionMetadataDidChange(const WebCore::MediaSessionMetadata&);
1151     void focusedContentMediaElementDidChange(uint64_t);
1152 #endif
1153
1154 #if PLATFORM(MAC)
1155     API::HitTestResult* lastMouseMoveHitTestResult() const { return m_lastMouseMoveHitTestResult.get(); }
1156     void performImmediateActionHitTestAtLocation(WebCore::FloatPoint);
1157
1158     void immediateActionDidUpdate();
1159     void immediateActionDidCancel();
1160     void immediateActionDidComplete();
1161
1162     void* immediateActionAnimationControllerForHitTestResult(RefPtr<API::HitTestResult>, uint64_t, RefPtr<API::Object>);
1163
1164     void installActivityStateChangeCompletionHandler(WTF::Function<void ()>&&);
1165
1166     void handleAcceptedCandidate(WebCore::TextCheckingResult);
1167     void didHandleAcceptedCandidate();
1168
1169     void setHeaderBannerHeightForTesting(int);
1170     void setFooterBannerHeightForTesting(int);
1171 #endif
1172
1173 #if USE(UNIFIED_TEXT_CHECKING)
1174     void checkTextOfParagraph(const String& text, uint64_t checkingTypes, int32_t insertionPoint, Vector<WebCore::TextCheckingResult>& results);
1175 #endif
1176     void getGuessesForWord(const String& word, const String& context, int32_t insertionPoint, Vector<String>& guesses);
1177
1178     void setShouldDispatchFakeMouseMoveEvents(bool);
1179
1180     // Diagnostic messages logging.
1181     void logDiagnosticMessage(const String& message, const String& description, WebCore::ShouldSample);
1182     void logDiagnosticMessageWithResult(const String& message, const String& description, uint32_t result, WebCore::ShouldSample);
1183     void logDiagnosticMessageWithValue(const String& message, const String& description, double value, unsigned significantFigures, WebCore::ShouldSample);
1184     void logDiagnosticMessageWithEnhancedPrivacy(const String& message, const String& description, WebCore::ShouldSample);
1185
1186     // Performance logging.
1187     void logScrollingEvent(uint32_t eventType, MonotonicTime, uint64_t);
1188
1189     // Form validation messages.
1190     void showValidationMessage(const WebCore::IntRect& anchorClientRect, const String& message);
1191     void hideValidationMessage();
1192 #if PLATFORM(COCOA)
1193     WebCore::ValidationBubble* validationBubble() const { return m_validationBubble.get(); } // For testing.
1194 #endif
1195
1196 #if PLATFORM(IOS)
1197     void setIsKeyboardAnimatingIn(bool isKeyboardAnimatingIn) { m_isKeyboardAnimatingIn = isKeyboardAnimatingIn; }
1198 #endif
1199
1200 #if ENABLE(WIRELESS_PLAYBACK_TARGET) && !PLATFORM(IOS)
1201     void addPlaybackTargetPickerClient(uint64_t);
1202     void removePlaybackTargetPickerClient(uint64_t);
1203     void showPlaybackTargetPicker(uint64_t, const WebCore::FloatRect&, bool hasVideo);
1204     void playbackTargetPickerClientStateDidChange(uint64_t, WebCore::MediaProducer::MediaStateFlags);
1205     void setMockMediaPlaybackTargetPickerEnabled(bool);
1206     void setMockMediaPlaybackTargetPickerState(const String&, WebCore::MediaPlaybackTargetContext::State);
1207
1208     // WebMediaSessionManagerClient
1209     void setPlaybackTarget(uint64_t, Ref<WebCore::MediaPlaybackTarget>&&) override;
1210     void externalOutputDeviceAvailableDidChange(uint64_t, bool) override;
1211     void setShouldPlayToPlaybackTarget(uint64_t, bool) override;
1212 #endif
1213
1214     void didChangeBackgroundColor();
1215     void didLayoutForCustomContentProvider();
1216
1217     // For testing
1218     void clearWheelEventTestTrigger();
1219     void callAfterNextPresentationUpdate(WTF::Function<void (CallbackBase::Error)>&&);
1220
1221     void didReachLayoutMilestone(uint32_t layoutMilestones);
1222
1223     void didRestoreScrollPosition();
1224
1225     void getLoadDecisionForIcon(const WebCore::LinkIcon&, WebKit::CallbackID);
1226     void finishedLoadingIcon(WebKit::CallbackID, const IPC::DataReference&);
1227
1228     void setFocus(bool focused);
1229     void setWindowFrame(const WebCore::FloatRect&);
1230     void getWindowFrame(Ref<Messages::WebPageProxy::GetWindowFrame::DelayedReply>&&);
1231     void getWindowFrameWithCallback(Function<void(WebCore::FloatRect)>&&);
1232
1233     bool isResourceCachingDisabled() const { return m_isResourceCachingDisabled; }
1234     void setResourceCachingDisabled(bool);
1235
1236     WebCore::UserInterfaceLayoutDirection userInterfaceLayoutDirection();
1237     void setUserInterfaceLayoutDirection(WebCore::UserInterfaceLayoutDirection);
1238
1239     bool hasHadSelectionChangesFromUserInteraction() const { return m_hasHadSelectionChangesFromUserInteraction; }
1240     bool needsHiddenContentEditableQuirk() const { return m_needsHiddenContentEditableQuirk; }
1241     bool needsPlainTextQuirk() const { return m_needsPlainTextQuirk; }
1242
1243     bool isAlwaysOnLoggingAllowed() const;
1244
1245     void canAuthenticateAgainstProtectionSpace(uint64_t loaderID, uint64_t frameID, const WebCore::ProtectionSpace&);
1246
1247 #if ENABLE(GAMEPAD)
1248     void gamepadActivity(const Vector<GamepadData>&, bool shouldMakeGamepadsVisible);
1249 #endif
1250         
1251     WeakPtr<WebPageProxy> createWeakPtr() const { return m_weakPtrFactory.createWeakPtr(*const_cast<WebPageProxy*>(this)); }
1252
1253     void isLoadingChanged() { activityStateDidChange(WebCore::ActivityState::IsLoading); }
1254
1255     void clearUserMediaState();
1256
1257     void setShouldSkipWaitingForPaintAfterNextViewDidMoveToWindow(bool shouldSkip) { m_shouldSkipWaitingForPaintAfterNextViewDidMoveToWindow = shouldSkip; }
1258
1259     void setURLSchemeHandlerForScheme(Ref<WebURLSchemeHandler>&&, const String& scheme);
1260     WebURLSchemeHandler* urlSchemeHandlerForScheme(const String& scheme);
1261
1262 #if PLATFORM(COCOA)
1263     void createSandboxExtensionsIfNeeded(const Vector<String>& files, SandboxExtension::Handle& fileReadHandle, SandboxExtension::HandleArray& fileUploadHandles);
1264 #endif
1265     void editorStateChanged(const EditorState&);
1266
1267 #if PLATFORM(COCOA)
1268     void touchBarMenuDataRemoved();
1269     void touchBarMenuDataChanged(const TouchBarMenuData&);
1270     void touchBarMenuItemDataAdded(const TouchBarMenuItemData&);
1271     void touchBarMenuItemDataRemoved(const TouchBarMenuItemData&);
1272 #endif
1273
1274 #if HAVE(CFNETWORK_STORAGE_PARTITIONING)
1275     void hasStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, uint64_t webProcessContextId);
1276     void requestStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, uint64_t webProcessContextId);
1277 #endif
1278
1279 #if ENABLE(ATTACHMENT_ELEMENT)
1280     void insertAttachment(const String& identifier, const WebCore::AttachmentDisplayOptions&, const String& filename, std::optional<String> contentType, WebCore::SharedBuffer& data, Function<void(CallbackBase::Error)>&&);
1281     void requestAttachmentInfo(const String& identifier, Function<void(const WebCore::AttachmentInfo&, CallbackBase::Error)>&&);
1282     void setAttachmentDisplayOptions(const String& identifier, WebCore::AttachmentDisplayOptions, Function<void(CallbackBase::Error)>&&);
1283     void setAttachmentDataAndContentType(const String& identifier, WebCore::SharedBuffer& data, std::optional<String>&& newContentType, std::optional<String>&& newFilename, Function<void(CallbackBase::Error)>&&);
1284     void attachmentInfoCallback(const WebCore::AttachmentInfo&, CallbackID);
1285 #endif
1286
1287 #if ENABLE(APPLICATION_MANIFEST)
1288     void getApplicationManifest(Function<void(const std::optional<WebCore::ApplicationManifest>&, CallbackBase::Error)>&&);
1289 #endif
1290
1291     void writeBlobToFilePath(const WebCore::URL& blobURL, const String& path, Function<void(bool success)>&&);
1292
1293     WebPreferencesStore preferencesStore() const;
1294
1295     SuspendedPageProxy* maybeCreateSuspendedPage(WebProcessProxy&);
1296     void suspendedPageProcessClosed(SuspendedPageProxy&);
1297
1298 private:
1299     WebPageProxy(PageClient&, WebProcessProxy&, uint64_t pageID, Ref<API::PageConfiguration>&&);
1300     void platformInitialize();
1301
1302     RefPtr<API::Navigation> goToBackForwardItem(WebBackForwardListItem&, WebCore::FrameLoadType);
1303
1304     void updateActivityState(WebCore::ActivityState::Flags flagsToUpdate = WebCore::ActivityState::AllFlags);
1305     void updateThrottleState();
1306     void updateHiddenPageThrottlingAutoIncreases();
1307
1308     enum class ResetStateReason {
1309         PageInvalidated,
1310         WebProcessExited,
1311         NavigationSwap,
1312     };
1313     void resetState(ResetStateReason);
1314     void resetStateAfterProcessExited(ProcessTerminationReason);
1315
1316     void setUserAgent(String&&);
1317
1318     // IPC::MessageReceiver
1319     // Implemented in generated WebPageProxyMessageReceiver.cpp
1320     void didReceiveMessage(IPC::Connection&, IPC::Decoder&) override;
1321     void didReceiveSyncMessage(IPC::Connection&, IPC::Decoder&, std::unique_ptr<IPC::Encoder>&) override;
1322
1323
1324     // IPC::MessageSender
1325     bool sendMessage(std::unique_ptr<IPC::Encoder>, OptionSet<IPC::SendOption>) override;
1326     IPC::Connection* messageSenderConnection() override;
1327     uint64_t messageSenderDestinationID() override;
1328
1329     // WebPopupMenuProxy::Client
1330     void valueChangedForPopupMenu(WebPopupMenuProxy*, int32_t newSelectedIndex) override;
1331     void setTextFromItemForPopupMenu(WebPopupMenuProxy*, int32_t index) override;
1332 #if PLATFORM(GTK)
1333     void failedToShowPopupMenu() override;
1334 #endif
1335
1336 #if ENABLE(POINTER_LOCK)
1337     void requestPointerLock();
1338     void requestPointerUnlock();
1339 #endif
1340
1341     void didCreateMainFrame(uint64_t frameID);
1342     void didCreateSubframe(uint64_t frameID);
1343     void didCreateWindow(uint64_t frameID, WebCore::GlobalWindowIdentifier&&);
1344
1345     void didStartProvisionalLoadForFrame(uint64_t frameID, uint64_t navigationID, WebCore::URL&&, WebCore::URL&& unreachableURL, const UserData&);
1346     void didReceiveServerRedirectForProvisionalLoadForFrame(uint64_t frameID, uint64_t navigationID, WebCore::ResourceRequest&&, const UserData&);
1347     void willPerformClientRedirectForFrame(uint64_t frameID, const String& url, double delay);
1348     void didCancelClientRedirectForFrame(uint64_t frameID);
1349     void didChangeProvisionalURLForFrame(uint64_t frameID, uint64_t navigationID, WebCore::URL&&);
1350     void didFailProvisionalLoadForFrame(uint64_t frameID, const WebCore::SecurityOriginData& frameSecurityOrigin, uint64_t navigationID, const String& provisionalURL, const WebCore::ResourceError&, const UserData&);
1351     void didCommitLoadForFrame(uint64_t frameID, uint64_t navigationID, const String& mimeType, bool frameHasCustomContentProvider, uint32_t frameLoadType, const WebCore::CertificateInfo&, bool containsPluginDocument, std::optional<WebCore::HasInsecureContent> forcedHasInsecureContent, const UserData&);
1352     void didFinishDocumentLoadForFrame(uint64_t frameID, uint64_t navigationID, const UserData&);
1353     void didFinishLoadForFrame(uint64_t frameID, uint64_t navigationID, const UserData&);
1354     void didFailLoadForFrame(uint64_t frameID, uint64_t navigationID, const WebCore::ResourceError&, const UserData&);
1355     void didSameDocumentNavigationForFrame(uint64_t frameID, uint64_t navigationID, uint32_t sameDocumentNavigationType, WebCore::URL&&, const UserData&);
1356     void didChangeMainDocument(uint64_t frameID);
1357
1358     void didReceiveTitleForFrame(uint64_t frameID, const String&, const UserData&);
1359     void didFirstLayoutForFrame(uint64_t frameID, const UserData&);
1360     void didFirstVisuallyNonEmptyLayoutForFrame(uint64_t frameID, const UserData&);
1361     void didDisplayInsecureContentForFrame(uint64_t frameID, const UserData&);
1362     void didRunInsecureContentForFrame(uint64_t frameID, const UserData&);
1363     void didDetectXSSForFrame(uint64_t frameID, const UserData&);
1364     void mainFramePluginHandlesPageScaleGestureDidChange(bool);
1365     void frameDidBecomeFrameSet(uint64_t frameID, bool);
1366     void didStartProgress();
1367     void didChangeProgress(double);
1368     void didFinishProgress();
1369     void setNetworkRequestsInProgress(bool);
1370
1371     void hasInsecureContent(WebCore::HasInsecureContent&);
1372
1373     void didDestroyNavigation(uint64_t navigationID);
1374
1375     void decidePolicyForNavigationAction(uint64_t frameID, const WebCore::SecurityOriginData& frameSecurityOrigin, uint64_t navigationID, NavigationActionData&&, const FrameInfoData&, uint64_t originatingPageID, const WebCore::ResourceRequest& originalRequest, WebCore::ResourceRequest&&, uint64_t listenerID, const UserData&);
1376     void decidePolicyForNavigationActionSync(uint64_t frameID, const WebCore::SecurityOriginData& frameSecurityOrigin, uint64_t navigationID, NavigationActionData&&, const FrameInfoData&, uint64_t originatingPageID, const WebCore::ResourceRequest& originalRequest, WebCore::ResourceRequest&&, uint64_t listenerID, const UserData&, Ref<Messages::WebPageProxy::DecidePolicyForNavigationActionSync::DelayedReply>&&);
1377     void decidePolicyForNewWindowAction(uint64_t frameID, const WebCore::SecurityOriginData& frameSecurityOrigin, NavigationActionData&&, WebCore::ResourceRequest&&, const String& frameName, uint64_t listenerID, const UserData&);
1378     void decidePolicyForResponse(uint64_t frameID, const WebCore::SecurityOriginData& frameSecurityOrigin, uint64_t navigationID, const WebCore::ResourceResponse&, const WebCore::ResourceRequest&, bool canShowMIMEType, uint64_t listenerID, const UserData&);
1379     void unableToImplementPolicy(uint64_t frameID, const WebCore::ResourceError&, const UserData&);
1380
1381     void willSubmitForm(uint64_t frameID, uint64_t sourceFrameID, const Vector<std::pair<String, String>>& textFieldValues, uint64_t listenerID, const UserData&);
1382         
1383     void contentRuleListNotification(WebCore::URL&&, Vector<String>&& identifiers, Vector<String>&& notifications);
1384
1385     // History client
1386     void didNavigateWithNavigationData(const WebNavigationDataStore&, uint64_t frameID);
1387     void didPerformClientRedirect(const String& sourceURLString, const String& destinationURLString, uint64_t frameID);
1388     void didPerformServerRedirect(const String& sourceURLString, const String& destinationURLString, uint64_t frameID);
1389     void didUpdateHistoryTitle(const String& title, const String& url, uint64_t frameID);
1390
1391     // UI client
1392     void createNewPage(const FrameInfoData&, uint64_t originatingPageID, WebCore::ResourceRequest&&, WebCore::WindowFeatures&&, NavigationActionData&&, Ref<Messages::WebPageProxy::CreateNewPage::DelayedReply>&&);
1393     void showPage();
1394     void runJavaScriptAlert(uint64_t frameID, const WebCore::SecurityOriginData&, const String&, Ref<Messages::WebPageProxy::RunJavaScriptAlert::DelayedReply>&&);
1395     void runJavaScriptConfirm(uint64_t frameID, const WebCore::SecurityOriginData&, const String&, Ref<Messages::WebPageProxy::RunJavaScriptConfirm::DelayedReply>&&);
1396     void runJavaScriptPrompt(uint64_t frameID, const WebCore::SecurityOriginData&, const String&, const String&, Ref<Messages::WebPageProxy::RunJavaScriptPrompt::DelayedReply>&&);
1397     void setStatusText(const String&);
1398     void mouseDidMoveOverElement(WebHitTestResultData&&, uint32_t modifiers, UserData&&);
1399
1400 #if ENABLE(NETSCAPE_PLUGIN_API)
1401     void unavailablePluginButtonClicked(uint32_t opaquePluginUnavailabilityReason, const String& mimeType, const String& pluginURLString, const String& pluginsPageURLString, const String& frameURLString, const String& pageURLString);
1402 #endif // ENABLE(NETSCAPE_PLUGIN_API)
1403 #if ENABLE(WEBGL)
1404     void webGLPolicyForURL(WebCore::URL&&, Ref<Messages::WebPageProxy::WebGLPolicyForURL::DelayedReply>&&);
1405     void resolveWebGLPolicyForURL(WebCore::URL&&, Ref<Messages::WebPageProxy::ResolveWebGLPolicyForURL::DelayedReply>&&);
1406 #endif // ENABLE(WEBGL)
1407     void setToolbarsAreVisible(bool toolbarsAreVisible);
1408     void getToolbarsAreVisible(Ref<Messages::WebPageProxy::GetToolbarsAreVisible::DelayedReply>&&);
1409     void setMenuBarIsVisible(bool menuBarIsVisible);
1410     void getMenuBarIsVisible(Ref<Messages::WebPageProxy::GetMenuBarIsVisible::DelayedReply>&&);
1411     void setStatusBarIsVisible(bool statusBarIsVisible);
1412     void getStatusBarIsVisible(Ref<Messages::WebPageProxy::GetStatusBarIsVisible::DelayedReply>&&);
1413     void setIsResizable(bool isResizable);
1414     void screenToRootView(const WebCore::IntPoint& screenPoint, Ref<Messages::WebPageProxy::ScreenToRootView::DelayedReply>&&);
1415     void rootViewToScreen(const WebCore::IntRect& viewRect, Ref<Messages::WebPageProxy::RootViewToScreen::DelayedReply>&&);
1416 #if PLATFORM(IOS)
1417     void accessibilityScreenToRootView(const WebCore::IntPoint& screenPoint, WebCore::IntPoint& windowPoint);
1418     void rootViewToAccessibilityScreen(const WebCore::IntRect& viewRect, WebCore::IntRect& result);
1419 #endif
1420     void runBeforeUnloadConfirmPanel(uint64_t frameID, const WebCore::SecurityOriginData&, const String& message, RefPtr<Messages::WebPageProxy::RunBeforeUnloadConfirmPanel::DelayedReply>);
1421     void didChangeViewportProperties(const WebCore::ViewportAttributes&);
1422     void pageDidScroll();
1423     void runOpenPanel(uint64_t frameID, const WebCore::SecurityOriginData&, const WebCore::FileChooserSettings&);
1424     void printFrame(uint64_t frameID);
1425     void exceededDatabaseQuota(uint64_t frameID, const String& originIdentifier, const String& databaseName, const String& displayName, uint64_t currentQuota, uint64_t currentOriginUsage, uint64_t currentDatabaseUsage, uint64_t expectedUsage, Ref<Messages::WebPageProxy::ExceededDatabaseQuota::DelayedReply>&&);
1426     void reachedApplicationCacheOriginQuota(const String& originIdentifier, uint64_t currentQuota, uint64_t totalBytesNeeded, Ref<Messages::WebPageProxy::ReachedApplicationCacheOriginQuota::DelayedReply>&&);
1427     void requestGeolocationPermissionForFrame(uint64_t geolocationID, uint64_t frameID, String originIdentifier);
1428
1429 #if ENABLE(MEDIA_STREAM)
1430     UserMediaPermissionRequestManagerProxy& userMediaPermissionRequestManager();
1431 #endif
1432     void requestUserMediaPermissionForFrame(uint64_t userMediaID, uint64_t frameID, const WebCore::SecurityOriginData& userMediaDocumentOriginIdentifier, const WebCore::SecurityOriginData& topLevelDocumentOriginIdentifier, const WebCore::MediaStreamRequest&);
1433     void enumerateMediaDevicesForFrame(uint64_t userMediaID, uint64_t frameID, const WebCore::SecurityOriginData& userMediaDocumentOriginData, const WebCore::SecurityOriginData& topLevelDocumentOriginData);
1434
1435     void runModal();
1436     void notifyScrollerThumbIsVisibleInRect(const WebCore::IntRect&);
1437     void recommendedScrollbarStyleDidChange(int32_t newStyle);
1438     void didChangeScrollbarsForMainFrame(bool hasHorizontalScrollbar, bool hasVerticalScrollbar);
1439     void didChangeScrollOffsetPinningForMainFrame(bool pinnedToLeftSide, bool pinnedToRightSide, bool pinnedToTopSide, bool pinnedToBottomSide);
1440     void didChangePageCount(unsigned);
1441     void pageExtendedBackgroundColorDidChange(const WebCore::Color&);
1442 #if ENABLE(NETSCAPE_PLUGIN_API)
1443     void didFailToInitializePlugin(const String& mimeType, const String& frameURLString, const String& pageURLString);
1444     void didBlockInsecurePluginVersion(const String& mimeType, const String& pluginURLString, const String& frameURLString, const String& pageURLString, bool replacementObscured);
1445 #endif // ENABLE(NETSCAPE_PLUGIN_API)
1446     void setCanShortCircuitHorizontalWheelEvents(bool canShortCircuitHorizontalWheelEvents) { m_canShortCircuitHorizontalWheelEvents = canShortCircuitHorizontalWheelEvents; }
1447
1448     void reattachToWebProcess();
1449     void attachToProcessForNavigation(Ref<WebProcessProxy>&&);
1450     void reattachToWebProcess(Ref<WebProcessProxy>&&, bool suspendInOldProcess);
1451
1452     RefPtr<API::Navigation> reattachToWebProcessForReload();
1453     RefPtr<API::Navigation> reattachToWebProcessWithItem(WebBackForwardListItem&);
1454
1455     void loadRequestWithNavigation(API::Navigation&, WebCore::ResourceRequest&&, WebCore::ShouldOpenExternalURLsPolicy, API::Object* userData, WebCore::NavigationPolicyCheck);
1456
1457     void requestNotificationPermission(uint64_t notificationID, const String& originString);
1458     void showNotification(const String& title, const String& body, const String& iconURL, const String& tag, const String& lang, WebCore::NotificationDirection, const String& originString, uint64_t notificationID);
1459     void cancelNotification(uint64_t notificationID);
1460     void clearNotifications(const Vector<uint64_t>& notificationIDs);
1461     void didDestroyNotification(uint64_t notificationID);
1462
1463     void didChangeContentSize(const WebCore::IntSize&);
1464
1465 #if ENABLE(INPUT_TYPE_COLOR)
1466     void showColorPicker(const WebCore::Color& initialColor, const WebCore::IntRect&);
1467     void didChooseColor(const WebCore::Color&) override;
1468     void didEndColorPicker() override;
1469 #endif
1470
1471     void compositionWasCanceled();
1472     void setHasHadSelectionChangesFromUserInteraction(bool);
1473     void setNeedsHiddenContentEditableQuirk(bool);
1474     void setNeedsPlainTextQuirk(bool);
1475
1476     // Back/Forward list management
1477     void backForwardAddItem(BackForwardListItemState&&);
1478     void backForwardGoToItem(const WebCore::BackForwardItemIdentifier&, SandboxExtension::Handle&);
1479     void backForwardItemAtIndex(int32_t index, std::optional<WebCore::BackForwardItemIdentifier>&);
1480     void backForwardBackListCount(int32_t& count);
1481     void backForwardForwardListCount(int32_t& count);
1482     void backForwardClear();
1483
1484     // Undo management
1485     void registerEditCommandForUndo(uint64_t commandID, uint32_t editAction);
1486     void registerInsertionUndoGrouping();
1487     void clearAllEditCommands();
1488     void canUndoRedo(uint32_t action, bool& result);
1489     void executeUndoRedo(uint32_t action, bool& result);
1490
1491     // Keyboard handling
1492 #if PLATFORM(COCOA)
1493     void executeSavedCommandBySelector(const String& selector, bool& handled);
1494 #endif
1495
1496 #if PLATFORM(GTK)
1497     void getEditorCommandsForKeyEvent(const AtomicString&, Vector<String>&);
1498     void bindAccessibilityTree(const String&);
1499 #endif
1500
1501     // Popup Menu.
1502     void showPopupMenu(const WebCore::IntRect& rect, uint64_t textDirection, const Vector<WebPopupItem>& items, int32_t selectedIndex, const PlatformPopupMenuData&);
1503     void hidePopupMenu();
1504
1505 #if ENABLE(CONTEXT_MENUS)
1506     void showContextMenu(ContextMenuContextData&&, const UserData&);
1507 #endif
1508
1509 #if ENABLE(TELEPHONE_NUMBER_DETECTION)
1510 #if PLATFORM(MAC)
1511     void showTelephoneNumberMenu(const String& telephoneNumber, const WebCore::IntPoint&);
1512 #endif
1513 #endif
1514
1515     // Search popup results
1516     void saveRecentSearches(const String&, const Vector<WebCore::RecentSearch>&);
1517     void loadRecentSearches(const String&, Vector<WebCore::RecentSearch>&);
1518
1519 #if PLATFORM(COCOA)
1520     // Speech.
1521     void getIsSpeaking(bool&);
1522     void speak(const String&);
1523     void stopSpeaking();
1524
1525     // Spotlight.
1526     void searchWithSpotlight(const String&);
1527         
1528     void searchTheWeb(const String&);
1529
1530     // Dictionary.
1531     void didPerformDictionaryLookup(const WebCore::DictionaryPopupInfo&);
1532 #endif
1533
1534 #if PLATFORM(MAC)
1535     bool appleMailPaginationQuirkEnabled();
1536 #endif
1537
1538 #if PLATFORM(MAC)
1539     // FIXME: Need to support iOS too, but there is no isAppleMail for iOS.
1540     bool appleMailLinesClampEnabled();
1541 #endif
1542
1543     // Spelling and grammar.
1544     void checkSpellingOfString(const String& text, int32_t& misspellingLocation, int32_t& misspellingLength);
1545     void checkGrammarOfString(const String& text, Vector<WebCore::GrammarDetail>&, int32_t& badGrammarLocation, int32_t& badGrammarLength);
1546     void spellingUIIsShowing(bool&);
1547     void updateSpellingUIWithMisspelledWord(const String& misspelledWord);
1548     void updateSpellingUIWithGrammarString(const String& badGrammarPhrase, const WebCore::GrammarDetail&);
1549     void learnWord(const String& word);
1550     void ignoreWord(const String& word);
1551     void requestCheckingOfString(uint64_t requestID, const WebCore::TextCheckingRequestData&, int32_t insertionPoint);
1552
1553     void takeFocus(uint32_t direction);
1554     void setToolTip(const String&);
1555     void setCursor(const WebCore::Cursor&);
1556     void setCursorHiddenUntilMouseMoves(bool);
1557
1558     void didReceiveEvent(uint32_t opaqueType, bool handled);
1559
1560     void voidCallback(CallbackID);
1561     void dataCallback(const IPC::DataReference&, CallbackID);
1562     void imageCallback(const ShareableBitmap::Handle&, CallbackID);
1563     void stringCallback(const String&, CallbackID);
1564     void invalidateStringCallback(CallbackID);
1565     void scriptValueCallback(const IPC::DataReference&, bool hadException, const WebCore::ExceptionDetails&, CallbackID);
1566     void computedPagesCallback(const Vector<WebCore::IntRect>&, double totalScaleFactorForPrinting, CallbackID);
1567     void validateCommandCallback(const String&, bool, int, CallbackID);
1568     void unsignedCallback(uint64_t, CallbackID);
1569     void editingRangeCallback(const EditingRange&, CallbackID);
1570 #if ENABLE(APPLICATION_MANIFEST)
1571     void applicationManifestCallback(const std::optional<WebCore::ApplicationManifest>&, CallbackID);
1572 #endif
1573 #if PLATFORM(COCOA)
1574     void machSendRightCallback(const WTF::MachSendRight&, CallbackID);
1575 #endif
1576     void rectForCharacterRangeCallback(const WebCore::IntRect&, const EditingRange&, CallbackID);
1577 #if PLATFORM(MAC)
1578     void attributedStringForCharacterRangeCallback(const AttributedString&, const EditingRange&, CallbackID);
1579     void fontAtSelectionCallback(const String&, double, bool, CallbackID);
1580 #endif
1581 #if PLATFORM(IOS)
1582     void gestureCallback(const WebCore::IntPoint&, uint32_t gestureType, uint32_t gestureState, uint32_t flags, CallbackID);
1583     void touchesCallback(const WebCore::IntPoint&, uint32_t touches, uint32_t flags, CallbackID);
1584     void autocorrectionDataCallback(const Vector<WebCore::FloatRect>&, const String& fontName, float fontSize, uint64_t fontTraits, CallbackID);
1585     void autocorrectionContextCallback(const String& beforeText, const String& markedText, const String& selectedText, const String& afterText, uint64_t location, uint64_t length, CallbackID);
1586     void selectionContextCallback(const String& selectedText, const String& beforeText, const String& afterText, CallbackID);
1587     void interpretKeyEvent(const EditorState&, bool isCharEvent, bool& handled);
1588     void showPlaybackTargetPicker(bool hasVideo, const WebCore::IntRect& elementRect);
1589     void selectionRectsCallback(const Vector<WebCore::SelectionRect>&, CallbackID);
1590 #endif
1591 #if PLATFORM(GTK)
1592     void printFinishedCallback(const WebCore::ResourceError&, CallbackID);
1593 #endif
1594
1595     void focusedFrameChanged(uint64_t frameID);
1596     void frameSetLargestFrameChanged(uint64_t frameID);
1597
1598     void didFinishLoadingDataForCustomContentProvider(const String& suggestedFilename, const IPC::DataReference&);
1599
1600 #if PLATFORM(COCOA)
1601     void pluginFocusOrWindowFocusChanged(uint64_t pluginComplexTextInputIdentifier, bool pluginHasFocusAndWindowHasFocus);
1602     void setPluginComplexTextInputState(uint64_t pluginComplexTextInputIdentifier, uint64_t complexTextInputState);
1603 #endif
1604
1605     bool maybeInitializeSandboxExtensionHandle(const WebCore::URL&, SandboxExtension::Handle&);
1606
1607 #if USE(AUTOMATIC_TEXT_REPLACEMENT)
1608     void toggleSmartInsertDelete();
1609     void toggleAutomaticQuoteSubstitution();
1610     void toggleAutomaticLinkDetection();
1611     void toggleAutomaticDashSubstitution();
1612     void toggleAutomaticTextReplacement();
1613 #endif
1614
1615 #if PLATFORM(MAC)
1616     void substitutionsPanelIsShowing(bool&);
1617     void showCorrectionPanel(int32_t panelType, const WebCore::FloatRect& boundingBoxOfReplacedString, const String& replacedString, const String& replacementString, const Vector<String>& alternativeReplacementStrings);
1618     void dismissCorrectionPanel(int32_t reason);
1619     void dismissCorrectionPanelSoon(int32_t reason, String& result);
1620     void recordAutocorrectionResponse(int32_t responseType, const String& replacedString, const String& replacementString);
1621
1622 #if USE(DICTATION_ALTERNATIVES)
1623     void showDictationAlternativeUI(const WebCore::FloatRect& boundingBoxOfDictatedText, uint64_t dictationContext);
1624     void removeDictationAlternatives(uint64_t dictationContext);
1625     void dictationAlternatives(uint64_t dictationContext, Vector<String>& result);
1626 #endif
1627
1628     void setEditableElementIsFocused(bool);
1629 #endif // PLATFORM(MAC)
1630
1631 #if PLATFORM(IOS)
1632     WebCore::FloatSize screenSize();
1633     WebCore::FloatSize availableScreenSize();
1634     WebCore::FloatSize overrideScreenSize();
1635     float textAutosizingWidth();
1636
1637     void dynamicViewportUpdateChangedTarget(double newTargetScale, const WebCore::FloatPoint& newScrollPosition, uint64_t dynamicViewportSizeUpdateID);
1638     void couldNotRestorePageState();
1639     void restorePageState(std::optional<WebCore::FloatPoint> scrollPosition, const WebCore::FloatPoint& scrollOrigin, const WebCore::FloatBoxExtent& obscuredInsetsOnSave, double scale);
1640     void restorePageCenterAndScale(std::optional<WebCore::FloatPoint>, double scale);
1641
1642     void didGetTapHighlightGeometries(uint64_t requestID, const WebCore::Color& color, const Vector<WebCore::FloatQuad>& geometries, const WebCore::IntSize& topLeftRadius, const WebCore::IntSize& topRightRadius, const WebCore::IntSize& bottomLeftRadius, const WebCore::IntSize& bottomRightRadius);
1643
1644     void startAssistingNode(const AssistedNodeInformation&, bool userIsInteracting, bool blurPreviousNode, bool changingActivityState, const UserData&);
1645     void stopAssistingNode();
1646
1647     void showInspectorHighlight(const WebCore::Highlight&);
1648     void hideInspectorHighlight();
1649
1650     void showInspectorIndication();
1651     void hideInspectorIndication();
1652
1653     void enableInspectorNodeSearch();
1654     void disableInspectorNodeSearch();
1655     void assistedNodeInformationCallback(const AssistedNodeInformation&, CallbackID);
1656 #endif // PLATFORM(IOS)
1657
1658 #if ENABLE(DATA_DETECTION)
1659     RetainPtr<NSArray> m_dataDetectionResults;
1660 #endif
1661
1662     void clearLoadDependentCallbacks();
1663
1664     void performDragControllerAction(DragControllerAction, WebCore::DragData&, const String& dragStorageName, SandboxExtension::Handle&&, SandboxExtension::HandleArray&&);
1665
1666     void updateBackingStoreDiscardableState();
1667
1668     void setRenderTreeSize(uint64_t treeSize) { m_renderTreeSize = treeSize; }
1669
1670 #if PLATFORM(X11)
1671     void createPluginContainer(uint64_t& windowID);
1672     void windowedPluginGeometryDidChange(const WebCore::IntRect& frameRect, const WebCore::IntRect& clipRect, uint64_t windowID);
1673     void windowedPluginVisibilityDidChange(bool isVisible, uint64_t windowID);
1674 #endif
1675
1676     void processNextQueuedWheelEvent();
1677     void sendWheelEvent(const WebWheelEvent&);
1678     bool shouldProcessWheelEventNow(const WebWheelEvent&) const;
1679
1680 #if ENABLE(TOUCH_EVENTS)
1681     void updateTouchEventTracking(const WebTouchEvent&);
1682     WebCore::TrackingType touchEventTrackingType(const WebTouchEvent&) const;
1683 #endif
1684
1685 #if ENABLE(NETSCAPE_PLUGIN_API)
1686     void findPlugin(const String& mimeType, uint32_t processType, const String& urlString, const String& frameURLString, const String& pageURLString, bool allowOnlyApplicationPlugins, uint64_t& pluginProcessToken, String& newMIMEType, uint32_t& pluginLoadPolicy, String& unavailabilityDescription, bool& isUnsupported);
1687 #endif
1688
1689 #if USE(QUICK_LOOK)
1690     void didStartLoadForQuickLookDocumentInMainFrame(const String& fileName, const String& uti);
1691     void didFinishLoadForQuickLookDocumentInMainFrame(const QuickLookDocumentData&);
1692     void didRequestPasswordForQuickLookDocumentInMainFrame(const String& fileName);
1693 #endif
1694
1695 #if ENABLE(CONTENT_FILTERING)
1696     void contentFilterDidBlockLoadForFrame(const WebCore::ContentFilterUnblockHandler&, uint64_t frameID);
1697 #endif
1698
1699     API::DiagnosticLoggingClient* effectiveDiagnosticLoggingClient(WebCore::ShouldSample);
1700
1701     void dispatchActivityStateChange();
1702     void viewDidLeaveWindow();
1703     void viewDidEnterWindow();
1704
1705 #if PLATFORM(MAC)
1706     void didPerformImmediateActionHitTest(const WebHitTestResultData&, bool contentPreventsDefault, const UserData&);
1707 #endif
1708
1709     void useFixedLayoutDidChange(bool useFixedLayout) { m_useFixedLayout = useFixedLayout; }
1710     void fixedLayoutSizeDidChange(WebCore::IntSize fixedLayoutSize) { m_fixedLayoutSize = fixedLayoutSize; }
1711
1712     void imageOrMediaDocumentSizeChanged(const WebCore::IntSize&);
1713 #if ENABLE(VIDEO)
1714 #if USE(GSTREAMER)
1715     void requestInstallMissingMediaPlugins(const String& details, const String& description);
1716 #endif
1717 #endif
1718
1719     void startURLSchemeTask(URLSchemeTaskParameters&&);
1720     void stopURLSchemeTask(uint64_t handlerIdentifier, uint64_t taskIdentifier);
1721
1722     void handleAutoFillButtonClick(const UserData&);
1723
1724     void finishInitializingWebPageAfterProcessLaunch();
1725
1726     void handleMessage(IPC::Connection&, const String& messageName, const UserData& messageBody);
1727     void handleSynchronousMessage(IPC::Connection&, const String& messageName, const UserData& messageBody, UserData& returnUserData);
1728
1729     void viewIsBecomingVisible();
1730
1731     void stopAllURLSchemeTasks();
1732
1733 #if ENABLE(ATTACHMENT_ELEMENT)
1734     void didInsertAttachment(const String& identifier, const String& source);
1735     void didRemoveAttachment(const String& identifier);
1736 #endif
1737
1738 #if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101400
1739     void startDisplayLink(unsigned observerID);
1740     void stopDisplayLink(unsigned observerID);
1741 #endif
1742
1743     void reportPageLoadResult(const WebCore::ResourceError& = { });
1744
1745     void continueNavigationInNewProcess(API::Navigation&, Ref<WebProcessProxy>&&);
1746
1747     PageClient& m_pageClient;
1748     Ref<API::PageConfiguration> m_configuration;
1749
1750     std::unique_ptr<API::LoaderClient> m_loaderClient;
1751     std::unique_ptr<API::PolicyClient> m_policyClient;
1752     std::unique_ptr<API::NavigationClient> m_navigationClient;
1753     std::unique_ptr<API::HistoryClient> m_historyClient;
1754     std::unique_ptr<API::IconLoadingClient> m_iconLoadingClient;
1755     std::unique_ptr<API::FormClient> m_formClient;
1756     std::unique_ptr<API::UIClient> m_uiClient;
1757     std::unique_ptr<API::FindClient> m_findClient;
1758     std::unique_ptr<API::FindMatchesClient> m_findMatchesClient;
1759     std::unique_ptr<API::DiagnosticLoggingClient> m_diagnosticLoggingClient;
1760 #if ENABLE(CONTEXT_MENUS)
1761     std::unique_ptr<API::ContextMenuClient> m_contextMenuClient;
1762 #endif
1763     std::unique_ptr<WebPageInjectedBundleClient> m_injectedBundleClient;
1764
1765     std::unique_ptr<WebNavigationState> m_navigationState;
1766     String m_failingProvisionalLoadURL;
1767     bool m_isLoadingAlternateHTMLStringForFailingProvisionalLoad { false };
1768
1769     std::unique_ptr<DrawingAreaProxy> m_drawingArea;
1770 #if ENABLE(ASYNC_SCROLLING)
1771     std::unique_ptr<RemoteScrollingCoordinatorProxy> m_scrollingCoordinatorProxy;
1772 #endif
1773
1774     Ref<WebProcessProxy> m_process;
1775     Ref<WebPageGroup> m_pageGroup;
1776     Ref<WebPreferences> m_preferences;
1777
1778     WebProcessLifetimeTracker m_webProcessLifetimeTracker { *this };
1779
1780     Ref<WebUserContentControllerProxy> m_userContentController;
1781     Ref<VisitedLinkStore> m_visitedLinkStore;
1782     Ref<WebsiteDataStore> m_websiteDataStore;
1783
1784     RefPtr<WebFrameProxy> m_mainFrame;
1785     Function<void()> m_mainFrameCreationHandler;
1786     Function<void(const WebCore::GlobalWindowIdentifier&)> m_mainFrameWindowCreationHandler;
1787
1788     RefPtr<WebFrameProxy> m_focusedFrame;
1789     RefPtr<WebFrameProxy> m_frameSetLargestFrame;
1790
1791     String m_userAgent;
1792     String m_applicationNameForUserAgent;
1793     String m_customUserAgent;
1794     String m_customTextEncodingName;
1795     String m_overrideContentSecurityPolicy;
1796
1797     bool m_treatsSHA1CertificatesAsInsecure { true };
1798
1799     RefPtr<WebInspectorProxy> m_inspector;
1800
1801 #if ENABLE(FULLSCREEN_API)
1802     RefPtr<WebFullScreenManagerProxy> m_fullScreenManager;
1803     std::unique_ptr<API::FullscreenClient> m_fullscreenClient;
1804 #endif
1805
1806 #if (PLATFORM(IOS) && HAVE(AVKIT)) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))
1807     RefPtr<PlaybackSessionManagerProxy> m_playbackSessionManager;
1808     RefPtr<VideoFullscreenManagerProxy> m_videoFullscreenManager;
1809 #endif
1810
1811 #if PLATFORM(IOS)
1812     VisibleContentRectUpdateInfo m_lastVisibleContentRectUpdate;
1813     uint64_t m_firstLayerTreeTransactionIdAfterDidCommitLoad { 0 };
1814     int32_t m_deviceOrientation { 0 };
1815     uint64_t m_dynamicViewportSizeUpdateLayerTreeTransactionID { 0 };
1816     uint64_t m_currentDynamicViewportSizeUpdateID { 0 };
1817     bool m_hasReceivedLayerTreeTransactionAfterDidCommitLoad { true };
1818     bool m_dynamicViewportSizeUpdateWaitingForTarget { false };
1819     bool m_dynamicViewportSizeUpdateWaitingForLayerTreeCommit { false };
1820     bool m_hasNetworkRequestsOnSuspended { false };
1821     bool m_isKeyboardAnimatingIn { false };
1822     bool m_isScrollingOrZooming { false };
1823 #endif
1824         
1825 #if PLATFORM(MAC)
1826     bool m_useSystemAppearance { false };
1827     bool m_defaultAppearance { true };
1828 #endif
1829
1830 #if ENABLE(APPLE_PAY)
1831     std::unique_ptr<WebPaymentCoordinatorProxy> m_paymentCoordinator;
1832 #endif
1833
1834     std::unique_ptr<SystemPreviewController> m_systemPreviewController;
1835
1836 #if ENABLE(WEB_AUTHN)
1837     std::unique_ptr<WebCredentialsMessengerProxy> m_credentialsMessenger;
1838 #endif
1839
1840     CallbackMap m_callbacks;
1841     HashSet<CallbackID> m_loadDependentStringCallbackIDs;
1842
1843     HashSet<WebEditCommandProxy*> m_editCommandSet;
1844
1845 #if PLATFORM(COCOA)
1846     HashSet<String> m_knownKeypressCommandNames;
1847 #endif
1848
1849     RefPtr<WebPopupMenuProxy> m_activePopupMenu;
1850 #if ENABLE(CONTEXT_MENUS)
1851     RefPtr<WebContextMenuProxy> m_activeContextMenu;
1852     ContextMenuContextData m_activeContextMenuContextData;
1853 #endif
1854     RefPtr<API::HitTestResult> m_lastMouseMoveHitTestResult;
1855
1856     RefPtr<WebOpenPanelResultListenerProxy> m_openPanelResultListener;
1857     GeolocationPermissionRequestManagerProxy m_geolocationPermissionRequestManager;
1858     NotificationPermissionRequestManagerProxy m_notificationPermissionRequestManager;
1859
1860 #if ENABLE(MEDIA_STREAM)
1861     std::unique_ptr<UserMediaPermissionRequestManagerProxy> m_userMediaPermissionRequestManager;
1862 #endif
1863
1864     WebCore::ActivityState::Flags m_activityState { WebCore::ActivityState::NoFlags };
1865     bool m_viewWasEverInWindow { false };
1866 #if PLATFORM(IOS)
1867     bool m_allowsMediaDocumentInlinePlayback { false };
1868     bool m_alwaysRunsAtForegroundPriority { false };
1869     ProcessThrottler::ForegroundActivityToken m_activityToken;
1870 #endif
1871     bool m_initialCapitalizationEnabled { false };
1872     std::optional<double> m_cpuLimit;
1873     Ref<WebBackForwardList> m_backForwardList;
1874         
1875     bool m_maintainsInactiveSelection { false };
1876
1877     bool m_waitsForPaintAfterViewDidMoveToWindow { false };
1878     bool m_shouldSkipWaitingForPaintAfterNextViewDidMoveToWindow { false };
1879
1880     String m_toolTip;
1881
1882     EditorState m_editorState;
1883     bool m_isEditable { false };
1884
1885 #if PLATFORM(COCOA)
1886     TouchBarMenuData m_touchBarMenuData;
1887 #endif
1888
1889     double m_textZoomFactor { 1 };
1890     double m_pageZoomFactor { 1 };
1891     double m_pageScaleFactor { 1 };
1892     double m_pluginZoomFactor { 1 };
1893     double m_pluginScaleFactor { 1 };
1894     double m_viewScaleFactor { 1 };
1895     float m_intrinsicDeviceScaleFactor { 1 };
1896     std::optional<float> m_customDeviceScaleFactor;
1897     float m_topContentInset { 0 };
1898
1899     LayerHostingMode m_layerHostingMode { LayerHostingMode::InProcess };
1900
1901     bool m_drawsBackground { true };
1902
1903     WebCore::Color m_underlayColor;
1904     WebCore::Color m_pageExtendedBackgroundColor;
1905
1906     bool m_useFixedLayout { false };
1907     WebCore::IntSize m_fixedLayoutSize;
1908
1909     bool m_alwaysShowsHorizontalScroller { false };
1910     bool m_alwaysShowsVerticalScroller { false };
1911
1912     WebCore::LayoutMilestones m_observedLayoutMilestones { 0 };
1913
1914     bool m_suppressScrollbarAnimations { false };
1915
1916     WebCore::Pagination::Mode m_paginationMode { WebCore::Pagination::Unpaginated };
1917     bool m_paginationBehavesLikeColumns { false };
1918     double m_pageLength { 0 };
1919     double m_gapBetweenPages { 0 };
1920     bool m_paginationLineGridEnabled { false };
1921         
1922     // If the process backing the web page is alive and kicking.
1923     bool m_isValid { true };
1924
1925     // Whether WebPageProxy::close() has been called on this page.
1926     bool m_isClosed { false };
1927
1928     // Whether it can run modal child web pages.
1929     bool m_canRunModal { false };
1930
1931     bool m_needsToFinishInitializingWebPageAfterProcessLaunch { false };
1932
1933     bool m_isInPrintingMode { false };
1934     bool m_isPerformingDOMPrintOperation { false };
1935
1936     // Synchronous navigation policy decision.
1937     RefPtr<Messages::WebPageProxy::DecidePolicyForNavigationActionSync::DelayedReply> m_syncNavigationActionPolicyReply;
1938
1939     WebCore::ResourceRequest m_decidePolicyForResponseRequest;
1940     bool m_shouldSuppressAppLinksInNextNavigationPolicyDecision { false };
1941
1942     Deque<NativeWebKeyboardEvent> m_keyEventQueue;
1943     Deque<NativeWebWheelEvent> m_wheelEventQueue;
1944     Deque<std::unique_ptr<Vector<NativeWebWheelEvent>>> m_currentlyProcessedWheelEvents;
1945 #if ENABLE(MAC_GESTURE_EVENTS)
1946     Deque<NativeWebGestureEvent> m_gestureEventQueue;
1947 #endif
1948
1949     bool m_processingMouseMoveEvent { false };
1950     std::unique_ptr<NativeWebMouseEvent> m_nextMouseMoveEvent;
1951     std::unique_ptr<NativeWebMouseEvent> m_currentlyProcessedMouseDownEvent;
1952
1953 #if ENABLE(TOUCH_EVENTS)
1954     struct TouchEventTracking {
1955         WebCore::TrackingType touchForceChangedTracking { WebCore::TrackingType::NotTracking };
1956         WebCore::TrackingType touchStartTracking { WebCore::TrackingType::NotTracking };
1957         WebCore::TrackingType touchMoveTracking { WebCore::TrackingType::NotTracking };
1958         WebCore::TrackingType touchEndTracking { WebCore::TrackingType::NotTracking };
1959
1960         bool isTrackingAnything() const
1961         {
1962             return touchForceChangedTracking != WebCore::TrackingType::NotTracking
1963                 || touchStartTracking != WebCore::TrackingType::NotTracking
1964                 || touchMoveTracking != WebCore::TrackingType::NotTracking
1965                 || touchEndTracking != WebCore::TrackingType::NotTracking;
1966         }
1967
1968         void reset()
1969         {
1970             touchForceChangedTracking = WebCore::TrackingType::NotTracking;
1971             touchStartTracking = WebCore::TrackingType::NotTracking;
1972             touchMoveTracking = WebCore::TrackingType::NotTracking;
1973             touchEndTracking = WebCore::TrackingType::NotTracking;
1974         }
1975     };
1976     TouchEventTracking m_touchEventTracking;
1977 #endif
1978 #if ENABLE(TOUCH_EVENTS) && !ENABLE(IOS_TOUCH_EVENTS)
1979     Deque<QueuedTouchEvents> m_touchEventQueue;
1980 #endif
1981
1982 #if ENABLE(INPUT_TYPE_COLOR)
1983     RefPtr<WebColorPicker> m_colorPicker;
1984 #endif
1985 #if PLATFORM(COCOA)
1986     RefPtr<WebCore::ValidationBubble> m_validationBubble;
1987 #endif
1988
1989     const uint64_t m_pageID;
1990
1991     bool m_isPageSuspended { false };
1992     bool m_addsVisitedLinks { true };
1993
1994     bool m_controlledByAutomation { false };
1995
1996 #if ENABLE(REMOTE_INSPECTOR)
1997     bool m_allowsRemoteInspection { true };
1998     String m_remoteInspectionNameOverride;
1999 #endif
2000
2001 #if PLATFORM(COCOA)
2002     bool m_isSmartInsertDeleteEnabled { false };
2003 #endif
2004
2005 #if PLATFORM(GTK)
2006     String m_accessibilityPlugID;
2007     WebCore::Color m_backgroundColor { WebCore::Color::white };
2008 #endif
2009
2010     int64_t m_spellDocumentTag { 0 }; // FIXME: use std::optional<>.
2011     bool m_hasSpellDocumentTag { false }; 
2012     unsigned m_pendingLearnOrIgnoreWordMessageCount { 0 };
2013
2014     bool m_mainFrameHasCustomContentProvider { false };
2015
2016 #if ENABLE(DRAG_SUPPORT)
2017     // Current drag destination details are delivered as an asynchronous response,
2018     // so we preserve them to be used when the next dragging delegate call is made.
2019     WebCore::DragOperation m_currentDragOperation { WebCore::DragOperationNone };
2020     bool m_currentDragIsOverFileInput { false };
2021     unsigned m_currentDragNumberOfFilesToBeAccepted { 0 };
2022     WebCore::IntRect m_currentDragCaretRect;
2023 #endif
2024
2025     PageLoadState m_pageLoadState;
2026     
2027     bool m_delegatesScrolling { false };
2028
2029     bool m_mainFrameHasHorizontalScrollbar { false };
2030     bool m_mainFrameHasVerticalScrollbar { false };
2031
2032     // Whether horizontal wheel events can be handled directly for swiping purposes.
2033     bool m_canShortCircuitHorizontalWheelEvents { true };
2034
2035     bool m_mainFrameIsPinnedToLeftSide { true };
2036     bool m_mainFrameIsPinnedToRightSide { true };
2037     bool m_mainFrameIsPinnedToTopSide { true };
2038     bool m_mainFrameIsPinnedToBottomSide { true };
2039
2040     bool m_shouldUseImplicitRubberBandControl { false };
2041     bool m_rubberBandsAtLeft { true };
2042     bool m_rubberBandsAtRight { true };
2043     bool m_rubberBandsAtTop { true };
2044     bool m_rubberBandsAtBottom { true };
2045         
2046     bool m_enableVerticalRubberBanding { true };
2047     bool m_enableHorizontalRubberBanding { true };
2048
2049     bool m_backgroundExtendsBeyondPage { false };
2050
2051     bool m_shouldRecordNavigationSnapshots { false };
2052     bool m_isShowingNavigationGestureSnapshot { false };
2053
2054     bool m_mainFramePluginHandlesPageScaleGesture { false };
2055
2056     unsigned m_pageCount { 0 };
2057
2058     WebCore::IntRect m_visibleScrollerThumbRect;
2059
2060     uint64_t m_renderTreeSize { 0 };
2061     uint64_t m_sessionRestorationRenderTreeSize { 0 };
2062     bool m_hitRenderTreeSizeThreshold { false };
2063
2064     bool m_suppressVisibilityUpdates { false };
2065     bool m_autoSizingShouldExpandToViewHeight { false };
2066     WebCore::IntSize m_minimumLayoutSize;
2067     std::optional<WebCore::IntSize> m_viewportSizeForCSSViewportUnits;
2068
2069     // Visual viewports
2070     WebCore::LayoutSize m_baseLayoutViewportSize;
2071     WebCore::LayoutPoint m_minStableLayoutViewportOrigin;
2072     WebCore::LayoutPoint m_maxStableLayoutViewportOrigin;
2073
2074     float m_mediaVolume { 1 };
2075     WebCore::MediaProducer::MutedStateFlags m_mutedState { WebCore::MediaProducer::NoneMuted };
2076     bool m_mayStartMediaWhenInWindow { true };
2077     bool m_mediaCaptureEnabled { true };
2078
2079     bool m_waitingForDidUpdateActivityState { false };
2080
2081     bool m_shouldScaleViewToFitDocument { false };
2082     bool m_suppressAutomaticNavigationSnapshotting { false };
2083
2084 #if PLATFORM(COCOA)
2085     HashMap<String, String> m_temporaryPDFFiles;
2086     std::unique_ptr<WebCore::RunLoopObserver> m_activityStateChangeDispatcher;
2087
2088     std::unique_ptr<RemoteLayerTreeScrollingPerformanceData> m_scrollingPerformanceData;
2089     bool m_scrollPerformanceDataCollectionEnabled { false };
2090 #endif
2091     UserObservablePageCounter::Token m_pageIsUserObservableCount;
2092     ProcessSuppressionDisabledToken m_preventProcessSuppressionCount;
2093     HiddenPageThrottlingAutoIncreasesCounter::Token m_hiddenPageDOMTimerThrottlingAutoIncreasesCount;
2094     VisibleWebPageToken m_visiblePageToken;
2095         
2096     WebCore::ScrollPinningBehavior m_scrollPinningBehavior { WebCore::DoNotPin };
2097     std::optional<WebCore::ScrollbarOverlayStyle> m_scrollbarOverlayStyle;
2098
2099     uint64_t m_navigationID { 0 };
2100
2101     WebPreferencesStore::ValueMap m_configurationPreferenceValues;
2102     WebCore::ActivityState::Flags m_potentiallyChangedActivityStateFlags { WebCore::ActivityState::NoFlags };
2103     bool m_activityStateChangeWantsSynchronousReply { false };
2104     Vector<CallbackID> m_nextActivityStateChangeCallbacks;
2105
2106     WebCore::MediaProducer::MediaStateFlags m_mediaState { WebCore::MediaProducer::IsNotPlaying };
2107
2108     bool m_isResourceCachingDisabled { false };
2109
2110     bool m_hasHadSelectionChangesFromUserInteraction { false };
2111     bool m_needsHiddenContentEditableQuirk { false };
2112     bool m_needsPlainTextQuirk { false };
2113
2114 #if ENABLE(MEDIA_SESSION)
2115     bool m_hasMediaSessionWithActiveMediaElements { false };
2116 #endif
2117
2118 #if ENABLE(WIRELESS_PLAYBACK_TARGET) && !PLATFORM(IOS)
2119     bool m_requiresTargetMonitoring { false };
2120 #endif
2121
2122 #if PLATFORM(IOS)
2123     std::unique_ptr<NodeAssistanceArguments> m_deferredNodeAssistanceArguments;
2124     bool m_forceAlwaysUserScalable { false };
2125     WebCore::FloatSize m_viewportConfigurationMinimumLayoutSize;
2126     WebCore::FloatSize m_viewportConfigurationViewSize;
2127     WebCore::FloatSize m_maximumUnobscuredSize;
2128 #endif
2129
2130 #if ENABLE(POINTER_LOCK)
2131     bool m_isPointerLockPending { false };
2132     bool m_isPointerLocked { false };
2133 #endif
2134
2135     bool m_isUsingHighPerformanceWebGL { false };
2136
2137     WeakPtrFactory<WebPageProxy> m_weakPtrFactory;
2138
2139     HashMap<String, Ref<WebURLSchemeHandler>> m_urlSchemeHandlersByScheme;
2140     HashMap<uint64_t, Ref<WebURLSchemeHandler>> m_urlSchemeHandlersByIdentifier;
2141         
2142 #if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101400
2143     std::unique_ptr<DisplayLink> m_displayLink;
2144 #endif
2145
2146     std::optional<MonotonicTime> m_pageLoadStart;
2147
2148     // FIXME: Support more than one suspended page per WebPageProxy,
2149     // and have a global collection of them per process pool
2150     // (e.g. for that process pool's page cache)
2151     RefPtr<SuspendedPageProxy> m_suspendedPage;
2152 };
2153
2154 } // namespace WebKit