Add SPI to retrieve the set of text inputs in a given rect, and later focus one
[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 WebPopupMenu;
236 class WebTouchEvent;
237 class WebURLSchemeHandlerProxy;
238 class WebUndoStep;
239 class WebUserContentController;
240 class WebWheelEvent;
241 class RemoteLayerTreeTransaction;
242
243 enum FindOptions : uint16_t;
244 enum class DragControllerAction : uint8_t;
245
246 struct AttributedString;
247 struct DataDetectionResult;
248 struct BackForwardListItemState;
249 struct EditorState;
250 struct InteractionInformationAtPosition;
251 struct InteractionInformationRequest;
252 struct LoadParameters;
253 struct PrintInfo;
254 struct TextInputContext;
255 struct WebAutocorrectionContext;
256 struct WebPageCreationParameters;
257 struct WebPreferencesStore;
258 struct WebSelectionData;
259 struct WebsitePoliciesData;
260
261 using SnapshotOptions = uint32_t;
262 using WKEventModifiers = uint32_t;
263
264 class WebPage : public API::ObjectImpl<API::Object::Type::BundlePage>, public IPC::MessageReceiver, public IPC::MessageSender, public CanMakeWeakPtr<WebPage> {
265 public:
266     static Ref<WebPage> create(uint64_t pageID, WebPageCreationParameters&&);
267     virtual ~WebPage();
268
269     void reinitializeWebPage(WebPageCreationParameters&&);
270
271     void close();
272
273     static WebPage* fromCorePage(WebCore::Page*);
274
275     WebCore::Page* corePage() const { return m_page.get(); }
276     uint64_t pageID() const { return m_pageID; }
277     PAL::SessionID sessionID() const { return m_page->sessionID(); }
278     bool usesEphemeralSession() const { return m_page->usesEphemeralSession(); }
279
280     void setSessionID(PAL::SessionID);
281
282     void setSize(const WebCore::IntSize&);
283     const WebCore::IntSize& size() const { return m_viewSize; }
284     WebCore::IntRect bounds() const { return WebCore::IntRect(WebCore::IntPoint(), size()); }
285
286     DrawingArea* drawingArea() const { return m_drawingArea.get(); }
287
288 #if ENABLE(ASYNC_SCROLLING)
289     WebCore::ScrollingCoordinator* scrollingCoordinator() const;
290 #endif
291
292     WebPageGroupProxy* pageGroup() const { return m_pageGroup.get(); }
293
294     void scrollMainFrameIfNotAtMaxScrollPosition(const WebCore::IntSize& scrollOffset);
295
296     bool scrollBy(uint32_t scrollDirection, uint32_t scrollGranularity);
297
298     void centerSelectionInVisibleArea();
299
300 #if PLATFORM(COCOA)
301     void willCommitLayerTree(RemoteLayerTreeTransaction&);
302     void didFlushLayerTreeAtTime(MonotonicTime);
303 #endif
304
305     void layoutIfNeeded();
306     void renderingUpdate();
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
340     // -- Called from WebCore clients.
341     bool handleEditingKeyboardEvent(WebCore::KeyboardEvent*);
342
343     void didStartPageTransition();
344     void didCompletePageTransition();
345     void didCommitLoad(WebFrame*);
346     void willReplaceMultipartContent(const WebFrame&);
347     void didReplaceMultipartContent(const WebFrame&);
348     void didFinishLoad(WebFrame*);
349     void show();
350     String userAgent(const URL&) const;
351     String platformUserAgent(const URL&) const;
352     WebCore::KeyboardUIMode keyboardUIMode();
353
354     void didInsertMenuElement(WebCore::HTMLMenuElement&);
355     void didRemoveMenuElement(WebCore::HTMLMenuElement&);
356     void didInsertMenuItemElement(WebCore::HTMLMenuItemElement&);
357     void didRemoveMenuItemElement(WebCore::HTMLMenuItemElement&);
358
359     const String& overrideContentSecurityPolicy() const { return m_overrideContentSecurityPolicy; }
360
361     WebUndoStep* webUndoStep(WebUndoStepID);
362     void addWebUndoStep(WebUndoStepID, Ref<WebUndoStep>&&);
363     void removeWebEditCommand(WebUndoStepID);
364     bool isInRedo() const { return m_isInRedo; }
365
366     bool isAlwaysOnLoggingAllowed() const;
367     void setActivePopupMenu(WebPopupMenu*);
368
369     void setHiddenPageDOMTimerThrottlingIncreaseLimit(Seconds limit)
370     {
371         m_page->setDOMTimerAlignmentIntervalIncreaseLimit(limit);
372     }
373
374 #if ENABLE(INPUT_TYPE_COLOR)
375     WebColorChooser* activeColorChooser() const { return m_activeColorChooser; }
376     void setActiveColorChooser(WebColorChooser*);
377     void didChooseColor(const WebCore::Color&);
378     void didEndColorPicker();
379 #endif
380
381 #if ENABLE(DATALIST_ELEMENT)
382     void setActiveDataListSuggestionPicker(WebDataListSuggestionPicker*);
383     void didSelectDataListOption(const String&);
384     void didCloseSuggestions();
385 #endif
386
387     WebOpenPanelResultListener* activeOpenPanelResultListener() const { return m_activeOpenPanelResultListener.get(); }
388     void setActiveOpenPanelResultListener(Ref<WebOpenPanelResultListener>&&);
389
390     void didReceiveMessage(IPC::Connection&, IPC::Decoder&) override;
391     void didReceiveSyncMessage(IPC::Connection&, IPC::Decoder&, std::unique_ptr<IPC::Encoder>&) override;
392
393     // -- InjectedBundle methods
394 #if ENABLE(CONTEXT_MENUS)
395     void setInjectedBundleContextMenuClient(std::unique_ptr<API::InjectedBundle::PageContextMenuClient>&&);
396 #endif
397     void setInjectedBundleEditorClient(std::unique_ptr<API::InjectedBundle::EditorClient>&&);
398     void setInjectedBundleFormClient(std::unique_ptr<API::InjectedBundle::FormClient>&&);
399     void setInjectedBundlePageLoaderClient(std::unique_ptr<API::InjectedBundle::PageLoaderClient>&&);
400     void initializeInjectedBundlePolicyClient(WKBundlePagePolicyClientBase*);
401     void setInjectedBundleResourceLoadClient(std::unique_ptr<API::InjectedBundle::ResourceLoadClient>&&);
402     void setInjectedBundleUIClient(std::unique_ptr<API::InjectedBundle::PageUIClient>&&);
403 #if ENABLE(FULLSCREEN_API)
404     void initializeInjectedBundleFullScreenClient(WKBundlePageFullScreenClientBase*);
405 #endif
406
407 #if ENABLE(CONTEXT_MENUS)
408     API::InjectedBundle::PageContextMenuClient& injectedBundleContextMenuClient() { return *m_contextMenuClient; }
409 #endif
410     API::InjectedBundle::EditorClient& injectedBundleEditorClient() { return *m_editorClient; }
411     API::InjectedBundle::FormClient& injectedBundleFormClient() { return *m_formClient; }
412     API::InjectedBundle::PageLoaderClient& injectedBundleLoaderClient() { return *m_loaderClient; }
413     InjectedBundlePagePolicyClient& injectedBundlePolicyClient() { return m_policyClient; }
414     API::InjectedBundle::ResourceLoadClient& injectedBundleResourceLoadClient() { return *m_resourceLoadClient; }
415     API::InjectedBundle::PageUIClient& injectedBundleUIClient() { return *m_uiClient; }
416 #if ENABLE(FULLSCREEN_API)
417     InjectedBundlePageFullScreenClient& injectedBundleFullScreenClient() { return m_fullScreenClient; }
418 #endif
419
420     bool findStringFromInjectedBundle(const String&, FindOptions);
421     void findStringMatchesFromInjectedBundle(const String&, FindOptions);
422     void replaceStringMatchesFromInjectedBundle(const Vector<uint32_t>& matchIndices, const String& replacementText, bool selectionOnly);
423
424     WebFrame* mainWebFrame() const { return m_mainFrame.get(); }
425
426     WebCore::Frame* mainFrame() const; // May return nullptr.
427     WebCore::FrameView* mainFrameView() const; // May return nullptr.
428
429     RefPtr<WebCore::Range> currentSelectionAsRange();
430
431 #if ENABLE(NETSCAPE_PLUGIN_API)
432     RefPtr<Plugin> createPlugin(WebFrame*, WebCore::HTMLPlugInElement*, const Plugin::Parameters&, String& newMIMEType);
433 #endif
434
435 #if ENABLE(WEBGL)
436     WebCore::WebGLLoadPolicy webGLPolicyForURL(WebFrame*, const URL&);
437     WebCore::WebGLLoadPolicy resolveWebGLPolicyForURL(WebFrame*, const URL&);
438 #endif
439     
440     enum class IncludePostLayoutDataHint { No, Yes };
441     EditorState editorState(IncludePostLayoutDataHint = IncludePostLayoutDataHint::Yes) const;
442     void updateEditorStateAfterLayoutIfEditabilityChanged();
443
444     String renderTreeExternalRepresentation() const;
445     String renderTreeExternalRepresentationForPrinting() const;
446     uint64_t renderTreeSize() const;
447
448     void setTracksRepaints(bool);
449     bool isTrackingRepaints() const;
450     void resetTrackedRepaints();
451     Ref<API::Array> trackedRepaintRects();
452
453     void executeEditingCommand(const String& commandName, const String& argument);
454     bool isEditingCommandEnabled(const String& commandName);
455     void clearMainFrameName();
456     void sendClose();
457
458     void suspendForProcessSwap();
459
460     void sendSetWindowFrame(const WebCore::FloatRect&);
461
462     double textZoomFactor() const;
463     void setTextZoomFactor(double);
464     double pageZoomFactor() const;
465     void setPageZoomFactor(double);
466     void setPageAndTextZoomFactors(double pageZoomFactor, double textZoomFactor);
467     void windowScreenDidChange(uint32_t);
468     String dumpHistoryForTesting(const String& directory);
469     void clearHistory();
470
471     void accessibilitySettingsDidChange();
472 #if ENABLE(ACCESSIBILITY_EVENTS)
473     void updateAccessibilityEventsEnabled(bool);
474 #endif
475
476     void scalePage(double scale, const WebCore::IntPoint& origin);
477     void scalePageInViewCoordinates(double scale, WebCore::IntPoint centerInViewCoordinates);
478     double pageScaleFactor() const;
479     double totalScaleFactor() const;
480     double viewScaleFactor() const;
481     void scaleView(double scale);
482
483     void setUseFixedLayout(bool);
484     bool useFixedLayout() const { return m_useFixedLayout; }
485     bool setFixedLayoutSize(const WebCore::IntSize&);
486     WebCore::IntSize fixedLayoutSize() const;
487
488     void listenForLayoutMilestones(OptionSet<WebCore::LayoutMilestone>);
489
490     void setSuppressScrollbarAnimations(bool);
491     
492     void setEnableVerticalRubberBanding(bool);
493     void setEnableHorizontalRubberBanding(bool);
494     
495     void setBackgroundExtendsBeyondPage(bool);
496
497     void setPaginationMode(uint32_t /* WebCore::Pagination::Mode */);
498     void setPaginationBehavesLikeColumns(bool);
499     void setPageLength(double);
500     void setGapBetweenPages(double);
501     void setPaginationLineGridEnabled(bool);
502     
503     void postInjectedBundleMessage(const String& messageName, const UserData&);
504
505     void setUnderlayColor(const WebCore::Color& color) { m_underlayColor = color; }
506     WebCore::Color underlayColor() const { return m_underlayColor; }
507
508     void stopLoading();
509     void stopLoadingFrame(uint64_t frameID);
510     bool defersLoading() const;
511     void setDefersLoading(bool deferLoading);
512
513     void enterAcceleratedCompositingMode(WebCore::GraphicsLayer*);
514     void exitAcceleratedCompositingMode();
515
516     void addPluginView(PluginView*);
517     void removePluginView(PluginView*);
518
519     bool isVisible() const { return m_activityState.contains(WebCore::ActivityState::IsVisible); }
520     bool isVisibleOrOccluded() const { return m_activityState.contains(WebCore::ActivityState::IsVisibleOrOccluded); }
521
522     LayerHostingMode layerHostingMode() const { return m_layerHostingMode; }
523     void setLayerHostingMode(LayerHostingMode);
524
525 #if PLATFORM(COCOA)
526     void updatePluginsActiveAndFocusedState();
527     const WebCore::FloatRect& windowFrameInScreenCoordinates() const { return m_windowFrameInScreenCoordinates; }
528     const WebCore::FloatRect& windowFrameInUnflippedScreenCoordinates() const { return m_windowFrameInUnflippedScreenCoordinates; }
529     const WebCore::FloatRect& viewFrameInWindowCoordinates() const { return m_viewFrameInWindowCoordinates; }
530
531     bool hasCachedWindowFrame() const { return m_hasCachedWindowFrame; }
532
533     void updateHeaderAndFooterLayersForDeviceScaleChange(float scaleFactor);
534 #endif
535
536 #if PLATFORM(MAC)
537     void setTopOverhangImage(WebImage*);
538     void setBottomOverhangImage(WebImage*);
539     
540     void setUseSystemAppearance(bool);
541 #endif
542
543     void setUseDarkAppearance(bool);
544
545     bool windowIsFocused() const;
546     bool windowAndWebPageAreFocused() const;
547
548 #if !PLATFORM(IOS_FAMILY)
549     void setHeaderPageBanner(PageBanner*);
550     PageBanner* headerPageBanner();
551     void setFooterPageBanner(PageBanner*);
552     PageBanner* footerPageBanner();
553
554     void hidePageBanners();
555     void showPageBanners();
556     
557     void setHeaderBannerHeightForTesting(int);
558     void setFooterBannerHeightForTesting(int);
559 #endif
560
561     WebCore::IntPoint screenToRootView(const WebCore::IntPoint&);
562     WebCore::IntRect rootViewToScreen(const WebCore::IntRect&);
563     WebCore::IntPoint accessibilityScreenToRootView(const WebCore::IntPoint&);
564     WebCore::IntRect rootViewToAccessibilityScreen(const WebCore::IntRect&);
565     
566     RefPtr<WebImage> scaledSnapshotWithOptions(const WebCore::IntRect&, double additionalScaleFactor, SnapshotOptions);
567
568     static const WebEvent* currentEvent();
569
570     FindController& findController() { return m_findController.get(); }
571
572 #if ENABLE(GEOLOCATION)
573     GeolocationPermissionRequestManager& geolocationPermissionRequestManager() { return m_geolocationPermissionRequestManager.get(); }
574 #endif
575
576 #if PLATFORM(IOS_FAMILY)
577     void savePageState(WebCore::HistoryItem&);
578     void restorePageState(const WebCore::HistoryItem&);
579 #endif
580
581 #if ENABLE(MEDIA_STREAM)
582     UserMediaPermissionRequestManager& userMediaPermissionRequestManager() { return m_userMediaPermissionRequestManager; }
583     void captureDevicesChanged();
584 #endif
585
586     void elementDidFocus(WebCore::Element&);
587     void elementDidRefocus(WebCore::Element&);
588     void elementDidBlur(WebCore::Element&);
589     void focusedElementDidChangeInputMode(WebCore::Element&, WebCore::InputMode);
590     void resetFocusedElementForFrame(WebFrame*);
591
592     void disabledAdaptationsDidChange(const OptionSet<WebCore::DisabledAdaptations>&);
593     void viewportPropertiesDidChange(const WebCore::ViewportArguments&);
594     void executeEditCommandWithCallback(const String&, const String& argument, CallbackID);
595
596     void textInputContextsInRect(WebCore::FloatRect, CompletionHandler<void(const Vector<WebKit::TextInputContext>&)>&&);
597     void focusTextInputContext(const TextInputContext&, CompletionHandler<void(bool)>&&);
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&, OptionSet<WebKit::WebEvent::Modifier>, uint64_t lastLayerTreeTransactionId);
616     void potentialTapAtPosition(uint64_t requestID, const WebCore::FloatPoint&);
617     void commitPotentialTap(OptionSet<WebKit::WebEvent::Modifier>, 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, CompletionHandler<void(bool)>&&);
648     void requestAutocorrectionContext();
649     void getPositionInformation(const InteractionInformationRequest&, CompletionHandler<void(InteractionInformationAtPosition&&)>&&);
650     void requestPositionInformation(const InteractionInformationRequest&);
651     void startInteractionWithElementAtPosition(const WebCore::IntPoint&);
652     void stopInteraction();
653     void performActionOnElement(uint32_t action);
654     void focusNextFocusedElement(bool isForward, CallbackID);
655     void autofillLoginCredentials(const String&, const String&);
656     void setFocusedElementValue(const String&);
657     void setFocusedElementValueAsNumber(double);
658     void setFocusedElementSelectedIndex(uint32_t index, bool allowMultipleSelection);
659     void updateSelectionAppearance();
660     void getSelectionContext(CallbackID);
661     void handleTwoFingerTapAtPoint(const WebCore::IntPoint&, OptionSet<WebKit::WebEvent::Modifier>, uint64_t requestID);
662     void handleStylusSingleTapAtPoint(const WebCore::IntPoint&, uint64_t requestID);
663     void getRectsForGranularityWithSelectionOffset(uint32_t, int32_t, CallbackID);
664     void getRectsAtSelectionOffsetWithText(int32_t, const String&, CallbackID);
665     void storeSelectionForAccessibility(bool);
666     void startAutoscrollAtPosition(const WebCore::FloatPoint&);
667     void cancelAutoscroll();
668     void requestEvasionRectsAboveSelection(CompletionHandler<void(const Vector<WebCore::FloatRect>&)>&&);
669
670     void contentSizeCategoryDidChange(const String&);
671
672     Seconds eventThrottlingDelay() const;
673
674     void showInspectorHighlight(const WebCore::Highlight&);
675     void hideInspectorHighlight();
676
677     void showInspectorIndication();
678     void hideInspectorIndication();
679
680     void enableInspectorNodeSearch();
681     void disableInspectorNodeSearch();
682
683     bool forceAlwaysUserScalable() const { return m_forceAlwaysUserScalable; }
684     void setForceAlwaysUserScalable(bool);
685 #endif
686
687 #if PLATFORM(IOS_FAMILY) && ENABLE(IOS_TOUCH_EVENTS)
688     void dispatchAsynchronousTouchEvents(const Vector<WebTouchEvent, 1>& queue);
689 #endif
690
691     bool hasRichlyEditableSelection() const;
692
693     enum class LayerTreeFreezeReason {
694         PageTransition          = 1 << 0,
695         BackgroundApplication   = 1 << 1,
696         ProcessSuspended        = 1 << 2,
697         PageSuspended           = 1 << 3,
698         Printing                = 1 << 4,
699         ProcessSwap             = 1 << 5,
700     };
701     void freezeLayerTree(LayerTreeFreezeReason);
702     void unfreezeLayerTree(LayerTreeFreezeReason);
703
704     void markLayersVolatile(WTF::Function<void (bool)>&& completionHandler = { });
705     void cancelMarkLayersVolatile();
706
707     NotificationPermissionRequestManager* notificationPermissionRequestManager();
708
709     void pageDidScroll();
710
711 #if ENABLE(CONTEXT_MENUS)
712     WebContextMenu* contextMenu();
713     WebContextMenu* contextMenuAtPointInWindow(const WebCore::IntPoint&);
714 #endif
715
716     bool hasLocalDataForURL(const URL&);
717
718     static bool canHandleRequest(const WebCore::ResourceRequest&);
719
720     class SandboxExtensionTracker {
721     public:
722         ~SandboxExtensionTracker();
723
724         void invalidate();
725
726         void beginLoad(WebFrame*, SandboxExtension::Handle&&);
727         void beginReload(WebFrame*, SandboxExtension::Handle&&);
728         void willPerformLoadDragDestinationAction(RefPtr<SandboxExtension>&& pendingDropSandboxExtension);
729         void didStartProvisionalLoad(WebFrame*);
730         void didCommitProvisionalLoad(WebFrame*);
731         void didFailProvisionalLoad(WebFrame*);
732
733     private:
734         void setPendingProvisionalSandboxExtension(RefPtr<SandboxExtension>&&);
735         bool shouldReuseCommittedSandboxExtension(WebFrame*);
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(bool keyboardIsAttached);
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 #endif
1116
1117 #if ENABLE(DEVICE_ORIENTATION)
1118     void shouldAllowDeviceOrientationAndMotionAccess(const WebCore::SecurityOrigin&, CompletionHandler<void(bool)>&&);
1119 #endif
1120
1121     void showShareSheet(WebCore::ShareDataWithParsedURL&, WTF::CompletionHandler<void(bool)>&& callback);
1122     void didCompleteShareSheet(bool wasCompleted, ShareSheetCallbackID contextId);
1123     
1124 #if ENABLE(ATTACHMENT_ELEMENT)
1125     void insertAttachment(const String& identifier, Optional<uint64_t>&& fileSize, const String& fileName, const String& contentType, CallbackID);
1126     void updateAttachmentAttributes(const String& identifier, Optional<uint64_t>&& fileSize, const String& contentType, const String& fileName, const IPC::DataReference& enclosingImageData, CallbackID);
1127 #endif
1128
1129 #if ENABLE(APPLICATION_MANIFEST)
1130     void getApplicationManifest(CallbackID);
1131     void didFinishLoadingApplicationManifest(uint64_t, const Optional<WebCore::ApplicationManifest>&);
1132 #endif
1133
1134 #if PLATFORM(WPE)
1135     int releaseHostFileDescriptor() { return m_hostFileDescriptor.releaseFileDescriptor(); }
1136 #endif
1137
1138     void updateCurrentModifierState(OptionSet<WebCore::PlatformEvent::Modifier> modifiers);
1139
1140     UserContentControllerIdentifier userContentControllerIdentifier() const { return m_userContentController->identifier(); }
1141
1142     WebCore::UserInterfaceLayoutDirection userInterfaceLayoutDirection() const { return m_userInterfaceLayoutDirection; }
1143
1144     bool isSuspended() const { return m_isSuspended; }
1145
1146     void didReceiveWebPageMessage(IPC::Connection&, IPC::Decoder&);
1147
1148     template<typename T>
1149     bool sendSyncWithDelayedReply(T&& message, typename T::Reply&& reply)
1150     {
1151         cancelGesturesBlockedOnSynchronousReplies();
1152         return sendSync(WTFMove(message), WTFMove(reply), m_pageID, Seconds::infinity(), IPC::SendSyncOption::InformPlatformProcessWillSuspend);
1153     }
1154
1155     WebCore::DOMPasteAccessResponse requestDOMPasteAccess(const String& originIdentifier);
1156     WebCore::IntRect rectForElementAtInteractionLocation() const;
1157
1158     const Optional<WebCore::Color>& backgroundColor() const { return m_backgroundColor; }
1159
1160     void suspendAllMediaBuffering();
1161     void resumeAllMediaBuffering();
1162
1163 private:
1164     WebPage(uint64_t pageID, WebPageCreationParameters&&);
1165
1166     void updateThrottleState();
1167     void updateUserActivity();
1168
1169     // IPC::MessageSender
1170     IPC::Connection* messageSenderConnection() const override;
1171     uint64_t messageSenderDestinationID() const override;
1172
1173     void platformInitialize();
1174     void platformReinitialize();
1175     void platformDetach();
1176     void platformEditorState(WebCore::Frame&, EditorState& result, IncludePostLayoutDataHint) const;
1177     void sendEditorStateUpdate();
1178     void scheduleFullEditorStateUpdate();
1179
1180 #if PLATFORM(COCOA)
1181     void sendTouchBarMenuDataAddedUpdate(WebCore::HTMLMenuElement&);
1182     void sendTouchBarMenuDataRemovedUpdate(WebCore::HTMLMenuElement&);
1183     void sendTouchBarMenuItemDataAddedUpdate(WebCore::HTMLMenuItemElement&);
1184     void sendTouchBarMenuItemDataRemovedUpdate(WebCore::HTMLMenuItemElement&);
1185 #endif
1186
1187     void didReceiveSyncWebPageMessage(IPC::Connection&, IPC::Decoder&, std::unique_ptr<IPC::Encoder>&);
1188
1189 #if PLATFORM(IOS_FAMILY)
1190     void resetViewportDefaultConfiguration(WebFrame* mainFrame, bool hasMobileDocType = false);
1191     enum class ZoomToInitialScale { No, Yes };
1192     void viewportConfigurationChanged(ZoomToInitialScale = ZoomToInitialScale::No);
1193     void updateViewportSizeForCSSViewportUnits();
1194
1195     static void convertSelectionRectsToRootView(WebCore::FrameView*, Vector<WebCore::SelectionRect>&);
1196     RefPtr<WebCore::Range> rangeForWebSelectionAtPosition(const WebCore::IntPoint&, const WebCore::VisiblePosition&, SelectionFlags&);
1197     void getFocusedElementInformation(FocusedElementInformation&);
1198     void platformInitializeAccessibility();
1199     void handleSyntheticClick(WebCore::Node& nodeRespondingToClick, const WebCore::FloatPoint& location, OptionSet<WebKit::WebEvent::Modifier>);
1200     void completeSyntheticClick(WebCore::Node& nodeRespondingToClick, const WebCore::FloatPoint& location, OptionSet<WebKit::WebEvent::Modifier>, WebCore::SyntheticClickType);
1201     void sendTapHighlightForNodeIfNecessary(uint64_t requestID, WebCore::Node*);
1202     void resetTextAutosizing();
1203     WebCore::VisiblePosition visiblePositionInFocusedNodeForPoint(const WebCore::Frame&, const WebCore::IntPoint&, bool isInteractingWithFocusedElement);
1204     RefPtr<WebCore::Range> rangeForGranularityAtPoint(WebCore::Frame&, const WebCore::IntPoint&, uint32_t granularity, bool isInteractingWithFocusedElement);
1205
1206     void sendPositionInformation(InteractionInformationAtPosition&&);
1207     InteractionInformationAtPosition positionInformation(const InteractionInformationRequest&);
1208     WebAutocorrectionContext autocorrectionContext();
1209     bool applyAutocorrectionInternal(const String& correction, const String& originalText);
1210 #endif
1211
1212 #if PLATFORM(IOS_FAMILY) && ENABLE(DATA_INTERACTION)
1213     void requestDragStart(const WebCore::IntPoint& clientPosition, const WebCore::IntPoint& globalPosition);
1214     void requestAdditionalItemsForDragSession(const WebCore::IntPoint& clientPosition, const WebCore::IntPoint& globalPosition);
1215 #endif
1216
1217 #if !PLATFORM(COCOA) && !PLATFORM(WPE)
1218     static const char* interpretKeyEvent(const WebCore::KeyboardEvent*);
1219 #endif
1220
1221     bool performDefaultBehaviorForKeyEvent(const WebKeyboardEvent&);
1222
1223 #if PLATFORM(MAC)
1224     bool executeKeypressCommandsInternal(const Vector<WebCore::KeypressCommand>&, WebCore::KeyboardEvent*);
1225 #endif
1226
1227     void updateDrawingAreaLayerTreeFreezeState();
1228     bool markLayersVolatileImmediatelyIfPossible();
1229     void layerVolatilityTimerFired();
1230     void callVolatilityCompletionHandlers(bool succeeded);
1231
1232     String sourceForFrame(WebFrame*);
1233
1234     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&);
1235
1236     // Actions
1237     void tryClose();
1238     void platformDidReceiveLoadParameters(const LoadParameters&);
1239     void loadRequest(LoadParameters&&);
1240     void loadData(LoadParameters&&);
1241     void loadAlternateHTML(LoadParameters&&);
1242     void navigateToPDFLinkWithSimulatedClick(const String& url, WebCore::IntPoint documentPoint, WebCore::IntPoint screenPoint);
1243     void reload(uint64_t navigationID, uint32_t reloadOptions, SandboxExtension::Handle&&);
1244     void goToBackForwardItem(uint64_t navigationID, const WebCore::BackForwardItemIdentifier&, WebCore::FrameLoadType, WebCore::ShouldTreatAsContinuingLoad, Optional<WebsitePoliciesData>&&);
1245     void tryRestoreScrollPosition();
1246     void setInitialFocus(bool forward, bool isKeyboardEventValid, const WebKeyboardEvent&, CallbackID);
1247     void updateIsInWindow(bool isInitialState = false);
1248     void visibilityDidChange();
1249     void setActivityState(OptionSet<WebCore::ActivityState::Flag>, ActivityStateChangeID, const Vector<CallbackID>& callbackIDs);
1250     void validateCommand(const String&, CallbackID);
1251     void executeEditCommand(const String&, const String&);
1252     void setEditable(bool);
1253
1254     void increaseListLevel();
1255     void decreaseListLevel();
1256     void changeListType();
1257
1258     void setBaseWritingDirection(WebCore::WritingDirection);
1259
1260     void setNeedsFontAttributes(bool);
1261
1262     void mouseEvent(const WebMouseEvent&);
1263     void keyEvent(const WebKeyboardEvent&);
1264
1265 #if ENABLE(IOS_TOUCH_EVENTS)
1266     void touchEventSync(const WebTouchEvent&, CompletionHandler<void(bool)>&&);
1267     void updatePotentialTapSecurityOrigin(const WebTouchEvent&, bool wasHandled);
1268 #elif ENABLE(TOUCH_EVENTS)
1269     void touchEvent(const WebTouchEvent&);
1270 #endif
1271
1272 #if ENABLE(POINTER_EVENTS)
1273     void cancelPointer(WebCore::PointerID, const WebCore::IntPoint&);
1274 #endif
1275
1276 #if ENABLE(CONTEXT_MENUS)
1277     void contextMenuHidden() { m_isShowingContextMenu = false; }
1278     void contextMenuForKeyEvent();
1279 #endif
1280
1281     static bool scroll(WebCore::Page*, WebCore::ScrollDirection, WebCore::ScrollGranularity);
1282     static bool logicalScroll(WebCore::Page*, WebCore::ScrollLogicalDirection, WebCore::ScrollGranularity);
1283
1284     void loadURLInFrame(URL&&, uint64_t frameID);
1285
1286     enum class WasRestoredByAPIRequest { No, Yes };
1287     void restoreSessionInternal(const Vector<BackForwardListItemState>&, WasRestoredByAPIRequest, WebBackForwardListProxy::OverwriteExistingItem);
1288     void restoreSession(const Vector<BackForwardListItemState>&);
1289     void didRemoveBackForwardItem(const WebCore::BackForwardItemIdentifier&);
1290     void updateBackForwardListForReattach(const Vector<WebKit::BackForwardListItemState>&);
1291     void setCurrentHistoryItemForReattach(WebKit::BackForwardListItemState&&);
1292
1293     void requestFontAttributesAtSelectionStart(CallbackID);
1294
1295 #if ENABLE(REMOTE_INSPECTOR)
1296     void setIndicating(bool);
1297 #endif
1298
1299     void setBackgroundColor(const Optional<WebCore::Color>&);
1300
1301 #if PLATFORM(COCOA)
1302     void setTopContentInsetFenced(float, IPC::Attachment);
1303 #endif
1304     void setTopContentInset(float);
1305
1306     void viewWillStartLiveResize();
1307     void viewWillEndLiveResize();
1308
1309     void getContentsAsString(CallbackID);
1310 #if ENABLE(MHTML)
1311     void getContentsAsMHTMLData(CallbackID);
1312 #endif
1313     void getMainResourceDataOfFrame(uint64_t frameID, CallbackID);
1314     void getResourceDataFromFrame(uint64_t frameID, const String& resourceURL, CallbackID);
1315     void getRenderTreeExternalRepresentation(CallbackID);
1316     void getSelectionOrContentsAsString(CallbackID);
1317     void getSelectionAsWebArchiveData(CallbackID);
1318     void getSourceForFrame(uint64_t frameID, CallbackID);
1319     void getWebArchiveOfFrame(uint64_t frameID, CallbackID);
1320     void runJavaScript(const String&, bool forceUserGesture, Optional<String> worldName, CallbackID);
1321     void runJavaScriptInMainFrame(const String&, bool forceUserGesture, CallbackID);
1322     void runJavaScriptInMainFrameScriptWorld(const String&, bool forceUserGesture, const String& worldName, CallbackID);
1323     void forceRepaint(CallbackID);
1324     void takeSnapshot(WebCore::IntRect snapshotRect, WebCore::IntSize bitmapSize, uint32_t options, CallbackID);
1325
1326     void preferencesDidChange(const WebPreferencesStore&);
1327     void updatePreferences(const WebPreferencesStore&);
1328     void updatePreferencesGenerated(const WebPreferencesStore&);
1329
1330 #if PLATFORM(IOS_FAMILY)
1331     bool parentProcessHasServiceWorkerEntitlement() const;
1332 #else
1333     bool parentProcessHasServiceWorkerEntitlement() const { return true; }
1334 #endif
1335
1336     void didReceivePolicyDecision(uint64_t frameID, uint64_t listenerID, WebCore::PolicyCheckIdentifier, WebCore::PolicyAction, uint64_t navigationID, const DownloadID&, Optional<WebsitePoliciesData>&&);
1337     void continueWillSubmitForm(uint64_t frameID, uint64_t listenerID);
1338     void setUserAgent(const String&);
1339     void setCustomTextEncodingName(const String&);
1340     void suspendActiveDOMObjectsAndAnimations();
1341     void resumeActiveDOMObjectsAndAnimations();
1342
1343 #if PLATFORM(COCOA)
1344     void performDictionaryLookupAtLocation(const WebCore::FloatPoint&);
1345     void performDictionaryLookupOfCurrentSelection();
1346     void performDictionaryLookupForRange(WebCore::Frame&, WebCore::Range&, NSDictionary *options, WebCore::TextIndicatorPresentationTransition);
1347     WebCore::DictionaryPopupInfo dictionaryPopupInfoForRange(WebCore::Frame&, WebCore::Range&, NSDictionary *options, WebCore::TextIndicatorPresentationTransition);
1348 #if ENABLE(PDFKIT_PLUGIN)
1349     WebCore::DictionaryPopupInfo dictionaryPopupInfoForSelectionInPDFPlugin(PDFSelection *, PDFPlugin&, NSDictionary *options, WebCore::TextIndicatorPresentationTransition);
1350 #endif
1351
1352     void windowAndViewFramesChanged(const WebCore::FloatRect& windowFrameInScreenCoordinates, const WebCore::FloatRect& windowFrameInUnflippedScreenCoordinates, const WebCore::FloatRect& viewFrameInWindowCoordinates, const WebCore::FloatPoint& accessibilityViewCoordinates);
1353
1354     RetainPtr<PDFDocument> pdfDocumentForPrintingFrame(WebCore::Frame*);
1355     void computePagesForPrintingPDFDocument(uint64_t frameID, const PrintInfo&, Vector<WebCore::IntRect>& resultPageRects);
1356     void drawPDFDocument(CGContextRef, PDFDocument *, const PrintInfo&, const WebCore::IntRect&);
1357     void drawPagesToPDFFromPDFDocument(CGContextRef, PDFDocument *, const PrintInfo&, uint32_t first, uint32_t count);
1358 #endif
1359
1360     void setMainFrameIsScrollable(bool);
1361
1362     void unapplyEditCommand(WebUndoStepID commandID);
1363     void reapplyEditCommand(WebUndoStepID commandID);
1364     void didRemoveEditCommand(WebUndoStepID commandID);
1365
1366     void findString(const String&, uint32_t findOptions, uint32_t maxMatchCount);
1367     void findStringMatches(const String&, uint32_t findOptions, uint32_t maxMatchCount);
1368     void getImageForFindMatch(uint32_t matchIndex);
1369     void selectFindMatch(uint32_t matchIndex);
1370     void hideFindUI();
1371     void countStringMatches(const String&, uint32_t findOptions, uint32_t maxMatchCount);
1372     void replaceMatches(const Vector<uint32_t>& matchIndices, const String& replacementText, bool selectionOnly, CallbackID);
1373
1374 #if USE(COORDINATED_GRAPHICS)
1375     void sendViewportAttributesChanged(const WebCore::ViewportArguments&);
1376 #endif
1377
1378     void didChangeSelectedIndexForActivePopupMenu(int32_t newIndex);
1379     void setTextForActivePopupMenu(int32_t index);
1380
1381 #if PLATFORM(GTK)
1382     void failedToShowPopupMenu();
1383 #endif
1384
1385     void didChooseFilesForOpenPanel(const Vector<String>&);
1386     void didCancelForOpenPanel();
1387
1388 #if PLATFORM(IOS_FAMILY)
1389     void didChooseFilesForOpenPanelWithDisplayStringAndIcon(const Vector<String>&, const String& displayString, const IPC::DataReference& iconData);
1390 #endif
1391
1392 #if ENABLE(SANDBOX_EXTENSIONS)
1393     void extendSandboxForFilesFromOpenPanel(SandboxExtension::HandleArray&&);
1394 #endif
1395
1396     void didReceiveGeolocationPermissionDecision(uint64_t geolocationID, bool allowed);
1397
1398     void didReceiveNotificationPermissionDecision(uint64_t notificationID, bool allowed);
1399
1400 #if ENABLE(MEDIA_STREAM)
1401     void userMediaAccessWasGranted(uint64_t userMediaID, WebCore::CaptureDevice&& audioDeviceUID, WebCore::CaptureDevice&& videoDeviceUID, String&& mediaDeviceIdentifierHashSalt);
1402     void userMediaAccessWasDenied(uint64_t userMediaID, uint64_t reason, String&& invalidConstraint);
1403
1404     void didCompleteMediaDeviceEnumeration(uint64_t userMediaID, const Vector<WebCore::CaptureDevice>& devices, String&& deviceIdentifierHashSalt, bool originHasPersistentAccess);
1405 #endif
1406
1407 #if ENABLE(WEB_RTC)
1408     void disableICECandidateFiltering();
1409     void enableICECandidateFiltering();
1410 #endif
1411
1412 #if ENABLE(WEB_RTC) && USE(LIBWEBRTC)
1413     void disableEnumeratingAllNetworkInterfaces();
1414     void enableEnumeratingAllNetworkInterfaces();
1415 #endif
1416
1417     void stopAllMediaPlayback();
1418     void suspendAllMediaPlayback();
1419     void resumeAllMediaPlayback();
1420
1421     void advanceToNextMisspelling(bool startBeforeSelection);
1422     void changeSpellingToWord(const String& word);
1423
1424 #if USE(APPKIT)
1425     void uppercaseWord();
1426     void lowercaseWord();
1427     void capitalizeWord();
1428 #endif
1429
1430 #if ENABLE(CONTEXT_MENUS)
1431     void didSelectItemFromActiveContextMenu(const WebContextMenuItemData&);
1432 #endif
1433
1434     void changeSelectedIndex(int32_t index);
1435     void setCanStartMediaTimerFired();
1436
1437     static bool platformCanHandleRequest(const WebCore::ResourceRequest&);
1438
1439     static PluginView* focusedPluginViewForFrame(WebCore::Frame&);
1440
1441     static RefPtr<WebCore::Range> rangeFromEditingRange(WebCore::Frame&, const EditingRange&, EditingRangeIsRelativeTo = EditingRangeIsRelativeTo::EditableRoot);
1442
1443     void reportUsedFeatures();
1444
1445     void updateWebsitePolicies(WebsitePoliciesData&&);
1446
1447     void changeFont(WebCore::FontChanges&&);
1448     void changeFontAttributes(WebCore::FontAttributeChanges&&);
1449
1450 #if PLATFORM(MAC)
1451     void performImmediateActionHitTestAtLocation(WebCore::FloatPoint);
1452     std::tuple<RefPtr<WebCore::Range>, NSDictionary *> lookupTextAtLocation(WebCore::FloatPoint);
1453     void immediateActionDidUpdate();
1454     void immediateActionDidCancel();
1455     void immediateActionDidComplete();
1456
1457     void dataDetectorsDidPresentUI(WebCore::PageOverlay::PageOverlayID);
1458     void dataDetectorsDidChangeUI(WebCore::PageOverlay::PageOverlayID);
1459     void dataDetectorsDidHideUI(WebCore::PageOverlay::PageOverlayID);
1460
1461     void handleAcceptedCandidate(WebCore::TextCheckingResult);
1462 #endif
1463
1464 #if PLATFORM(COCOA)
1465     void requestActiveNowPlayingSessionInfo(CallbackID);
1466     RetainPtr<NSData> accessibilityRemoteTokenData() const;
1467     void accessibilityTransferRemoteToken(RetainPtr<NSData>);
1468 #endif
1469
1470     void setShouldDispatchFakeMouseMoveEvents(bool dispatch) { m_shouldDispatchFakeMouseMoveEvents = dispatch; }
1471
1472 #if ENABLE(WIRELESS_PLAYBACK_TARGET) && !PLATFORM(IOS_FAMILY)
1473     void playbackTargetSelected(uint64_t, const WebCore::MediaPlaybackTargetContext& outputDevice) const;
1474     void playbackTargetAvailabilityDidChange(uint64_t, bool);
1475     void setShouldPlayToPlaybackTarget(uint64_t, bool);
1476 #endif
1477
1478     void clearWheelEventTestTrigger();
1479
1480     void setShouldScaleViewToFitDocument(bool);
1481
1482     void pageStoppedScrolling();
1483
1484 #if ENABLE(VIDEO) && USE(GSTREAMER)
1485     void didEndRequestInstallMissingMediaPlugins(uint32_t result);
1486 #endif
1487
1488     void setResourceCachingDisabled(bool);
1489     void setUserInterfaceLayoutDirection(uint32_t);
1490
1491     bool canPluginHandleResponse(const WebCore::ResourceResponse&);
1492
1493 #if USE(QUICK_LOOK)
1494     void didReceivePasswordForQuickLookDocument(const String&);
1495 #endif
1496
1497     void simulateDeviceOrientationChange(double alpha, double beta, double gamma);
1498
1499     void frameBecameRemote(uint64_t frameID, WebCore::GlobalFrameIdentifier&& remoteFrameIdentifier, WebCore::GlobalWindowIdentifier&& remoteWindowIdentifier);
1500
1501     void registerURLSchemeHandler(uint64_t identifier, const String& scheme);
1502
1503     void urlSchemeTaskDidPerformRedirection(uint64_t handlerIdentifier, uint64_t taskIdentifier, WebCore::ResourceResponse&&, WebCore::ResourceRequest&&);
1504     void urlSchemeTaskDidReceiveResponse(uint64_t handlerIdentifier, uint64_t taskIdentifier, const WebCore::ResourceResponse&);
1505     void urlSchemeTaskDidReceiveData(uint64_t handlerIdentifier, uint64_t taskIdentifier, const IPC::DataReference&);
1506     void urlSchemeTaskDidComplete(uint64_t handlerIdentifier, uint64_t taskIdentifier, const WebCore::ResourceError&);
1507
1508     void setIsSuspended(bool);
1509
1510     RefPtr<WebImage> snapshotAtSize(const WebCore::IntRect&, const WebCore::IntSize& bitmapSize, SnapshotOptions);
1511     RefPtr<WebImage> snapshotNode(WebCore::Node&, SnapshotOptions, unsigned maximumPixelCount = std::numeric_limits<unsigned>::max());
1512 #if USE(CF)
1513     RetainPtr<CFDataRef> pdfSnapshotAtSize(const WebCore::IntRect&, const WebCore::IntSize& bitmapSize, SnapshotOptions);
1514 #endif
1515
1516 #if ENABLE(ATTACHMENT_ELEMENT)
1517     RefPtr<WebCore::HTMLAttachmentElement> attachmentElementWithIdentifier(const String& identifier) const;
1518 #endif
1519
1520     bool canShowMIMEType(const String&, const Function<bool(const String&, WebCore::PluginData::AllowedPluginTypes)>& supportsPlugin) const;
1521
1522     void cancelGesturesBlockedOnSynchronousReplies();
1523
1524     uint64_t m_pageID;
1525
1526     std::unique_ptr<WebCore::Page> m_page;
1527     RefPtr<WebFrame> m_mainFrame;
1528
1529     RefPtr<WebPageGroupProxy> m_pageGroup;
1530
1531     String m_userAgent;
1532
1533     WebCore::IntSize m_viewSize;
1534     std::unique_ptr<DrawingArea> m_drawingArea;
1535     bool m_shouldResetDrawingAreaAfterSuspend { false };
1536
1537     HashSet<PluginView*> m_pluginViews;
1538     bool m_hasSeenPlugin { false };
1539
1540     HashMap<uint64_t, RefPtr<WebCore::TextCheckingRequest>> m_pendingTextCheckingRequestMap;
1541
1542     bool m_useFixedLayout { false };
1543     bool m_drawsBackground { true };
1544
1545     WebCore::Color m_underlayColor;
1546
1547     bool m_isInRedo { false };
1548     bool m_isClosed { false };
1549     bool m_tabToLinks { false };
1550     
1551     bool m_asynchronousPluginInitializationEnabled { false };
1552     bool m_asynchronousPluginInitializationEnabledForAllPlugins { false };
1553     bool m_artificialPluginInitializationDelayEnabled { false };
1554     bool m_scrollingPerformanceLoggingEnabled { false };
1555     bool m_mainFrameIsScrollable { true };
1556
1557     bool m_alwaysShowsHorizontalScroller { false };
1558     bool m_alwaysShowsVerticalScroller { false };
1559
1560 #if PLATFORM(IOS_FAMILY)
1561     bool m_ignoreViewportScalingConstraints { false };
1562 #endif
1563
1564 #if ENABLE(PRIMARY_SNAPSHOTTED_PLUGIN_HEURISTIC)
1565     bool m_readyToFindPrimarySnapshottedPlugin { false };
1566     bool m_didFindPrimarySnapshottedPlugin { false };
1567     unsigned m_numberOfPrimarySnapshotDetectionAttempts { 0 };
1568     String m_primaryPlugInPageOrigin;
1569     String m_primaryPlugInOrigin;
1570     String m_primaryPlugInMimeType;
1571     RunLoop::Timer<WebPage> m_determinePrimarySnapshottedPlugInTimer;
1572 #endif
1573
1574     // The layer hosting mode.
1575     LayerHostingMode m_layerHostingMode;
1576
1577 #if PLATFORM(COCOA)
1578     bool m_pdfPluginEnabled { false };
1579     bool m_hasCachedWindowFrame { false };
1580
1581     // The frame of the containing window in screen coordinates.
1582     WebCore::FloatRect m_windowFrameInScreenCoordinates;
1583
1584     // The frame of the containing window in unflipped screen coordinates.
1585     WebCore::FloatRect m_windowFrameInUnflippedScreenCoordinates;
1586
1587     // The frame of the view in window coordinates.
1588     WebCore::FloatRect m_viewFrameInWindowCoordinates;
1589
1590     // The accessibility position of the view.
1591     WebCore::FloatPoint m_accessibilityPosition;
1592     
1593     RetainPtr<WKAccessibilityWebPageObject> m_mockAccessibilityElement;
1594 #endif
1595
1596 #if PLATFORM(COCOA) || PLATFORM(GTK)
1597     std::unique_ptr<ViewGestureGeometryCollector> m_viewGestureGeometryCollector;
1598 #endif
1599
1600 #if PLATFORM(COCOA)
1601     RetainPtr<NSDictionary> m_dataDetectionContext;
1602 #endif
1603
1604 #if HAVE(ACCESSIBILITY) && PLATFORM(GTK)
1605     GRefPtr<WebPageAccessibilityObject> m_accessibilityObject;
1606 #endif
1607
1608 #if PLATFORM(GTK) && USE(TEXTURE_MAPPER_GL)
1609     // Our view's window in the UI process.
1610     uint64_t m_nativeWindowHandle { 0 };
1611 #endif
1612
1613 #if !PLATFORM(IOS_FAMILY)
1614     RefPtr<PageBanner> m_headerBanner;
1615     RefPtr<PageBanner> m_footerBanner;
1616 #endif
1617
1618     RunLoop::Timer<WebPage> m_setCanStartMediaTimer;
1619     bool m_mayStartMediaWhenInWindow { false };
1620
1621     HashMap<WebUndoStepID, RefPtr<WebUndoStep>> m_undoStepMap;
1622
1623 #if ENABLE(CONTEXT_MENUS)
1624     std::unique_ptr<API::InjectedBundle::PageContextMenuClient> m_contextMenuClient;
1625 #endif
1626     std::unique_ptr<API::InjectedBundle::EditorClient> m_editorClient;
1627     std::unique_ptr<API::InjectedBundle::FormClient> m_formClient;
1628     std::unique_ptr<API::InjectedBundle::PageLoaderClient> m_loaderClient;
1629     InjectedBundlePagePolicyClient m_policyClient;
1630     std::unique_ptr<API::InjectedBundle::ResourceLoadClient> m_resourceLoadClient;
1631     std::unique_ptr<API::InjectedBundle::PageUIClient> m_uiClient;
1632 #if ENABLE(FULLSCREEN_API)
1633     InjectedBundlePageFullScreenClient m_fullScreenClient;
1634 #endif
1635
1636     UniqueRef<FindController> m_findController;
1637
1638     RefPtr<WebInspector> m_inspector;
1639     RefPtr<WebInspectorUI> m_inspectorUI;
1640     RefPtr<RemoteWebInspectorUI> m_remoteInspectorUI;
1641     std::unique_ptr<WebPageInspectorTargetController> m_inspectorTargetController;
1642
1643 #if (PLATFORM(IOS_FAMILY) && HAVE(AVKIT)) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))
1644     RefPtr<PlaybackSessionManager> m_playbackSessionManager;
1645     RefPtr<VideoFullscreenManager> m_videoFullscreenManager;
1646 #endif
1647
1648 #if PLATFORM(IOS_FAMILY)
1649     bool m_allowsMediaDocumentInlinePlayback { false };
1650     RefPtr<WebCore::Range> m_startingGestureRange;
1651 #endif
1652
1653 #if ENABLE(FULLSCREEN_API)
1654     RefPtr<WebFullScreenManager> m_fullScreenManager;
1655 #endif
1656
1657     RefPtr<WebPopupMenu> m_activePopupMenu;
1658
1659 #if ENABLE(CONTEXT_MENUS)
1660     RefPtr<WebContextMenu> m_contextMenu;
1661 #endif
1662
1663 #if ENABLE(INPUT_TYPE_COLOR)
1664     WebColorChooser* m_activeColorChooser { nullptr };
1665 #endif
1666
1667 #if ENABLE(DATALIST_ELEMENT)
1668     WeakPtr<WebDataListSuggestionPicker> m_activeDataListSuggestionPicker;
1669 #endif
1670
1671     RefPtr<WebOpenPanelResultListener> m_activeOpenPanelResultListener;
1672     RefPtr<NotificationPermissionRequestManager> m_notificationPermissionRequestManager;
1673
1674     Ref<WebUserContentController> m_userContentController;
1675
1676 #if ENABLE(GEOLOCATION)
1677     UniqueRef<GeolocationPermissionRequestManager> m_geolocationPermissionRequestManager;
1678 #endif
1679
1680 #if ENABLE(MEDIA_STREAM)
1681     UniqueRef<UserMediaPermissionRequestManager> m_userMediaPermissionRequestManager;
1682 #endif
1683
1684     std::unique_ptr<WebCore::PrintContext> m_printContext;
1685 #if PLATFORM(GTK)
1686     RefPtr<WebPrintOperationGtk> m_printOperation;
1687 #endif
1688
1689     SandboxExtensionTracker m_sandboxExtensionTracker;
1690
1691     RefPtr<SandboxExtension> m_pendingDropSandboxExtension;
1692     Vector<RefPtr<SandboxExtension>> m_pendingDropExtensionsForFileUpload;
1693
1694     PAL::HysteresisActivity m_pageScrolledHysteresis;
1695
1696     bool m_canRunBeforeUnloadConfirmPanel { false };
1697
1698     bool m_canRunModal { false };
1699     bool m_isRunningModal { false };
1700
1701 #if ENABLE(DRAG_SUPPORT)
1702     bool m_isStartingDrag { false };
1703 #endif
1704
1705     bool m_cachedMainFrameIsPinnedToLeftSide { true };
1706     bool m_cachedMainFrameIsPinnedToRightSide { true };
1707     bool m_cachedMainFrameIsPinnedToTopSide { true };
1708     bool m_cachedMainFrameIsPinnedToBottomSide { true };
1709     bool m_canShortCircuitHorizontalWheelEvents { false };
1710     bool m_hasWheelEventHandlers { false };
1711
1712     unsigned m_cachedPageCount { 0 };
1713
1714     HashSet<unsigned long> m_trackedNetworkResourceRequestIdentifiers;
1715
1716     WebCore::IntSize m_viewLayoutSize;
1717     bool m_autoSizingShouldExpandToViewHeight { false };
1718     Optional<WebCore::IntSize> m_viewportSizeForCSSViewportUnits;
1719
1720     bool m_userIsInteracting { false };
1721     bool m_isFocusingElementDueToUserInteraction { false };
1722     bool m_hasEverFocusedElementDueToUserInteractionSincePageTransition { false };
1723     bool m_needsHiddenContentEditableQuirk { false };
1724     bool m_needsPlainTextQuirk { false };
1725     bool m_changingActivityState { false };
1726
1727 #if ENABLE(CONTEXT_MENUS)
1728     bool m_isShowingContextMenu { false };
1729 #endif
1730
1731     RefPtr<WebCore::Element> m_focusedElement;
1732     bool m_hasPendingBlurNotification { false };
1733     bool m_hasPendingEditorStateUpdate { false };
1734
1735 #if ENABLE(IOS_TOUCH_EVENTS)
1736     CompletionHandler<void(bool)> m_pendingSynchronousTouchEventReply;
1737 #endif
1738     
1739 #if PLATFORM(IOS_FAMILY)
1740     RefPtr<WebCore::Range> m_currentWordRange;
1741     RefPtr<WebCore::Node> m_interactionNode;
1742     WebCore::IntPoint m_lastInteractionLocation;
1743     
1744     enum SelectionAnchor { Start, End };
1745     SelectionAnchor m_selectionAnchor { Start };
1746
1747     RefPtr<WebCore::Node> m_potentialTapNode;
1748     WebCore::FloatPoint m_potentialTapLocation;
1749     RefPtr<WebCore::SecurityOrigin> m_potentialTapSecurityOrigin;
1750
1751     WebCore::ViewportConfiguration m_viewportConfiguration;
1752
1753     bool m_hasReceivedVisibleContentRectsAfterDidCommitLoad { false };
1754     bool m_hasRestoredExposedContentRectAfterDidCommitLoad { false };
1755     bool m_scaleWasSetByUIProcess { false };
1756     bool m_userHasChangedPageScaleFactor { false };
1757     bool m_hasStablePageScaleFactor { true };
1758     bool m_useTestingViewportConfiguration { false };
1759     bool m_isInStableState { true };
1760     bool m_forceAlwaysUserScalable { false };
1761     MonotonicTime m_oldestNonStableUpdateVisibleContentRectsTimestamp;
1762     Seconds m_estimatedLatency { 0 };
1763     WebCore::FloatSize m_screenSize;
1764     WebCore::FloatSize m_availableScreenSize;
1765     WebCore::FloatSize m_overrideScreenSize;
1766     RefPtr<WebCore::Range> m_currentBlockSelection;
1767     WebCore::IntRect m_blockRectForTextSelection;
1768
1769     RefPtr<WebCore::Range> m_initialSelection;
1770     WebCore::VisibleSelection m_storedSelectionForAccessibility { WebCore::VisibleSelection() };
1771     WebCore::IntSize m_blockSelectionDesiredSize;
1772     WebCore::FloatSize m_maximumUnobscuredSize;
1773     int32_t m_deviceOrientation { 0 };
1774     bool m_inDynamicSizeUpdate { false };
1775     HashMap<std::pair<WebCore::IntSize, double>, WebCore::IntPoint> m_dynamicSizeUpdateHistory;
1776     RefPtr<WebCore::Node> m_pendingSyntheticClickNode;
1777     WebCore::FloatPoint m_pendingSyntheticClickLocation;
1778     WebCore::FloatRect m_previousExposedContentRect;
1779     OptionSet<WebKit::WebEvent::Modifier> m_pendingSyntheticClickModifiers;
1780     FocusedElementIdentifier m_currentFocusedElementIdentifier { 0 };
1781     Optional<DynamicViewportSizeUpdateID> m_pendingDynamicViewportSizeUpdateID;
1782     double m_lastTransactionPageScaleFactor { 0 };
1783     uint64_t m_lastTransactionIDWithScaleChange { 0 };
1784
1785     CompletionHandler<void(InteractionInformationAtPosition&&)> m_pendingSynchronousPositionInformationReply;
1786 #endif
1787
1788     WebCore::Timer m_layerVolatilityTimer;
1789     Vector<WTF::Function<void (bool)>> m_markLayersAsVolatileCompletionHandlers;
1790     bool m_isSuspendedUnderLock { false };
1791
1792     HashSet<String, ASCIICaseInsensitiveHash> m_mimeTypesWithCustomContentProviders;
1793     Optional<WebCore::Color> m_backgroundColor { WebCore::Color::white };
1794
1795     HashSet<unsigned> m_activeRenderingSuppressionTokens;
1796     unsigned m_maximumRenderingSuppressionToken { 0 };
1797     
1798     WebCore::ScrollPinningBehavior m_scrollPinningBehavior { WebCore::DoNotPin };
1799     Optional<WebCore::ScrollbarOverlayStyle> m_scrollbarOverlayStyle;
1800
1801     bool m_useAsyncScrolling { false };
1802
1803     OptionSet<WebCore::ActivityState::Flag> m_activityState;
1804
1805     bool m_processSuppressionEnabled;
1806     UserActivity m_userActivity;
1807     PAL::HysteresisActivity m_userActivityHysteresis;
1808
1809     uint64_t m_pendingNavigationID { 0 };
1810     Optional<WebsitePoliciesData> m_pendingWebsitePolicies;
1811
1812     bool m_mainFrameProgressCompleted { false };
1813     bool m_shouldDispatchFakeMouseMoveEvents { true };
1814     bool m_isEditorStateMissingPostLayoutData { false };
1815     bool m_isSelectingTextWhileInsertingAsynchronously { false };
1816
1817     enum class EditorStateIsContentEditable { No, Yes, Unset };
1818     mutable EditorStateIsContentEditable m_lastEditorStateWasContentEditable { EditorStateIsContentEditable::Unset };
1819
1820 #if PLATFORM(GTK)
1821     bool m_inputMethodEnabled { false };
1822 #endif
1823
1824 #if ENABLE(VIDEO) && USE(GSTREAMER)
1825     RefPtr<WebCore::MediaPlayerRequestInstallMissingPluginsCallback> m_installMediaPluginsCallback;
1826 #endif
1827
1828 #if USE(OS_STATE)
1829     WallTime m_loadCommitTime;
1830 #endif
1831
1832     WebCore::UserInterfaceLayoutDirection m_userInterfaceLayoutDirection { WebCore::UserInterfaceLayoutDirection::LTR };
1833
1834     const String m_overrideContentSecurityPolicy;
1835     const Optional<double> m_cpuLimit;
1836
1837 #if PLATFORM(WPE)
1838     IPC::Attachment m_hostFileDescriptor;
1839 #endif
1840
1841     HashMap<String, RefPtr<WebURLSchemeHandlerProxy>> m_schemeToURLSchemeHandlerProxyMap;
1842     HashMap<uint64_t, WebURLSchemeHandlerProxy*> m_identifierToURLSchemeHandlerProxyMap;
1843
1844     HashMap<uint64_t, WTF::Function<void(bool granted)>> m_storageAccessResponseCallbackMap;
1845     HashMap<ShareSheetCallbackID, WTF::Function<void(bool completed)>> m_shareSheetResponseCallbackMap;
1846
1847 #if ENABLE(APPLICATION_MANIFEST)
1848     HashMap<uint64_t, uint64_t> m_applicationManifestFetchCallbackMap;
1849 #endif
1850
1851     OptionSet<LayerTreeFreezeReason> m_LayerTreeFreezeReasons;
1852     bool m_isSuspended { false };
1853     bool m_needsFontAttributes { false };
1854 #if PLATFORM(IOS_FAMILY)
1855     bool m_keyboardIsAttached { false };
1856 #endif
1857 };
1858
1859 } // namespace WebKit
1860