Use CompletionHandlers for DelayedReplies
[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 "SystemPreviewController.h"
48 #include "UserMediaPermissionRequestManagerProxy.h"
49 #include "VisibleContentRectUpdateInfo.h"
50 #include "VisibleWebPageCounter.h"
51 #include "WKBase.h"
52 #include "WKPagePrivate.h"
53 #include "WebColorPicker.h"
54 #include "WebContextMenuItemData.h"
55 #include "WebCoreArgumentCoders.h"
56 #include "WebFrameProxy.h"
57 #include "WebPageCreationParameters.h"
58 #include "WebPageDiagnosticLoggingClient.h"
59 #include "WebPageInjectedBundleClient.h"
60 #include "WebPaymentCoordinatorProxy.h"
61 #include "WebPreferences.h"
62 #include <WebCore/AlternativeTextClient.h> // FIXME: Needed by WebPageProxyMessages.h for DICTATION_ALTERNATIVES.
63 #include "WebPageProxyMessages.h"
64 #include "WebPopupMenuProxy.h"
65 #include "WebProcessLifetimeTracker.h"
66 #include "WebsitePoliciesData.h"
67 #include <WebCore/ActivityState.h>
68 #include <WebCore/AutoplayEvent.h>
69 #include <WebCore/Color.h>
70 #include <WebCore/DragActions.h>
71 #include <WebCore/EventTrackingRegions.h>
72 #include <WebCore/FrameLoaderTypes.h>
73 #include <WebCore/FrameView.h> // FIXME: Move LayoutViewportConstraint to its own file and stop including this.
74 #include <WebCore/LayoutPoint.h>
75 #include <WebCore/LayoutSize.h>
76 #include <WebCore/MediaPlaybackTargetContext.h>
77 #include <WebCore/MediaProducer.h>
78 #include <WebCore/PlatformScreen.h>
79 #include <WebCore/ScrollTypes.h>
80 #include <WebCore/SearchPopupMenu.h>
81 #include <WebCore/TextChecking.h>
82 #include <WebCore/TextGranularity.h>
83 #include <WebCore/URL.h>
84 #include <WebCore/UserInterfaceLayoutDirection.h>
85 #include <memory>
86 #include <wtf/CompletionHandler.h>
87 #include <wtf/HashMap.h>
88 #include <wtf/HashSet.h>
89 #include <wtf/MonotonicTime.h>
90 #include <wtf/Optional.h>
91 #include <wtf/ProcessID.h>
92 #include <wtf/Ref.h>
93 #include <wtf/RefPtr.h>
94 #include <wtf/Vector.h>
95 #include <wtf/text/WTFString.h>
96
97 OBJC_CLASS NSView;
98 OBJC_CLASS _WKRemoteObjectRegistry;
99
100 #if ENABLE(DRAG_SUPPORT)
101 #include <WebCore/DragActions.h>
102 #endif
103
104 #if ENABLE(TOUCH_EVENTS)
105 #include "NativeWebTouchEvent.h"
106 #endif
107
108 #if PLATFORM(COCOA)
109 #include "LayerRepresentation.h"
110 #include "TouchBarMenuData.h"
111 #include "TouchBarMenuItemData.h"
112 #endif
113
114 #if PLATFORM(GTK)
115 #include "ArgumentCodersGtk.h"
116 #endif
117
118 #if ENABLE(WIRELESS_PLAYBACK_TARGET) && !PLATFORM(IOS)
119 #include <WebCore/MediaPlaybackTargetPicker.h>
120 #include <WebCore/WebMediaSessionManagerClient.h>
121 #endif
122
123 #if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101400
124 #include "DisplayLink.h"
125 #endif
126
127 #if ENABLE(MEDIA_SESSION)
128 namespace WebCore {
129 class MediaSessionMetadata;
130 }
131 #endif
132
133 namespace API {
134 class ContextMenuClient;
135 class FindClient;
136 class FindMatchesClient;
137 class FormClient;
138 class FullscreenClient;
139 class HistoryClient;
140 class IconLoadingClient;
141 class LoaderClient;
142 class Navigation;
143 class NavigationClient;
144 class PolicyClient;
145 class UIClient;
146 class URLRequest;
147 }
148
149 namespace IPC {
150 class Decoder;
151 class Connection;
152 }
153
154 namespace WebCore {
155 class AuthenticationChallenge;
156 class Cursor;
157 class DragData;
158 class FloatRect;
159 class GraphicsLayer;
160 class IntSize;
161 class ProtectionSpace;
162 class RunLoopObserver;
163 class SharedBuffer;
164 class TextIndicator;
165 class ValidationBubble;
166
167 enum SelectionDirection : uint8_t;
168
169 enum class AutoplayEvent;
170 enum class HasInsecureContent;
171 enum class NavigationPolicyCheck;
172 enum class NotificationDirection;
173 enum class ShouldSample;
174
175 struct ApplicationManifest;
176 struct DictionaryPopupInfo;
177 struct ExceptionDetails;
178 struct FileChooserSettings;
179 struct MediaStreamRequest;
180 struct SecurityOriginData;
181 struct TextAlternativeWithRange;
182 struct TextCheckingResult;
183 struct ViewportAttributes;
184 struct WindowFeatures;
185
186 template <typename> class RectEdges;
187 using FloatBoxExtent = RectEdges<float>;
188 }
189
190 #if ENABLE(ATTACHMENT_ELEMENT)
191 namespace WebCore {
192 struct AttachmentDisplayOptions;
193 struct AttachmentInfo;
194 }
195 #endif
196
197 #if PLATFORM(GTK)
198 typedef GtkWidget* PlatformWidget;
199 #endif
200
201 #if PLATFORM(GTK) || PLATFORM(WPE)
202 typedef struct OpaqueJSContext* JSGlobalContextRef;
203 #endif
204
205 namespace WebKit {
206 class CertificateInfo;
207 class DrawingAreaProxy;
208 class NativeWebGestureEvent;
209 class NativeWebKeyboardEvent;
210 class NativeWebMouseEvent;
211 class NativeWebWheelEvent;
212 class PageClient;
213 class RemoteLayerTreeScrollingPerformanceData;
214 class RemoteLayerTreeTransaction;
215 class RemoteScrollingCoordinatorProxy;
216 class UserData;
217 class ViewSnapshot;
218 class VisitedLinkStore;
219 class WebBackForwardList;
220 class WebBackForwardListItem;
221 class WebContextMenuProxy;
222 class WebEditCommandProxy;
223 class WebFullScreenManagerProxy;
224 class PlaybackSessionManagerProxy;
225 class WebNavigationState;
226 class VideoFullscreenManagerProxy;
227 class WebCredentialsMessengerProxy;
228 class WebKeyboardEvent;
229 class WebURLSchemeHandler;
230 class WebMouseEvent;
231 class WebOpenPanelResultListenerProxy;
232 class WebPageGroup;
233 class WebProcessProxy;
234 class WebUserContentControllerProxy;
235 class WebWheelEvent;
236 class WebsiteDataStore;
237 class GamepadData;
238
239 struct AttributedString;
240 struct ColorSpaceData;
241 struct EditingRange;
242 struct EditorState;
243 struct FrameInfoData;
244 struct InteractionInformationRequest;
245 struct LoadParameters;
246 struct PlatformPopupMenuData;
247 struct PrintInfo;
248 struct WebPopupItem;
249 struct URLSchemeTaskParameters;
250
251 #if USE(QUICK_LOOK)
252 class QuickLookDocumentData;
253 #endif
254
255 typedef GenericCallback<uint64_t> UnsignedCallback;
256 typedef GenericCallback<EditingRange> EditingRangeCallback;
257 typedef GenericCallback<const String&> StringCallback;
258 typedef GenericCallback<API::SerializedScriptValue*, bool, const WebCore::ExceptionDetails&> ScriptValueCallback;
259
260 #if ENABLE(ATTACHMENT_ELEMENT)
261 typedef GenericCallback<const WebCore::AttachmentInfo&> AttachmentInfoCallback;
262 #endif
263
264 #if PLATFORM(GTK)
265 typedef GenericCallback<API::Error*> PrintFinishedCallback;
266 #endif
267
268 #if ENABLE(TOUCH_EVENTS)
269 struct QueuedTouchEvents {
270     QueuedTouchEvents(const NativeWebTouchEvent& event)
271         : forwardedEvent(event)
272     {
273     }
274     NativeWebTouchEvent forwardedEvent;
275     Vector<NativeWebTouchEvent> deferredTouchEvents;
276 };
277 #endif
278
279 typedef GenericCallback<const String&, bool, int32_t> ValidateCommandCallback;
280 typedef GenericCallback<const WebCore::IntRect&, const EditingRange&> RectForCharacterRangeCallback;
281
282 #if ENABLE(APPLICATION_MANIFEST)
283 typedef GenericCallback<const std::optional<WebCore::ApplicationManifest>&> ApplicationManifestCallback;
284 #endif
285
286 #if PLATFORM(MAC)
287 typedef GenericCallback<const AttributedString&, const EditingRange&> AttributedStringForCharacterRangeCallback;
288 typedef GenericCallback<const String&, double, bool> FontAtSelectionCallback;
289 #endif
290
291 #if PLATFORM(IOS)
292 typedef GenericCallback<const WebCore::IntPoint&, uint32_t, uint32_t, uint32_t> GestureCallback;
293 typedef GenericCallback<const WebCore::IntPoint&, uint32_t, uint32_t> TouchesCallback;
294 typedef GenericCallback<const Vector<WebCore::SelectionRect>&> SelectionRectsCallback;
295 typedef GenericCallback<const AssistedNodeInformation&> AssistedNodeInformationCallback;
296 struct NodeAssistanceArguments {
297     AssistedNodeInformation m_nodeInformation;
298     bool m_userIsInteracting;
299     bool m_blurPreviousNode;
300     bool m_changingActivityState;
301     RefPtr<API::Object> m_userData;
302 };
303
304 using DrawToPDFCallback = GenericCallback<const IPC::DataReference&>;
305 #endif
306
307 #if PLATFORM(COCOA)
308 typedef GenericCallback<const WTF::MachSendRight&> MachSendRightCallback;
309 typedef GenericCallback<bool, bool, String, double, double, uint64_t> NowPlayingInfoCallback;
310 #endif
311
312 class WebPageProxy : public API::ObjectImpl<API::Object::Type::Page>
313 #if ENABLE(INPUT_TYPE_COLOR)
314     , public WebColorPicker::Client
315 #endif
316 #if ENABLE(WIRELESS_PLAYBACK_TARGET) && !PLATFORM(IOS)
317     , public WebCore::WebMediaSessionManagerClient
318 #endif
319     , public WebPopupMenuProxy::Client
320     , public IPC::MessageReceiver
321     , public IPC::MessageSender {
322 public:
323     static Ref<WebPageProxy> create(PageClient&, WebProcessProxy&, uint64_t pageID, Ref<API::PageConfiguration>&&);
324     virtual ~WebPageProxy();
325
326     const API::PageConfiguration& configuration() const;
327
328     uint64_t pageID() const { return m_pageID; }
329
330     PAL::SessionID sessionID() const;
331
332     WebFrameProxy* mainFrame() const { return m_mainFrame.get(); }
333     WebFrameProxy* focusedFrame() const { return m_focusedFrame.get(); }
334     WebFrameProxy* frameSetLargestFrame() const { return m_frameSetLargestFrame.get(); }
335
336     DrawingAreaProxy* drawingArea() const { return m_drawingArea.get(); }
337
338     WebNavigationState& navigationState() { return *m_navigationState.get(); }
339
340     WebsiteDataStore& websiteDataStore() { return m_websiteDataStore; }
341     void changeWebsiteDataStore(WebsiteDataStore&);
342
343 #if ENABLE(DATA_DETECTION)
344     NSArray *dataDetectionResults() { return m_dataDetectionResults.get(); }
345 #endif
346         
347 #if ENABLE(ASYNC_SCROLLING)
348     RemoteScrollingCoordinatorProxy* scrollingCoordinatorProxy() const { return m_scrollingCoordinatorProxy.get(); }
349 #endif
350
351     WebBackForwardList& backForwardList() { return m_backForwardList; }
352
353     bool addsVisitedLinks() const { return m_addsVisitedLinks; }
354     void setAddsVisitedLinks(bool addsVisitedLinks) { m_addsVisitedLinks = addsVisitedLinks; }
355
356     void fullscreenMayReturnToInline();
357     void didEnterFullscreen();
358     void didExitFullscreen();
359
360     WebInspectorProxy* inspector() const;
361
362     bool isControlledByAutomation() const { return m_controlledByAutomation; }
363     void setControlledByAutomation(bool);
364
365 #if ENABLE(REMOTE_INSPECTOR)
366     bool allowsRemoteInspection() const { return m_allowsRemoteInspection; }
367     void setAllowsRemoteInspection(bool);
368     String remoteInspectionNameOverride() const { return m_remoteInspectionNameOverride; }
369     void setRemoteInspectionNameOverride(const String&);
370 #endif
371
372 #if ENABLE(FULLSCREEN_API)
373     WebFullScreenManagerProxy* fullScreenManager();
374
375     API::FullscreenClient& fullscreenClient() const { return *m_fullscreenClient; }
376     void setFullscreenClient(std::unique_ptr<API::FullscreenClient>&&);
377 #endif
378 #if (PLATFORM(IOS) && HAVE(AVKIT)) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))
379     PlaybackSessionManagerProxy* playbackSessionManager();
380     VideoFullscreenManagerProxy* videoFullscreenManager();
381 #endif
382
383 #if PLATFORM(IOS)
384     bool allowsMediaDocumentInlinePlayback() const;
385     void setAllowsMediaDocumentInlinePlayback(bool);
386 #endif
387
388     SystemPreviewController* systemPreviewController() { return m_systemPreviewController.get(); }
389
390 #if ENABLE(CONTEXT_MENUS)
391     API::ContextMenuClient& contextMenuClient() { return *m_contextMenuClient; }
392     void setContextMenuClient(std::unique_ptr<API::ContextMenuClient>&&);
393 #endif
394     API::FindClient& findClient() { return *m_findClient; }
395     void setFindClient(std::unique_ptr<API::FindClient>&&);
396     API::FindMatchesClient& findMatchesClient() { return *m_findMatchesClient; }
397     void setFindMatchesClient(std::unique_ptr<API::FindMatchesClient>&&);
398     API::DiagnosticLoggingClient* diagnosticLoggingClient() { return m_diagnosticLoggingClient.get(); }
399     void setDiagnosticLoggingClient(std::unique_ptr<API::DiagnosticLoggingClient>&&);
400     void setFormClient(std::unique_ptr<API::FormClient>&&);
401     void setNavigationClient(std::unique_ptr<API::NavigationClient>&&);
402     void setHistoryClient(std::unique_ptr<API::HistoryClient>&&);
403     void setLoaderClient(std::unique_ptr<API::LoaderClient>&&);
404     void setPolicyClient(std::unique_ptr<API::PolicyClient>&&);
405     void setInjectedBundleClient(const WKPageInjectedBundleClientBase*);
406     WebPageInjectedBundleClient* injectedBundleClient() { return m_injectedBundleClient.get(); }
407
408     API::UIClient& uiClient() { return *m_uiClient; }
409     void setUIClient(std::unique_ptr<API::UIClient>&&);
410
411     API::IconLoadingClient& iconLoadingClient() { return *m_iconLoadingClient; }
412     void setIconLoadingClient(std::unique_ptr<API::IconLoadingClient>&&);
413
414     void initializeWebPage();
415
416     void close();
417     bool tryClose();
418     bool isClosed() const { return m_isClosed; }
419
420     void setIsUsingHighPerformanceWebGL(bool value) { m_isUsingHighPerformanceWebGL = value; }
421     bool isUsingHighPerformanceWebGL() const { return m_isUsingHighPerformanceWebGL; }
422
423     void didExceedInactiveMemoryLimitWhileActive();
424     void didExceedBackgroundCPULimitWhileInForeground();
425
426     void closePage(bool stopResponsivenessTimer);
427
428     void addPlatformLoadParameters(LoadParameters&);
429     RefPtr<API::Navigation> loadRequest(WebCore::ResourceRequest&&, WebCore::ShouldOpenExternalURLsPolicy = WebCore::ShouldOpenExternalURLsPolicy::ShouldAllowExternalSchemes, API::Object* userData = nullptr);
430     RefPtr<API::Navigation> loadFile(const String& fileURL, const String& resourceDirectoryURL, API::Object* userData = nullptr);
431     RefPtr<API::Navigation> loadData(API::Data*, const String& MIMEType, const String& encoding, const String& baseURL, API::Object* userData = nullptr);
432     RefPtr<API::Navigation> loadHTMLString(const String& htmlString, const String& baseURL, API::Object* userData = nullptr);
433     void loadAlternateHTMLString(const String& htmlString, const WebCore::URL& baseURL, const WebCore::URL& unreachableURL, API::Object* userData = nullptr);
434     void loadPlainTextString(const String&, API::Object* userData = nullptr);
435     void loadWebArchiveData(API::Data*, API::Object* userData = nullptr);
436     void navigateToPDFLinkWithSimulatedClick(const String& url, WebCore::IntPoint documentPoint, WebCore::IntPoint screenPoint);
437
438     void stopLoading();
439     RefPtr<API::Navigation> reload(OptionSet<WebCore::ReloadOption>);
440
441     RefPtr<API::Navigation> goForward();
442     RefPtr<API::Navigation> goBack();
443
444     RefPtr<API::Navigation> goToBackForwardItem(WebBackForwardListItem&);
445     void tryRestoreScrollPosition();
446     void didChangeBackForwardList(WebBackForwardListItem* addedItem, Vector<Ref<WebBackForwardListItem>>&& removed);
447     void willGoToBackForwardListItem(uint64_t itemID, bool inPageCache, const UserData&);
448
449     bool shouldKeepCurrentBackForwardListItemInList(WebBackForwardListItem&);
450
451     bool willHandleHorizontalScrollEvents() const;
452
453     void updateWebsitePolicies(WebsitePoliciesData&&);
454
455     bool canShowMIMEType(const String& mimeType);
456
457     bool drawsBackground() const { return m_drawsBackground; }
458     void setDrawsBackground(bool);
459
460     String currentURL() const;
461
462     float topContentInset() const { return m_topContentInset; }
463     void setTopContentInset(float);
464
465     WebCore::Color underlayColor() const { return m_underlayColor; }
466     void setUnderlayColor(const WebCore::Color&);
467
468     // At this time, m_pageExtendedBackgroundColor can be set via pageExtendedBackgroundColorDidChange() which is a message
469     // from the UIProcess, or by didCommitLayerTree(). When PLATFORM(MAC) adopts UI side compositing, we should get rid of
470     // the message entirely.
471     WebCore::Color pageExtendedBackgroundColor() const { return m_pageExtendedBackgroundColor; }
472
473     void viewWillStartLiveResize();
474     void viewWillEndLiveResize();
475
476     void setInitialFocus(bool forward, bool isKeyboardEventValid, const WebKeyboardEvent&, WTF::Function<void (CallbackBase::Error)>&&);
477     
478     void clearSelection();
479     void restoreSelectionInFocusedEditableElement();
480
481     void setViewNeedsDisplay(const WebCore::Region&);
482     void requestScroll(const WebCore::FloatPoint& scrollPosition, const WebCore::IntPoint& scrollOrigin, bool isProgrammaticScroll);
483     
484     WebCore::FloatPoint viewScrollPosition() const;
485
486     void setDelegatesScrolling(bool delegatesScrolling) { m_delegatesScrolling = delegatesScrolling; }
487     bool delegatesScrolling() const { return m_delegatesScrolling; }
488
489     enum class ActivityStateChangeDispatchMode { Deferrable, Immediate };
490     void activityStateDidChange(WebCore::ActivityState::Flags mayHaveChanged, bool wantsSynchronousReply = false, ActivityStateChangeDispatchMode = ActivityStateChangeDispatchMode::Deferrable);
491     bool isInWindow() const { return m_activityState & WebCore::ActivityState::IsInWindow; }
492     void waitForDidUpdateActivityState();
493     void didUpdateActivityState() { m_waitingForDidUpdateActivityState = false; }
494
495     void layerHostingModeDidChange();
496
497     WebCore::IntSize viewSize() const;
498     bool isViewVisible() const { return m_activityState & WebCore::ActivityState::IsVisible; }
499     bool isViewFocused() const { return m_activityState & WebCore::ActivityState::IsFocused; }
500     bool isViewWindowActive() const { return m_activityState & WebCore::ActivityState::WindowIsActive; }
501
502     void addMIMETypeWithCustomContentProvider(const String& mimeType);
503
504     void executeEditCommand(const String& commandName, const String& argument = String());
505     void validateCommand(const String& commandName, WTF::Function<void (const String&, bool, int32_t, CallbackBase::Error)>&&);
506
507     const EditorState& editorState() const { return m_editorState; }
508     bool canDelete() const { return hasSelectedRange() && isContentEditable(); }
509     bool hasSelectedRange() const { return m_editorState.selectionIsRange; }
510     bool isContentEditable() const { return m_editorState.isContentEditable; }
511
512 #if PLATFORM(COCOA)
513     const TouchBarMenuData& touchBarMenuData() const { return m_touchBarMenuData; }
514 #endif
515
516     bool maintainsInactiveSelection() const;
517     void setMaintainsInactiveSelection(bool);
518     void setEditable(bool);
519     bool isEditable() const { return m_isEditable; }
520
521     void activateMediaStreamCaptureInPage();
522     bool isMediaStreamCaptureMuted() const { return m_mutedState & WebCore::MediaProducer::CaptureDevicesAreMuted; }
523     void setMediaStreamCaptureMuted(bool);
524     void executeEditCommand(const String& commandName, const String& argument, WTF::Function<void(CallbackBase::Error)>&&);
525         
526 #if PLATFORM(IOS)
527     double displayedContentScale() const { return m_lastVisibleContentRectUpdate.scale(); }
528     const WebCore::FloatRect& exposedContentRect() const { return m_lastVisibleContentRectUpdate.exposedContentRect(); }
529     const WebCore::FloatRect& unobscuredContentRect() const { return m_lastVisibleContentRectUpdate.unobscuredContentRect(); }
530     bool inStableState() const { return m_lastVisibleContentRectUpdate.inStableState(); }
531     const WebCore::FloatRect& unobscuredContentRectRespectingInputViewBounds() const { return m_lastVisibleContentRectUpdate.unobscuredContentRectRespectingInputViewBounds(); }
532     // When visual viewports are enabled, this is the layout viewport rect.
533     const WebCore::FloatRect& customFixedPositionRect() const { return m_lastVisibleContentRectUpdate.customFixedPositionRect(); }
534
535     void updateVisibleContentRects(const VisibleContentRectUpdateInfo&);
536     void resendLastVisibleContentRects();
537
538     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;
539
540     void overflowScrollViewWillStartPanGesture();
541     void overflowScrollViewDidScroll();
542     void overflowScrollWillStartScroll();
543     void overflowScrollDidEndScroll();
544
545     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);
546     void synchronizeDynamicViewportUpdate();
547
548     void setViewportConfigurationMinimumLayoutSize(const WebCore::FloatSize&, const WebCore::FloatSize& viewSize);
549     void setMaximumUnobscuredSize(const WebCore::FloatSize&);
550     void setDeviceOrientation(int32_t);
551     int32_t deviceOrientation() const { return m_deviceOrientation; }
552     void willCommitLayerTree(uint64_t transactionID);
553
554     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)>&&);
555     void updateSelectionWithTouches(const WebCore::IntPoint, uint32_t touches, bool baseIsStart, WTF::Function<void (const WebCore::IntPoint&, uint32_t, uint32_t, CallbackBase::Error)>&&);
556     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)>&&);
557 #if __IPHONE_OS_VERSION_MAX_ALLOWED < 120000
558     void updateBlockSelectionWithTouch(const WebCore::IntPoint, uint32_t touch, uint32_t handlePosition);
559 #endif
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 #if __IPHONE_OS_VERSION_MAX_ALLOWED < 120000
585     void didUpdateBlockSelectionWithTouch(uint32_t touch, uint32_t flags, float growThreshold, float shrinkThreshold);
586 #endif
587     void focusNextAssistedNode(bool isForward, WTF::Function<void (CallbackBase::Error)>&& = [] (auto) { });
588     void setAssistedNodeValue(const String&);
589     void setAssistedNodeValueAsNumber(double);
590     void setAssistedNodeSelectedIndex(uint32_t index, bool allowMultipleSelection = false);
591     void applicationDidEnterBackground();
592     void applicationDidFinishSnapshottingAfterEnteringBackground();
593     void applicationWillEnterForeground();
594     void applicationWillResignActive();
595     void applicationDidBecomeActive();
596     void commitPotentialTapFailed();
597     void didNotHandleTapAsClick(const WebCore::IntPoint&);
598     void didCompleteSyntheticClick();
599     void disableDoubleTapGesturesDuringTapIfNecessary(uint64_t requestID);
600     void contentSizeCategoryDidChange(const String& contentSizeCategory);
601     void getSelectionContext(WTF::Function<void(const String&, const String&, const String&, CallbackBase::Error)>&&);
602     void handleTwoFingerTapAtPoint(const WebCore::IntPoint&, uint64_t requestID);
603     void setForceAlwaysUserScalable(bool);
604     void setIsScrollingOrZooming(bool);
605     void requestRectsForGranularityWithSelectionOffset(WebCore::TextGranularity, uint32_t offset, WTF::Function<void(const Vector<WebCore::SelectionRect>&, CallbackBase::Error)>&&);
606     void requestRectsAtSelectionOffsetWithText(int32_t offset, const String&, WTF::Function<void(const Vector<WebCore::SelectionRect>&, CallbackBase::Error)>&&);
607     void autofillLoginCredentials(const String& username, const String& password);
608     void storeSelectionForAccessibility(bool);
609     void startAutoscrollAtPosition(const WebCore::FloatPoint& positionInWindow);
610     void cancelAutoscroll();
611 #if ENABLE(DATA_INTERACTION)
612     void didPerformDataInteractionControllerOperation(bool handled);
613     void didHandleStartDataInteractionRequest(bool started);
614     void didHandleAdditionalDragItemsRequest(bool added);
615     void requestStartDataInteraction(const WebCore::IntPoint& clientPosition, const WebCore::IntPoint& globalPosition);
616     void requestAdditionalItemsForDragSession(const WebCore::IntPoint& clientPosition, const WebCore::IntPoint& globalPosition);
617     void didConcludeEditDataInteraction(std::optional<WebCore::TextIndicatorData>);
618 #endif
619 #endif
620 #if ENABLE(DATA_DETECTION)
621     void setDataDetectionResult(const DataDetectionResult&);
622 #endif
623     void didCommitLayerTree(const WebKit::RemoteLayerTreeTransaction&);
624     void layerTreeCommitComplete();
625
626     bool updateLayoutViewportParameters(const WebKit::RemoteLayerTreeTransaction&);
627
628 #if PLATFORM(GTK)
629     void setComposition(const String& text, Vector<WebCore::CompositionUnderline> underlines, uint64_t selectionStart, uint64_t selectionEnd, uint64_t replacementRangeStart, uint64_t replacementRangeEnd);
630     void confirmComposition(const String& compositionString, int64_t selectionStart, int64_t selectionLength);
631     void cancelComposition();
632 #endif
633
634 #if PLATFORM(GTK)
635     void setInputMethodState(bool enabled);
636 #endif
637
638 #if PLATFORM (GTK) && HAVE(GTK_GESTURES)
639     void getCenterForZoomGesture(const WebCore::IntPoint& centerInViewCoordinates, WebCore::IntPoint& center);
640 #endif
641
642 #if PLATFORM(COCOA)
643     void windowAndViewFramesChanged(const WebCore::FloatRect& viewFrameInWindowCoordinates, const WebCore::FloatPoint& accessibilityViewCoordinates);
644     void setMainFrameIsScrollable(bool);
645
646     void sendComplexTextInputToPlugin(uint64_t pluginComplexTextInputIdentifier, const String& textInput);
647     bool shouldDelayWindowOrderingForEvent(const WebMouseEvent&);
648     bool acceptsFirstMouse(int eventNumber, const WebMouseEvent&);
649
650     void setAcceleratedCompositingRootLayer(LayerOrView*);
651     LayerOrView* acceleratedCompositingRootLayer() const;
652
653     void setTextAsync(const String&);
654     void insertTextAsync(const String& text, const EditingRange& replacementRange, bool registerUndoGroup = false, EditingRangeIsRelativeTo = EditingRangeIsRelativeTo::EditableRoot, bool suppressSelectionUpdate = false);
655     void getMarkedRangeAsync(WTF::Function<void (EditingRange, CallbackBase::Error)>&&);
656     void getSelectedRangeAsync(WTF::Function<void (EditingRange, CallbackBase::Error)>&&);
657     void characterIndexForPointAsync(const WebCore::IntPoint&, WTF::Function<void (uint64_t, CallbackBase::Error)>&&);
658     void firstRectForCharacterRangeAsync(const EditingRange&, WTF::Function<void (const WebCore::IntRect&, const EditingRange&, CallbackBase::Error)>&&);
659     void setCompositionAsync(const String& text, const Vector<WebCore::CompositionUnderline>& underlines, const EditingRange& selectionRange, const EditingRange& replacementRange);
660     void confirmCompositionAsync();
661
662     void setScrollPerformanceDataCollectionEnabled(bool);
663     bool scrollPerformanceDataCollectionEnabled() const { return m_scrollPerformanceDataCollectionEnabled; }
664     RemoteLayerTreeScrollingPerformanceData* scrollingPerformanceData() { return m_scrollingPerformanceData.get(); }
665 #endif // PLATFORM(COCOA)
666
667 #if PLATFORM(MAC)
668     void insertDictatedTextAsync(const String& text, const EditingRange& replacementRange, const Vector<WebCore::TextAlternativeWithRange>& dictationAlternatives, bool registerUndoGroup);
669     void attributedSubstringForCharacterRangeAsync(const EditingRange&, WTF::Function<void (const AttributedString&, const EditingRange&, CallbackBase::Error)>&&);
670     void setFont(const String& fontFamily, double fontSize, uint64_t fontTraits);
671     void fontAtSelection(WTF::Function<void (const String&, double, bool, CallbackBase::Error)>&&);
672
673     void startWindowDrag();
674     NSWindow *platformWindow();
675     void rootViewToWindow(const WebCore::IntRect& viewRect, WebCore::IntRect& windowRect);
676
677 #if WK_API_ENABLED
678     NSView *inspectorAttachmentView();
679     _WKRemoteObjectRegistry *remoteObjectRegistry();
680 #endif
681
682     void intrinsicContentSizeDidChange(const WebCore::IntSize& intrinsicContentSize);
683     CGRect boundsOfLayerInLayerBackedWindowCoordinates(CALayer *) const;
684 #endif // PLATFORM(MAC)
685
686 #if PLATFORM(GTK)
687     PlatformWidget viewWidget();
688     const WebCore::Color& backgroundColor() const { return m_backgroundColor; }
689     void setBackgroundColor(const WebCore::Color& color) { m_backgroundColor = color; }
690 #endif
691
692     void handleMouseEvent(const NativeWebMouseEvent&);
693     void handleWheelEvent(const NativeWebWheelEvent&);
694     void handleKeyboardEvent(const NativeWebKeyboardEvent&);
695
696 #if ENABLE(MAC_GESTURE_EVENTS)
697     void handleGestureEvent(const NativeWebGestureEvent&);
698 #endif
699
700 #if ENABLE(IOS_TOUCH_EVENTS)
701     void handleTouchEventSynchronously(NativeWebTouchEvent&);
702     void handleTouchEventAsynchronously(const NativeWebTouchEvent&);
703
704 #elif ENABLE(TOUCH_EVENTS)
705     void handleTouchEvent(const NativeWebTouchEvent&);
706 #endif
707
708     void scrollBy(WebCore::ScrollDirection, WebCore::ScrollGranularity);
709     void centerSelectionInVisibleArea();
710
711     const String& toolTip() const { return m_toolTip; }
712
713     const String& userAgent() const { return m_userAgent; }
714     void setApplicationNameForUserAgent(const String&);
715     const String& applicationNameForUserAgent() const { return m_applicationNameForUserAgent; }
716     void setCustomUserAgent(const String&);
717     const String& customUserAgent() const { return m_customUserAgent; }
718     static String standardUserAgent(const String& applicationName = String());
719
720     bool supportsTextEncoding() const;
721     void setCustomTextEncodingName(const String&);
722     String customTextEncodingName() const { return m_customTextEncodingName; }
723
724     bool areActiveDOMObjectsAndAnimationsSuspended() const { return m_isPageSuspended; }
725     void resumeActiveDOMObjectsAndAnimations();
726     void suspendActiveDOMObjectsAndAnimations();
727
728     double estimatedProgress() const;
729
730     SessionState sessionState(WTF::Function<bool (WebBackForwardListItem&)>&& = nullptr) const;
731     RefPtr<API::Navigation> restoreFromSessionState(SessionState, bool navigate);
732
733     bool supportsTextZoom() const;
734     double textZoomFactor() const { return m_textZoomFactor; }
735     void setTextZoomFactor(double);
736     double pageZoomFactor() const;
737     void setPageZoomFactor(double);
738     void setPageAndTextZoomFactors(double pageZoomFactor, double textZoomFactor);
739
740     void scalePage(double scale, const WebCore::IntPoint& origin);
741     void scalePageInViewCoordinates(double scale, const WebCore::IntPoint& centerInViewCoordinates);
742     double pageScaleFactor() const;
743     double viewScaleFactor() const { return m_viewScaleFactor; }
744     void scaleView(double scale);
745     void setShouldScaleViewToFitDocument(bool);
746     
747     float deviceScaleFactor() const;
748     void setIntrinsicDeviceScaleFactor(float);
749     void setCustomDeviceScaleFactor(float);
750     void windowScreenDidChange(WebCore::PlatformDisplayID);
751     void accessibilitySettingsDidChange();
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(uint64_t itemID);
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(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 private:
1296     WebPageProxy(PageClient&, WebProcessProxy&, uint64_t pageID, Ref<API::PageConfiguration>&&);
1297     void platformInitialize();
1298
1299     RefPtr<API::Navigation> goToBackForwardItem(WebBackForwardListItem&, WebCore::FrameLoadType);
1300
1301     void updateActivityState(WebCore::ActivityState::Flags flagsToUpdate = WebCore::ActivityState::AllFlags);
1302     void updateThrottleState();
1303     void updateHiddenPageThrottlingAutoIncreases();
1304
1305     enum class ResetStateReason {
1306         PageInvalidated,
1307         WebProcessExited,
1308         NavigationSwap,
1309     };
1310     void resetState(ResetStateReason);
1311     void resetStateAfterProcessExited(ProcessTerminationReason);
1312
1313     void setUserAgent(String&&);
1314
1315     // IPC::MessageReceiver
1316     // Implemented in generated WebPageProxyMessageReceiver.cpp
1317     void didReceiveMessage(IPC::Connection&, IPC::Decoder&) override;
1318     void didReceiveSyncMessage(IPC::Connection&, IPC::Decoder&, std::unique_ptr<IPC::Encoder>&) override;
1319
1320
1321     // IPC::MessageSender
1322     bool sendMessage(std::unique_ptr<IPC::Encoder>, OptionSet<IPC::SendOption>) override;
1323     IPC::Connection* messageSenderConnection() override;
1324     uint64_t messageSenderDestinationID() override;
1325
1326     // WebPopupMenuProxy::Client
1327     void valueChangedForPopupMenu(WebPopupMenuProxy*, int32_t newSelectedIndex) override;
1328     void setTextFromItemForPopupMenu(WebPopupMenuProxy*, int32_t index) override;
1329 #if PLATFORM(GTK)
1330     void failedToShowPopupMenu() override;
1331 #endif
1332
1333 #if ENABLE(POINTER_LOCK)
1334     void requestPointerLock();
1335     void requestPointerUnlock();
1336 #endif
1337
1338     void didCreateMainFrame(uint64_t frameID);
1339     void didCreateSubframe(uint64_t frameID);
1340
1341     void didStartProvisionalLoadForFrame(uint64_t frameID, uint64_t navigationID, WebCore::URL&&, WebCore::URL&& unreachableURL, const UserData&);
1342     void didReceiveServerRedirectForProvisionalLoadForFrame(uint64_t frameID, uint64_t navigationID, WebCore::ResourceRequest&&, const UserData&);
1343     void willPerformClientRedirectForFrame(uint64_t frameID, const String& url, double delay);
1344     void didCancelClientRedirectForFrame(uint64_t frameID);
1345     void didChangeProvisionalURLForFrame(uint64_t frameID, uint64_t navigationID, WebCore::URL&&);
1346     void didFailProvisionalLoadForFrame(uint64_t frameID, const WebCore::SecurityOriginData& frameSecurityOrigin, uint64_t navigationID, const String& provisionalURL, const WebCore::ResourceError&, const UserData&);
1347     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&);
1348     void didFinishDocumentLoadForFrame(uint64_t frameID, uint64_t navigationID, const UserData&);
1349     void didFinishLoadForFrame(uint64_t frameID, uint64_t navigationID, const UserData&);
1350     void didFailLoadForFrame(uint64_t frameID, uint64_t navigationID, const WebCore::ResourceError&, const UserData&);
1351     void didSameDocumentNavigationForFrame(uint64_t frameID, uint64_t navigationID, uint32_t sameDocumentNavigationType, WebCore::URL&&, const UserData&);
1352     void didChangeMainDocument(uint64_t frameID);
1353
1354     void didReceiveTitleForFrame(uint64_t frameID, const String&, const UserData&);
1355     void didFirstLayoutForFrame(uint64_t frameID, const UserData&);
1356     void didFirstVisuallyNonEmptyLayoutForFrame(uint64_t frameID, const UserData&);
1357     void didDisplayInsecureContentForFrame(uint64_t frameID, const UserData&);
1358     void didRunInsecureContentForFrame(uint64_t frameID, const UserData&);
1359     void didDetectXSSForFrame(uint64_t frameID, const UserData&);
1360     void mainFramePluginHandlesPageScaleGestureDidChange(bool);
1361     void frameDidBecomeFrameSet(uint64_t frameID, bool);
1362     void didStartProgress();
1363     void didChangeProgress(double);
1364     void didFinishProgress();
1365     void setNetworkRequestsInProgress(bool);
1366
1367     void hasInsecureContent(WebCore::HasInsecureContent&);
1368
1369     void didDestroyNavigation(uint64_t navigationID);
1370
1371     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&);
1372     void decidePolicyForNewWindowAction(uint64_t frameID, const WebCore::SecurityOriginData& frameSecurityOrigin, NavigationActionData&&, WebCore::ResourceRequest&&, const String& frameName, uint64_t listenerID, const UserData&);
1373     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&);
1374     void unableToImplementPolicy(uint64_t frameID, const WebCore::ResourceError&, const UserData&);
1375
1376     void willSubmitForm(uint64_t frameID, uint64_t sourceFrameID, const Vector<std::pair<String, String>>& textFieldValues, uint64_t listenerID, const UserData&);
1377         
1378     void contentRuleListNotification(WebCore::URL&&, Vector<String>&& identifiers, Vector<String>&& notifications);
1379
1380     // History client
1381     void didNavigateWithNavigationData(const WebNavigationDataStore&, uint64_t frameID);
1382     void didPerformClientRedirect(const String& sourceURLString, const String& destinationURLString, uint64_t frameID);
1383     void didPerformServerRedirect(const String& sourceURLString, const String& destinationURLString, uint64_t frameID);
1384     void didUpdateHistoryTitle(const String& title, const String& url, uint64_t frameID);
1385
1386     // UI client
1387     void createNewPage(const FrameInfoData&, uint64_t originatingPageID, WebCore::ResourceRequest&&, WebCore::WindowFeatures&&, NavigationActionData&&, Messages::WebPageProxy::CreateNewPage::DelayedReply&&);
1388     void showPage();
1389     void runJavaScriptAlert(uint64_t frameID, const WebCore::SecurityOriginData&, const String&, Messages::WebPageProxy::RunJavaScriptAlert::DelayedReply&&);
1390     void runJavaScriptConfirm(uint64_t frameID, const WebCore::SecurityOriginData&, const String&, Messages::WebPageProxy::RunJavaScriptConfirm::DelayedReply&&);
1391     void runJavaScriptPrompt(uint64_t frameID, const WebCore::SecurityOriginData&, const String&, const String&, Messages::WebPageProxy::RunJavaScriptPrompt::DelayedReply&&);
1392     void setStatusText(const String&);
1393     void mouseDidMoveOverElement(WebHitTestResultData&&, uint32_t modifiers, UserData&&);
1394
1395 #if ENABLE(NETSCAPE_PLUGIN_API)
1396     void unavailablePluginButtonClicked(uint32_t opaquePluginUnavailabilityReason, const String& mimeType, const String& pluginURLString, const String& pluginsPageURLString, const String& frameURLString, const String& pageURLString);
1397 #endif // ENABLE(NETSCAPE_PLUGIN_API)
1398 #if ENABLE(WEBGL)
1399     void webGLPolicyForURL(WebCore::URL&&, Messages::WebPageProxy::WebGLPolicyForURL::DelayedReply&&);
1400     void resolveWebGLPolicyForURL(WebCore::URL&&, Messages::WebPageProxy::ResolveWebGLPolicyForURL::DelayedReply&&);
1401 #endif // ENABLE(WEBGL)
1402     void setToolbarsAreVisible(bool toolbarsAreVisible);
1403     void getToolbarsAreVisible(Messages::WebPageProxy::GetToolbarsAreVisible::DelayedReply&&);
1404     void setMenuBarIsVisible(bool menuBarIsVisible);
1405     void getMenuBarIsVisible(Messages::WebPageProxy::GetMenuBarIsVisible::DelayedReply&&);
1406     void setStatusBarIsVisible(bool statusBarIsVisible);
1407     void getStatusBarIsVisible(Messages::WebPageProxy::GetStatusBarIsVisible::DelayedReply&&);
1408     void setIsResizable(bool isResizable);
1409     void screenToRootView(const WebCore::IntPoint& screenPoint, Messages::WebPageProxy::ScreenToRootView::DelayedReply&&);
1410     void rootViewToScreen(const WebCore::IntRect& viewRect, Messages::WebPageProxy::RootViewToScreen::DelayedReply&&);
1411 #if PLATFORM(IOS)
1412     void accessibilityScreenToRootView(const WebCore::IntPoint& screenPoint, WebCore::IntPoint& windowPoint);
1413     void rootViewToAccessibilityScreen(const WebCore::IntRect& viewRect, WebCore::IntRect& result);
1414 #endif
1415     void runBeforeUnloadConfirmPanel(uint64_t frameID, const WebCore::SecurityOriginData&, const String& message, Messages::WebPageProxy::RunBeforeUnloadConfirmPanel::DelayedReply);
1416     void didChangeViewportProperties(const WebCore::ViewportAttributes&);
1417     void pageDidScroll();
1418     void runOpenPanel(uint64_t frameID, const WebCore::SecurityOriginData&, const WebCore::FileChooserSettings&);
1419     void printFrame(uint64_t frameID);
1420     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, Messages::WebPageProxy::ExceededDatabaseQuota::DelayedReply&&);
1421     void reachedApplicationCacheOriginQuota(const String& originIdentifier, uint64_t currentQuota, uint64_t totalBytesNeeded, Messages::WebPageProxy::ReachedApplicationCacheOriginQuota::DelayedReply&&);
1422     void requestGeolocationPermissionForFrame(uint64_t geolocationID, uint64_t frameID, String originIdentifier);
1423
1424 #if ENABLE(MEDIA_STREAM)
1425     UserMediaPermissionRequestManagerProxy& userMediaPermissionRequestManager();
1426 #endif
1427     void requestUserMediaPermissionForFrame(uint64_t userMediaID, uint64_t frameID, const WebCore::SecurityOriginData& userMediaDocumentOriginIdentifier, const WebCore::SecurityOriginData& topLevelDocumentOriginIdentifier, const WebCore::MediaStreamRequest&);
1428     void enumerateMediaDevicesForFrame(uint64_t userMediaID, uint64_t frameID, const WebCore::SecurityOriginData& userMediaDocumentOriginData, const WebCore::SecurityOriginData& topLevelDocumentOriginData);
1429
1430     void runModal();
1431     void notifyScrollerThumbIsVisibleInRect(const WebCore::IntRect&);
1432     void recommendedScrollbarStyleDidChange(int32_t newStyle);
1433     void didChangeScrollbarsForMainFrame(bool hasHorizontalScrollbar, bool hasVerticalScrollbar);
1434     void didChangeScrollOffsetPinningForMainFrame(bool pinnedToLeftSide, bool pinnedToRightSide, bool pinnedToTopSide, bool pinnedToBottomSide);
1435     void didChangePageCount(unsigned);
1436     void pageExtendedBackgroundColorDidChange(const WebCore::Color&);
1437 #if ENABLE(NETSCAPE_PLUGIN_API)
1438     void didFailToInitializePlugin(const String& mimeType, const String& frameURLString, const String& pageURLString);
1439     void didBlockInsecurePluginVersion(const String& mimeType, const String& pluginURLString, const String& frameURLString, const String& pageURLString, bool replacementObscured);
1440 #endif // ENABLE(NETSCAPE_PLUGIN_API)
1441     void setCanShortCircuitHorizontalWheelEvents(bool canShortCircuitHorizontalWheelEvents) { m_canShortCircuitHorizontalWheelEvents = canShortCircuitHorizontalWheelEvents; }
1442
1443     void reattachToWebProcess();
1444     void attachToProcessForNavigation(Ref<WebProcessProxy>&&);
1445     void reattachToWebProcess(Ref<WebProcessProxy>&&);
1446
1447     RefPtr<API::Navigation> reattachToWebProcessForReload();
1448     RefPtr<API::Navigation> reattachToWebProcessWithItem(WebBackForwardListItem&);
1449
1450     void loadRequestWithNavigation(API::Navigation&, WebCore::ResourceRequest&&, WebCore::ShouldOpenExternalURLsPolicy, API::Object* userData, WebCore::NavigationPolicyCheck);
1451
1452     void requestNotificationPermission(uint64_t notificationID, const String& originString);
1453     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);
1454     void cancelNotification(uint64_t notificationID);
1455     void clearNotifications(const Vector<uint64_t>& notificationIDs);
1456     void didDestroyNotification(uint64_t notificationID);
1457
1458     void didChangeContentSize(const WebCore::IntSize&);
1459
1460 #if ENABLE(INPUT_TYPE_COLOR)
1461     void showColorPicker(const WebCore::Color& initialColor, const WebCore::IntRect&);
1462     void didChooseColor(const WebCore::Color&) override;
1463     void didEndColorPicker() override;
1464 #endif
1465
1466     void compositionWasCanceled();
1467     void setHasHadSelectionChangesFromUserInteraction(bool);
1468     void setNeedsHiddenContentEditableQuirk(bool);
1469     void setNeedsPlainTextQuirk(bool);
1470
1471     // Back/Forward list management
1472     void backForwardAddItem(uint64_t itemID);
1473     void backForwardGoToItem(uint64_t itemID, SandboxExtension::Handle&);
1474     void backForwardItemAtIndex(int32_t index, uint64_t& itemID);
1475     void backForwardBackListCount(int32_t& count);
1476     void backForwardForwardListCount(int32_t& count);
1477     void backForwardClear();
1478
1479     // Undo management
1480     void registerEditCommandForUndo(uint64_t commandID, uint32_t editAction);
1481     void registerInsertionUndoGrouping();
1482     void clearAllEditCommands();
1483     void canUndoRedo(uint32_t action, bool& result);
1484     void executeUndoRedo(uint32_t action, bool& result);
1485
1486     // Keyboard handling
1487 #if PLATFORM(COCOA)
1488     void executeSavedCommandBySelector(const String& selector, bool& handled);
1489 #endif
1490
1491 #if PLATFORM(GTK)
1492     void getEditorCommandsForKeyEvent(const AtomicString&, Vector<String>&);
1493     void bindAccessibilityTree(const String&);
1494 #endif
1495
1496     // Popup Menu.
1497     void showPopupMenu(const WebCore::IntRect& rect, uint64_t textDirection, const Vector<WebPopupItem>& items, int32_t selectedIndex, const PlatformPopupMenuData&);
1498     void hidePopupMenu();
1499
1500 #if ENABLE(CONTEXT_MENUS)
1501     void showContextMenu(ContextMenuContextData&&, const UserData&);
1502 #endif
1503
1504 #if ENABLE(TELEPHONE_NUMBER_DETECTION)
1505 #if PLATFORM(MAC)
1506     void showTelephoneNumberMenu(const String& telephoneNumber, const WebCore::IntPoint&);
1507 #endif
1508 #endif
1509
1510     // Search popup results
1511     void saveRecentSearches(const String&, const Vector<WebCore::RecentSearch>&);
1512     void loadRecentSearches(const String&, Vector<WebCore::RecentSearch>&);
1513
1514 #if PLATFORM(COCOA)
1515     // Speech.
1516     void getIsSpeaking(bool&);
1517     void speak(const String&);
1518     void stopSpeaking();
1519
1520     // Spotlight.
1521     void searchWithSpotlight(const String&);
1522         
1523     void searchTheWeb(const String&);
1524
1525     // Dictionary.
1526     void didPerformDictionaryLookup(const WebCore::DictionaryPopupInfo&);
1527 #endif
1528
1529 #if PLATFORM(MAC)
1530     bool appleMailPaginationQuirkEnabled();
1531 #endif
1532
1533 #if PLATFORM(MAC)
1534     // FIXME: Need to support iOS too, but there is no isAppleMail for iOS.
1535     bool appleMailLinesClampEnabled();
1536 #endif
1537
1538     // Spelling and grammar.
1539     void checkSpellingOfString(const String& text, int32_t& misspellingLocation, int32_t& misspellingLength);
1540     void checkGrammarOfString(const String& text, Vector<WebCore::GrammarDetail>&, int32_t& badGrammarLocation, int32_t& badGrammarLength);
1541     void spellingUIIsShowing(bool&);
1542     void updateSpellingUIWithMisspelledWord(const String& misspelledWord);
1543     void updateSpellingUIWithGrammarString(const String& badGrammarPhrase, const WebCore::GrammarDetail&);
1544     void learnWord(const String& word);
1545     void ignoreWord(const String& word);
1546     void requestCheckingOfString(uint64_t requestID, const WebCore::TextCheckingRequestData&, int32_t insertionPoint);
1547
1548     void takeFocus(uint32_t direction);
1549     void setToolTip(const String&);
1550     void setCursor(const WebCore::Cursor&);
1551     void setCursorHiddenUntilMouseMoves(bool);
1552
1553     void didReceiveEvent(uint32_t opaqueType, bool handled);
1554
1555     void voidCallback(CallbackID);
1556     void dataCallback(const IPC::DataReference&, CallbackID);
1557     void imageCallback(const ShareableBitmap::Handle&, CallbackID);
1558     void stringCallback(const String&, CallbackID);
1559     void invalidateStringCallback(CallbackID);
1560     void scriptValueCallback(const IPC::DataReference&, bool hadException, const WebCore::ExceptionDetails&, CallbackID);
1561     void computedPagesCallback(const Vector<WebCore::IntRect>&, double totalScaleFactorForPrinting, CallbackID);
1562     void validateCommandCallback(const String&, bool, int, CallbackID);
1563     void unsignedCallback(uint64_t, CallbackID);
1564     void editingRangeCallback(const EditingRange&, CallbackID);
1565 #if ENABLE(APPLICATION_MANIFEST)
1566     void applicationManifestCallback(const std::optional<WebCore::ApplicationManifest>&, CallbackID);
1567 #endif
1568 #if PLATFORM(COCOA)
1569     void machSendRightCallback(const WTF::MachSendRight&, CallbackID);
1570 #endif
1571     void rectForCharacterRangeCallback(const WebCore::IntRect&, const EditingRange&, CallbackID);
1572 #if PLATFORM(MAC)
1573     void attributedStringForCharacterRangeCallback(const AttributedString&, const EditingRange&, CallbackID);
1574     void fontAtSelectionCallback(const String&, double, bool, CallbackID);
1575 #endif
1576 #if PLATFORM(IOS)
1577     void gestureCallback(const WebCore::IntPoint&, uint32_t gestureType, uint32_t gestureState, uint32_t flags, CallbackID);
1578     void touchesCallback(const WebCore::IntPoint&, uint32_t touches, uint32_t flags, CallbackID);
1579     void autocorrectionDataCallback(const Vector<WebCore::FloatRect>&, const String& fontName, float fontSize, uint64_t fontTraits, CallbackID);
1580     void autocorrectionContextCallback(const String& beforeText, const String& markedText, const String& selectedText, const String& afterText, uint64_t location, uint64_t length, CallbackID);
1581     void selectionContextCallback(const String& selectedText, const String& beforeText, const String& afterText, CallbackID);
1582     void interpretKeyEvent(const EditorState&, bool isCharEvent, bool& handled);
1583     void showPlaybackTargetPicker(bool hasVideo, const WebCore::IntRect& elementRect);
1584     void selectionRectsCallback(const Vector<WebCore::SelectionRect>&, CallbackID);
1585 #endif
1586 #if PLATFORM(GTK)
1587     void printFinishedCallback(const WebCore::ResourceError&, CallbackID);
1588 #endif
1589
1590     void focusedFrameChanged(uint64_t frameID);
1591     void frameSetLargestFrameChanged(uint64_t frameID);
1592
1593     void didFinishLoadingDataForCustomContentProvider(const String& suggestedFilename, const IPC::DataReference&);
1594
1595 #if PLATFORM(COCOA)
1596     void pluginFocusOrWindowFocusChanged(uint64_t pluginComplexTextInputIdentifier, bool pluginHasFocusAndWindowHasFocus);
1597     void setPluginComplexTextInputState(uint64_t pluginComplexTextInputIdentifier, uint64_t complexTextInputState);
1598 #endif
1599
1600     bool maybeInitializeSandboxExtensionHandle(const WebCore::URL&, SandboxExtension::Handle&);
1601
1602 #if USE(AUTOMATIC_TEXT_REPLACEMENT)
1603     void toggleSmartInsertDelete();
1604     void toggleAutomaticQuoteSubstitution();
1605     void toggleAutomaticLinkDetection();
1606     void toggleAutomaticDashSubstitution();
1607     void toggleAutomaticTextReplacement();
1608 #endif
1609
1610 #if PLATFORM(MAC)
1611     void substitutionsPanelIsShowing(bool&);
1612     void showCorrectionPanel(int32_t panelType, const WebCore::FloatRect& boundingBoxOfReplacedString, const String& replacedString, const String& replacementString, const Vector<String>& alternativeReplacementStrings);
1613     void dismissCorrectionPanel(int32_t reason);
1614     void dismissCorrectionPanelSoon(int32_t reason, String& result);
1615     void recordAutocorrectionResponse(int32_t responseType, const String& replacedString, const String& replacementString);
1616
1617 #if USE(DICTATION_ALTERNATIVES)
1618     void showDictationAlternativeUI(const WebCore::FloatRect& boundingBoxOfDictatedText, uint64_t dictationContext);
1619     void removeDictationAlternatives(uint64_t dictationContext);
1620     void dictationAlternatives(uint64_t dictationContext, Vector<String>& result);
1621 #endif
1622
1623     void setEditableElementIsFocused(bool);
1624 #endif // PLATFORM(MAC)
1625
1626 #if PLATFORM(IOS)
1627     WebCore::FloatSize screenSize();
1628     WebCore::FloatSize availableScreenSize();
1629     WebCore::FloatSize overrideScreenSize();
1630     float textAutosizingWidth();
1631
1632     void dynamicViewportUpdateChangedTarget(double newTargetScale, const WebCore::FloatPoint& newScrollPosition, uint64_t dynamicViewportSizeUpdateID);
1633     void couldNotRestorePageState();
1634     void restorePageState(std::optional<WebCore::FloatPoint> scrollPosition, const WebCore::FloatPoint& scrollOrigin, const WebCore::FloatBoxExtent& obscuredInsetsOnSave, double scale);
1635     void restorePageCenterAndScale(std::optional<WebCore::FloatPoint>, double scale);
1636
1637     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);
1638
1639     void startAssistingNode(const AssistedNodeInformation&, bool userIsInteracting, bool blurPreviousNode, bool changingActivityState, const UserData&);
1640     void stopAssistingNode();
1641
1642     void showInspectorHighlight(const WebCore::Highlight&);
1643     void hideInspectorHighlight();
1644
1645     void showInspectorIndication();
1646     void hideInspectorIndication();
1647
1648     void enableInspectorNodeSearch();
1649     void disableInspectorNodeSearch();
1650     void assistedNodeInformationCallback(const AssistedNodeInformation&, CallbackID);
1651 #endif // PLATFORM(IOS)
1652
1653 #if ENABLE(DATA_DETECTION)
1654     RetainPtr<NSArray> m_dataDetectionResults;
1655 #endif
1656
1657     void clearLoadDependentCallbacks();
1658
1659     void performDragControllerAction(DragControllerAction, WebCore::DragData&, const String& dragStorageName, SandboxExtension::Handle&&, SandboxExtension::HandleArray&&);
1660
1661     void updateBackingStoreDiscardableState();
1662
1663     void setRenderTreeSize(uint64_t treeSize) { m_renderTreeSize = treeSize; }
1664
1665 #if PLATFORM(X11)
1666     void createPluginContainer(uint64_t& windowID);
1667     void windowedPluginGeometryDidChange(const WebCore::IntRect& frameRect, const WebCore::IntRect& clipRect, uint64_t windowID);
1668     void windowedPluginVisibilityDidChange(bool isVisible, uint64_t windowID);
1669 #endif
1670
1671     void processNextQueuedWheelEvent();
1672     void sendWheelEvent(const WebWheelEvent&);
1673     bool shouldProcessWheelEventNow(const WebWheelEvent&) const;
1674
1675 #if ENABLE(TOUCH_EVENTS)
1676     void updateTouchEventTracking(const WebTouchEvent&);
1677     WebCore::TrackingType touchEventTrackingType(const WebTouchEvent&) const;
1678 #endif
1679
1680 #if ENABLE(NETSCAPE_PLUGIN_API)
1681     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);
1682 #endif
1683
1684 #if USE(QUICK_LOOK)
1685     void didStartLoadForQuickLookDocumentInMainFrame(const String& fileName, const String& uti);
1686     void didFinishLoadForQuickLookDocumentInMainFrame(const QuickLookDocumentData&);
1687     void didRequestPasswordForQuickLookDocumentInMainFrame(const String& fileName);
1688 #endif
1689
1690 #if ENABLE(CONTENT_FILTERING)
1691     void contentFilterDidBlockLoadForFrame(const WebCore::ContentFilterUnblockHandler&, uint64_t frameID);
1692 #endif
1693
1694     API::DiagnosticLoggingClient* effectiveDiagnosticLoggingClient(WebCore::ShouldSample);
1695
1696     void dispatchActivityStateChange();
1697     void viewDidLeaveWindow();
1698     void viewDidEnterWindow();
1699
1700 #if PLATFORM(MAC)
1701     void didPerformImmediateActionHitTest(const WebHitTestResultData&, bool contentPreventsDefault, const UserData&);
1702 #endif
1703
1704     void useFixedLayoutDidChange(bool useFixedLayout) { m_useFixedLayout = useFixedLayout; }
1705     void fixedLayoutSizeDidChange(WebCore::IntSize fixedLayoutSize) { m_fixedLayoutSize = fixedLayoutSize; }
1706
1707     void imageOrMediaDocumentSizeChanged(const WebCore::IntSize&);
1708 #if ENABLE(VIDEO)
1709 #if USE(GSTREAMER)
1710     void requestInstallMissingMediaPlugins(const String& details, const String& description);
1711 #endif
1712 #endif
1713
1714     void startURLSchemeTask(URLSchemeTaskParameters&&);
1715     void stopURLSchemeTask(uint64_t handlerIdentifier, uint64_t taskIdentifier);
1716
1717     void handleAutoFillButtonClick(const UserData&);
1718
1719     void finishInitializingWebPageAfterProcessLaunch();
1720
1721     void handleMessage(IPC::Connection&, const String& messageName, const UserData& messageBody);
1722     void handleSynchronousMessage(IPC::Connection&, const String& messageName, const UserData& messageBody, UserData& returnUserData);
1723
1724     void viewIsBecomingVisible();
1725
1726     void stopAllURLSchemeTasks();
1727
1728 #if ENABLE(ATTACHMENT_ELEMENT)
1729     void didInsertAttachment(const String& identifier, const String& source);
1730     void didRemoveAttachment(const String& identifier);
1731 #endif
1732
1733 #if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101400
1734     void startDisplayLink(unsigned observerID);
1735     void stopDisplayLink(unsigned observerID);
1736 #endif
1737
1738     void reportPageLoadResult(const WebCore::ResourceError& = { });
1739
1740     void continueNavigationInNewProcess(API::Navigation&, Ref<WebProcessProxy>&&);
1741
1742     PageClient& m_pageClient;
1743     Ref<API::PageConfiguration> m_configuration;
1744
1745     std::unique_ptr<API::LoaderClient> m_loaderClient;
1746     std::unique_ptr<API::PolicyClient> m_policyClient;
1747     std::unique_ptr<API::NavigationClient> m_navigationClient;
1748     std::unique_ptr<API::HistoryClient> m_historyClient;
1749     std::unique_ptr<API::IconLoadingClient> m_iconLoadingClient;
1750     std::unique_ptr<API::FormClient> m_formClient;
1751     std::unique_ptr<API::UIClient> m_uiClient;
1752     std::unique_ptr<API::FindClient> m_findClient;
1753     std::unique_ptr<API::FindMatchesClient> m_findMatchesClient;
1754     std::unique_ptr<API::DiagnosticLoggingClient> m_diagnosticLoggingClient;
1755 #if ENABLE(CONTEXT_MENUS)
1756     std::unique_ptr<API::ContextMenuClient> m_contextMenuClient;
1757 #endif
1758     std::unique_ptr<WebPageInjectedBundleClient> m_injectedBundleClient;
1759
1760     std::unique_ptr<WebNavigationState> m_navigationState;
1761     String m_failingProvisionalLoadURL;
1762     bool m_isLoadingAlternateHTMLStringForFailingProvisionalLoad { false };
1763
1764     std::unique_ptr<DrawingAreaProxy> m_drawingArea;
1765 #if ENABLE(ASYNC_SCROLLING)
1766     std::unique_ptr<RemoteScrollingCoordinatorProxy> m_scrollingCoordinatorProxy;
1767 #endif
1768
1769     Ref<WebProcessProxy> m_process;
1770     Ref<WebPageGroup> m_pageGroup;
1771     Ref<WebPreferences> m_preferences;
1772
1773     WebProcessLifetimeTracker m_webProcessLifetimeTracker { *this };
1774
1775     Ref<WebUserContentControllerProxy> m_userContentController;
1776     Ref<VisitedLinkStore> m_visitedLinkStore;
1777     Ref<WebsiteDataStore> m_websiteDataStore;
1778
1779     RefPtr<WebFrameProxy> m_mainFrame;
1780     Function<void()> m_mainFrameCreationHandler;
1781
1782     RefPtr<WebFrameProxy> m_focusedFrame;
1783     RefPtr<WebFrameProxy> m_frameSetLargestFrame;
1784
1785     String m_userAgent;
1786     String m_applicationNameForUserAgent;
1787     String m_customUserAgent;
1788     String m_customTextEncodingName;
1789     String m_overrideContentSecurityPolicy;
1790
1791     bool m_treatsSHA1CertificatesAsInsecure { true };
1792
1793     RefPtr<WebInspectorProxy> m_inspector;
1794
1795 #if ENABLE(FULLSCREEN_API)
1796     RefPtr<WebFullScreenManagerProxy> m_fullScreenManager;
1797     std::unique_ptr<API::FullscreenClient> m_fullscreenClient;
1798 #endif
1799
1800 #if (PLATFORM(IOS) && HAVE(AVKIT)) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))
1801     RefPtr<PlaybackSessionManagerProxy> m_playbackSessionManager;
1802     RefPtr<VideoFullscreenManagerProxy> m_videoFullscreenManager;
1803 #endif
1804
1805 #if PLATFORM(IOS)
1806     VisibleContentRectUpdateInfo m_lastVisibleContentRectUpdate;
1807     uint64_t m_firstLayerTreeTransactionIdAfterDidCommitLoad { 0 };
1808     int32_t m_deviceOrientation { 0 };
1809     uint64_t m_dynamicViewportSizeUpdateLayerTreeTransactionID { 0 };
1810     uint64_t m_currentDynamicViewportSizeUpdateID { 0 };
1811     bool m_hasReceivedLayerTreeTransactionAfterDidCommitLoad { true };
1812     bool m_dynamicViewportSizeUpdateWaitingForTarget { false };
1813     bool m_dynamicViewportSizeUpdateWaitingForLayerTreeCommit { false };
1814     bool m_hasNetworkRequestsOnSuspended { false };
1815     bool m_isKeyboardAnimatingIn { false };
1816     bool m_isScrollingOrZooming { false };
1817 #endif
1818         
1819 #if PLATFORM(MAC)
1820     bool m_useSystemAppearance { false };
1821     bool m_defaultAppearance { true };
1822 #endif
1823
1824 #if ENABLE(APPLE_PAY)
1825     std::unique_ptr<WebPaymentCoordinatorProxy> m_paymentCoordinator;
1826 #endif
1827
1828     std::unique_ptr<SystemPreviewController> m_systemPreviewController;
1829
1830 #if ENABLE(WEB_AUTHN)
1831     std::unique_ptr<WebCredentialsMessengerProxy> m_credentialsMessenger;
1832 #endif
1833
1834     CallbackMap m_callbacks;
1835     HashSet<CallbackID> m_loadDependentStringCallbackIDs;
1836
1837     HashSet<WebEditCommandProxy*> m_editCommandSet;
1838
1839 #if PLATFORM(COCOA)
1840     HashSet<String> m_knownKeypressCommandNames;
1841 #endif
1842
1843     RefPtr<WebPopupMenuProxy> m_activePopupMenu;
1844 #if ENABLE(CONTEXT_MENUS)
1845     RefPtr<WebContextMenuProxy> m_activeContextMenu;
1846     ContextMenuContextData m_activeContextMenuContextData;
1847 #endif
1848     RefPtr<API::HitTestResult> m_lastMouseMoveHitTestResult;
1849
1850     RefPtr<WebOpenPanelResultListenerProxy> m_openPanelResultListener;
1851     GeolocationPermissionRequestManagerProxy m_geolocationPermissionRequestManager;
1852     NotificationPermissionRequestManagerProxy m_notificationPermissionRequestManager;
1853
1854 #if ENABLE(MEDIA_STREAM)
1855     std::unique_ptr<UserMediaPermissionRequestManagerProxy> m_userMediaPermissionRequestManager;
1856 #endif
1857
1858     WebCore::ActivityState::Flags m_activityState { WebCore::ActivityState::NoFlags };
1859     bool m_viewWasEverInWindow { false };
1860 #if PLATFORM(IOS)
1861     bool m_allowsMediaDocumentInlinePlayback { false };
1862     bool m_alwaysRunsAtForegroundPriority { false };
1863     ProcessThrottler::ForegroundActivityToken m_activityToken;
1864 #endif
1865     bool m_initialCapitalizationEnabled { false };
1866     std::optional<double> m_cpuLimit;
1867     Ref<WebBackForwardList> m_backForwardList;
1868         
1869     bool m_maintainsInactiveSelection { false };
1870
1871     bool m_waitsForPaintAfterViewDidMoveToWindow { false };
1872     bool m_shouldSkipWaitingForPaintAfterNextViewDidMoveToWindow { false };
1873
1874     String m_toolTip;
1875
1876     EditorState m_editorState;
1877     bool m_isEditable { false };
1878
1879 #if PLATFORM(COCOA)
1880     TouchBarMenuData m_touchBarMenuData;
1881 #endif
1882
1883     double m_textZoomFactor { 1 };
1884     double m_pageZoomFactor { 1 };
1885     double m_pageScaleFactor { 1 };
1886     double m_pluginZoomFactor { 1 };
1887     double m_pluginScaleFactor { 1 };
1888     double m_viewScaleFactor { 1 };
1889     float m_intrinsicDeviceScaleFactor { 1 };
1890     std::optional<float> m_customDeviceScaleFactor;
1891     float m_topContentInset { 0 };
1892
1893     LayerHostingMode m_layerHostingMode { LayerHostingMode::InProcess };
1894
1895     bool m_drawsBackground { true };
1896
1897     WebCore::Color m_underlayColor;
1898     WebCore::Color m_pageExtendedBackgroundColor;
1899
1900     bool m_useFixedLayout { false };
1901     WebCore::IntSize m_fixedLayoutSize;
1902
1903     bool m_alwaysShowsHorizontalScroller { false };
1904     bool m_alwaysShowsVerticalScroller { false };
1905
1906     WebCore::LayoutMilestones m_observedLayoutMilestones { 0 };
1907
1908     bool m_suppressScrollbarAnimations { false };
1909
1910     WebCore::Pagination::Mode m_paginationMode { WebCore::Pagination::Unpaginated };
1911     bool m_paginationBehavesLikeColumns { false };
1912     double m_pageLength { 0 };
1913     double m_gapBetweenPages { 0 };
1914     bool m_paginationLineGridEnabled { false };
1915         
1916     // If the process backing the web page is alive and kicking.
1917     bool m_isValid { true };
1918
1919     // Whether WebPageProxy::close() has been called on this page.
1920     bool m_isClosed { false };
1921
1922     // Whether it can run modal child web pages.
1923     bool m_canRunModal { false };
1924
1925     bool m_needsToFinishInitializingWebPageAfterProcessLaunch { false };
1926
1927     bool m_isInPrintingMode { false };
1928     bool m_isPerformingDOMPrintOperation { false };
1929
1930     WebCore::ResourceRequest m_decidePolicyForResponseRequest;
1931     bool m_shouldSuppressAppLinksInNextNavigationPolicyDecision { false };
1932
1933     Deque<NativeWebKeyboardEvent> m_keyEventQueue;
1934     Deque<NativeWebWheelEvent> m_wheelEventQueue;
1935     Deque<std::unique_ptr<Vector<NativeWebWheelEvent>>> m_currentlyProcessedWheelEvents;
1936 #if ENABLE(MAC_GESTURE_EVENTS)
1937     Deque<NativeWebGestureEvent> m_gestureEventQueue;
1938 #endif
1939
1940     bool m_processingMouseMoveEvent { false };
1941     std::unique_ptr<NativeWebMouseEvent> m_nextMouseMoveEvent;
1942     std::unique_ptr<NativeWebMouseEvent> m_currentlyProcessedMouseDownEvent;
1943
1944 #if ENABLE(TOUCH_EVENTS)
1945     struct TouchEventTracking {
1946         WebCore::TrackingType touchForceChangedTracking { WebCore::TrackingType::NotTracking };
1947         WebCore::TrackingType touchStartTracking { WebCore::TrackingType::NotTracking };
1948         WebCore::TrackingType touchMoveTracking { WebCore::TrackingType::NotTracking };
1949         WebCore::TrackingType touchEndTracking { WebCore::TrackingType::NotTracking };
1950
1951         bool isTrackingAnything() const
1952         {
1953             return touchForceChangedTracking != WebCore::TrackingType::NotTracking
1954                 || touchStartTracking != WebCore::TrackingType::NotTracking
1955                 || touchMoveTracking != WebCore::TrackingType::NotTracking
1956                 || touchEndTracking != WebCore::TrackingType::NotTracking;
1957         }
1958
1959         void reset()
1960         {
1961             touchForceChangedTracking = WebCore::TrackingType::NotTracking;
1962             touchStartTracking = WebCore::TrackingType::NotTracking;
1963             touchMoveTracking = WebCore::TrackingType::NotTracking;
1964             touchEndTracking = WebCore::TrackingType::NotTracking;
1965         }
1966     };
1967     TouchEventTracking m_touchEventTracking;
1968 #endif
1969 #if ENABLE(TOUCH_EVENTS) && !ENABLE(IOS_TOUCH_EVENTS)
1970     Deque<QueuedTouchEvents> m_touchEventQueue;
1971 #endif
1972
1973 #if ENABLE(INPUT_TYPE_COLOR)
1974     RefPtr<WebColorPicker> m_colorPicker;
1975 #endif
1976 #if PLATFORM(COCOA)
1977     RefPtr<WebCore::ValidationBubble> m_validationBubble;
1978 #endif
1979
1980     const uint64_t m_pageID;
1981
1982     bool m_isPageSuspended { false };
1983     bool m_addsVisitedLinks { true };
1984
1985     bool m_controlledByAutomation { false };
1986
1987 #if ENABLE(REMOTE_INSPECTOR)
1988     bool m_allowsRemoteInspection { true };
1989     String m_remoteInspectionNameOverride;
1990 #endif
1991
1992 #if PLATFORM(COCOA)
1993     bool m_isSmartInsertDeleteEnabled { false };
1994 #endif
1995
1996 #if PLATFORM(GTK)
1997     String m_accessibilityPlugID;
1998     WebCore::Color m_backgroundColor { WebCore::Color::white };
1999 #endif
2000
2001     int64_t m_spellDocumentTag { 0 }; // FIXME: use std::optional<>.
2002     bool m_hasSpellDocumentTag { false }; 
2003     unsigned m_pendingLearnOrIgnoreWordMessageCount { 0 };
2004
2005     bool m_mainFrameHasCustomContentProvider { false };
2006
2007 #if ENABLE(DRAG_SUPPORT)
2008     // Current drag destination details are delivered as an asynchronous response,
2009     // so we preserve them to be used when the next dragging delegate call is made.
2010     WebCore::DragOperation m_currentDragOperation { WebCore::DragOperationNone };
2011     bool m_currentDragIsOverFileInput { false };
2012     unsigned m_currentDragNumberOfFilesToBeAccepted { 0 };
2013     WebCore::IntRect m_currentDragCaretRect;
2014 #endif
2015
2016     PageLoadState m_pageLoadState;
2017     
2018     bool m_delegatesScrolling { false };
2019
2020     bool m_mainFrameHasHorizontalScrollbar { false };
2021     bool m_mainFrameHasVerticalScrollbar { false };
2022
2023     // Whether horizontal wheel events can be handled directly for swiping purposes.
2024     bool m_canShortCircuitHorizontalWheelEvents { true };
2025
2026     bool m_mainFrameIsPinnedToLeftSide { true };
2027     bool m_mainFrameIsPinnedToRightSide { true };
2028     bool m_mainFrameIsPinnedToTopSide { true };
2029     bool m_mainFrameIsPinnedToBottomSide { true };
2030
2031     bool m_shouldUseImplicitRubberBandControl { false };
2032     bool m_rubberBandsAtLeft { true };
2033     bool m_rubberBandsAtRight { true };
2034     bool m_rubberBandsAtTop { true };
2035     bool m_rubberBandsAtBottom { true };
2036         
2037     bool m_enableVerticalRubberBanding { true };
2038     bool m_enableHorizontalRubberBanding { true };
2039
2040     bool m_backgroundExtendsBeyondPage { false };
2041
2042     bool m_shouldRecordNavigationSnapshots { false };
2043     bool m_isShowingNavigationGestureSnapshot { false };
2044
2045     bool m_mainFramePluginHandlesPageScaleGesture { false };
2046
2047     unsigned m_pageCount { 0 };
2048
2049     WebCore::IntRect m_visibleScrollerThumbRect;
2050
2051     uint64_t m_renderTreeSize { 0 };
2052     uint64_t m_sessionRestorationRenderTreeSize { 0 };
2053     bool m_hitRenderTreeSizeThreshold { false };
2054
2055     bool m_suppressVisibilityUpdates { false };
2056     bool m_autoSizingShouldExpandToViewHeight { false };
2057     WebCore::IntSize m_minimumLayoutSize;
2058     std::optional<WebCore::IntSize> m_viewportSizeForCSSViewportUnits;
2059
2060     // Visual viewports
2061     WebCore::LayoutSize m_baseLayoutViewportSize;
2062     WebCore::LayoutPoint m_minStableLayoutViewportOrigin;
2063     WebCore::LayoutPoint m_maxStableLayoutViewportOrigin;
2064
2065     float m_mediaVolume { 1 };
2066     WebCore::MediaProducer::MutedStateFlags m_mutedState { WebCore::MediaProducer::NoneMuted };
2067     bool m_mayStartMediaWhenInWindow { true };
2068     bool m_mediaCaptureEnabled { true };
2069
2070     bool m_waitingForDidUpdateActivityState { false };
2071
2072     bool m_shouldScaleViewToFitDocument { false };
2073     bool m_suppressAutomaticNavigationSnapshotting { false };
2074
2075 #if PLATFORM(COCOA)
2076     HashMap<String, String> m_temporaryPDFFiles;
2077     std::unique_ptr<WebCore::RunLoopObserver> m_activityStateChangeDispatcher;
2078
2079     std::unique_ptr<RemoteLayerTreeScrollingPerformanceData> m_scrollingPerformanceData;
2080     bool m_scrollPerformanceDataCollectionEnabled { false };
2081 #endif
2082     UserObservablePageCounter::Token m_pageIsUserObservableCount;
2083     ProcessSuppressionDisabledToken m_preventProcessSuppressionCount;
2084     HiddenPageThrottlingAutoIncreasesCounter::Token m_hiddenPageDOMTimerThrottlingAutoIncreasesCount;
2085     VisibleWebPageToken m_visiblePageToken;
2086         
2087     WebCore::ScrollPinningBehavior m_scrollPinningBehavior { WebCore::DoNotPin };
2088     std::optional<WebCore::ScrollbarOverlayStyle> m_scrollbarOverlayStyle;
2089
2090     uint64_t m_navigationID { 0 };
2091
2092     WebPreferencesStore::ValueMap m_configurationPreferenceValues;
2093     WebCore::ActivityState::Flags m_potentiallyChangedActivityStateFlags { WebCore::ActivityState::NoFlags };
2094     bool m_activityStateChangeWantsSynchronousReply { false };
2095     Vector<CallbackID> m_nextActivityStateChangeCallbacks;
2096
2097     WebCore::MediaProducer::MediaStateFlags m_mediaState { WebCore::MediaProducer::IsNotPlaying };
2098
2099     bool m_isResourceCachingDisabled { false };
2100
2101     bool m_hasHadSelectionChangesFromUserInteraction { false };
2102     bool m_needsHiddenContentEditableQuirk { false };
2103     bool m_needsPlainTextQuirk { false };
2104
2105 #if ENABLE(MEDIA_SESSION)
2106     bool m_hasMediaSessionWithActiveMediaElements { false };
2107 #endif
2108
2109 #if ENABLE(WIRELESS_PLAYBACK_TARGET) && !PLATFORM(IOS)
2110     bool m_requiresTargetMonitoring { false };
2111 #endif
2112
2113 #if PLATFORM(IOS)
2114     std::unique_ptr<NodeAssistanceArguments> m_deferredNodeAssistanceArguments;
2115     bool m_forceAlwaysUserScalable { false };
2116     WebCore::FloatSize m_viewportConfigurationMinimumLayoutSize;
2117     WebCore::FloatSize m_viewportConfigurationViewSize;
2118     WebCore::FloatSize m_maximumUnobscuredSize;
2119 #endif
2120
2121 #if ENABLE(POINTER_LOCK)
2122     bool m_isPointerLockPending { false };
2123     bool m_isPointerLocked { false };
2124 #endif
2125
2126     bool m_isUsingHighPerformanceWebGL { false };
2127
2128     WeakPtrFactory<WebPageProxy> m_weakPtrFactory;
2129
2130     HashMap<String, Ref<WebURLSchemeHandler>> m_urlSchemeHandlersByScheme;
2131     HashMap<uint64_t, Ref<WebURLSchemeHandler>> m_urlSchemeHandlersByIdentifier;
2132         
2133 #if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101400
2134     std::unique_ptr<DisplayLink> m_displayLink;
2135 #endif
2136
2137     std::optional<MonotonicTime> m_pageLoadStart;
2138 };
2139
2140 } // namespace WebKit