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