AX: Provide a way for Accessibility to cache the selection while retrieving rects...
[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     PAL::SessionID sessionID() const;
300
301     WebFrameProxy* mainFrame() const { return m_mainFrame.get(); }
302     WebFrameProxy* focusedFrame() const { return m_focusedFrame.get(); }
303     WebFrameProxy* frameSetLargestFrame() const { return m_frameSetLargestFrame.get(); }
304
305     DrawingAreaProxy* drawingArea() const { return m_drawingArea.get(); }
306
307     WebNavigationState& navigationState() { return *m_navigationState.get(); }
308
309     WebsiteDataStore& websiteDataStore() { return m_websiteDataStore; }
310
311 #if ENABLE(DATA_DETECTION)
312     NSArray *dataDetectionResults() { return m_dataDetectionResults.get(); }
313 #endif
314         
315 #if ENABLE(ASYNC_SCROLLING)
316     RemoteScrollingCoordinatorProxy* scrollingCoordinatorProxy() const { return m_scrollingCoordinatorProxy.get(); }
317 #endif
318
319     WebBackForwardList& backForwardList() { return m_backForwardList; }
320
321     bool addsVisitedLinks() const { return m_addsVisitedLinks; }
322     void setAddsVisitedLinks(bool addsVisitedLinks) { m_addsVisitedLinks = addsVisitedLinks; }
323
324     void fullscreenMayReturnToInline();
325     void didEnterFullscreen();
326     void didExitFullscreen();
327
328     WebInspectorProxy* inspector() const;
329
330     bool isControlledByAutomation() const { return m_controlledByAutomation; }
331     void setControlledByAutomation(bool);
332
333 #if ENABLE(REMOTE_INSPECTOR)
334     bool allowsRemoteInspection() const { return m_allowsRemoteInspection; }
335     void setAllowsRemoteInspection(bool);
336     String remoteInspectionNameOverride() const { return m_remoteInspectionNameOverride; }
337     void setRemoteInspectionNameOverride(const String&);
338 #endif
339
340 #if ENABLE(FULLSCREEN_API)
341     WebFullScreenManagerProxy* fullScreenManager();
342
343     API::FullscreenClient& fullscreenClient() const { return *m_fullscreenClient; }
344     void setFullscreenClient(std::unique_ptr<API::FullscreenClient>&&);
345 #endif
346 #if (PLATFORM(IOS) && HAVE(AVKIT)) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))
347     PlaybackSessionManagerProxy* playbackSessionManager();
348     VideoFullscreenManagerProxy* videoFullscreenManager();
349 #endif
350
351 #if PLATFORM(IOS)
352     bool allowsMediaDocumentInlinePlayback() const;
353     void setAllowsMediaDocumentInlinePlayback(bool);
354 #endif
355
356 #if ENABLE(CONTEXT_MENUS)
357     API::ContextMenuClient& contextMenuClient() { return *m_contextMenuClient; }
358     void setContextMenuClient(std::unique_ptr<API::ContextMenuClient>&&);
359 #endif
360     API::FindClient& findClient() { return *m_findClient; }
361     void setFindClient(std::unique_ptr<API::FindClient>&&);
362     API::FindMatchesClient& findMatchesClient() { return *m_findMatchesClient; }
363     void setFindMatchesClient(std::unique_ptr<API::FindMatchesClient>&&);
364     API::DiagnosticLoggingClient* diagnosticLoggingClient() { return m_diagnosticLoggingClient.get(); }
365     void setDiagnosticLoggingClient(std::unique_ptr<API::DiagnosticLoggingClient>&&);
366     void setFormClient(std::unique_ptr<API::FormClient>&&);
367     void setNavigationClient(std::unique_ptr<API::NavigationClient>&&);
368     void setHistoryClient(std::unique_ptr<API::HistoryClient>&&);
369     void setLoaderClient(std::unique_ptr<API::LoaderClient>&&);
370     void setPolicyClient(std::unique_ptr<API::PolicyClient>&&);
371     void setInjectedBundleClient(const WKPageInjectedBundleClientBase*);
372     WebPageInjectedBundleClient* injectedBundleClient() { return m_injectedBundleClient.get(); }
373
374     API::UIClient& uiClient() { return *m_uiClient; }
375     void setUIClient(std::unique_ptr<API::UIClient>&&);
376
377     API::IconLoadingClient& iconLoadingClient() { return *m_iconLoadingClient; }
378     void setIconLoadingClient(std::unique_ptr<API::IconLoadingClient>&&);
379
380     void initializeWebPage();
381
382     void close();
383     bool tryClose();
384     bool isClosed() const { return m_isClosed; }
385
386     void setIsUsingHighPerformanceWebGL(bool value) { m_isUsingHighPerformanceWebGL = value; }
387     bool isUsingHighPerformanceWebGL() const { return m_isUsingHighPerformanceWebGL; }
388
389     void didExceedInactiveMemoryLimitWhileActive();
390     void didExceedBackgroundCPULimitWhileInForeground();
391
392     void closePage(bool stopResponsivenessTimer);
393
394     void addPlatformLoadParameters(LoadParameters&);
395     RefPtr<API::Navigation> loadRequest(WebCore::ResourceRequest&&, WebCore::ShouldOpenExternalURLsPolicy = WebCore::ShouldOpenExternalURLsPolicy::ShouldAllowExternalSchemes, API::Object* userData = nullptr);
396     RefPtr<API::Navigation> loadFile(const String& fileURL, const String& resourceDirectoryURL, API::Object* userData = nullptr);
397     RefPtr<API::Navigation> loadData(API::Data*, const String& MIMEType, const String& encoding, const String& baseURL, API::Object* userData = nullptr);
398     RefPtr<API::Navigation> loadHTMLString(const String& htmlString, const String& baseURL, API::Object* userData = nullptr);
399     void loadAlternateHTMLString(const String& htmlString, const WebCore::URL& baseURL, const WebCore::URL& unreachableURL, API::Object* userData = nullptr);
400     void loadPlainTextString(const String&, API::Object* userData = nullptr);
401     void loadWebArchiveData(API::Data*, API::Object* userData = nullptr);
402     void navigateToPDFLinkWithSimulatedClick(const String& url, WebCore::IntPoint documentPoint, WebCore::IntPoint screenPoint);
403
404     void stopLoading();
405     RefPtr<API::Navigation> reload(OptionSet<WebCore::ReloadOption>);
406
407     RefPtr<API::Navigation> goForward();
408     RefPtr<API::Navigation> goBack();
409
410     RefPtr<API::Navigation> goToBackForwardItem(WebBackForwardListItem*);
411     void tryRestoreScrollPosition();
412     void didChangeBackForwardList(WebBackForwardListItem* addedItem, Vector<Ref<WebBackForwardListItem>>&& removed);
413     void willGoToBackForwardListItem(uint64_t itemID, bool inPageCache, const UserData&);
414
415     bool shouldKeepCurrentBackForwardListItemInList(WebBackForwardListItem&);
416
417     bool willHandleHorizontalScrollEvents() const;
418
419     void updateWebsitePolicies(const WebsitePolicies&);
420
421     bool canShowMIMEType(const String& mimeType);
422
423     bool drawsBackground() const { return m_drawsBackground; }
424     void setDrawsBackground(bool);
425
426     String currentURL() const;
427
428     float topContentInset() const { return m_topContentInset; }
429     void setTopContentInset(float);
430
431     WebCore::Color underlayColor() const { return m_underlayColor; }
432     void setUnderlayColor(const WebCore::Color&);
433
434     // At this time, m_pageExtendedBackgroundColor can be set via pageExtendedBackgroundColorDidChange() which is a message
435     // from the UIProcess, or by didCommitLayerTree(). When PLATFORM(MAC) adopts UI side compositing, we should get rid of
436     // the message entirely.
437     WebCore::Color pageExtendedBackgroundColor() const { return m_pageExtendedBackgroundColor; }
438
439     void viewWillStartLiveResize();
440     void viewWillEndLiveResize();
441
442     void setInitialFocus(bool forward, bool isKeyboardEventValid, const WebKeyboardEvent&, WTF::Function<void (CallbackBase::Error)>&&);
443     
444     void clearSelection();
445     void restoreSelectionInFocusedEditableElement();
446
447     void setViewNeedsDisplay(const WebCore::Region&);
448     void requestScroll(const WebCore::FloatPoint& scrollPosition, const WebCore::IntPoint& scrollOrigin, bool isProgrammaticScroll);
449     
450     WebCore::FloatPoint viewScrollPosition() const;
451
452     void setDelegatesScrolling(bool delegatesScrolling) { m_delegatesScrolling = delegatesScrolling; }
453     bool delegatesScrolling() const { return m_delegatesScrolling; }
454
455     enum class ActivityStateChangeDispatchMode { Deferrable, Immediate };
456     void activityStateDidChange(WebCore::ActivityState::Flags mayHaveChanged, bool wantsSynchronousReply = false, ActivityStateChangeDispatchMode = ActivityStateChangeDispatchMode::Deferrable);
457     bool isInWindow() const { return m_activityState & WebCore::ActivityState::IsInWindow; }
458     void waitForDidUpdateActivityState();
459     void didUpdateActivityState() { m_waitingForDidUpdateActivityState = false; }
460
461     void layerHostingModeDidChange();
462
463     WebCore::IntSize viewSize() const;
464     bool isViewVisible() const { return m_activityState & WebCore::ActivityState::IsVisible; }
465     bool isViewWindowActive() const;
466
467     void addMIMETypeWithCustomContentProvider(const String& mimeType);
468
469     void executeEditCommand(const String& commandName, const String& argument = String());
470     void validateCommand(const String& commandName, WTF::Function<void (const String&, bool, int32_t, CallbackBase::Error)>&&);
471
472     const EditorState& editorState() const { return m_editorState; }
473     bool canDelete() const { return hasSelectedRange() && isContentEditable(); }
474     bool hasSelectedRange() const { return m_editorState.selectionIsRange; }
475     bool isContentEditable() const { return m_editorState.isContentEditable; }
476     
477     bool maintainsInactiveSelection() const;
478     void setMaintainsInactiveSelection(bool);
479     void setEditable(bool);
480     bool isEditable() const { return m_isEditable; }
481
482     void activateMediaStreamCaptureInPage();
483     bool isMediaStreamCaptureMuted() const { return m_mutedState & WebCore::MediaProducer::CaptureDevicesAreMuted; }
484     void setMediaStreamCaptureMuted(bool);
485     void executeEditCommand(const String& commandName, const String& argument, WTF::Function<void(CallbackBase::Error)>&&);
486         
487 #if PLATFORM(IOS)
488     double displayedContentScale() const { return m_lastVisibleContentRectUpdate.scale(); }
489     const WebCore::FloatRect& exposedContentRect() const { return m_lastVisibleContentRectUpdate.exposedContentRect(); }
490     const WebCore::FloatRect& unobscuredContentRect() const { return m_lastVisibleContentRectUpdate.unobscuredContentRect(); }
491     bool inStableState() const { return m_lastVisibleContentRectUpdate.inStableState(); }
492     const WebCore::FloatRect& unobscuredContentRectRespectingInputViewBounds() const { return m_lastVisibleContentRectUpdate.unobscuredContentRectRespectingInputViewBounds(); }
493     // When visual viewports are enabled, this is the layout viewport rect.
494     const WebCore::FloatRect& customFixedPositionRect() const { return m_lastVisibleContentRectUpdate.customFixedPositionRect(); }
495
496     void updateVisibleContentRects(const VisibleContentRectUpdateInfo&);
497     void resendLastVisibleContentRects();
498
499     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;
500
501     void overflowScrollViewWillStartPanGesture();
502     void overflowScrollViewDidScroll();
503     void overflowScrollWillStartScroll();
504     void overflowScrollDidEndScroll();
505
506     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);
507     void synchronizeDynamicViewportUpdate();
508
509     void setViewportConfigurationMinimumLayoutSize(const WebCore::FloatSize&);
510     void setMaximumUnobscuredSize(const WebCore::FloatSize&);
511     void setDeviceOrientation(int32_t);
512     int32_t deviceOrientation() const { return m_deviceOrientation; }
513     void willCommitLayerTree(uint64_t transactionID);
514
515     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)>&&);
516     void updateSelectionWithTouches(const WebCore::IntPoint, uint32_t touches, bool baseIsStart, WTF::Function<void (const WebCore::IntPoint&, uint32_t, uint32_t, CallbackBase::Error)>&&);
517     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)>&&);
518     void updateBlockSelectionWithTouch(const WebCore::IntPoint, uint32_t touch, uint32_t handlePosition);
519     void extendSelection(WebCore::TextGranularity);
520     void selectWordBackward();
521     void moveSelectionByOffset(int32_t offset, WTF::Function<void (CallbackBase::Error)>&&);
522     void selectTextWithGranularityAtPoint(const WebCore::IntPoint, WebCore::TextGranularity, bool isInteractingWithAssistedNode, WTF::Function<void (CallbackBase::Error)>&&);
523     void selectPositionAtPoint(const WebCore::IntPoint, bool isInteractingWithAssistedNode, WTF::Function<void (CallbackBase::Error)>&&);
524     void selectPositionAtBoundaryWithDirection(const WebCore::IntPoint, WebCore::TextGranularity, WebCore::SelectionDirection, bool isInteractingWithAssistedNode, WTF::Function<void (CallbackBase::Error)>&&);
525     void moveSelectionAtBoundaryWithDirection(WebCore::TextGranularity, WebCore::SelectionDirection, WTF::Function<void(CallbackBase::Error)>&&);
526     void beginSelectionInDirection(WebCore::SelectionDirection, WTF::Function<void (uint64_t, CallbackBase::Error)>&&);
527     void updateSelectionWithExtentPoint(const WebCore::IntPoint, bool isInteractingWithAssistedNode, WTF::Function<void (uint64_t, CallbackBase::Error)>&&);
528     void updateSelectionWithExtentPointAndBoundary(const WebCore::IntPoint, WebCore::TextGranularity, bool isInteractingWithAssistedNode, WTF::Function<void(uint64_t, CallbackBase::Error)>&&);
529     void requestAutocorrectionData(const String& textForAutocorrection, WTF::Function<void (const Vector<WebCore::FloatRect>&, const String&, double, uint64_t, CallbackBase::Error)>&&);
530     void applyAutocorrection(const String& correction, const String& originalText, WTF::Function<void (const String&, CallbackBase::Error)>&&);
531     bool applyAutocorrection(const String& correction, const String& originalText);
532     void requestAutocorrectionContext(WTF::Function<void (const String&, const String&, const String&, const String&, uint64_t, uint64_t, CallbackBase::Error)>&&);
533     void getAutocorrectionContext(String& contextBefore, String& markedText, String& selectedText, String& contextAfter, uint64_t& location, uint64_t& length);
534     void requestDictationContext(WTF::Function<void (const String&, const String&, const String&, CallbackBase::Error)>&&);
535     void replaceDictatedText(const String& oldText, const String& newText);
536     void replaceSelectedText(const String& oldText, const String& newText);
537     void didReceivePositionInformation(const InteractionInformationAtPosition&);
538     void requestPositionInformation(const InteractionInformationRequest&);
539     void startInteractionWithElementAtPosition(const WebCore::IntPoint&);
540     void stopInteraction();
541     void performActionOnElement(uint32_t action);
542     void saveImageToLibrary(const SharedMemory::Handle& imageHandle, uint64_t imageSize);
543     void didUpdateBlockSelectionWithTouch(uint32_t touch, uint32_t flags, float growThreshold, float shrinkThreshold);
544     void focusNextAssistedNode(bool isForward, WTF::Function<void (CallbackBase::Error)>&&);
545     void setAssistedNodeValue(const String&);
546     void setAssistedNodeValueAsNumber(double);
547     void setAssistedNodeSelectedIndex(uint32_t index, bool allowMultipleSelection = false);
548     void applicationDidEnterBackground();
549     void applicationDidFinishSnapshottingAfterEnteringBackground();
550     void applicationWillEnterForeground();
551     void applicationWillResignActive();
552     void applicationDidBecomeActive();
553     void commitPotentialTapFailed();
554     void didNotHandleTapAsClick(const WebCore::IntPoint&);
555     void didCompleteSyntheticClick();
556     void disableDoubleTapGesturesDuringTapIfNecessary(uint64_t requestID);
557     void contentSizeCategoryDidChange(const String& contentSizeCategory);
558     void getSelectionContext(WTF::Function<void(const String&, const String&, const String&, CallbackBase::Error)>&&);
559     void handleTwoFingerTapAtPoint(const WebCore::IntPoint&, uint64_t requestID);
560     void setForceAlwaysUserScalable(bool);
561     void setIsScrollingOrZooming(bool);
562     void requestRectsForGranularityWithSelectionOffset(WebCore::TextGranularity, uint32_t offset, WTF::Function<void(const Vector<WebCore::SelectionRect>&, CallbackBase::Error)>&&);
563     void requestRectsAtSelectionOffsetWithText(int32_t offset, const String&, WTF::Function<void(const Vector<WebCore::SelectionRect>&, CallbackBase::Error)>&&);
564     void autofillLoginCredentials(const String& username, const String& password);
565     void storeSelectionForAccessibility(bool);
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     void requestStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t webProcessContextId);
1214
1215 private:
1216     WebPageProxy(PageClient&, WebProcessProxy&, uint64_t pageID, Ref<API::PageConfiguration>&&);
1217     void platformInitialize();
1218
1219     void updateActivityState(WebCore::ActivityState::Flags flagsToUpdate = WebCore::ActivityState::AllFlags);
1220     void updateThrottleState();
1221     void updateHiddenPageThrottlingAutoIncreases();
1222
1223     enum class ResetStateReason {
1224         PageInvalidated,
1225         WebProcessExited,
1226     };
1227     void resetState(ResetStateReason);
1228     void resetStateAfterProcessExited();
1229
1230     void setUserAgent(const String&);
1231
1232     // IPC::MessageReceiver
1233     // Implemented in generated WebPageProxyMessageReceiver.cpp
1234     void didReceiveMessage(IPC::Connection&, IPC::Decoder&) override;
1235     void didReceiveSyncMessage(IPC::Connection&, IPC::Decoder&, std::unique_ptr<IPC::Encoder>&) override;
1236
1237
1238     // IPC::MessageSender
1239     bool sendMessage(std::unique_ptr<IPC::Encoder>, OptionSet<IPC::SendOption>) override;
1240     IPC::Connection* messageSenderConnection() override;
1241     uint64_t messageSenderDestinationID() override;
1242
1243     // WebPopupMenuProxy::Client
1244     void valueChangedForPopupMenu(WebPopupMenuProxy*, int32_t newSelectedIndex) override;
1245     void setTextFromItemForPopupMenu(WebPopupMenuProxy*, int32_t index) override;
1246 #if PLATFORM(GTK)
1247     void failedToShowPopupMenu() override;
1248 #endif
1249
1250 #if ENABLE(POINTER_LOCK)
1251     void requestPointerLock();
1252     void requestPointerUnlock();
1253 #endif
1254
1255     void didCreateMainFrame(uint64_t frameID);
1256     void didCreateSubframe(uint64_t frameID);
1257
1258     void didStartProvisionalLoadForFrame(uint64_t frameID, uint64_t navigationID, WebCore::URL&&, WebCore::URL&& unreachableURL, const UserData&);
1259     void didReceiveServerRedirectForProvisionalLoadForFrame(uint64_t frameID, uint64_t navigationID, WebCore::URL&&, const UserData&);
1260     void willPerformClientRedirectForFrame(uint64_t frameID, const String& url, double delay);
1261     void didCancelClientRedirectForFrame(uint64_t frameID);
1262     void didChangeProvisionalURLForFrame(uint64_t frameID, uint64_t navigationID, WebCore::URL&&);
1263     void didFailProvisionalLoadForFrame(uint64_t frameID, const WebCore::SecurityOriginData& frameSecurityOrigin, uint64_t navigationID, const String& provisionalURL, const WebCore::ResourceError&, const UserData&);
1264     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&);
1265     void didFinishDocumentLoadForFrame(uint64_t frameID, uint64_t navigationID, const UserData&);
1266     void didFinishLoadForFrame(uint64_t frameID, uint64_t navigationID, const UserData&);
1267     void didFailLoadForFrame(uint64_t frameID, uint64_t navigationID, const WebCore::ResourceError&, const UserData&);
1268     void didSameDocumentNavigationForFrame(uint64_t frameID, uint64_t navigationID, uint32_t sameDocumentNavigationType, WebCore::URL&&, const UserData&);
1269     void didChangeMainDocument(uint64_t frameID);
1270
1271     void didReceiveTitleForFrame(uint64_t frameID, const String&, const UserData&);
1272     void didFirstLayoutForFrame(uint64_t frameID, const UserData&);
1273     void didFirstVisuallyNonEmptyLayoutForFrame(uint64_t frameID, const UserData&);
1274     void didDisplayInsecureContentForFrame(uint64_t frameID, const UserData&);
1275     void didRunInsecureContentForFrame(uint64_t frameID, const UserData&);
1276     void didDetectXSSForFrame(uint64_t frameID, const UserData&);
1277     void mainFramePluginHandlesPageScaleGestureDidChange(bool);
1278     void frameDidBecomeFrameSet(uint64_t frameID, bool);
1279     void didStartProgress();
1280     void didChangeProgress(double);
1281     void didFinishProgress();
1282     void setNetworkRequestsInProgress(bool);
1283
1284     void hasInsecureContent(WebCore::HasInsecureContent&);
1285
1286     void didDestroyNavigation(uint64_t navigationID);
1287
1288     void decidePolicyForNavigationAction(uint64_t frameID, const WebCore::SecurityOriginData& frameSecurityOrigin, uint64_t navigationID, NavigationActionData&&, const FrameInfoData&, uint64_t originatingPageID, const WebCore::ResourceRequest& originalRequest, WebCore::ResourceRequest&&, uint64_t listenerID, const UserData&, bool& receivedPolicyAction, uint64_t& newNavigationID, WebCore::PolicyAction&, DownloadID&, WebsitePolicies&);
1289     void decidePolicyForNewWindowAction(uint64_t frameID, const WebCore::SecurityOriginData& frameSecurityOrigin, NavigationActionData&&, WebCore::ResourceRequest&&, const String& frameName, uint64_t listenerID, const UserData&);
1290     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&);
1291     void decidePolicyForResponseSync(uint64_t frameID, const WebCore::SecurityOriginData& frameSecurityOrigin, uint64_t navigationID, const WebCore::ResourceResponse&, const WebCore::ResourceRequest&, bool canShowMIMEType, uint64_t listenerID, const UserData&, bool& receivedPolicyAction, WebCore::PolicyAction&, DownloadID&);
1292     void unableToImplementPolicy(uint64_t frameID, const WebCore::ResourceError&, const UserData&);
1293
1294     void willSubmitForm(uint64_t frameID, uint64_t sourceFrameID, const Vector<std::pair<String, String>>& textFieldValues, uint64_t listenerID, const UserData&);
1295         
1296     void contentRuleListNotification(WebCore::URL&&, Vector<String>&& identifiers, Vector<String>&& notifications);
1297
1298     // History client
1299     void didNavigateWithNavigationData(const WebNavigationDataStore&, uint64_t frameID);
1300     void didPerformClientRedirect(const String& sourceURLString, const String& destinationURLString, uint64_t frameID);
1301     void didPerformServerRedirect(const String& sourceURLString, const String& destinationURLString, uint64_t frameID);
1302     void didUpdateHistoryTitle(const String& title, const String& url, uint64_t frameID);
1303
1304     // UI client
1305     void createNewPage(const FrameInfoData&, uint64_t originatingPageID, WebCore::ResourceRequest&&, WebCore::WindowFeatures&&, NavigationActionData&&, Ref<Messages::WebPageProxy::CreateNewPage::DelayedReply>&&);
1306     void showPage();
1307     void runJavaScriptAlert(uint64_t frameID, const WebCore::SecurityOriginData&, const String&, Ref<Messages::WebPageProxy::RunJavaScriptAlert::DelayedReply>&&);
1308     void runJavaScriptConfirm(uint64_t frameID, const WebCore::SecurityOriginData&, const String&, Ref<Messages::WebPageProxy::RunJavaScriptConfirm::DelayedReply>&&);
1309     void runJavaScriptPrompt(uint64_t frameID, const WebCore::SecurityOriginData&, const String&, const String&, Ref<Messages::WebPageProxy::RunJavaScriptPrompt::DelayedReply>&&);
1310     void setStatusText(const String&);
1311     void mouseDidMoveOverElement(WebHitTestResultData&&, uint32_t modifiers, UserData&&);
1312
1313 #if ENABLE(NETSCAPE_PLUGIN_API)
1314     void unavailablePluginButtonClicked(uint32_t opaquePluginUnavailabilityReason, const String& mimeType, const String& pluginURLString, const String& pluginsPageURLString, const String& frameURLString, const String& pageURLString);
1315 #endif // ENABLE(NETSCAPE_PLUGIN_API)
1316 #if ENABLE(WEBGL)
1317     void webGLPolicyForURL(WebCore::URL&&, Ref<Messages::WebPageProxy::WebGLPolicyForURL::DelayedReply>&&);
1318     void resolveWebGLPolicyForURL(WebCore::URL&&, Ref<Messages::WebPageProxy::ResolveWebGLPolicyForURL::DelayedReply>&&);
1319 #endif // ENABLE(WEBGL)
1320     void setToolbarsAreVisible(bool toolbarsAreVisible);
1321     void getToolbarsAreVisible(Ref<Messages::WebPageProxy::GetToolbarsAreVisible::DelayedReply>&&);
1322     void setMenuBarIsVisible(bool menuBarIsVisible);
1323     void getMenuBarIsVisible(Ref<Messages::WebPageProxy::GetMenuBarIsVisible::DelayedReply>&&);
1324     void setStatusBarIsVisible(bool statusBarIsVisible);
1325     void getStatusBarIsVisible(Ref<Messages::WebPageProxy::GetStatusBarIsVisible::DelayedReply>&&);
1326     void setIsResizable(bool isResizable);
1327     void screenToRootView(const WebCore::IntPoint& screenPoint, Ref<Messages::WebPageProxy::ScreenToRootView::DelayedReply>&&);
1328     void rootViewToScreen(const WebCore::IntRect& viewRect, Ref<Messages::WebPageProxy::RootViewToScreen::DelayedReply>&&);
1329 #if PLATFORM(IOS)
1330     void accessibilityScreenToRootView(const WebCore::IntPoint& screenPoint, WebCore::IntPoint& windowPoint);
1331     void rootViewToAccessibilityScreen(const WebCore::IntRect& viewRect, WebCore::IntRect& result);
1332 #endif
1333     void runBeforeUnloadConfirmPanel(uint64_t frameID, const WebCore::SecurityOriginData&, const String& message, RefPtr<Messages::WebPageProxy::RunBeforeUnloadConfirmPanel::DelayedReply>);
1334     void didChangeViewportProperties(const WebCore::ViewportAttributes&);
1335     void pageDidScroll();
1336     void runOpenPanel(uint64_t frameID, const WebCore::SecurityOriginData&, const WebCore::FileChooserSettings&);
1337     void printFrame(uint64_t frameID);
1338     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>&&);
1339     void reachedApplicationCacheOriginQuota(const String& originIdentifier, uint64_t currentQuota, uint64_t totalBytesNeeded, Ref<Messages::WebPageProxy::ReachedApplicationCacheOriginQuota::DelayedReply>&&);
1340     void requestGeolocationPermissionForFrame(uint64_t geolocationID, uint64_t frameID, String originIdentifier);
1341
1342 #if ENABLE(MEDIA_STREAM)
1343     UserMediaPermissionRequestManagerProxy& userMediaPermissionRequestManager();
1344 #endif
1345     void requestUserMediaPermissionForFrame(uint64_t userMediaID, uint64_t frameID, const WebCore::SecurityOriginData& userMediaDocumentOriginIdentifier, const WebCore::SecurityOriginData& topLevelDocumentOriginIdentifier, const WebCore::MediaConstraints& audioConstraints, const WebCore::MediaConstraints& videoConstraints);
1346     void enumerateMediaDevicesForFrame(uint64_t userMediaID, uint64_t frameID, const WebCore::SecurityOriginData& userMediaDocumentOriginData, const WebCore::SecurityOriginData& topLevelDocumentOriginData);
1347
1348     void runModal();
1349     void notifyScrollerThumbIsVisibleInRect(const WebCore::IntRect&);
1350     void recommendedScrollbarStyleDidChange(int32_t newStyle);
1351     void didChangeScrollbarsForMainFrame(bool hasHorizontalScrollbar, bool hasVerticalScrollbar);
1352     void didChangeScrollOffsetPinningForMainFrame(bool pinnedToLeftSide, bool pinnedToRightSide, bool pinnedToTopSide, bool pinnedToBottomSide);
1353     void didChangePageCount(unsigned);
1354     void pageExtendedBackgroundColorDidChange(const WebCore::Color&);
1355 #if ENABLE(NETSCAPE_PLUGIN_API)
1356     void didFailToInitializePlugin(const String& mimeType, const String& frameURLString, const String& pageURLString);
1357     void didBlockInsecurePluginVersion(const String& mimeType, const String& pluginURLString, const String& frameURLString, const String& pageURLString, bool replacementObscured);
1358 #endif // ENABLE(NETSCAPE_PLUGIN_API)
1359     void setCanShortCircuitHorizontalWheelEvents(bool canShortCircuitHorizontalWheelEvents) { m_canShortCircuitHorizontalWheelEvents = canShortCircuitHorizontalWheelEvents; }
1360
1361     void reattachToWebProcess();
1362     RefPtr<API::Navigation> reattachToWebProcessForReload();
1363     RefPtr<API::Navigation> reattachToWebProcessWithItem(WebBackForwardListItem*);
1364
1365     void requestNotificationPermission(uint64_t notificationID, const String& originString);
1366     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);
1367     void cancelNotification(uint64_t notificationID);
1368     void clearNotifications(const Vector<uint64_t>& notificationIDs);
1369     void didDestroyNotification(uint64_t notificationID);
1370
1371     void didChangeContentSize(const WebCore::IntSize&);
1372
1373 #if ENABLE(INPUT_TYPE_COLOR)
1374     void showColorPicker(const WebCore::Color& initialColor, const WebCore::IntRect&);
1375     void didChooseColor(const WebCore::Color&) override;
1376     void didEndColorPicker() override;
1377 #endif
1378
1379     void compositionWasCanceled();
1380     void setHasHadSelectionChangesFromUserInteraction(bool);
1381     void setNeedsHiddenContentEditableQuirk(bool);
1382     void setNeedsPlainTextQuirk(bool);
1383
1384     // Back/Forward list management
1385     void backForwardAddItem(uint64_t itemID);
1386     void backForwardGoToItem(uint64_t itemID, SandboxExtension::Handle&);
1387     void backForwardItemAtIndex(int32_t index, uint64_t& itemID);
1388     void backForwardBackListCount(int32_t& count);
1389     void backForwardForwardListCount(int32_t& count);
1390     void backForwardClear();
1391
1392     // Undo management
1393     void registerEditCommandForUndo(uint64_t commandID, uint32_t editAction);
1394     void registerInsertionUndoGrouping();
1395     void clearAllEditCommands();
1396     void canUndoRedo(uint32_t action, bool& result);
1397     void executeUndoRedo(uint32_t action, bool& result);
1398
1399     // Keyboard handling
1400 #if PLATFORM(COCOA)
1401     void executeSavedCommandBySelector(const String& selector, bool& handled);
1402 #endif
1403
1404 #if PLATFORM(GTK)
1405     void getEditorCommandsForKeyEvent(const AtomicString&, Vector<String>&);
1406     void bindAccessibilityTree(const String&);
1407 #endif
1408
1409     // Popup Menu.
1410     void showPopupMenu(const WebCore::IntRect& rect, uint64_t textDirection, const Vector<WebPopupItem>& items, int32_t selectedIndex, const PlatformPopupMenuData&);
1411     void hidePopupMenu();
1412
1413 #if ENABLE(CONTEXT_MENUS)
1414     void showContextMenu(const ContextMenuContextData&, const UserData&);
1415     void internalShowContextMenu(const ContextMenuContextData&, const UserData&);
1416 #endif
1417
1418 #if ENABLE(TELEPHONE_NUMBER_DETECTION)
1419 #if PLATFORM(MAC)
1420     void showTelephoneNumberMenu(const String& telephoneNumber, const WebCore::IntPoint&);
1421 #endif
1422 #endif
1423
1424     // Search popup results
1425     void saveRecentSearches(const String&, const Vector<WebCore::RecentSearch>&);
1426     void loadRecentSearches(const String&, Vector<WebCore::RecentSearch>&);
1427
1428 #if PLATFORM(COCOA)
1429     // Speech.
1430     void getIsSpeaking(bool&);
1431     void speak(const String&);
1432     void stopSpeaking();
1433
1434     // Spotlight.
1435     void searchWithSpotlight(const String&);
1436         
1437     void searchTheWeb(const String&);
1438
1439     // Dictionary.
1440     void didPerformDictionaryLookup(const WebCore::DictionaryPopupInfo&);
1441 #endif
1442
1443 #if PLATFORM(MAC)
1444     bool appleMailPaginationQuirkEnabled();
1445 #endif
1446
1447     // Spelling and grammar.
1448     void checkSpellingOfString(const String& text, int32_t& misspellingLocation, int32_t& misspellingLength);
1449     void checkGrammarOfString(const String& text, Vector<WebCore::GrammarDetail>&, int32_t& badGrammarLocation, int32_t& badGrammarLength);
1450     void spellingUIIsShowing(bool&);
1451     void updateSpellingUIWithMisspelledWord(const String& misspelledWord);
1452     void updateSpellingUIWithGrammarString(const String& badGrammarPhrase, const WebCore::GrammarDetail&);
1453     void learnWord(const String& word);
1454     void ignoreWord(const String& word);
1455     void requestCheckingOfString(uint64_t requestID, const WebCore::TextCheckingRequestData&, int32_t insertionPoint);
1456
1457     void takeFocus(uint32_t direction);
1458     void setToolTip(const String&);
1459     void setCursor(const WebCore::Cursor&);
1460     void setCursorHiddenUntilMouseMoves(bool);
1461
1462     void didReceiveEvent(uint32_t opaqueType, bool handled);
1463
1464     void voidCallback(CallbackID);
1465     void dataCallback(const IPC::DataReference&, CallbackID);
1466     void imageCallback(const ShareableBitmap::Handle&, CallbackID);
1467     void stringCallback(const String&, CallbackID);
1468     void invalidateStringCallback(CallbackID);
1469     void scriptValueCallback(const IPC::DataReference&, bool hadException, const WebCore::ExceptionDetails&, CallbackID);
1470     void computedPagesCallback(const Vector<WebCore::IntRect>&, double totalScaleFactorForPrinting, CallbackID);
1471     void validateCommandCallback(const String&, bool, int, CallbackID);
1472     void unsignedCallback(uint64_t, CallbackID);
1473     void editingRangeCallback(const EditingRange&, CallbackID);
1474 #if PLATFORM(COCOA)
1475     void machSendRightCallback(const WebCore::MachSendRight&, CallbackID);
1476 #endif
1477     void rectForCharacterRangeCallback(const WebCore::IntRect&, const EditingRange&, CallbackID);
1478 #if PLATFORM(MAC)
1479     void attributedStringForCharacterRangeCallback(const AttributedString&, const EditingRange&, CallbackID);
1480     void fontAtSelectionCallback(const String&, double, bool, CallbackID);
1481 #endif
1482 #if PLATFORM(IOS)
1483     void gestureCallback(const WebCore::IntPoint&, uint32_t gestureType, uint32_t gestureState, uint32_t flags, CallbackID);
1484     void touchesCallback(const WebCore::IntPoint&, uint32_t touches, uint32_t flags, CallbackID);
1485     void autocorrectionDataCallback(const Vector<WebCore::FloatRect>&, const String& fontName, float fontSize, uint64_t fontTraits, CallbackID);
1486     void autocorrectionContextCallback(const String& beforeText, const String& markedText, const String& selectedText, const String& afterText, uint64_t location, uint64_t length, CallbackID);
1487     void selectionContextCallback(const String& selectedText, const String& beforeText, const String& afterText, CallbackID);
1488     void interpretKeyEvent(const EditorState&, bool isCharEvent, bool& handled);
1489     void showPlaybackTargetPicker(bool hasVideo, const WebCore::IntRect& elementRect);
1490     void selectionRectsCallback(const Vector<WebCore::SelectionRect>&, CallbackID);
1491 #endif
1492 #if PLATFORM(GTK)
1493     void printFinishedCallback(const WebCore::ResourceError&, CallbackID);
1494 #endif
1495
1496     void focusedFrameChanged(uint64_t frameID);
1497     void frameSetLargestFrameChanged(uint64_t frameID);
1498
1499     void didReceiveAuthenticationChallenge(uint64_t frameID, const WebCore::AuthenticationChallenge&, uint64_t challengeID);
1500
1501     void didFinishLoadingDataForCustomContentProvider(const String& suggestedFilename, const IPC::DataReference&);
1502
1503 #if PLATFORM(COCOA)
1504     void pluginFocusOrWindowFocusChanged(uint64_t pluginComplexTextInputIdentifier, bool pluginHasFocusAndWindowHasFocus);
1505     void setPluginComplexTextInputState(uint64_t pluginComplexTextInputIdentifier, uint64_t complexTextInputState);
1506 #endif
1507
1508     bool maybeInitializeSandboxExtensionHandle(const WebCore::URL&, SandboxExtension::Handle&);
1509
1510 #if USE(AUTOMATIC_TEXT_REPLACEMENT)
1511     void toggleSmartInsertDelete();
1512     void toggleAutomaticQuoteSubstitution();
1513     void toggleAutomaticLinkDetection();
1514     void toggleAutomaticDashSubstitution();
1515     void toggleAutomaticTextReplacement();
1516 #endif
1517
1518 #if PLATFORM(MAC)
1519     void substitutionsPanelIsShowing(bool&);
1520     void showCorrectionPanel(int32_t panelType, const WebCore::FloatRect& boundingBoxOfReplacedString, const String& replacedString, const String& replacementString, const Vector<String>& alternativeReplacementStrings);
1521     void dismissCorrectionPanel(int32_t reason);
1522     void dismissCorrectionPanelSoon(int32_t reason, String& result);
1523     void recordAutocorrectionResponse(int32_t responseType, const String& replacedString, const String& replacementString);
1524
1525 #if USE(DICTATION_ALTERNATIVES)
1526     void showDictationAlternativeUI(const WebCore::FloatRect& boundingBoxOfDictatedText, uint64_t dictationContext);
1527     void removeDictationAlternatives(uint64_t dictationContext);
1528     void dictationAlternatives(uint64_t dictationContext, Vector<String>& result);
1529 #endif
1530
1531     void setEditableElementIsFocused(bool);
1532 #endif // PLATFORM(MAC)
1533
1534 #if PLATFORM(IOS)
1535     WebCore::FloatSize screenSize();
1536     WebCore::FloatSize availableScreenSize();
1537     float textAutosizingWidth();
1538
1539     void dynamicViewportUpdateChangedTarget(double newTargetScale, const WebCore::FloatPoint& newScrollPosition, uint64_t dynamicViewportSizeUpdateID);
1540     void couldNotRestorePageState();
1541     void restorePageState(std::optional<WebCore::FloatPoint> scrollPosition, const WebCore::FloatPoint& scrollOrigin, const WebCore::FloatBoxExtent& obscuredInsetsOnSave, double scale);
1542     void restorePageCenterAndScale(std::optional<WebCore::FloatPoint>, double scale);
1543
1544     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);
1545
1546     void startAssistingNode(const AssistedNodeInformation&, bool userIsInteracting, bool blurPreviousNode, const UserData&);
1547     void stopAssistingNode();
1548
1549     void showInspectorHighlight(const WebCore::Highlight&);
1550     void hideInspectorHighlight();
1551
1552     void showInspectorIndication();
1553     void hideInspectorIndication();
1554
1555     void enableInspectorNodeSearch();
1556     void disableInspectorNodeSearch();
1557 #endif // PLATFORM(IOS)
1558
1559 #if ENABLE(DATA_DETECTION)
1560     RetainPtr<NSArray> m_dataDetectionResults;
1561 #endif
1562
1563     void clearLoadDependentCallbacks();
1564
1565     void performDragControllerAction(DragControllerAction, WebCore::DragData&, const String& dragStorageName, const SandboxExtension::Handle&, const SandboxExtension::HandleArray&);
1566
1567     void updateBackingStoreDiscardableState();
1568
1569     void setRenderTreeSize(uint64_t treeSize) { m_renderTreeSize = treeSize; }
1570
1571 #if PLATFORM(X11)
1572     void createPluginContainer(uint64_t& windowID);
1573     void windowedPluginGeometryDidChange(const WebCore::IntRect& frameRect, const WebCore::IntRect& clipRect, uint64_t windowID);
1574     void windowedPluginVisibilityDidChange(bool isVisible, uint64_t windowID);
1575 #endif
1576
1577     void processNextQueuedWheelEvent();
1578     void sendWheelEvent(const WebWheelEvent&);
1579     bool shouldProcessWheelEventNow(const WebWheelEvent&) const;
1580
1581 #if ENABLE(TOUCH_EVENTS)
1582     void updateTouchEventTracking(const WebTouchEvent&);
1583     WebCore::TrackingType touchEventTrackingType(const WebTouchEvent&) const;
1584 #endif
1585
1586 #if ENABLE(NETSCAPE_PLUGIN_API)
1587     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);
1588 #endif
1589
1590 #if USE(QUICK_LOOK)
1591     void didStartLoadForQuickLookDocumentInMainFrame(const String& fileName, const String& uti);
1592     void didFinishLoadForQuickLookDocumentInMainFrame(const QuickLookDocumentData&);
1593     void didRequestPasswordForQuickLookDocumentInMainFrame(const String& fileName);
1594 #endif
1595
1596 #if ENABLE(CONTENT_FILTERING)
1597     void contentFilterDidBlockLoadForFrame(const WebCore::ContentFilterUnblockHandler&, uint64_t frameID);
1598 #endif
1599
1600     uint64_t generateNavigationID();
1601     API::DiagnosticLoggingClient* effectiveDiagnosticLoggingClient(WebCore::ShouldSample);
1602
1603     WebPreferencesStore preferencesStore() const;
1604
1605     void dispatchActivityStateChange();
1606     void viewDidLeaveWindow();
1607     void viewDidEnterWindow();
1608
1609 #if PLATFORM(MAC)
1610     void didPerformImmediateActionHitTest(const WebHitTestResultData&, bool contentPreventsDefault, const UserData&);
1611 #endif
1612
1613     void useFixedLayoutDidChange(bool useFixedLayout) { m_useFixedLayout = useFixedLayout; }
1614     void fixedLayoutSizeDidChange(WebCore::IntSize fixedLayoutSize) { m_fixedLayoutSize = fixedLayoutSize; }
1615
1616     void imageOrMediaDocumentSizeChanged(const WebCore::IntSize&);
1617 #if ENABLE(VIDEO)
1618 #if USE(GSTREAMER)
1619     void requestInstallMissingMediaPlugins(const String& details, const String& description);
1620 #endif
1621 #endif
1622
1623     void startURLSchemeTask(uint64_t handlerIdentifier, uint64_t taskIdentifier, const WebCore::ResourceRequest&);
1624     void stopURLSchemeTask(uint64_t handlerIdentifier, uint64_t taskIdentifier);
1625
1626     void handleAutoFillButtonClick(const UserData&);
1627
1628     void finishInitializingWebPageAfterProcessLaunch();
1629
1630     void handleMessage(IPC::Connection&, const String& messageName, const UserData& messageBody);
1631     void handleSynchronousMessage(IPC::Connection&, const String& messageName, const UserData& messageBody, UserData& returnUserData);
1632
1633     void viewIsBecomingVisible();
1634
1635     void stopAllURLSchemeTasks();
1636
1637     PageClient& m_pageClient;
1638     Ref<API::PageConfiguration> m_configuration;
1639
1640     std::unique_ptr<API::LoaderClient> m_loaderClient;
1641     std::unique_ptr<API::PolicyClient> m_policyClient;
1642     std::unique_ptr<API::NavigationClient> m_navigationClient;
1643     std::unique_ptr<API::HistoryClient> m_historyClient;
1644     std::unique_ptr<API::IconLoadingClient> m_iconLoadingClient;
1645     std::unique_ptr<API::FormClient> m_formClient;
1646     std::unique_ptr<API::UIClient> m_uiClient;
1647     std::unique_ptr<API::FindClient> m_findClient;
1648     std::unique_ptr<API::FindMatchesClient> m_findMatchesClient;
1649     std::unique_ptr<API::DiagnosticLoggingClient> m_diagnosticLoggingClient;
1650 #if ENABLE(CONTEXT_MENUS)
1651     std::unique_ptr<API::ContextMenuClient> m_contextMenuClient;
1652 #endif
1653     std::unique_ptr<WebPageInjectedBundleClient> m_injectedBundleClient;
1654
1655     std::unique_ptr<WebNavigationState> m_navigationState;
1656     String m_failingProvisionalLoadURL;
1657     bool m_isLoadingAlternateHTMLStringForFailingProvisionalLoad { false };
1658
1659     std::unique_ptr<DrawingAreaProxy> m_drawingArea;
1660 #if ENABLE(ASYNC_SCROLLING)
1661     std::unique_ptr<RemoteScrollingCoordinatorProxy> m_scrollingCoordinatorProxy;
1662 #endif
1663
1664     Ref<WebProcessProxy> m_process;
1665     Ref<WebPageGroup> m_pageGroup;
1666     Ref<WebPreferences> m_preferences;
1667
1668     WebProcessLifetimeTracker m_webProcessLifetimeTracker { *this };
1669
1670     Ref<WebUserContentControllerProxy> m_userContentController;
1671     Ref<VisitedLinkStore> m_visitedLinkStore;
1672     Ref<WebsiteDataStore> m_websiteDataStore;
1673
1674     RefPtr<WebFrameProxy> m_mainFrame;
1675     RefPtr<WebFrameProxy> m_focusedFrame;
1676     RefPtr<WebFrameProxy> m_frameSetLargestFrame;
1677
1678     String m_userAgent;
1679     String m_applicationNameForUserAgent;
1680     String m_customUserAgent;
1681     String m_customTextEncodingName;
1682     String m_overrideContentSecurityPolicy;
1683
1684     bool m_treatsSHA1CertificatesAsInsecure { true };
1685
1686     RefPtr<WebInspectorProxy> m_inspector;
1687
1688 #if ENABLE(FULLSCREEN_API)
1689     RefPtr<WebFullScreenManagerProxy> m_fullScreenManager;
1690     std::unique_ptr<API::FullscreenClient> m_fullscreenClient;
1691 #endif
1692
1693 #if (PLATFORM(IOS) && HAVE(AVKIT)) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))
1694     RefPtr<PlaybackSessionManagerProxy> m_playbackSessionManager;
1695     RefPtr<VideoFullscreenManagerProxy> m_videoFullscreenManager;
1696 #endif
1697
1698 #if PLATFORM(IOS)
1699     VisibleContentRectUpdateInfo m_lastVisibleContentRectUpdate;
1700     uint64_t m_firstLayerTreeTransactionIdAfterDidCommitLoad { 0 };
1701     int32_t m_deviceOrientation { 0 };
1702     uint64_t m_dynamicViewportSizeUpdateLayerTreeTransactionID { 0 };
1703     uint64_t m_currentDynamicViewportSizeUpdateID { 0 };
1704     bool m_hasReceivedLayerTreeTransactionAfterDidCommitLoad { true };
1705     bool m_dynamicViewportSizeUpdateWaitingForTarget { false };
1706     bool m_dynamicViewportSizeUpdateWaitingForLayerTreeCommit { false };
1707     bool m_hasNetworkRequestsOnSuspended { false };
1708     bool m_isKeyboardAnimatingIn { false };
1709     bool m_isScrollingOrZooming { false };
1710 #endif
1711
1712 #if ENABLE(APPLE_PAY)
1713     std::unique_ptr<WebPaymentCoordinatorProxy> m_paymentCoordinator;
1714 #endif
1715
1716     CallbackMap m_callbacks;
1717     HashSet<CallbackID> m_loadDependentStringCallbackIDs;
1718
1719     HashSet<WebEditCommandProxy*> m_editCommandSet;
1720
1721 #if PLATFORM(COCOA)
1722     HashSet<String> m_knownKeypressCommandNames;
1723 #endif
1724
1725     RefPtr<WebPopupMenuProxy> m_activePopupMenu;
1726 #if ENABLE(CONTEXT_MENUS)
1727     RefPtr<WebContextMenuProxy> m_activeContextMenu;
1728     ContextMenuContextData m_activeContextMenuContextData;
1729 #endif
1730     RefPtr<API::HitTestResult> m_lastMouseMoveHitTestResult;
1731
1732     RefPtr<WebOpenPanelResultListenerProxy> m_openPanelResultListener;
1733     GeolocationPermissionRequestManagerProxy m_geolocationPermissionRequestManager;
1734     NotificationPermissionRequestManagerProxy m_notificationPermissionRequestManager;
1735
1736 #if ENABLE(MEDIA_STREAM)
1737     std::unique_ptr<UserMediaPermissionRequestManagerProxy> m_userMediaPermissionRequestManager;
1738 #endif
1739
1740     WebCore::ActivityState::Flags m_activityState { WebCore::ActivityState::NoFlags };
1741     bool m_viewWasEverInWindow { false };
1742 #if PLATFORM(IOS)
1743     bool m_allowsMediaDocumentInlinePlayback { false };
1744     bool m_alwaysRunsAtForegroundPriority { false };
1745     ProcessThrottler::ForegroundActivityToken m_activityToken;
1746 #endif
1747     bool m_initialCapitalizationEnabled { false };
1748     std::optional<double> m_cpuLimit;
1749     Ref<WebBackForwardList> m_backForwardList;
1750         
1751     bool m_maintainsInactiveSelection { false };
1752
1753     bool m_waitsForPaintAfterViewDidMoveToWindow { false };
1754     bool m_shouldSkipWaitingForPaintAfterNextViewDidMoveToWindow { false };
1755
1756     String m_toolTip;
1757
1758     EditorState m_editorState;
1759     bool m_isEditable { false };
1760
1761     double m_textZoomFactor { 1 };
1762     double m_pageZoomFactor { 1 };
1763     double m_pageScaleFactor { 1 };
1764     double m_pluginZoomFactor { 1 };
1765     double m_pluginScaleFactor { 1 };
1766     double m_viewScaleFactor { 1 };
1767     float m_intrinsicDeviceScaleFactor { 1 };
1768     std::optional<float> m_customDeviceScaleFactor;
1769     float m_topContentInset { 0 };
1770
1771     LayerHostingMode m_layerHostingMode { LayerHostingMode::InProcess };
1772
1773     bool m_drawsBackground { true };
1774
1775     WebCore::Color m_underlayColor;
1776     WebCore::Color m_pageExtendedBackgroundColor;
1777
1778     bool m_useFixedLayout { false };
1779     WebCore::IntSize m_fixedLayoutSize;
1780
1781     WebCore::LayoutMilestones m_observedLayoutMilestones { 0 };
1782
1783     bool m_suppressScrollbarAnimations { false };
1784
1785     WebCore::Pagination::Mode m_paginationMode { WebCore::Pagination::Unpaginated };
1786     bool m_paginationBehavesLikeColumns { false };
1787     double m_pageLength { 0 };
1788     double m_gapBetweenPages { 0 };
1789     bool m_paginationLineGridEnabled { false };
1790         
1791     // If the process backing the web page is alive and kicking.
1792     bool m_isValid { true };
1793
1794     // Whether WebPageProxy::close() has been called on this page.
1795     bool m_isClosed { false };
1796
1797     // Whether it can run modal child web pages.
1798     bool m_canRunModal { false };
1799
1800     bool m_needsToFinishInitializingWebPageAfterProcessLaunch { false };
1801
1802     bool m_isInPrintingMode { false };
1803     bool m_isPerformingDOMPrintOperation { false };
1804
1805     bool m_inDecidePolicyForResponseSync { false };
1806     const WebCore::ResourceRequest* m_decidePolicyForResponseRequest { nullptr };
1807     bool m_syncMimeTypePolicyActionIsValid { false };
1808     WebCore::PolicyAction m_syncMimeTypePolicyAction { WebCore::PolicyAction::Use };
1809     DownloadID m_syncMimeTypePolicyDownloadID { 0 };
1810     bool m_inDecidePolicyForNavigationAction { false };
1811     bool m_syncNavigationActionPolicyActionIsValid { false };
1812     WebCore::PolicyAction m_syncNavigationActionPolicyAction { WebCore::PolicyAction::Use };
1813     DownloadID m_syncNavigationActionPolicyDownloadID { 0 };
1814     WebsitePolicies m_syncNavigationActionPolicyWebsitePolicies;
1815
1816     bool m_shouldSuppressAppLinksInNextNavigationPolicyDecision { false };
1817
1818     Deque<NativeWebKeyboardEvent> m_keyEventQueue;
1819     Deque<NativeWebWheelEvent> m_wheelEventQueue;
1820     Deque<std::unique_ptr<Vector<NativeWebWheelEvent>>> m_currentlyProcessedWheelEvents;
1821 #if ENABLE(MAC_GESTURE_EVENTS)
1822     Deque<NativeWebGestureEvent> m_gestureEventQueue;
1823 #endif
1824
1825     bool m_processingMouseMoveEvent { false };
1826     std::unique_ptr<NativeWebMouseEvent> m_nextMouseMoveEvent;
1827     std::unique_ptr<NativeWebMouseEvent> m_currentlyProcessedMouseDownEvent;
1828
1829 #if ENABLE(TOUCH_EVENTS)
1830     struct TouchEventTracking {
1831         WebCore::TrackingType touchForceChangedTracking { WebCore::TrackingType::NotTracking };
1832         WebCore::TrackingType touchStartTracking { WebCore::TrackingType::NotTracking };
1833         WebCore::TrackingType touchMoveTracking { WebCore::TrackingType::NotTracking };
1834         WebCore::TrackingType touchEndTracking { WebCore::TrackingType::NotTracking };
1835
1836         bool isTrackingAnything() const
1837         {
1838             return touchForceChangedTracking != WebCore::TrackingType::NotTracking
1839                 || touchStartTracking != WebCore::TrackingType::NotTracking
1840                 || touchMoveTracking != WebCore::TrackingType::NotTracking
1841                 || touchEndTracking != WebCore::TrackingType::NotTracking;
1842         }
1843
1844         void reset()
1845         {
1846             touchForceChangedTracking = WebCore::TrackingType::NotTracking;
1847             touchStartTracking = WebCore::TrackingType::NotTracking;
1848             touchMoveTracking = WebCore::TrackingType::NotTracking;
1849             touchEndTracking = WebCore::TrackingType::NotTracking;
1850         }
1851     };
1852     TouchEventTracking m_touchEventTracking;
1853 #endif
1854 #if ENABLE(TOUCH_EVENTS) && !ENABLE(IOS_TOUCH_EVENTS)
1855     Deque<QueuedTouchEvents> m_touchEventQueue;
1856 #endif
1857
1858 #if ENABLE(INPUT_TYPE_COLOR)
1859     RefPtr<WebColorPicker> m_colorPicker;
1860 #endif
1861 #if PLATFORM(COCOA)
1862     RefPtr<WebCore::ValidationBubble> m_validationBubble;
1863 #endif
1864
1865     const uint64_t m_pageID;
1866
1867     bool m_isPageSuspended { false };
1868     bool m_addsVisitedLinks { true };
1869
1870     bool m_controlledByAutomation { false };
1871
1872 #if ENABLE(REMOTE_INSPECTOR)
1873     bool m_allowsRemoteInspection { true };
1874     String m_remoteInspectionNameOverride;
1875 #endif
1876
1877 #if PLATFORM(COCOA)
1878     bool m_isSmartInsertDeleteEnabled { false };
1879 #endif
1880
1881 #if PLATFORM(GTK)
1882     String m_accessibilityPlugID;
1883     WebCore::Color m_backgroundColor { WebCore::Color::white };
1884 #endif
1885
1886     int64_t m_spellDocumentTag { 0 }; // FIXME: use std::optional<>.
1887     bool m_hasSpellDocumentTag { false }; 
1888     unsigned m_pendingLearnOrIgnoreWordMessageCount { 0 };
1889
1890     bool m_mainFrameHasCustomContentProvider { false };
1891
1892 #if ENABLE(DRAG_SUPPORT)
1893     // Current drag destination details are delivered as an asynchronous response,
1894     // so we preserve them to be used when the next dragging delegate call is made.
1895     WebCore::DragOperation m_currentDragOperation { WebCore::DragOperationNone };
1896     bool m_currentDragIsOverFileInput { false };
1897     unsigned m_currentDragNumberOfFilesToBeAccepted { 0 };
1898     WebCore::IntRect m_currentDragCaretRect;
1899 #endif
1900
1901     PageLoadState m_pageLoadState;
1902     
1903     bool m_delegatesScrolling { false };
1904
1905     bool m_mainFrameHasHorizontalScrollbar { false };
1906     bool m_mainFrameHasVerticalScrollbar { false };
1907
1908     // Whether horizontal wheel events can be handled directly for swiping purposes.
1909     bool m_canShortCircuitHorizontalWheelEvents { true };
1910
1911     bool m_mainFrameIsPinnedToLeftSide { true };
1912     bool m_mainFrameIsPinnedToRightSide { true };
1913     bool m_mainFrameIsPinnedToTopSide { true };
1914     bool m_mainFrameIsPinnedToBottomSide { true };
1915
1916     bool m_shouldUseImplicitRubberBandControl { false };
1917     bool m_rubberBandsAtLeft { true };
1918     bool m_rubberBandsAtRight { true };
1919     bool m_rubberBandsAtTop { true };
1920     bool m_rubberBandsAtBottom { true };
1921         
1922     bool m_enableVerticalRubberBanding { true };
1923     bool m_enableHorizontalRubberBanding { true };
1924
1925     bool m_backgroundExtendsBeyondPage { false };
1926
1927     bool m_shouldRecordNavigationSnapshots { false };
1928     bool m_isShowingNavigationGestureSnapshot { false };
1929
1930     bool m_mainFramePluginHandlesPageScaleGesture { false };
1931
1932     unsigned m_pageCount { 0 };
1933
1934     WebCore::IntRect m_visibleScrollerThumbRect;
1935
1936     uint64_t m_renderTreeSize { 0 };
1937     uint64_t m_sessionRestorationRenderTreeSize { 0 };
1938     bool m_hitRenderTreeSizeThreshold { false };
1939
1940     bool m_suppressVisibilityUpdates { false };
1941     bool m_autoSizingShouldExpandToViewHeight { false };
1942     WebCore::IntSize m_minimumLayoutSize;
1943     std::optional<WebCore::IntSize> m_viewportSizeForCSSViewportUnits;
1944
1945     // Visual viewports
1946     WebCore::LayoutSize m_baseLayoutViewportSize;
1947     WebCore::LayoutPoint m_minStableLayoutViewportOrigin;
1948     WebCore::LayoutPoint m_maxStableLayoutViewportOrigin;
1949
1950     float m_mediaVolume { 1 };
1951     WebCore::MediaProducer::MutedStateFlags m_mutedState { WebCore::MediaProducer::NoneMuted };
1952     bool m_mayStartMediaWhenInWindow { true };
1953     bool m_mediaCaptureEnabled { true };
1954
1955     bool m_waitingForDidUpdateActivityState { false };
1956
1957     bool m_shouldScaleViewToFitDocument { false };
1958     bool m_suppressAutomaticNavigationSnapshotting { false };
1959
1960 #if PLATFORM(COCOA)
1961     HashMap<String, String> m_temporaryPDFFiles;
1962     std::unique_ptr<WebCore::RunLoopObserver> m_activityStateChangeDispatcher;
1963
1964     std::unique_ptr<RemoteLayerTreeScrollingPerformanceData> m_scrollingPerformanceData;
1965     bool m_scrollPerformanceDataCollectionEnabled { false };
1966 #endif
1967     UserObservablePageCounter::Token m_pageIsUserObservableCount;
1968     ProcessSuppressionDisabledToken m_preventProcessSuppressionCount;
1969     HiddenPageThrottlingAutoIncreasesCounter::Token m_hiddenPageDOMTimerThrottlingAutoIncreasesCount;
1970     VisibleWebPageToken m_visiblePageToken;
1971         
1972     WebCore::ScrollPinningBehavior m_scrollPinningBehavior { WebCore::DoNotPin };
1973     std::optional<WebCore::ScrollbarOverlayStyle> m_scrollbarOverlayStyle;
1974
1975     uint64_t m_navigationID { 0 };
1976
1977     WebPreferencesStore::ValueMap m_configurationPreferenceValues;
1978     WebCore::ActivityState::Flags m_potentiallyChangedActivityStateFlags { WebCore::ActivityState::NoFlags };
1979     bool m_activityStateChangeWantsSynchronousReply { false };
1980     Vector<CallbackID> m_nextActivityStateChangeCallbacks;
1981
1982     WebCore::MediaProducer::MediaStateFlags m_mediaState { WebCore::MediaProducer::IsNotPlaying };
1983
1984     bool m_isResourceCachingDisabled { false };
1985
1986     bool m_hasHadSelectionChangesFromUserInteraction { false };
1987     bool m_needsHiddenContentEditableQuirk { false };
1988     bool m_needsPlainTextQuirk { false };
1989
1990 #if ENABLE(MEDIA_SESSION)
1991     bool m_hasMediaSessionWithActiveMediaElements { false };
1992 #endif
1993
1994 #if ENABLE(WIRELESS_PLAYBACK_TARGET) && !PLATFORM(IOS)
1995     bool m_requiresTargetMonitoring { false };
1996 #endif
1997
1998 #if PLATFORM(IOS)
1999     bool m_hasDeferredStartAssistingNode { false };
2000     std::unique_ptr<NodeAssistanceArguments> m_deferredNodeAssistanceArguments;
2001     bool m_forceAlwaysUserScalable { false };
2002 #endif
2003
2004 #if ENABLE(POINTER_LOCK)
2005     bool m_isPointerLockPending { false };
2006     bool m_isPointerLocked { false };
2007 #endif
2008
2009     bool m_isUsingHighPerformanceWebGL { false };
2010
2011     WeakPtrFactory<WebPageProxy> m_weakPtrFactory;
2012
2013     HashMap<String, Ref<WebURLSchemeHandler>> m_urlSchemeHandlersByScheme;
2014     HashMap<uint64_t, Ref<WebURLSchemeHandler>> m_urlSchemeHandlersByIdentifier;
2015 };
2016
2017 } // namespace WebKit