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