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