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