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