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