92429f450af51eac581e850bb637286a3b7ee3a7
[WebKit-https.git] / Source / WebKit / WebProcess / WebPage / WebPage.h
1 /*
2  * Copyright (C) 2010-2018 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 "APIInjectedBundleEditorClient.h"
29 #include "APIInjectedBundleFormClient.h"
30 #include "APIInjectedBundlePageContextMenuClient.h"
31 #include "APIInjectedBundlePageLoaderClient.h"
32 #include "APIInjectedBundlePageResourceLoadClient.h"
33 #include "APIInjectedBundlePageUIClient.h"
34 #include "APIObject.h"
35 #include "CallbackID.h"
36 #include "DrawingAreaInfo.h"
37 #include "EditingRange.h"
38 #include "FocusedElementInformation.h"
39 #include "InjectedBundlePageContextMenuClient.h"
40 #include "InjectedBundlePageFullScreenClient.h"
41 #include "InjectedBundlePagePolicyClient.h"
42 #include "LayerTreeContext.h"
43 #include "MessageReceiver.h"
44 #include "MessageSender.h"
45 #include "OptionalCallbackID.h"
46 #include "Plugin.h"
47 #include "SandboxExtension.h"
48 #include "ShareSheetCallbackID.h"
49 #include "SharedMemory.h"
50 #include "UserData.h"
51 #include "WebBackForwardListProxy.h"
52 #include "WebURLSchemeHandler.h"
53 #include "WebUndoStepID.h"
54 #include "WebUserContentController.h"
55 #include "WebsitePoliciesData.h"
56 #include <JavaScriptCore/InspectorFrontendChannel.h>
57 #include <WebCore/ActivityState.h>
58 #include <WebCore/DictionaryPopupInfo.h>
59 #include <WebCore/DisabledAdaptations.h>
60 #include <WebCore/FrameLoaderTypes.h>
61 #include <WebCore/HTMLMenuElement.h>
62 #include <WebCore/HTMLMenuItemElement.h>
63 #include <WebCore/IntRect.h>
64 #include <WebCore/IntSizeHash.h>
65 #include <WebCore/Page.h>
66 #include <WebCore/PageOverlay.h>
67 #include <WebCore/PluginData.h>
68 #include <WebCore/SecurityPolicyViolationEvent.h>
69 #include <WebCore/ShareData.h>
70 #include <WebCore/UserActivity.h>
71 #include <WebCore/UserContentTypes.h>
72 #include <WebCore/UserInterfaceLayoutDirection.h>
73 #include <WebCore/UserScriptTypes.h>
74 #include <WebCore/VisibilityState.h>
75 #include <WebCore/WebCoreKeyboardUIMode.h>
76 #include <memory>
77 #include <pal/HysteresisActivity.h>
78 #include <wtf/HashMap.h>
79 #include <wtf/MonotonicTime.h>
80 #include <wtf/RefPtr.h>
81 #include <wtf/RunLoop.h>
82 #include <wtf/Seconds.h>
83 #include <wtf/WallTime.h>
84 #include <wtf/text/WTFString.h>
85
86 #if HAVE(ACCESSIBILITY) && PLATFORM(GTK)
87 #include "WebPageAccessibilityObject.h"
88 #include <wtf/glib/GRefPtr.h>
89 #endif
90
91 #if PLATFORM(GTK)
92 #include "ArgumentCodersGtk.h"
93 #include "WebPrintOperationGtk.h"
94 #endif
95
96 #if PLATFORM(IOS_FAMILY)
97 #include "GestureTypes.h"
98 #include "WebPageMessages.h"
99 #include <WebCore/IntPointHash.h>
100 #include <WebCore/ViewportConfiguration.h>
101 #endif
102
103 #if ENABLE(APPLICATION_MANIFEST)
104 #include <WebCore/ApplicationManifest.h>
105 #endif
106
107 #if ENABLE(IOS_TOUCH_EVENTS)
108 #include <WebKitAdditions/PlatformTouchEventIOS.h>
109 #elif ENABLE(TOUCH_EVENTS)
110 #include <WebCore/PlatformTouchEvent.h>
111 #endif
112
113 #if ENABLE(DATA_DETECTION)
114 #include <WebCore/DataDetection.h>
115 #endif
116
117 #if ENABLE(MAC_GESTURE_EVENTS)
118 #include <WebKitAdditions/PlatformGestureEventMac.h>
119 #endif
120
121 #if PLATFORM(COCOA)
122 #include "DynamicViewportSizeUpdate.h"
123 #include <WebCore/VisibleSelection.h>
124 #include <wtf/RetainPtr.h>
125 OBJC_CLASS CALayer;
126 OBJC_CLASS NSArray;
127 OBJC_CLASS NSDictionary;
128 OBJC_CLASS NSObject;
129 OBJC_CLASS WKAccessibilityWebPageObject;
130 #endif
131
132 namespace API {
133 class Array;
134 }
135
136 namespace IPC {
137 class Connection;
138 class Decoder;
139 class FormDataReference;
140 }
141
142 namespace WebCore {
143
144 class CaptureDevice;
145 class DocumentLoader;
146 class DragData;
147 class FontAttributeChanges;
148 class FontChanges;
149 class Frame;
150 class FrameSelection;
151 class FrameView;
152 class GraphicsContext;
153 class HTMLMenuElement;
154 class HTMLMenuItemElement;
155 class HTMLPlugInElement;
156 class HTMLPlugInImageElement;
157 class IntPoint;
158 class KeyboardEvent;
159 class MediaPlaybackTargetContext;
160 class MediaPlayerRequestInstallMissingPluginsCallback;
161 class Page;
162 class PrintContext;
163 class Range;
164 class ResourceRequest;
165 class ResourceResponse;
166 class SelectionRect;
167 class SharedBuffer;
168 class SubstituteData;
169 class TextCheckingRequest;
170 class VisiblePosition;
171
172 enum SyntheticClickType : int8_t;
173 enum class DragHandlingMethod : uint8_t;
174 enum class ShouldTreatAsContinuingLoad : bool;
175 enum class TextIndicatorPresentationTransition : uint8_t;
176 enum class WritingDirection : uint8_t;
177
178 struct BackForwardItemIdentifier;
179 struct CompositionUnderline;
180 struct DictationAlternative;
181 struct GlobalFrameIdentifier;
182 struct GlobalWindowIdentifier;
183 struct Highlight;
184 struct KeypressCommand;
185 struct PromisedAttachmentInfo;
186 struct TextCheckingResult;
187 struct ViewportArguments;
188
189 #if ENABLE(ATTACHMENT_ELEMENT)
190 class HTMLAttachmentElement;
191 #endif
192 }
193
194 namespace WebKit {
195
196 class DataReference;
197 class DrawingArea;
198 class DownloadID;
199 class FindController;
200 class GamepadData;
201 class GeolocationPermissionRequestManager;
202 class MediaDeviceSandboxExtensions;
203 class NotificationPermissionRequestManager;
204 class PDFPlugin;
205 class PageBanner;
206 class PluginView;
207 class RemoteWebInspectorUI;
208 class UserMediaPermissionRequestManager;
209 class ViewGestureGeometryCollector;
210 class VisibleContentRectUpdateInfo;
211 class WebColorChooser;
212 class WebContextMenu;
213 class WebContextMenuItemData;
214 class WebDataListSuggestionPicker;
215 class WebDocumentLoader;
216 class WebEvent;
217 class PlaybackSessionManager;
218 class VideoFullscreenManager;
219 class WebFrame;
220 class WebFullScreenManager;
221 class WebGestureEvent;
222 class WebImage;
223 class WebInspector;
224 class WebInspectorClient;
225 class WebInspectorUI;
226 class WebKeyboardEvent;
227 class WebMouseEvent;
228 class WebNotificationClient;
229 class WebOpenPanelResultListener;
230 class WebPageGroupProxy;
231 class WebPageInspectorTargetController;
232 class WebPageOverlay;
233 class WebPopupMenu;
234 class WebTouchEvent;
235 class WebURLSchemeHandlerProxy;
236 class WebUndoStep;
237 class WebUserContentController;
238 class WebWheelEvent;
239 class RemoteLayerTreeTransaction;
240
241 enum FindOptions : uint16_t;
242 enum class DragControllerAction : uint8_t;
243
244 struct AttributedString;
245 struct DataDetectionResult;
246 struct BackForwardListItemState;
247 struct EditorState;
248 struct InteractionInformationAtPosition;
249 struct InteractionInformationRequest;
250 struct LoadParameters;
251 struct PrintInfo;
252 struct WebPageCreationParameters;
253 struct WebPreferencesStore;
254 struct WebSelectionData;
255 struct WebsitePoliciesData;
256
257 using SnapshotOptions = uint32_t;
258 using WKEventModifiers = uint32_t;
259
260 class WebPage : public API::ObjectImpl<API::Object::Type::BundlePage>, public IPC::MessageReceiver, public IPC::MessageSender, public CanMakeWeakPtr<WebPage> {
261 public:
262     static Ref<WebPage> create(uint64_t pageID, WebPageCreationParameters&&);
263     virtual ~WebPage();
264
265     void reinitializeWebPage(WebPageCreationParameters&&);
266
267     void close();
268
269     static WebPage* fromCorePage(WebCore::Page*);
270
271     WebCore::Page* corePage() const { return m_page.get(); }
272     uint64_t pageID() const { return m_pageID; }
273     PAL::SessionID sessionID() const { return m_page->sessionID(); }
274     bool usesEphemeralSession() const { return m_page->usesEphemeralSession(); }
275
276     void setSessionID(PAL::SessionID);
277
278     void setSize(const WebCore::IntSize&);
279     const WebCore::IntSize& size() const { return m_viewSize; }
280     WebCore::IntRect bounds() const { return WebCore::IntRect(WebCore::IntPoint(), size()); }
281
282     DrawingArea* drawingArea() const { return m_drawingArea.get(); }
283
284 #if ENABLE(ASYNC_SCROLLING)
285     WebCore::ScrollingCoordinator* scrollingCoordinator() const;
286 #endif
287
288     WebPageGroupProxy* pageGroup() const { return m_pageGroup.get(); }
289
290     void scrollMainFrameIfNotAtMaxScrollPosition(const WebCore::IntSize& scrollOffset);
291
292     bool scrollBy(uint32_t scrollDirection, uint32_t scrollGranularity);
293
294     void centerSelectionInVisibleArea();
295
296 #if PLATFORM(COCOA)
297     void willCommitLayerTree(RemoteLayerTreeTransaction&);
298     void didFlushLayerTreeAtTime(MonotonicTime);
299 #endif
300
301     void willDisplayPage();
302
303     enum class LazyCreationPolicy { UseExistingOnly, CreateIfNeeded };
304
305     WebInspector* inspector(LazyCreationPolicy = LazyCreationPolicy::CreateIfNeeded);
306     WebInspectorUI* inspectorUI();
307     RemoteWebInspectorUI* remoteInspectorUI();
308     bool isInspectorPage() { return !!m_inspectorUI || !!m_remoteInspectorUI; }
309
310     void inspectorFrontendCountChanged(unsigned);
311
312 #if PLATFORM(IOS_FAMILY) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))
313     PlaybackSessionManager& playbackSessionManager();
314     VideoFullscreenManager& videoFullscreenManager();
315     void videoControlsManagerDidChange();
316 #endif
317
318 #if PLATFORM(IOS_FAMILY)
319     void setAllowsMediaDocumentInlinePlayback(bool);
320     bool allowsMediaDocumentInlinePlayback() const { return m_allowsMediaDocumentInlinePlayback; }
321 #endif
322
323 #if ENABLE(FULLSCREEN_API)
324     WebFullScreenManager* fullScreenManager();
325 #endif
326
327     void addConsoleMessage(uint64_t frameID, MessageSource, MessageLevel, const String&, uint64_t requestID = 0);
328     void sendCSPViolationReport(uint64_t frameID, const URL& reportURL, IPC::FormDataReference&&);
329     void enqueueSecurityPolicyViolationEvent(uint64_t frameID, WebCore::SecurityPolicyViolationEvent::Init&&);
330
331     // -- Called by the DrawingArea.
332     // FIXME: We could genericize these into a DrawingArea client interface. Would that be beneficial?
333     void drawRect(WebCore::GraphicsContext&, const WebCore::IntRect&);
334     void layoutIfNeeded();
335
336     // -- Called from WebCore clients.
337     bool handleEditingKeyboardEvent(WebCore::KeyboardEvent*);
338
339     void didStartPageTransition();
340     void didCompletePageTransition();
341     void didCommitLoad(WebFrame*);
342     void willReplaceMultipartContent(const WebFrame&);
343     void didReplaceMultipartContent(const WebFrame&);
344     void didFinishLoad(WebFrame*);
345     void show();
346     String userAgent(const URL&) const;
347     String userAgent(WebFrame*, const URL&) const;
348     String platformUserAgent(const URL&) const;
349     WebCore::KeyboardUIMode keyboardUIMode();
350
351     void didInsertMenuElement(WebCore::HTMLMenuElement&);
352     void didRemoveMenuElement(WebCore::HTMLMenuElement&);
353     void didInsertMenuItemElement(WebCore::HTMLMenuItemElement&);
354     void didRemoveMenuItemElement(WebCore::HTMLMenuItemElement&);
355
356     const String& overrideContentSecurityPolicy() const { return m_overrideContentSecurityPolicy; }
357
358     WebUndoStep* webUndoStep(WebUndoStepID);
359     void addWebUndoStep(WebUndoStepID, Ref<WebUndoStep>&&);
360     void removeWebEditCommand(WebUndoStepID);
361     bool isInRedo() const { return m_isInRedo; }
362
363     bool isAlwaysOnLoggingAllowed() const;
364     void setActivePopupMenu(WebPopupMenu*);
365
366     void setHiddenPageDOMTimerThrottlingIncreaseLimit(Seconds limit)
367     {
368         m_page->setDOMTimerAlignmentIntervalIncreaseLimit(limit);
369     }
370
371 #if ENABLE(INPUT_TYPE_COLOR)
372     WebColorChooser* activeColorChooser() const { return m_activeColorChooser; }
373     void setActiveColorChooser(WebColorChooser*);
374     void didChooseColor(const WebCore::Color&);
375     void didEndColorPicker();
376 #endif
377
378 #if ENABLE(DATALIST_ELEMENT)
379     void setActiveDataListSuggestionPicker(WebDataListSuggestionPicker*);
380     void didSelectDataListOption(const String&);
381     void didCloseSuggestions();
382 #endif
383
384     WebOpenPanelResultListener* activeOpenPanelResultListener() const { return m_activeOpenPanelResultListener.get(); }
385     void setActiveOpenPanelResultListener(Ref<WebOpenPanelResultListener>&&);
386
387     void didReceiveMessage(IPC::Connection&, IPC::Decoder&) override;
388     void didReceiveSyncMessage(IPC::Connection&, IPC::Decoder&, std::unique_ptr<IPC::Encoder>&) override;
389
390     // -- InjectedBundle methods
391 #if ENABLE(CONTEXT_MENUS)
392     void setInjectedBundleContextMenuClient(std::unique_ptr<API::InjectedBundle::PageContextMenuClient>&&);
393 #endif
394     void setInjectedBundleEditorClient(std::unique_ptr<API::InjectedBundle::EditorClient>&&);
395     void setInjectedBundleFormClient(std::unique_ptr<API::InjectedBundle::FormClient>&&);
396     void setInjectedBundlePageLoaderClient(std::unique_ptr<API::InjectedBundle::PageLoaderClient>&&);
397     void initializeInjectedBundlePolicyClient(WKBundlePagePolicyClientBase*);
398     void setInjectedBundleResourceLoadClient(std::unique_ptr<API::InjectedBundle::ResourceLoadClient>&&);
399     void setInjectedBundleUIClient(std::unique_ptr<API::InjectedBundle::PageUIClient>&&);
400 #if ENABLE(FULLSCREEN_API)
401     void initializeInjectedBundleFullScreenClient(WKBundlePageFullScreenClientBase*);
402 #endif
403
404 #if ENABLE(CONTEXT_MENUS)
405     API::InjectedBundle::PageContextMenuClient& injectedBundleContextMenuClient() { return *m_contextMenuClient; }
406 #endif
407     API::InjectedBundle::EditorClient& injectedBundleEditorClient() { return *m_editorClient; }
408     API::InjectedBundle::FormClient& injectedBundleFormClient() { return *m_formClient; }
409     API::InjectedBundle::PageLoaderClient& injectedBundleLoaderClient() { return *m_loaderClient; }
410     InjectedBundlePagePolicyClient& injectedBundlePolicyClient() { return m_policyClient; }
411     API::InjectedBundle::ResourceLoadClient& injectedBundleResourceLoadClient() { return *m_resourceLoadClient; }
412     API::InjectedBundle::PageUIClient& injectedBundleUIClient() { return *m_uiClient; }
413 #if ENABLE(FULLSCREEN_API)
414     InjectedBundlePageFullScreenClient& injectedBundleFullScreenClient() { return m_fullScreenClient; }
415 #endif
416
417     bool findStringFromInjectedBundle(const String&, FindOptions);
418     void findStringMatchesFromInjectedBundle(const String&, FindOptions);
419     void replaceStringMatchesFromInjectedBundle(const Vector<uint32_t>& matchIndices, const String& replacementText, bool selectionOnly);
420
421     WebFrame* mainWebFrame() const { return m_mainFrame.get(); }
422
423     WebCore::Frame* mainFrame() const; // May return nullptr.
424     WebCore::FrameView* mainFrameView() const; // May return nullptr.
425
426     RefPtr<WebCore::Range> currentSelectionAsRange();
427
428 #if ENABLE(NETSCAPE_PLUGIN_API)
429     RefPtr<Plugin> createPlugin(WebFrame*, WebCore::HTMLPlugInElement*, const Plugin::Parameters&, String& newMIMEType);
430 #endif
431
432 #if ENABLE(WEBGL)
433     WebCore::WebGLLoadPolicy webGLPolicyForURL(WebFrame*, const URL&);
434     WebCore::WebGLLoadPolicy resolveWebGLPolicyForURL(WebFrame*, const URL&);
435 #endif
436     
437     enum class IncludePostLayoutDataHint { No, Yes };
438     EditorState editorState(IncludePostLayoutDataHint = IncludePostLayoutDataHint::Yes) const;
439     void updateEditorStateAfterLayoutIfEditabilityChanged();
440
441     String renderTreeExternalRepresentation() const;
442     String renderTreeExternalRepresentationForPrinting() const;
443     uint64_t renderTreeSize() const;
444
445     void setTracksRepaints(bool);
446     bool isTrackingRepaints() const;
447     void resetTrackedRepaints();
448     Ref<API::Array> trackedRepaintRects();
449
450     void executeEditingCommand(const String& commandName, const String& argument);
451     bool isEditingCommandEnabled(const String& commandName);
452     void clearMainFrameName();
453     void sendClose();
454
455     void suspendForProcessSwap();
456
457     void sendSetWindowFrame(const WebCore::FloatRect&);
458
459     double textZoomFactor() const;
460     void setTextZoomFactor(double);
461     double pageZoomFactor() const;
462     void setPageZoomFactor(double);
463     void setPageAndTextZoomFactors(double pageZoomFactor, double textZoomFactor);
464     void windowScreenDidChange(uint32_t);
465     String dumpHistoryForTesting(const String& directory);
466     void clearHistory();
467
468     void accessibilitySettingsDidChange();
469 #if ENABLE(ACCESSIBILITY_EVENTS)
470     void updateAccessibilityEventsEnabled(bool);
471 #endif
472
473     void scalePage(double scale, const WebCore::IntPoint& origin);
474     void scalePageInViewCoordinates(double scale, WebCore::IntPoint centerInViewCoordinates);
475     double pageScaleFactor() const;
476     double totalScaleFactor() const;
477     double viewScaleFactor() const;
478     void scaleView(double scale);
479
480     void setUseFixedLayout(bool);
481     bool useFixedLayout() const { return m_useFixedLayout; }
482     bool setFixedLayoutSize(const WebCore::IntSize&);
483     WebCore::IntSize fixedLayoutSize() const;
484
485     void listenForLayoutMilestones(OptionSet<WebCore::LayoutMilestone>);
486
487     void setSuppressScrollbarAnimations(bool);
488     
489     void setEnableVerticalRubberBanding(bool);
490     void setEnableHorizontalRubberBanding(bool);
491     
492     void setBackgroundExtendsBeyondPage(bool);
493
494     void setPaginationMode(uint32_t /* WebCore::Pagination::Mode */);
495     void setPaginationBehavesLikeColumns(bool);
496     void setPageLength(double);
497     void setGapBetweenPages(double);
498     void setPaginationLineGridEnabled(bool);
499     
500     void postInjectedBundleMessage(const String& messageName, const UserData&);
501
502     bool drawsBackground() const { return m_drawsBackground; }
503
504     void setUnderlayColor(const WebCore::Color& color) { m_underlayColor = color; }
505     WebCore::Color underlayColor() const { return m_underlayColor; }
506
507     void stopLoading();
508     void stopLoadingFrame(uint64_t frameID);
509     bool defersLoading() const;
510     void setDefersLoading(bool deferLoading);
511
512     void enterAcceleratedCompositingMode(WebCore::GraphicsLayer*);
513     void exitAcceleratedCompositingMode();
514
515     void addPluginView(PluginView*);
516     void removePluginView(PluginView*);
517
518     bool isVisible() const { return m_activityState.contains(WebCore::ActivityState::IsVisible); }
519     bool isVisibleOrOccluded() const { return m_activityState.contains(WebCore::ActivityState::IsVisibleOrOccluded); }
520
521     LayerHostingMode layerHostingMode() const { return m_layerHostingMode; }
522     void setLayerHostingMode(LayerHostingMode);
523
524 #if PLATFORM(COCOA)
525     void updatePluginsActiveAndFocusedState();
526     const WebCore::FloatRect& windowFrameInScreenCoordinates() const { return m_windowFrameInScreenCoordinates; }
527     const WebCore::FloatRect& windowFrameInUnflippedScreenCoordinates() const { return m_windowFrameInUnflippedScreenCoordinates; }
528     const WebCore::FloatRect& viewFrameInWindowCoordinates() const { return m_viewFrameInWindowCoordinates; }
529
530     bool hasCachedWindowFrame() const { return m_hasCachedWindowFrame; }
531
532     void updateHeaderAndFooterLayersForDeviceScaleChange(float scaleFactor);
533 #endif
534
535 #if PLATFORM(MAC)
536     void setTopOverhangImage(WebImage*);
537     void setBottomOverhangImage(WebImage*);
538     
539     void setUseSystemAppearance(bool);
540 #endif
541
542     void setUseDarkAppearance(bool);
543
544     bool windowIsFocused() const;
545     bool windowAndWebPageAreFocused() const;
546
547 #if !PLATFORM(IOS_FAMILY)
548     void setHeaderPageBanner(PageBanner*);
549     PageBanner* headerPageBanner();
550     void setFooterPageBanner(PageBanner*);
551     PageBanner* footerPageBanner();
552
553     void hidePageBanners();
554     void showPageBanners();
555     
556     void setHeaderBannerHeightForTesting(int);
557     void setFooterBannerHeightForTesting(int);
558 #endif
559
560     WebCore::IntPoint screenToRootView(const WebCore::IntPoint&);
561     WebCore::IntRect rootViewToScreen(const WebCore::IntRect&);
562     
563 #if PLATFORM(IOS_FAMILY)
564     WebCore::IntPoint accessibilityScreenToRootView(const WebCore::IntPoint&);
565     WebCore::IntRect rootViewToAccessibilityScreen(const WebCore::IntRect&);
566 #endif
567     
568     RefPtr<WebImage> scaledSnapshotWithOptions(const WebCore::IntRect&, double additionalScaleFactor, SnapshotOptions);
569
570     static const WebEvent* currentEvent();
571
572     FindController& findController() { return m_findController.get(); }
573
574 #if ENABLE(GEOLOCATION)
575     GeolocationPermissionRequestManager& geolocationPermissionRequestManager() { return m_geolocationPermissionRequestManager.get(); }
576 #endif
577
578 #if PLATFORM(IOS_FAMILY)
579     void savePageState(WebCore::HistoryItem&);
580     void restorePageState(const WebCore::HistoryItem&);
581 #endif
582
583 #if ENABLE(MEDIA_STREAM)
584     UserMediaPermissionRequestManager& userMediaPermissionRequestManager() { return m_userMediaPermissionRequestManager; }
585     void prepareToSendUserMediaPermissionRequest();
586     void captureDevicesChanged();
587 #endif
588
589     void elementDidFocus(WebCore::Element&);
590     void elementDidRefocus(WebCore::Element&);
591     void elementDidBlur(WebCore::Element&);
592     void focusedElementDidChangeInputMode(WebCore::Element&, WebCore::InputMode);
593     void resetFocusedElementForFrame(WebFrame*);
594
595     void disabledAdaptationsDidChange(const OptionSet<WebCore::DisabledAdaptations>&);
596     void viewportPropertiesDidChange(const WebCore::ViewportArguments&);
597     void executeEditCommandWithCallback(const String&, const String& argument, CallbackID);
598
599 #if PLATFORM(IOS_FAMILY)
600     WebCore::FloatSize screenSize() const;
601     WebCore::FloatSize availableScreenSize() const;
602     WebCore::FloatSize overrideScreenSize() const;
603     int32_t deviceOrientation() const { return m_deviceOrientation; }
604     void didReceiveMobileDocType(bool);
605
606     void setUseTestingViewportConfiguration(bool useTestingViewport) { m_useTestingViewportConfiguration = useTestingViewport; }
607     bool isUsingTestingViewportConfiguration() const { return m_useTestingViewportConfiguration; }
608
609     double minimumPageScaleFactor() const;
610     double maximumPageScaleFactor() const;
611     double maximumPageScaleFactorIgnoringAlwaysScalable() const;
612     bool allowsUserScaling() const;
613     bool hasStablePageScaleFactor() const { return m_hasStablePageScaleFactor; }
614
615     void handleTap(const WebCore::IntPoint&, uint64_t lastLayerTreeTransactionId);
616     void potentialTapAtPosition(uint64_t requestID, const WebCore::FloatPoint&);
617     void commitPotentialTap(uint64_t lastLayerTreeTransactionId);
618     void commitPotentialTapFailed();
619     void cancelPotentialTap();
620     void cancelPotentialTapInFrame(WebFrame&);
621     void tapHighlightAtPosition(uint64_t requestID, const WebCore::FloatPoint&);
622
623     void inspectorNodeSearchMovedToPosition(const WebCore::FloatPoint&);
624     void inspectorNodeSearchEndedAtPosition(const WebCore::FloatPoint&);
625
626     void blurFocusedElement();
627     void requestFocusedElementInformation(CallbackID);
628     void selectWithGesture(const WebCore::IntPoint&, uint32_t granularity, uint32_t gestureType, uint32_t gestureState, bool isInteractingWithFocusedElement, CallbackID);
629     void updateSelectionWithTouches(const WebCore::IntPoint&, uint32_t touches, bool baseIsStart, CallbackID);
630     void selectWithTwoTouches(const WebCore::IntPoint& from, const WebCore::IntPoint& to, uint32_t gestureType, uint32_t gestureState, CallbackID);
631     void extendSelection(uint32_t granularity);
632     void selectWordBackward();
633     void moveSelectionByOffset(int32_t offset, CallbackID);
634     void selectTextWithGranularityAtPoint(const WebCore::IntPoint&, uint32_t granularity, bool isInteractingWithFocusedElement, CallbackID);
635     void selectPositionAtBoundaryWithDirection(const WebCore::IntPoint&, uint32_t granularity, uint32_t direction, bool isInteractingWithFocusedElement, CallbackID);
636     void moveSelectionAtBoundaryWithDirection(uint32_t granularity, uint32_t direction, CallbackID);
637     void selectPositionAtPoint(const WebCore::IntPoint&, bool isInteractingWithFocusedElement, CallbackID);
638     void beginSelectionInDirection(uint32_t direction, CallbackID);
639     void updateSelectionWithExtentPoint(const WebCore::IntPoint&, bool isInteractingWithFocusedElement, CallbackID);
640     void updateSelectionWithExtentPointAndBoundary(const WebCore::IntPoint&, uint32_t granularity, bool isInteractingWithFocusedElement, CallbackID);
641
642     void requestDictationContext(CallbackID);
643     void replaceDictatedText(const String& oldText, const String& newText);
644     void replaceSelectedText(const String& oldText, const String& newText);
645     void requestAutocorrectionData(const String& textForAutocorrection, CallbackID);
646     void applyAutocorrection(const String& correction, const String& originalText, CallbackID);
647     void syncApplyAutocorrection(const String& correction, const String& originalText, bool& correctionApplied);
648     void requestAutocorrectionContext(CallbackID);
649     void getAutocorrectionContext(String& beforeText, String& markedText, String& selectedText, String& afterText, uint64_t& location, uint64_t& length);
650     void getPositionInformation(const InteractionInformationRequest&, InteractionInformationAtPosition&);
651     void requestPositionInformation(const InteractionInformationRequest&);
652     void startInteractionWithElementAtPosition(const WebCore::IntPoint&);
653     void stopInteraction();
654     void performActionOnElement(uint32_t action);
655     void focusNextFocusedElement(bool isForward, CallbackID);
656     void autofillLoginCredentials(const String&, const String&);
657     void setFocusedElementValue(const String&);
658     void setFocusedElementValueAsNumber(double);
659     void setFocusedElementSelectedIndex(uint32_t index, bool allowMultipleSelection);
660     WebCore::IntRect rectForElementAtInteractionLocation();
661     void updateSelectionAppearance();
662     void getSelectionContext(CallbackID);
663     void handleTwoFingerTapAtPoint(const WebCore::IntPoint&, uint64_t requestID);
664     void handleStylusSingleTapAtPoint(const WebCore::IntPoint&, uint64_t requestID);
665     void getRectsForGranularityWithSelectionOffset(uint32_t, int32_t, CallbackID);
666     void getRectsAtSelectionOffsetWithText(int32_t, const String&, CallbackID);
667     void storeSelectionForAccessibility(bool);
668     void startAutoscrollAtPosition(const WebCore::FloatPoint&);
669     void cancelAutoscroll();
670
671     void contentSizeCategoryDidChange(const String&);
672
673     Seconds eventThrottlingDelay() const;
674
675     void showInspectorHighlight(const WebCore::Highlight&);
676     void hideInspectorHighlight();
677
678     void showInspectorIndication();
679     void hideInspectorIndication();
680
681     void enableInspectorNodeSearch();
682     void disableInspectorNodeSearch();
683
684     bool forceAlwaysUserScalable() const { return m_forceAlwaysUserScalable; }
685     void setForceAlwaysUserScalable(bool);
686 #endif
687
688 #if PLATFORM(IOS_FAMILY) && ENABLE(IOS_TOUCH_EVENTS)
689     void dispatchAsynchronousTouchEvents(const Vector<WebTouchEvent, 1>& queue);
690 #endif
691
692     bool hasRichlyEditableSelection() const;
693
694     enum class LayerTreeFreezeReason {
695         PageTransition          = 1 << 0,
696         BackgroundApplication   = 1 << 1,
697         ProcessSuspended        = 1 << 2,
698         PageSuspended           = 1 << 3,
699         Printing                = 1 << 4,
700         ProcessSwap             = 1 << 5,
701     };
702     void freezeLayerTree(LayerTreeFreezeReason);
703     void unfreezeLayerTree(LayerTreeFreezeReason);
704
705     void markLayersVolatile(WTF::Function<void (bool)>&& completionHandler = { });
706     void cancelMarkLayersVolatile();
707
708     NotificationPermissionRequestManager* notificationPermissionRequestManager();
709
710     void pageDidScroll();
711
712 #if ENABLE(CONTEXT_MENUS)
713     WebContextMenu* contextMenu();
714     WebContextMenu* contextMenuAtPointInWindow(const WebCore::IntPoint&);
715 #endif
716
717     bool hasLocalDataForURL(const URL&);
718
719     static bool canHandleRequest(const WebCore::ResourceRequest&);
720
721     class SandboxExtensionTracker {
722     public:
723         ~SandboxExtensionTracker();
724
725         void invalidate();
726
727         void beginLoad(WebFrame*, SandboxExtension::Handle&&);
728         void beginReload(WebFrame*, SandboxExtension::Handle&&);
729         void willPerformLoadDragDestinationAction(RefPtr<SandboxExtension>&& pendingDropSandboxExtension);
730         void didStartProvisionalLoad(WebFrame*);
731         void didCommitProvisionalLoad(WebFrame*);
732         void didFailProvisionalLoad(WebFrame*);
733
734     private:
735         void setPendingProvisionalSandboxExtension(RefPtr<SandboxExtension>&&);
736
737         RefPtr<SandboxExtension> m_pendingProvisionalSandboxExtension;
738         RefPtr<SandboxExtension> m_provisionalSandboxExtension;
739         RefPtr<SandboxExtension> m_committedSandboxExtension;
740     };
741
742     SandboxExtensionTracker& sandboxExtensionTracker() { return m_sandboxExtensionTracker; }
743
744 #if PLATFORM(GTK)
745     void setComposition(const String& text, const Vector<WebCore::CompositionUnderline>& underlines, uint64_t selectionStart, uint64_t selectionEnd, uint64_t replacementRangeStart, uint64_t replacementRangeLength);
746     void confirmComposition(const String& text, int64_t selectionStart, int64_t selectionLength);
747     void cancelComposition();
748
749     void collapseSelectionInFrame(uint64_t frameID);
750 #endif
751
752 #if PLATFORM (GTK) && HAVE(GTK_GESTURES)
753     void getCenterForZoomGesture(const WebCore::IntPoint& centerInViewCoordinates, WebCore::IntPoint& result);
754 #endif
755
756     void didApplyStyle();
757     void didChangeSelection();
758     void didChangeContents();
759     void discardedComposition();
760     void canceledComposition();
761     void didUpdateComposition();
762     void didEndUserTriggeredSelectionChanges();
763
764 #if PLATFORM(COCOA)
765     void registerUIProcessAccessibilityTokens(const IPC::DataReference& elemenToken, const IPC::DataReference& windowToken);
766     WKAccessibilityWebPageObject* accessibilityRemoteObject();
767     NSObject *accessibilityObjectForMainFramePlugin();
768     const WebCore::FloatPoint& accessibilityPosition() const { return m_accessibilityPosition; }
769     
770     void sendComplexTextInputToPlugin(uint64_t pluginComplexTextInputIdentifier, const String& textInput);
771
772     void setTextAsync(const String&);
773     void insertTextAsync(const String& text, const EditingRange& replacementRange, bool registerUndoGroup = false, uint32_t editingRangeIsRelativeTo = (uint32_t)EditingRangeIsRelativeTo::EditableRoot, bool suppressSelectionUpdate = false);
774     void getMarkedRangeAsync(CallbackID);
775     void getSelectedRangeAsync(CallbackID);
776     void characterIndexForPointAsync(const WebCore::IntPoint&, CallbackID);
777     void firstRectForCharacterRangeAsync(const EditingRange&, CallbackID);
778     void setCompositionAsync(const String& text, const Vector<WebCore::CompositionUnderline>& underlines, const EditingRange& selectionRange, const EditingRange& replacementRange);
779     void confirmCompositionAsync();
780
781     void readSelectionFromPasteboard(const WTF::String& pasteboardName, bool& result);
782     void getStringSelectionForPasteboard(WTF::String& stringValue);
783     void getDataSelectionForPasteboard(const WTF::String pasteboardType, SharedMemory::Handle& handle, uint64_t& size);
784     void shouldDelayWindowOrderingEvent(const WebKit::WebMouseEvent&, bool& result);
785     void acceptsFirstMouse(int eventNumber, const WebKit::WebMouseEvent&, bool& result);
786     bool performNonEditingBehaviorForSelector(const String&, WebCore::KeyboardEvent*);
787 #endif
788
789 #if PLATFORM(MAC)
790     void insertDictatedTextAsync(const String& text, const EditingRange& replacementRange, const Vector<WebCore::DictationAlternative>& dictationAlternativeLocations, bool registerUndoGroup = false);
791     void attributedSubstringForCharacterRangeAsync(const EditingRange&, CallbackID);
792     void fontAtSelection(CallbackID);
793 #endif
794
795 #if PLATFORM(COCOA) && ENABLE(SERVICE_CONTROLS)
796     void replaceSelectionWithPasteboardData(const Vector<String>& types, const IPC::DataReference&);
797 #endif
798
799 #if HAVE(ACCESSIBILITY) && PLATFORM(GTK)
800     void updateAccessibilityTree();
801 #endif
802
803     void setCompositionForTesting(const String& compositionString, uint64_t from, uint64_t length, bool suppressUnderline);
804     bool hasCompositionForTesting();
805     void confirmCompositionForTesting(const String& compositionString);
806
807 #if PLATFORM(COCOA)
808     bool isSpeaking();
809     void speak(const String&);
810     void stopSpeaking();
811
812     void performDictionaryLookupForSelection(WebCore::Frame&, const WebCore::VisibleSelection&, WebCore::TextIndicatorPresentationTransition);
813 #endif
814
815     bool isSmartInsertDeleteEnabled();
816     void setSmartInsertDeleteEnabled(bool);
817
818     bool isSelectTrailingWhitespaceEnabled() const;
819     void setSelectTrailingWhitespaceEnabled(bool);
820
821     void replaceSelectionWithText(WebCore::Frame*, const String&);
822     void clearSelection();
823     void restoreSelectionInFocusedEditableElement();
824
825 #if ENABLE(DRAG_SUPPORT) && PLATFORM(GTK)
826     void performDragControllerAction(DragControllerAction, const WebCore::IntPoint& clientPosition, const WebCore::IntPoint& globalPosition, uint64_t draggingSourceOperationMask, WebSelectionData&&, uint32_t flags);
827 #endif
828
829 #if ENABLE(DRAG_SUPPORT) && !PLATFORM(GTK)
830     void performDragControllerAction(DragControllerAction, const WebCore::DragData&, SandboxExtension::Handle&&, SandboxExtension::HandleArray&&);
831 #endif
832
833 #if ENABLE(DRAG_SUPPORT)
834     void dragEnded(WebCore::IntPoint clientPosition, WebCore::IntPoint globalPosition, uint64_t operation);
835
836     void willPerformLoadDragDestinationAction();
837     void mayPerformUploadDragDestinationAction();
838
839     void willStartDrag() { ASSERT(!m_isStartingDrag); m_isStartingDrag = true; }
840     void didStartDrag();
841     void dragCancelled();
842 #endif
843
844     void beginPrinting(uint64_t frameID, const PrintInfo&);
845     void endPrinting();
846     void computePagesForPrinting(uint64_t frameID, const PrintInfo&, CallbackID);
847     void computePagesForPrintingImpl(uint64_t frameID, const PrintInfo&, Vector<WebCore::IntRect>& pageRects, double& totalScaleFactor);
848
849 #if PLATFORM(COCOA)
850     void drawRectToImage(uint64_t frameID, const PrintInfo&, const WebCore::IntRect&, const WebCore::IntSize&, CallbackID);
851     void drawPagesToPDF(uint64_t frameID, const PrintInfo&, uint32_t first, uint32_t count, CallbackID);
852     void drawPagesToPDFImpl(uint64_t frameID, const PrintInfo&, uint32_t first, uint32_t count, RetainPtr<CFMutableDataRef>& pdfPageData);
853 #endif
854
855 #if PLATFORM(IOS_FAMILY)
856     void computePagesForPrintingAndDrawToPDF(uint64_t frameID, const PrintInfo&, CallbackID, Messages::WebPage::ComputePagesForPrintingAndDrawToPDF::DelayedReply&&);
857 #endif
858
859 #if PLATFORM(GTK)
860     void drawPagesForPrinting(uint64_t frameID, const PrintInfo&, CallbackID);
861     void didFinishPrintOperation(const WebCore::ResourceError&, CallbackID);
862 #endif
863
864     void addResourceRequest(unsigned long, const WebCore::ResourceRequest&);
865     void removeResourceRequest(unsigned long);
866
867     void setMediaVolume(float);
868     void setMuted(WebCore::MediaProducer::MutedStateFlags);
869     void setMayStartMediaWhenInWindow(bool);
870     void stopMediaCapture();
871
872 #if ENABLE(MEDIA_SESSION)
873     void handleMediaEvent(uint32_t /* WebCore::MediaEventType */);
874     void setVolumeOfMediaElement(double, uint64_t);
875 #endif
876
877     void updateMainFrameScrollOffsetPinning();
878
879     bool mainFrameHasCustomContentProvider() const;
880     void addMIMETypeWithCustomContentProvider(const String&);
881
882     void mainFrameDidLayout();
883
884     bool canRunBeforeUnloadConfirmPanel() const { return m_canRunBeforeUnloadConfirmPanel; }
885     void setCanRunBeforeUnloadConfirmPanel(bool canRunBeforeUnloadConfirmPanel) { m_canRunBeforeUnloadConfirmPanel = canRunBeforeUnloadConfirmPanel; }
886
887     bool canRunModal() const { return m_canRunModal; }
888     void setCanRunModal(bool canRunModal) { m_canRunModal = canRunModal; }
889
890     void runModal();
891
892     void setDeviceScaleFactor(float);
893     float deviceScaleFactor() const;
894
895     void forceRepaintWithoutCallback();
896
897     void unmarkAllMisspellings();
898     void unmarkAllBadGrammar();
899
900 #if PLATFORM(COCOA)
901     void handleAlternativeTextUIResult(const String&);
902 #endif
903
904     // For testing purpose.
905     void simulateMouseDown(int button, WebCore::IntPoint, int clickCount, WKEventModifiers, WallTime);
906     void simulateMouseUp(int button, WebCore::IntPoint, int clickCount, WKEventModifiers, WallTime);
907     void simulateMouseMotion(WebCore::IntPoint, WallTime);
908
909 #if ENABLE(CONTEXT_MENUS)
910     void contextMenuShowing() { m_isShowingContextMenu = true; }
911 #endif
912
913     void wheelEvent(const WebWheelEvent&);
914
915     void wheelEventHandlersChanged(bool);
916     void recomputeShortCircuitHorizontalWheelEventsState();
917
918 #if ENABLE(MAC_GESTURE_EVENTS)
919     void gestureEvent(const WebGestureEvent&);
920 #endif
921
922     void updateVisibilityState(bool isInitialState = false);
923
924 #if PLATFORM(IOS_FAMILY)
925     void setViewportConfigurationViewLayoutSize(const WebCore::FloatSize&, double scaleFactor, double minimumEffectiveDeviceWidth);
926     void setMaximumUnobscuredSize(const WebCore::FloatSize&);
927     void setDeviceOrientation(int32_t);
928     void setOverrideViewportArguments(const Optional<WebCore::ViewportArguments>&);
929     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& targetUnobscuredSafeAreaInsets, double scale, int32_t deviceOrientation, DynamicViewportSizeUpdateID);
930     Optional<float> scaleFromUIProcess(const VisibleContentRectUpdateInfo&) const;
931     void updateVisibleContentRects(const VisibleContentRectUpdateInfo&, MonotonicTime oldestTimestamp);
932     bool scaleWasSetByUIProcess() const { return m_scaleWasSetByUIProcess; }
933     void willStartUserTriggeredZooming();
934     void applicationWillResignActive();
935     void applicationDidEnterBackground(bool isSuspendedUnderLock);
936     void applicationDidFinishSnapshottingAfterEnteringBackground();
937     void applicationWillEnterForeground(bool isSuspendedUnderLock);
938     void applicationDidBecomeActive();
939     void completePendingSyntheticClickForContentChangeObserver();
940
941     bool platformPrefersTextLegibilityBasedZoomScaling() const;
942     const WebCore::ViewportConfiguration& viewportConfiguration() const { return m_viewportConfiguration; }
943
944     void hardwareKeyboardAvailabilityChanged();
945
946     void updateStringForFind(const String&);
947 #endif
948
949 #if ENABLE(IOS_TOUCH_EVENTS)
950     void dispatchTouchEvent(const WebTouchEvent&, bool& handled);
951 #endif
952
953 #if PLATFORM(GTK) && USE(TEXTURE_MAPPER_GL)
954     uint64_t nativeWindowHandle() { return m_nativeWindowHandle; }
955 #endif
956
957     bool shouldUseCustomContentProviderForResponse(const WebCore::ResourceResponse&);
958
959     bool asynchronousPluginInitializationEnabled() const { return m_asynchronousPluginInitializationEnabled; }
960     void setAsynchronousPluginInitializationEnabled(bool enabled) { m_asynchronousPluginInitializationEnabled = enabled; }
961     bool asynchronousPluginInitializationEnabledForAllPlugins() const { return m_asynchronousPluginInitializationEnabledForAllPlugins; }
962     void setAsynchronousPluginInitializationEnabledForAllPlugins(bool enabled) { m_asynchronousPluginInitializationEnabledForAllPlugins = enabled; }
963     bool artificialPluginInitializationDelayEnabled() const { return m_artificialPluginInitializationDelayEnabled; }
964     void setArtificialPluginInitializationDelayEnabled(bool enabled) { m_artificialPluginInitializationDelayEnabled = enabled; }
965     void setTabToLinksEnabled(bool enabled) { m_tabToLinks = enabled; }
966     bool tabToLinksEnabled() const { return m_tabToLinks; }
967
968     bool scrollingPerformanceLoggingEnabled() const { return m_scrollingPerformanceLoggingEnabled; }
969     void setScrollingPerformanceLoggingEnabled(bool);
970
971 #if PLATFORM(COCOA)
972     bool shouldUsePDFPlugin() const;
973     bool pdfPluginEnabled() const { return m_pdfPluginEnabled; }
974     void setPDFPluginEnabled(bool enabled) { m_pdfPluginEnabled = enabled; }
975
976     NSDictionary *dataDetectionContext() const { return m_dataDetectionContext.get(); }
977 #endif
978
979     void savePDFToFileInDownloadsFolder(const String& suggestedFilename, const URL& originatingURL, const uint8_t* data, unsigned long size);
980
981 #if PLATFORM(COCOA)
982     void savePDFToTemporaryFolderAndOpenWithNativeApplication(const String& suggestedFilename, const String& originatingURLString, const uint8_t* data, unsigned long size, const String& pdfUUID);
983 #endif
984
985     bool mainFrameIsScrollable() const { return m_mainFrameIsScrollable; }
986
987     void setAlwaysShowsHorizontalScroller(bool);
988     void setAlwaysShowsVerticalScroller(bool);
989
990     bool alwaysShowsHorizontalScroller() const { return m_alwaysShowsHorizontalScroller; };
991     bool alwaysShowsVerticalScroller() const { return m_alwaysShowsVerticalScroller; };
992
993     void setViewLayoutSize(const WebCore::IntSize&);
994     WebCore::IntSize viewLayoutSize() const { return m_viewLayoutSize; }
995
996     void setAutoSizingShouldExpandToViewHeight(bool shouldExpand);
997     bool autoSizingShouldExpandToViewHeight() { return m_autoSizingShouldExpandToViewHeight; }
998
999     void setViewportSizeForCSSViewportUnits(Optional<WebCore::IntSize>);
1000     Optional<WebCore::IntSize> viewportSizeForCSSViewportUnits() const { return m_viewportSizeForCSSViewportUnits; }
1001
1002     bool canShowMIMEType(const String& MIMEType) const;
1003     bool canShowResponse(const WebCore::ResourceResponse&) const;
1004
1005     void addTextCheckingRequest(uint64_t requestID, Ref<WebCore::TextCheckingRequest>&&);
1006     void didFinishCheckingText(uint64_t requestID, const Vector<WebCore::TextCheckingResult>&);
1007     void didCancelCheckingText(uint64_t requestID);
1008
1009 #if ENABLE(PRIMARY_SNAPSHOTTED_PLUGIN_HEURISTIC)
1010     void determinePrimarySnapshottedPlugIn();
1011     void determinePrimarySnapshottedPlugInTimerFired();
1012     void resetPrimarySnapshottedPlugIn();
1013     bool matchesPrimaryPlugIn(const String& pageOrigin, const String& pluginOrigin, const String& mimeType) const;
1014     bool plugInIntersectsSearchRect(WebCore::HTMLPlugInImageElement& pluginImageElement);
1015     bool plugInIsPrimarySize(WebCore::HTMLPlugInImageElement& pluginImageElement, unsigned &pluginArea);
1016 #endif
1017
1018 #if ENABLE(DATA_DETECTION)
1019     void setDataDetectionResults(NSArray *);
1020     void detectDataInAllFrames(uint64_t, CompletionHandler<void(const DataDetectionResult&)>&&);
1021     void removeDataDetectedLinks(CompletionHandler<void(const DataDetectionResult&)>&&);
1022 #endif
1023
1024     unsigned extendIncrementalRenderingSuppression();
1025     void stopExtendingIncrementalRenderingSuppression(unsigned token);
1026     bool shouldExtendIncrementalRenderingSuppression() { return !m_activeRenderingSuppressionTokens.isEmpty(); }
1027
1028     WebCore::ScrollPinningBehavior scrollPinningBehavior() { return m_scrollPinningBehavior; }
1029     void setScrollPinningBehavior(uint32_t /* WebCore::ScrollPinningBehavior */ pinning);
1030
1031     Optional<WebCore::ScrollbarOverlayStyle> scrollbarOverlayStyle() { return m_scrollbarOverlayStyle; }
1032     void setScrollbarOverlayStyle(Optional<uint32_t /* WebCore::ScrollbarOverlayStyle */> scrollbarStyle);
1033
1034     Ref<WebCore::DocumentLoader> createDocumentLoader(WebCore::Frame&, const WebCore::ResourceRequest&, const WebCore::SubstituteData&);
1035     void updateCachedDocumentLoader(WebDocumentLoader&, WebCore::Frame&);
1036
1037     void getBytecodeProfile(CallbackID);
1038     void getSamplingProfilerOutput(CallbackID);
1039     
1040 #if ENABLE(SERVICE_CONTROLS) || ENABLE(TELEPHONE_NUMBER_DETECTION)
1041     void handleTelephoneNumberClick(const String& number, const WebCore::IntPoint&);
1042     void handleSelectionServiceClick(WebCore::FrameSelection&, const Vector<String>& telephoneNumbers, const WebCore::IntPoint&);
1043 #endif
1044
1045     void didChangeScrollOffsetForFrame(WebCore::Frame*);
1046
1047     void setMainFrameProgressCompleted(bool completed) { m_mainFrameProgressCompleted = completed; }
1048     bool shouldDispatchFakeMouseMoveEvents() const { return m_shouldDispatchFakeMouseMoveEvents; }
1049
1050     void postMessage(const String& messageName, API::Object* messageBody);
1051     void postSynchronousMessageForTesting(const String& messageName, API::Object* messageBody, RefPtr<API::Object>& returnData);
1052     void postMessageIgnoringFullySynchronousMode(const String& messageName, API::Object* messageBody);
1053
1054 #if PLATFORM(GTK)
1055     void setInputMethodState(bool);
1056 #endif
1057
1058     void imageOrMediaDocumentSizeChanged(const WebCore::IntSize&);
1059
1060 #if ENABLE(VIDEO) && USE(GSTREAMER)
1061     void requestInstallMissingMediaPlugins(const String& details, const String& description, WebCore::MediaPlayerRequestInstallMissingPluginsCallback&);
1062 #endif
1063
1064     void addUserScript(String&& source, WebCore::UserContentInjectedFrames, WebCore::UserScriptInjectionTime);
1065     void addUserStyleSheet(const String& source, WebCore::UserContentInjectedFrames);
1066     void removeAllUserContent();
1067
1068     void dispatchDidReachLayoutMilestone(OptionSet<WebCore::LayoutMilestone>);
1069
1070     void didRestoreScrollPosition();
1071
1072     bool isControlledByAutomation() const;
1073     void setControlledByAutomation(bool);
1074
1075     void connectInspector(const String& targetId, Inspector::FrontendChannel::ConnectionType);
1076     void disconnectInspector(const String& targetId);
1077     void sendMessageToTargetBackend(const String& targetId, const String& message);
1078
1079     void insertNewlineInQuotedContent();
1080
1081 #if USE(OS_STATE)
1082     WallTime loadCommitTime() const { return m_loadCommitTime; }
1083 #endif
1084
1085 #if ENABLE(GAMEPAD)
1086     void gamepadActivity(const Vector<GamepadData>&, bool shouldMakeGamepadsVisible);
1087 #endif
1088     
1089 #if ENABLE(POINTER_LOCK)
1090     void didAcquirePointerLock();
1091     void didNotAcquirePointerLock();
1092     void didLosePointerLock();
1093 #endif
1094
1095     void didGetLoadDecisionForIcon(bool decision, CallbackID loadIdentifier, OptionalCallbackID);
1096     void setUseIconLoadingClient(bool);
1097
1098 #if ENABLE(DATA_INTERACTION)
1099     void didConcludeEditDrag();
1100 #endif
1101
1102     WebURLSchemeHandlerProxy* urlSchemeHandlerForScheme(const String&);
1103     void stopAllURLSchemeTasks();
1104
1105     Optional<double> cpuLimit() const { return m_cpuLimit; }
1106
1107     static PluginView* pluginViewForFrame(WebCore::Frame*);
1108
1109     void sendPartialEditorStateAndSchedulePostLayoutUpdate();
1110     void flushPendingEditorStateUpdate();
1111
1112 #if ENABLE(RESOURCE_LOAD_STATISTICS)
1113     void hasStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, CompletionHandler<void(bool)>&& callback);
1114     void requestStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, CompletionHandler<void(bool)>&& callback);
1115     void storageAccessResponse(bool wasGranted, uint64_t contextId);
1116 #endif
1117
1118     void showShareSheet(WebCore::ShareDataWithParsedURL&, WTF::CompletionHandler<void(bool)>&& callback);
1119     void didCompleteShareSheet(bool wasCompleted, ShareSheetCallbackID contextId);
1120     
1121 #if ENABLE(ATTACHMENT_ELEMENT)
1122     void insertAttachment(const String& identifier, Optional<uint64_t>&& fileSize, const String& fileName, const String& contentType, CallbackID);
1123     void updateAttachmentAttributes(const String& identifier, Optional<uint64_t>&& fileSize, const String& contentType, const String& fileName, const IPC::DataReference& enclosingImageData, CallbackID);
1124 #endif
1125
1126 #if ENABLE(APPLICATION_MANIFEST)
1127     void getApplicationManifest(CallbackID);
1128     void didFinishLoadingApplicationManifest(uint64_t, const Optional<WebCore::ApplicationManifest>&);
1129 #endif
1130
1131     void updateCurrentModifierState(OptionSet<WebCore::PlatformEvent::Modifier> modifiers);
1132
1133     UserContentControllerIdentifier userContentControllerIdentifier() const { return m_userContentController->identifier(); }
1134
1135     WebCore::UserInterfaceLayoutDirection userInterfaceLayoutDirection() const { return m_userInterfaceLayoutDirection; }
1136
1137     bool isSuspended() const { return m_isSuspended; }
1138
1139     void didReceiveWebPageMessage(IPC::Connection&, IPC::Decoder&);
1140
1141 private:
1142     WebPage(uint64_t pageID, WebPageCreationParameters&&);
1143
1144     void updateThrottleState();
1145     void updateUserActivity();
1146
1147     // IPC::MessageSender
1148     IPC::Connection* messageSenderConnection() override;
1149     uint64_t messageSenderDestinationID() override;
1150
1151     void platformInitialize();
1152     void platformDetach();
1153     void platformEditorState(WebCore::Frame&, EditorState& result, IncludePostLayoutDataHint) const;
1154     void sendEditorStateUpdate();
1155     void scheduleFullEditorStateUpdate();
1156
1157 #if PLATFORM(COCOA)
1158     void sendTouchBarMenuDataAddedUpdate(WebCore::HTMLMenuElement&);
1159     void sendTouchBarMenuDataRemovedUpdate(WebCore::HTMLMenuElement&);
1160     void sendTouchBarMenuItemDataAddedUpdate(WebCore::HTMLMenuItemElement&);
1161     void sendTouchBarMenuItemDataRemovedUpdate(WebCore::HTMLMenuItemElement&);
1162 #endif
1163
1164     void didReceiveSyncWebPageMessage(IPC::Connection&, IPC::Decoder&, std::unique_ptr<IPC::Encoder>&);
1165
1166 #if PLATFORM(IOS_FAMILY)
1167     void resetViewportDefaultConfiguration(WebFrame* mainFrame, bool hasMobileDocType = false);
1168     enum class ZoomToInitialScale { No, Yes };
1169     void viewportConfigurationChanged(ZoomToInitialScale = ZoomToInitialScale::No);
1170     void updateViewportSizeForCSSViewportUnits();
1171
1172     static void convertSelectionRectsToRootView(WebCore::FrameView*, Vector<WebCore::SelectionRect>&);
1173     RefPtr<WebCore::Range> rangeForWebSelectionAtPosition(const WebCore::IntPoint&, const WebCore::VisiblePosition&, SelectionFlags&);
1174     void getFocusedElementInformation(FocusedElementInformation&);
1175     void platformInitializeAccessibility();
1176     void handleSyntheticClick(WebCore::Node* nodeRespondingToClick, const WebCore::FloatPoint& location);
1177     void completeSyntheticClick(WebCore::Node* nodeRespondingToClick, const WebCore::FloatPoint& location, WebCore::SyntheticClickType);
1178     void sendTapHighlightForNodeIfNecessary(uint64_t requestID, WebCore::Node*);
1179     void resetTextAutosizing();
1180     WebCore::VisiblePosition visiblePositionInFocusedNodeForPoint(const WebCore::Frame&, const WebCore::IntPoint&, bool isInteractingWithFocusedElement);
1181     RefPtr<WebCore::Range> rangeForGranularityAtPoint(WebCore::Frame&, const WebCore::IntPoint&, uint32_t granularity, bool isInteractingWithFocusedElement);
1182 #endif
1183
1184 #if PLATFORM(IOS_FAMILY) && ENABLE(DATA_INTERACTION)
1185     void requestDragStart(const WebCore::IntPoint& clientPosition, const WebCore::IntPoint& globalPosition);
1186     void requestAdditionalItemsForDragSession(const WebCore::IntPoint& clientPosition, const WebCore::IntPoint& globalPosition);
1187 #endif
1188
1189 #if !PLATFORM(COCOA) && !PLATFORM(WPE)
1190     static const char* interpretKeyEvent(const WebCore::KeyboardEvent*);
1191 #endif
1192
1193     bool performDefaultBehaviorForKeyEvent(const WebKeyboardEvent&);
1194
1195 #if PLATFORM(MAC)
1196     bool executeKeypressCommandsInternal(const Vector<WebCore::KeypressCommand>&, WebCore::KeyboardEvent*);
1197 #endif
1198
1199     void updateDrawingAreaLayerTreeFreezeState();
1200     bool markLayersVolatileImmediatelyIfPossible();
1201     void layerVolatilityTimerFired();
1202     void callVolatilityCompletionHandlers(bool succeeded);
1203
1204     String sourceForFrame(WebFrame*);
1205
1206     void loadDataImpl(uint64_t navigationID, bool shouldTreatAsContinuingLoad, Optional<WebsitePoliciesData>&&, Ref<WebCore::SharedBuffer>&&, const String& MIMEType, const String& encodingName, const URL& baseURL, const URL& failingURL, const UserData&);
1207
1208     // Actions
1209     void tryClose();
1210     void platformDidReceiveLoadParameters(const LoadParameters&);
1211     void loadRequest(LoadParameters&&);
1212     void loadData(LoadParameters&&);
1213     void loadAlternateHTML(LoadParameters&&);
1214     void navigateToPDFLinkWithSimulatedClick(const String& url, WebCore::IntPoint documentPoint, WebCore::IntPoint screenPoint);
1215     void reload(uint64_t navigationID, uint32_t reloadOptions, SandboxExtension::Handle&&);
1216     void goToBackForwardItem(uint64_t navigationID, const WebCore::BackForwardItemIdentifier&, WebCore::FrameLoadType, WebCore::ShouldTreatAsContinuingLoad, Optional<WebsitePoliciesData>&&);
1217     void tryRestoreScrollPosition();
1218     void setInitialFocus(bool forward, bool isKeyboardEventValid, const WebKeyboardEvent&, CallbackID);
1219     void updateIsInWindow(bool isInitialState = false);
1220     void visibilityDidChange();
1221     void setActivityState(OptionSet<WebCore::ActivityState::Flag>, ActivityStateChangeID, const Vector<CallbackID>& callbackIDs);
1222     void validateCommand(const String&, CallbackID);
1223     void executeEditCommand(const String&, const String&);
1224     void setEditable(bool);
1225
1226     void increaseListLevel();
1227     void decreaseListLevel();
1228     void changeListType();
1229
1230     void setBaseWritingDirection(WebCore::WritingDirection);
1231
1232     void setNeedsFontAttributes(bool);
1233
1234     void mouseEvent(const WebMouseEvent&);
1235     void keyEvent(const WebKeyboardEvent&);
1236
1237 #if ENABLE(IOS_TOUCH_EVENTS)
1238     void touchEventSync(const WebTouchEvent&, bool& handled);
1239     void updatePotentialTapSecurityOrigin(const WebTouchEvent&, bool wasHandled);
1240 #elif ENABLE(TOUCH_EVENTS)
1241     void touchEvent(const WebTouchEvent&);
1242 #endif
1243
1244 #if ENABLE(CONTEXT_MENUS)
1245     void contextMenuHidden() { m_isShowingContextMenu = false; }
1246     void contextMenuForKeyEvent();
1247 #endif
1248
1249     static bool scroll(WebCore::Page*, WebCore::ScrollDirection, WebCore::ScrollGranularity);
1250     static bool logicalScroll(WebCore::Page*, WebCore::ScrollLogicalDirection, WebCore::ScrollGranularity);
1251
1252     void loadURLInFrame(URL&&, uint64_t frameID);
1253
1254     enum class WasRestoredByAPIRequest { No, Yes };
1255     void restoreSessionInternal(const Vector<BackForwardListItemState>&, WasRestoredByAPIRequest, WebBackForwardListProxy::OverwriteExistingItem);
1256     void restoreSession(const Vector<BackForwardListItemState>&);
1257     void didRemoveBackForwardItem(const WebCore::BackForwardItemIdentifier&);
1258     void updateBackForwardListForReattach(const Vector<WebKit::BackForwardListItemState>&);
1259     void setCurrentHistoryItemForReattach(WebKit::BackForwardListItemState&&);
1260
1261     void requestFontAttributesAtSelectionStart(CallbackID);
1262
1263 #if ENABLE(REMOTE_INSPECTOR)
1264     void setIndicating(bool);
1265 #endif
1266
1267     void setDrawsBackground(bool);
1268
1269 #if PLATFORM(COCOA)
1270     void setTopContentInsetFenced(float, IPC::Attachment);
1271 #endif
1272     void setTopContentInset(float);
1273
1274     void viewWillStartLiveResize();
1275     void viewWillEndLiveResize();
1276
1277     void getContentsAsString(CallbackID);
1278 #if ENABLE(MHTML)
1279     void getContentsAsMHTMLData(CallbackID);
1280 #endif
1281     void getMainResourceDataOfFrame(uint64_t frameID, CallbackID);
1282     void getResourceDataFromFrame(uint64_t frameID, const String& resourceURL, CallbackID);
1283     void getRenderTreeExternalRepresentation(CallbackID);
1284     void getSelectionOrContentsAsString(CallbackID);
1285     void getSelectionAsWebArchiveData(CallbackID);
1286     void getSourceForFrame(uint64_t frameID, CallbackID);
1287     void getWebArchiveOfFrame(uint64_t frameID, CallbackID);
1288     void runJavaScript(const String&, bool forceUserGesture, Optional<String> worldName, CallbackID);
1289     void runJavaScriptInMainFrame(const String&, bool forceUserGesture, CallbackID);
1290     void runJavaScriptInMainFrameScriptWorld(const String&, bool forceUserGesture, const String& worldName, CallbackID);
1291     void forceRepaint(CallbackID);
1292     void takeSnapshot(WebCore::IntRect snapshotRect, WebCore::IntSize bitmapSize, uint32_t options, CallbackID);
1293
1294     void preferencesDidChange(const WebPreferencesStore&);
1295     void updatePreferences(const WebPreferencesStore&);
1296     void updatePreferencesGenerated(const WebPreferencesStore&);
1297
1298 #if PLATFORM(IOS_FAMILY)
1299     bool parentProcessHasServiceWorkerEntitlement() const;
1300 #else
1301     bool parentProcessHasServiceWorkerEntitlement() const { return true; }
1302 #endif
1303
1304     void didReceivePolicyDecision(uint64_t frameID, uint64_t listenerID, WebCore::PolicyAction, uint64_t navigationID, const DownloadID&, Optional<WebsitePoliciesData>&&);
1305     void continueWillSubmitForm(uint64_t frameID, uint64_t listenerID);
1306     void setUserAgent(const String&);
1307     void setCustomTextEncodingName(const String&);
1308     void suspendActiveDOMObjectsAndAnimations();
1309     void resumeActiveDOMObjectsAndAnimations();
1310
1311 #if PLATFORM(COCOA)
1312     void performDictionaryLookupAtLocation(const WebCore::FloatPoint&);
1313     void performDictionaryLookupOfCurrentSelection();
1314     void performDictionaryLookupForRange(WebCore::Frame&, WebCore::Range&, NSDictionary *options, WebCore::TextIndicatorPresentationTransition);
1315     WebCore::DictionaryPopupInfo dictionaryPopupInfoForRange(WebCore::Frame&, WebCore::Range&, NSDictionary *options, WebCore::TextIndicatorPresentationTransition);
1316 #if ENABLE(PDFKIT_PLUGIN)
1317     WebCore::DictionaryPopupInfo dictionaryPopupInfoForSelectionInPDFPlugin(PDFSelection *, PDFPlugin&, NSDictionary *options, WebCore::TextIndicatorPresentationTransition);
1318 #endif
1319
1320     void windowAndViewFramesChanged(const WebCore::FloatRect& windowFrameInScreenCoordinates, const WebCore::FloatRect& windowFrameInUnflippedScreenCoordinates, const WebCore::FloatRect& viewFrameInWindowCoordinates, const WebCore::FloatPoint& accessibilityViewCoordinates);
1321
1322     RetainPtr<PDFDocument> pdfDocumentForPrintingFrame(WebCore::Frame*);
1323     void computePagesForPrintingPDFDocument(uint64_t frameID, const PrintInfo&, Vector<WebCore::IntRect>& resultPageRects);
1324     void drawPDFDocument(CGContextRef, PDFDocument *, const PrintInfo&, const WebCore::IntRect&);
1325     void drawPagesToPDFFromPDFDocument(CGContextRef, PDFDocument *, const PrintInfo&, uint32_t first, uint32_t count);
1326 #endif
1327
1328     void setMainFrameIsScrollable(bool);
1329
1330     void unapplyEditCommand(WebUndoStepID commandID);
1331     void reapplyEditCommand(WebUndoStepID commandID);
1332     void didRemoveEditCommand(WebUndoStepID commandID);
1333
1334     void findString(const String&, uint32_t findOptions, uint32_t maxMatchCount);
1335     void findStringMatches(const String&, uint32_t findOptions, uint32_t maxMatchCount);
1336     void getImageForFindMatch(uint32_t matchIndex);
1337     void selectFindMatch(uint32_t matchIndex);
1338     void hideFindUI();
1339     void countStringMatches(const String&, uint32_t findOptions, uint32_t maxMatchCount);
1340     void replaceMatches(const Vector<uint32_t>& matchIndices, const String& replacementText, bool selectionOnly, CallbackID);
1341
1342 #if USE(COORDINATED_GRAPHICS)
1343     void sendViewportAttributesChanged(const WebCore::ViewportArguments&);
1344 #endif
1345
1346     void didChangeSelectedIndexForActivePopupMenu(int32_t newIndex);
1347     void setTextForActivePopupMenu(int32_t index);
1348
1349 #if PLATFORM(GTK)
1350     void failedToShowPopupMenu();
1351 #endif
1352
1353     void didChooseFilesForOpenPanel(const Vector<String>&);
1354     void didCancelForOpenPanel();
1355
1356 #if PLATFORM(IOS_FAMILY)
1357     void didChooseFilesForOpenPanelWithDisplayStringAndIcon(const Vector<String>&, const String& displayString, const IPC::DataReference& iconData);
1358 #endif
1359
1360 #if ENABLE(SANDBOX_EXTENSIONS)
1361     void extendSandboxForFilesFromOpenPanel(SandboxExtension::HandleArray&&);
1362 #endif
1363
1364     void didReceiveGeolocationPermissionDecision(uint64_t geolocationID, bool allowed);
1365
1366     void didReceiveNotificationPermissionDecision(uint64_t notificationID, bool allowed);
1367
1368 #if ENABLE(MEDIA_STREAM)
1369     void userMediaAccessWasGranted(uint64_t userMediaID, WebCore::CaptureDevice&& audioDeviceUID, WebCore::CaptureDevice&& videoDeviceUID, String&& mediaDeviceIdentifierHashSalt);
1370     void userMediaAccessWasDenied(uint64_t userMediaID, uint64_t reason, String&& invalidConstraint);
1371
1372     void didCompleteMediaDeviceEnumeration(uint64_t userMediaID, const Vector<WebCore::CaptureDevice>& devices, String&& deviceIdentifierHashSalt, bool originHasPersistentAccess);
1373 #endif
1374
1375 #if ENABLE(MEDIA_STREAM) && ENABLE(SANDBOX_EXTENSIONS)
1376     void grantUserMediaDeviceSandboxExtensions(MediaDeviceSandboxExtensions&&);
1377     void revokeUserMediaDeviceSandboxExtensions(const Vector<String>&);
1378 #endif
1379
1380 #if ENABLE(WEB_RTC)
1381     void disableICECandidateFiltering();
1382     void enableICECandidateFiltering();
1383 #endif
1384
1385 #if ENABLE(WEB_RTC) && USE(LIBWEBRTC)
1386     void disableEnumeratingAllNetworkInterfaces();
1387     void enableEnumeratingAllNetworkInterfaces();
1388 #endif
1389
1390     void stopAllMediaPlayback();
1391     void suspendAllMediaPlayback();
1392     void resumeAllMediaPlayback();
1393
1394     void advanceToNextMisspelling(bool startBeforeSelection);
1395     void changeSpellingToWord(const String& word);
1396
1397 #if USE(APPKIT)
1398     void uppercaseWord();
1399     void lowercaseWord();
1400     void capitalizeWord();
1401 #endif
1402
1403 #if ENABLE(CONTEXT_MENUS)
1404     void didSelectItemFromActiveContextMenu(const WebContextMenuItemData&);
1405 #endif
1406
1407     void changeSelectedIndex(int32_t index);
1408     void setCanStartMediaTimerFired();
1409
1410     static bool platformCanHandleRequest(const WebCore::ResourceRequest&);
1411
1412     static PluginView* focusedPluginViewForFrame(WebCore::Frame&);
1413
1414     static RefPtr<WebCore::Range> rangeFromEditingRange(WebCore::Frame&, const EditingRange&, EditingRangeIsRelativeTo = EditingRangeIsRelativeTo::EditableRoot);
1415
1416     void reportUsedFeatures();
1417
1418     void updateWebsitePolicies(WebsitePoliciesData&&);
1419
1420     void changeFont(WebCore::FontChanges&&);
1421     void changeFontAttributes(WebCore::FontAttributeChanges&&);
1422
1423 #if PLATFORM(MAC)
1424     void performImmediateActionHitTestAtLocation(WebCore::FloatPoint);
1425     std::tuple<RefPtr<WebCore::Range>, NSDictionary *> lookupTextAtLocation(WebCore::FloatPoint);
1426     void immediateActionDidUpdate();
1427     void immediateActionDidCancel();
1428     void immediateActionDidComplete();
1429
1430     void dataDetectorsDidPresentUI(WebCore::PageOverlay::PageOverlayID);
1431     void dataDetectorsDidChangeUI(WebCore::PageOverlay::PageOverlayID);
1432     void dataDetectorsDidHideUI(WebCore::PageOverlay::PageOverlayID);
1433
1434     void handleAcceptedCandidate(WebCore::TextCheckingResult);
1435 #endif
1436
1437 #if PLATFORM(COCOA)
1438     void requestActiveNowPlayingSessionInfo(CallbackID);
1439 #endif
1440
1441     void setShouldDispatchFakeMouseMoveEvents(bool dispatch) { m_shouldDispatchFakeMouseMoveEvents = dispatch; }
1442
1443 #if ENABLE(WIRELESS_PLAYBACK_TARGET) && !PLATFORM(IOS_FAMILY)
1444     void playbackTargetSelected(uint64_t, const WebCore::MediaPlaybackTargetContext& outputDevice) const;
1445     void playbackTargetAvailabilityDidChange(uint64_t, bool);
1446     void setShouldPlayToPlaybackTarget(uint64_t, bool);
1447 #endif
1448
1449     void clearWheelEventTestTrigger();
1450
1451     void setShouldScaleViewToFitDocument(bool);
1452
1453     void pageStoppedScrolling();
1454
1455 #if ENABLE(VIDEO) && USE(GSTREAMER)
1456     void didEndRequestInstallMissingMediaPlugins(uint32_t result);
1457 #endif
1458
1459     void setResourceCachingDisabled(bool);
1460     void setUserInterfaceLayoutDirection(uint32_t);
1461
1462     bool canPluginHandleResponse(const WebCore::ResourceResponse&);
1463
1464 #if USE(QUICK_LOOK)
1465     void didReceivePasswordForQuickLookDocument(const String&);
1466 #endif
1467
1468     void simulateDeviceOrientationChange(double alpha, double beta, double gamma);
1469
1470     void frameBecameRemote(uint64_t frameID, WebCore::GlobalFrameIdentifier&& remoteFrameIdentifier, WebCore::GlobalWindowIdentifier&& remoteWindowIdentifier);
1471
1472     void registerURLSchemeHandler(uint64_t identifier, const String& scheme);
1473
1474     void urlSchemeTaskDidPerformRedirection(uint64_t handlerIdentifier, uint64_t taskIdentifier, WebCore::ResourceResponse&&, WebCore::ResourceRequest&&);
1475     void urlSchemeTaskDidReceiveResponse(uint64_t handlerIdentifier, uint64_t taskIdentifier, const WebCore::ResourceResponse&);
1476     void urlSchemeTaskDidReceiveData(uint64_t handlerIdentifier, uint64_t taskIdentifier, const IPC::DataReference&);
1477     void urlSchemeTaskDidComplete(uint64_t handlerIdentifier, uint64_t taskIdentifier, const WebCore::ResourceError&);
1478
1479     void setIsSuspended(bool);
1480
1481     RefPtr<WebImage> snapshotAtSize(const WebCore::IntRect&, const WebCore::IntSize& bitmapSize, SnapshotOptions);
1482     RefPtr<WebImage> snapshotNode(WebCore::Node&, SnapshotOptions, unsigned maximumPixelCount = std::numeric_limits<unsigned>::max());
1483 #if USE(CF)
1484     RetainPtr<CFDataRef> pdfSnapshotAtSize(const WebCore::IntRect&, const WebCore::IntSize& bitmapSize, SnapshotOptions);
1485 #endif
1486
1487 #if ENABLE(ATTACHMENT_ELEMENT)
1488     RefPtr<WebCore::HTMLAttachmentElement> attachmentElementWithIdentifier(const String& identifier) const;
1489 #endif
1490
1491     bool canShowMIMEType(const String&, const Function<bool(const String&, WebCore::PluginData::AllowedPluginTypes)>& supportsPlugin) const;
1492
1493     uint64_t m_pageID;
1494
1495     std::unique_ptr<WebCore::Page> m_page;
1496     RefPtr<WebFrame> m_mainFrame;
1497
1498     RefPtr<WebPageGroupProxy> m_pageGroup;
1499
1500     String m_userAgent;
1501
1502     WebCore::IntSize m_viewSize;
1503     std::unique_ptr<DrawingArea> m_drawingArea;
1504     bool m_shouldResetDrawingAreaAfterSuspend { false };
1505
1506     HashSet<PluginView*> m_pluginViews;
1507     bool m_hasSeenPlugin { false };
1508
1509     HashMap<uint64_t, RefPtr<WebCore::TextCheckingRequest>> m_pendingTextCheckingRequestMap;
1510
1511     bool m_useFixedLayout { false };
1512     bool m_drawsBackground { true };
1513
1514     WebCore::Color m_underlayColor;
1515
1516     bool m_isInRedo { false };
1517     bool m_isClosed { false };
1518     bool m_tabToLinks { false };
1519     
1520     bool m_asynchronousPluginInitializationEnabled { false };
1521     bool m_asynchronousPluginInitializationEnabledForAllPlugins { false };
1522     bool m_artificialPluginInitializationDelayEnabled { false };
1523     bool m_scrollingPerformanceLoggingEnabled { false };
1524     bool m_mainFrameIsScrollable { true };
1525
1526     bool m_alwaysShowsHorizontalScroller { false };
1527     bool m_alwaysShowsVerticalScroller { false };
1528
1529 #if PLATFORM(IOS_FAMILY)
1530     bool m_ignoreViewportScalingConstraints { false };
1531 #endif
1532
1533 #if ENABLE(PRIMARY_SNAPSHOTTED_PLUGIN_HEURISTIC)
1534     bool m_readyToFindPrimarySnapshottedPlugin { false };
1535     bool m_didFindPrimarySnapshottedPlugin { false };
1536     unsigned m_numberOfPrimarySnapshotDetectionAttempts { 0 };
1537     String m_primaryPlugInPageOrigin;
1538     String m_primaryPlugInOrigin;
1539     String m_primaryPlugInMimeType;
1540     RunLoop::Timer<WebPage> m_determinePrimarySnapshottedPlugInTimer;
1541 #endif
1542
1543     // The layer hosting mode.
1544     LayerHostingMode m_layerHostingMode;
1545
1546 #if PLATFORM(COCOA)
1547     bool m_pdfPluginEnabled { false };
1548     bool m_hasCachedWindowFrame { false };
1549
1550     // The frame of the containing window in screen coordinates.
1551     WebCore::FloatRect m_windowFrameInScreenCoordinates;
1552
1553     // The frame of the containing window in unflipped screen coordinates.
1554     WebCore::FloatRect m_windowFrameInUnflippedScreenCoordinates;
1555
1556     // The frame of the view in window coordinates.
1557     WebCore::FloatRect m_viewFrameInWindowCoordinates;
1558
1559     // The accessibility position of the view.
1560     WebCore::FloatPoint m_accessibilityPosition;
1561     
1562     RetainPtr<WKAccessibilityWebPageObject> m_mockAccessibilityElement;
1563
1564     UniqueRef<ViewGestureGeometryCollector> m_viewGestureGeometryCollector;
1565
1566     RetainPtr<NSDictionary> m_dataDetectionContext;
1567 #endif
1568
1569 #if HAVE(ACCESSIBILITY) && PLATFORM(GTK)
1570     GRefPtr<WebPageAccessibilityObject> m_accessibilityObject;
1571 #endif
1572
1573 #if PLATFORM(GTK) && USE(TEXTURE_MAPPER_GL)
1574     // Our view's window in the UI process.
1575     uint64_t m_nativeWindowHandle { 0 };
1576 #endif
1577
1578 #if !PLATFORM(IOS_FAMILY)
1579     RefPtr<PageBanner> m_headerBanner;
1580     RefPtr<PageBanner> m_footerBanner;
1581 #endif
1582
1583     RunLoop::Timer<WebPage> m_setCanStartMediaTimer;
1584     bool m_mayStartMediaWhenInWindow { false };
1585
1586     HashMap<WebUndoStepID, RefPtr<WebUndoStep>> m_undoStepMap;
1587
1588 #if ENABLE(CONTEXT_MENUS)
1589     std::unique_ptr<API::InjectedBundle::PageContextMenuClient> m_contextMenuClient;
1590 #endif
1591     std::unique_ptr<API::InjectedBundle::EditorClient> m_editorClient;
1592     std::unique_ptr<API::InjectedBundle::FormClient> m_formClient;
1593     std::unique_ptr<API::InjectedBundle::PageLoaderClient> m_loaderClient;
1594     InjectedBundlePagePolicyClient m_policyClient;
1595     std::unique_ptr<API::InjectedBundle::ResourceLoadClient> m_resourceLoadClient;
1596     std::unique_ptr<API::InjectedBundle::PageUIClient> m_uiClient;
1597 #if ENABLE(FULLSCREEN_API)
1598     InjectedBundlePageFullScreenClient m_fullScreenClient;
1599 #endif
1600
1601     UniqueRef<FindController> m_findController;
1602
1603     RefPtr<WebInspector> m_inspector;
1604     RefPtr<WebInspectorUI> m_inspectorUI;
1605     RefPtr<RemoteWebInspectorUI> m_remoteInspectorUI;
1606     std::unique_ptr<WebPageInspectorTargetController> m_inspectorTargetController;
1607
1608 #if (PLATFORM(IOS_FAMILY) && HAVE(AVKIT)) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))
1609     RefPtr<PlaybackSessionManager> m_playbackSessionManager;
1610     RefPtr<VideoFullscreenManager> m_videoFullscreenManager;
1611 #endif
1612
1613 #if PLATFORM(IOS_FAMILY)
1614     bool m_allowsMediaDocumentInlinePlayback { false };
1615     RefPtr<WebCore::Range> m_startingGestureRange;
1616 #endif
1617
1618 #if ENABLE(FULLSCREEN_API)
1619     RefPtr<WebFullScreenManager> m_fullScreenManager;
1620 #endif
1621
1622     RefPtr<WebPopupMenu> m_activePopupMenu;
1623
1624 #if ENABLE(CONTEXT_MENUS)
1625     RefPtr<WebContextMenu> m_contextMenu;
1626 #endif
1627
1628 #if ENABLE(INPUT_TYPE_COLOR)
1629     WebColorChooser* m_activeColorChooser { nullptr };
1630 #endif
1631
1632 #if ENABLE(DATALIST_ELEMENT)
1633     WebDataListSuggestionPicker* m_activeDataListSuggestionPicker { nullptr };
1634 #endif
1635
1636     RefPtr<WebOpenPanelResultListener> m_activeOpenPanelResultListener;
1637     RefPtr<NotificationPermissionRequestManager> m_notificationPermissionRequestManager;
1638
1639     Ref<WebUserContentController> m_userContentController;
1640
1641 #if ENABLE(GEOLOCATION)
1642     UniqueRef<GeolocationPermissionRequestManager> m_geolocationPermissionRequestManager;
1643 #endif
1644
1645 #if ENABLE(MEDIA_STREAM)
1646     UniqueRef<UserMediaPermissionRequestManager> m_userMediaPermissionRequestManager;
1647 #endif
1648
1649     std::unique_ptr<WebCore::PrintContext> m_printContext;
1650 #if PLATFORM(GTK)
1651     RefPtr<WebPrintOperationGtk> m_printOperation;
1652 #endif
1653
1654     SandboxExtensionTracker m_sandboxExtensionTracker;
1655
1656     RefPtr<SandboxExtension> m_pendingDropSandboxExtension;
1657     Vector<RefPtr<SandboxExtension>> m_pendingDropExtensionsForFileUpload;
1658
1659     PAL::HysteresisActivity m_pageScrolledHysteresis;
1660
1661     bool m_canRunBeforeUnloadConfirmPanel { false };
1662
1663     bool m_canRunModal { false };
1664     bool m_isRunningModal { false };
1665
1666 #if ENABLE(DRAG_SUPPORT)
1667     bool m_isStartingDrag { false };
1668 #endif
1669
1670     bool m_cachedMainFrameIsPinnedToLeftSide { true };
1671     bool m_cachedMainFrameIsPinnedToRightSide { true };
1672     bool m_cachedMainFrameIsPinnedToTopSide { true };
1673     bool m_cachedMainFrameIsPinnedToBottomSide { true };
1674     bool m_canShortCircuitHorizontalWheelEvents { false };
1675     bool m_hasWheelEventHandlers { false };
1676
1677     unsigned m_cachedPageCount { 0 };
1678
1679     HashSet<unsigned long> m_trackedNetworkResourceRequestIdentifiers;
1680
1681     WebCore::IntSize m_viewLayoutSize;
1682     bool m_autoSizingShouldExpandToViewHeight { false };
1683     Optional<WebCore::IntSize> m_viewportSizeForCSSViewportUnits;
1684
1685     bool m_userIsInteracting { false };
1686     bool m_isFocusingElementDueToUserInteraction { false };
1687     bool m_hasEverFocusedElementDueToUserInteractionSincePageTransition { false };
1688     bool m_needsHiddenContentEditableQuirk { false };
1689     bool m_needsPlainTextQuirk { false };
1690     bool m_changingActivityState { false };
1691
1692 #if ENABLE(CONTEXT_MENUS)
1693     bool m_isShowingContextMenu { false };
1694 #endif
1695
1696     RefPtr<WebCore::Element> m_focusedElement;
1697     bool m_hasPendingBlurNotification { false };
1698     bool m_hasPendingEditorStateUpdate { false };
1699     
1700 #if PLATFORM(IOS_FAMILY)
1701     RefPtr<WebCore::Range> m_currentWordRange;
1702     RefPtr<WebCore::Node> m_interactionNode;
1703     WebCore::IntPoint m_lastInteractionLocation;
1704     
1705     enum SelectionAnchor { Start, End };
1706     SelectionAnchor m_selectionAnchor { Start };
1707
1708     RefPtr<WebCore::Node> m_potentialTapNode;
1709     WebCore::FloatPoint m_potentialTapLocation;
1710     RefPtr<WebCore::SecurityOrigin> m_potentialTapSecurityOrigin;
1711
1712     WebCore::ViewportConfiguration m_viewportConfiguration;
1713
1714     bool m_hasReceivedVisibleContentRectsAfterDidCommitLoad { false };
1715     bool m_hasRestoredExposedContentRectAfterDidCommitLoad { false };
1716     bool m_scaleWasSetByUIProcess { false };
1717     bool m_userHasChangedPageScaleFactor { false };
1718     bool m_hasStablePageScaleFactor { true };
1719     bool m_useTestingViewportConfiguration { false };
1720     bool m_isInStableState { true };
1721     bool m_forceAlwaysUserScalable { false };
1722     MonotonicTime m_oldestNonStableUpdateVisibleContentRectsTimestamp;
1723     Seconds m_estimatedLatency { 0 };
1724     WebCore::FloatSize m_screenSize;
1725     WebCore::FloatSize m_availableScreenSize;
1726     WebCore::FloatSize m_overrideScreenSize;
1727     RefPtr<WebCore::Range> m_currentBlockSelection;
1728     WebCore::IntRect m_blockRectForTextSelection;
1729
1730     RefPtr<WebCore::Range> m_initialSelection;
1731     WebCore::VisibleSelection m_storedSelectionForAccessibility { WebCore::VisibleSelection() };
1732     WebCore::IntSize m_blockSelectionDesiredSize;
1733     WebCore::FloatSize m_maximumUnobscuredSize;
1734     int32_t m_deviceOrientation { 0 };
1735     bool m_inDynamicSizeUpdate { false };
1736     HashMap<std::pair<WebCore::IntSize, double>, WebCore::IntPoint> m_dynamicSizeUpdateHistory;
1737     RefPtr<WebCore::Node> m_pendingSyntheticClickNode;
1738     WebCore::FloatPoint m_pendingSyntheticClickLocation;
1739     WebCore::FloatRect m_previousExposedContentRect;
1740     FocusedElementIdentifier m_currentFocusedElementIdentifier { 0 };
1741     Optional<DynamicViewportSizeUpdateID> m_pendingDynamicViewportSizeUpdateID;
1742     double m_lastTransactionPageScaleFactor { 0 };
1743     uint64_t m_lastTransactionIDWithScaleChange { 0 };
1744 #endif
1745
1746     WebCore::Timer m_layerVolatilityTimer;
1747     Vector<WTF::Function<void (bool)>> m_markLayersAsVolatileCompletionHandlers;
1748     bool m_isSuspendedUnderLock { false };
1749
1750     HashSet<String, ASCIICaseInsensitiveHash> m_mimeTypesWithCustomContentProviders;
1751     WebCore::Color m_backgroundColor { WebCore::Color::white };
1752
1753     HashSet<unsigned> m_activeRenderingSuppressionTokens;
1754     unsigned m_maximumRenderingSuppressionToken { 0 };
1755     
1756     WebCore::ScrollPinningBehavior m_scrollPinningBehavior { WebCore::DoNotPin };
1757     Optional<WebCore::ScrollbarOverlayStyle> m_scrollbarOverlayStyle;
1758
1759     bool m_useAsyncScrolling { false };
1760
1761     OptionSet<WebCore::ActivityState::Flag> m_activityState;
1762
1763     bool m_processSuppressionEnabled;
1764     UserActivity m_userActivity;
1765     PAL::HysteresisActivity m_userActivityHysteresis;
1766
1767     uint64_t m_pendingNavigationID { 0 };
1768     Optional<WebsitePoliciesData> m_pendingWebsitePolicies;
1769
1770     bool m_mainFrameProgressCompleted { false };
1771     bool m_shouldDispatchFakeMouseMoveEvents { true };
1772     bool m_isEditorStateMissingPostLayoutData { false };
1773     bool m_isSelectingTextWhileInsertingAsynchronously { false };
1774
1775     enum class EditorStateIsContentEditable { No, Yes, Unset };
1776     mutable EditorStateIsContentEditable m_lastEditorStateWasContentEditable { EditorStateIsContentEditable::Unset };
1777
1778 #if PLATFORM(GTK)
1779     bool m_inputMethodEnabled { false };
1780 #endif
1781
1782 #if ENABLE(VIDEO) && USE(GSTREAMER)
1783     RefPtr<WebCore::MediaPlayerRequestInstallMissingPluginsCallback> m_installMediaPluginsCallback;
1784 #endif
1785
1786 #if USE(OS_STATE)
1787     WallTime m_loadCommitTime;
1788 #endif
1789
1790     WebCore::UserInterfaceLayoutDirection m_userInterfaceLayoutDirection { WebCore::UserInterfaceLayoutDirection::LTR };
1791
1792     const String m_overrideContentSecurityPolicy;
1793     const Optional<double> m_cpuLimit;
1794
1795     HashMap<String, RefPtr<WebURLSchemeHandlerProxy>> m_schemeToURLSchemeHandlerProxyMap;
1796     HashMap<uint64_t, WebURLSchemeHandlerProxy*> m_identifierToURLSchemeHandlerProxyMap;
1797
1798     HashMap<uint64_t, WTF::Function<void(bool granted)>> m_storageAccessResponseCallbackMap;
1799     HashMap<ShareSheetCallbackID, WTF::Function<void(bool completed)>> m_shareSheetResponseCallbackMap;
1800
1801 #if ENABLE(APPLICATION_MANIFEST)
1802     HashMap<uint64_t, uint64_t> m_applicationManifestFetchCallbackMap;
1803 #endif
1804
1805     OptionSet<LayerTreeFreezeReason> m_LayerTreeFreezeReasons;
1806     bool m_isSuspended { false };
1807     bool m_needsFontAttributes { false };
1808 };
1809
1810 } // namespace WebKit
1811