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