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