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