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