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