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