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