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