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