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