Remove UserMediaProcessManager processState map
[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 WebAutocorrectionContext;
254 struct WebPageCreationParameters;
255 struct WebPreferencesStore;
256 struct WebSelectionData;
257 struct WebsitePoliciesData;
258
259 using SnapshotOptions = uint32_t;
260 using WKEventModifiers = uint32_t;
261
262 class WebPage : public API::ObjectImpl<API::Object::Type::BundlePage>, public IPC::MessageReceiver, public IPC::MessageSender, public CanMakeWeakPtr<WebPage> {
263 public:
264     static Ref<WebPage> create(uint64_t pageID, WebPageCreationParameters&&);
265     virtual ~WebPage();
266
267     void reinitializeWebPage(WebPageCreationParameters&&);
268
269     void close();
270
271     static WebPage* fromCorePage(WebCore::Page*);
272
273     WebCore::Page* corePage() const { return m_page.get(); }
274     uint64_t pageID() const { return m_pageID; }
275     PAL::SessionID sessionID() const { return m_page->sessionID(); }
276     bool usesEphemeralSession() const { return m_page->usesEphemeralSession(); }
277
278     void setSessionID(PAL::SessionID);
279
280     void setSize(const WebCore::IntSize&);
281     const WebCore::IntSize& size() const { return m_viewSize; }
282     WebCore::IntRect bounds() const { return WebCore::IntRect(WebCore::IntPoint(), size()); }
283
284     DrawingArea* drawingArea() const { return m_drawingArea.get(); }
285
286 #if ENABLE(ASYNC_SCROLLING)
287     WebCore::ScrollingCoordinator* scrollingCoordinator() const;
288 #endif
289
290     WebPageGroupProxy* pageGroup() const { return m_pageGroup.get(); }
291
292     void scrollMainFrameIfNotAtMaxScrollPosition(const WebCore::IntSize& scrollOffset);
293
294     bool scrollBy(uint32_t scrollDirection, uint32_t scrollGranularity);
295
296     void centerSelectionInVisibleArea();
297
298 #if PLATFORM(COCOA)
299     void willCommitLayerTree(RemoteLayerTreeTransaction&);
300     void didFlushLayerTreeAtTime(MonotonicTime);
301 #endif
302
303     void willDisplayPage();
304
305     enum class LazyCreationPolicy { UseExistingOnly, CreateIfNeeded };
306
307     WebInspector* inspector(LazyCreationPolicy = LazyCreationPolicy::CreateIfNeeded);
308     WebInspectorUI* inspectorUI();
309     RemoteWebInspectorUI* remoteInspectorUI();
310     bool isInspectorPage() { return !!m_inspectorUI || !!m_remoteInspectorUI; }
311
312     void inspectorFrontendCountChanged(unsigned);
313
314 #if PLATFORM(IOS_FAMILY) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))
315     PlaybackSessionManager& playbackSessionManager();
316     VideoFullscreenManager& videoFullscreenManager();
317     void videoControlsManagerDidChange();
318 #endif
319
320 #if PLATFORM(IOS_FAMILY)
321     void setAllowsMediaDocumentInlinePlayback(bool);
322     bool allowsMediaDocumentInlinePlayback() const { return m_allowsMediaDocumentInlinePlayback; }
323 #endif
324
325 #if ENABLE(FULLSCREEN_API)
326     WebFullScreenManager* fullScreenManager();
327 #endif
328
329     void addConsoleMessage(uint64_t frameID, MessageSource, MessageLevel, const String&, uint64_t requestID = 0);
330     void sendCSPViolationReport(uint64_t frameID, const URL& reportURL, IPC::FormDataReference&&);
331     void enqueueSecurityPolicyViolationEvent(uint64_t frameID, WebCore::SecurityPolicyViolationEvent::Init&&);
332
333     // -- Called by the DrawingArea.
334     // FIXME: We could genericize these into a DrawingArea client interface. Would that be beneficial?
335     void drawRect(WebCore::GraphicsContext&, const WebCore::IntRect&);
336     void layoutIfNeeded();
337
338     // -- Called from WebCore clients.
339     bool handleEditingKeyboardEvent(WebCore::KeyboardEvent*);
340
341     void didStartPageTransition();
342     void didCompletePageTransition();
343     void didCommitLoad(WebFrame*);
344     void willReplaceMultipartContent(const WebFrame&);
345     void didReplaceMultipartContent(const WebFrame&);
346     void didFinishLoad(WebFrame*);
347     void show();
348     String userAgent(const URL&) const;
349     String userAgent(WebFrame*, 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(CallbackID);
645     void autocorrectionContextSync(CompletionHandler<void(WebAutocorrectionContext&&)>&&);
646     void getPositionInformation(const InteractionInformationRequest&, CompletionHandler<void(InteractionInformationAtPosition&&)>&&);
647     void requestPositionInformation(const InteractionInformationRequest&);
648     void startInteractionWithElementAtPosition(const WebCore::IntPoint&);
649     void stopInteraction();
650     void performActionOnElement(uint32_t action);
651     void focusNextFocusedElement(bool isForward, CallbackID);
652     void autofillLoginCredentials(const String&, const String&);
653     void setFocusedElementValue(const String&);
654     void setFocusedElementValueAsNumber(double);
655     void setFocusedElementSelectedIndex(uint32_t index, bool allowMultipleSelection);
656     void updateSelectionAppearance();
657     void getSelectionContext(CallbackID);
658     void handleTwoFingerTapAtPoint(const WebCore::IntPoint&, OptionSet<WebKit::WebEvent::Modifier>, uint64_t requestID);
659     void handleStylusSingleTapAtPoint(const WebCore::IntPoint&, uint64_t requestID);
660     void getRectsForGranularityWithSelectionOffset(uint32_t, int32_t, CallbackID);
661     void getRectsAtSelectionOffsetWithText(int32_t, const String&, CallbackID);
662     void storeSelectionForAccessibility(bool);
663     void startAutoscrollAtPosition(const WebCore::FloatPoint&);
664     void cancelAutoscroll();
665     void requestEvasionRectsAboveSelection(CompletionHandler<void(const Vector<WebCore::FloatRect>&)>&&);
666
667     void contentSizeCategoryDidChange(const String&);
668
669     Seconds eventThrottlingDelay() const;
670
671     void showInspectorHighlight(const WebCore::Highlight&);
672     void hideInspectorHighlight();
673
674     void showInspectorIndication();
675     void hideInspectorIndication();
676
677     void enableInspectorNodeSearch();
678     void disableInspectorNodeSearch();
679
680     bool forceAlwaysUserScalable() const { return m_forceAlwaysUserScalable; }
681     void setForceAlwaysUserScalable(bool);
682 #endif
683
684 #if PLATFORM(IOS_FAMILY) && ENABLE(IOS_TOUCH_EVENTS)
685     void dispatchAsynchronousTouchEvents(const Vector<WebTouchEvent, 1>& queue);
686 #endif
687
688     bool hasRichlyEditableSelection() const;
689
690     enum class LayerTreeFreezeReason {
691         PageTransition          = 1 << 0,
692         BackgroundApplication   = 1 << 1,
693         ProcessSuspended        = 1 << 2,
694         PageSuspended           = 1 << 3,
695         Printing                = 1 << 4,
696         ProcessSwap             = 1 << 5,
697     };
698     void freezeLayerTree(LayerTreeFreezeReason);
699     void unfreezeLayerTree(LayerTreeFreezeReason);
700
701     void markLayersVolatile(WTF::Function<void (bool)>&& completionHandler = { });
702     void cancelMarkLayersVolatile();
703
704     NotificationPermissionRequestManager* notificationPermissionRequestManager();
705
706     void pageDidScroll();
707
708 #if ENABLE(CONTEXT_MENUS)
709     WebContextMenu* contextMenu();
710     WebContextMenu* contextMenuAtPointInWindow(const WebCore::IntPoint&);
711 #endif
712
713     bool hasLocalDataForURL(const URL&);
714
715     static bool canHandleRequest(const WebCore::ResourceRequest&);
716
717     class SandboxExtensionTracker {
718     public:
719         ~SandboxExtensionTracker();
720
721         void invalidate();
722
723         void beginLoad(WebFrame*, SandboxExtension::Handle&&);
724         void beginReload(WebFrame*, SandboxExtension::Handle&&);
725         void willPerformLoadDragDestinationAction(RefPtr<SandboxExtension>&& pendingDropSandboxExtension);
726         void didStartProvisionalLoad(WebFrame*);
727         void didCommitProvisionalLoad(WebFrame*);
728         void didFailProvisionalLoad(WebFrame*);
729
730     private:
731         void setPendingProvisionalSandboxExtension(RefPtr<SandboxExtension>&&);
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();
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     void showShareSheet(WebCore::ShareDataWithParsedURL&, WTF::CompletionHandler<void(bool)>&& callback);
1114     void didCompleteShareSheet(bool wasCompleted, ShareSheetCallbackID contextId);
1115     
1116 #if ENABLE(ATTACHMENT_ELEMENT)
1117     void insertAttachment(const String& identifier, Optional<uint64_t>&& fileSize, const String& fileName, const String& contentType, CallbackID);
1118     void updateAttachmentAttributes(const String& identifier, Optional<uint64_t>&& fileSize, const String& contentType, const String& fileName, const IPC::DataReference& enclosingImageData, CallbackID);
1119 #endif
1120
1121 #if ENABLE(APPLICATION_MANIFEST)
1122     void getApplicationManifest(CallbackID);
1123     void didFinishLoadingApplicationManifest(uint64_t, const Optional<WebCore::ApplicationManifest>&);
1124 #endif
1125
1126 #if PLATFORM(WPE)
1127     int releaseHostFileDescriptor() { return m_hostFileDescriptor.releaseFileDescriptor(); }
1128 #endif
1129
1130     void updateCurrentModifierState(OptionSet<WebCore::PlatformEvent::Modifier> modifiers);
1131
1132     UserContentControllerIdentifier userContentControllerIdentifier() const { return m_userContentController->identifier(); }
1133
1134     WebCore::UserInterfaceLayoutDirection userInterfaceLayoutDirection() const { return m_userInterfaceLayoutDirection; }
1135
1136     bool isSuspended() const { return m_isSuspended; }
1137
1138     void didReceiveWebPageMessage(IPC::Connection&, IPC::Decoder&);
1139
1140     template<typename T>
1141     bool sendSyncWithDelayedReply(T&& message, typename T::Reply&& reply)
1142     {
1143         cancelGesturesBlockedOnSynchronousReplies();
1144         return sendSync(WTFMove(message), WTFMove(reply), m_pageID, Seconds::infinity(), IPC::SendSyncOption::InformPlatformProcessWillSuspend);
1145     }
1146
1147     bool requestDOMPasteAccess();
1148     WebCore::IntRect rectForElementAtInteractionLocation() const;
1149
1150     const Optional<WebCore::Color>& backgroundColor() const { return m_backgroundColor; }
1151
1152     void suspendAllMediaBuffering();
1153     void resumeAllMediaBuffering();
1154
1155 private:
1156     WebPage(uint64_t pageID, WebPageCreationParameters&&);
1157
1158     void updateThrottleState();
1159     void updateUserActivity();
1160
1161     // IPC::MessageSender
1162     IPC::Connection* messageSenderConnection() const override;
1163     uint64_t messageSenderDestinationID() const override;
1164
1165     void platformInitialize();
1166     void platformReinitialize();
1167     void platformDetach();
1168     void platformEditorState(WebCore::Frame&, EditorState& result, IncludePostLayoutDataHint) const;
1169     void sendEditorStateUpdate();
1170     void scheduleFullEditorStateUpdate();
1171
1172 #if PLATFORM(COCOA)
1173     void sendTouchBarMenuDataAddedUpdate(WebCore::HTMLMenuElement&);
1174     void sendTouchBarMenuDataRemovedUpdate(WebCore::HTMLMenuElement&);
1175     void sendTouchBarMenuItemDataAddedUpdate(WebCore::HTMLMenuItemElement&);
1176     void sendTouchBarMenuItemDataRemovedUpdate(WebCore::HTMLMenuItemElement&);
1177 #endif
1178
1179     void didReceiveSyncWebPageMessage(IPC::Connection&, IPC::Decoder&, std::unique_ptr<IPC::Encoder>&);
1180
1181 #if PLATFORM(IOS_FAMILY)
1182     void resetViewportDefaultConfiguration(WebFrame* mainFrame, bool hasMobileDocType = false);
1183     enum class ZoomToInitialScale { No, Yes };
1184     void viewportConfigurationChanged(ZoomToInitialScale = ZoomToInitialScale::No);
1185     void updateViewportSizeForCSSViewportUnits();
1186
1187     static void convertSelectionRectsToRootView(WebCore::FrameView*, Vector<WebCore::SelectionRect>&);
1188     RefPtr<WebCore::Range> rangeForWebSelectionAtPosition(const WebCore::IntPoint&, const WebCore::VisiblePosition&, SelectionFlags&);
1189     void getFocusedElementInformation(FocusedElementInformation&);
1190     void platformInitializeAccessibility();
1191     void handleSyntheticClick(WebCore::Node* nodeRespondingToClick, const WebCore::FloatPoint& location, OptionSet<WebKit::WebEvent::Modifier>);
1192     void completeSyntheticClick(WebCore::Node* nodeRespondingToClick, const WebCore::FloatPoint& location, OptionSet<WebKit::WebEvent::Modifier>, WebCore::SyntheticClickType);
1193     void sendTapHighlightForNodeIfNecessary(uint64_t requestID, WebCore::Node*);
1194     void resetTextAutosizing();
1195     WebCore::VisiblePosition visiblePositionInFocusedNodeForPoint(const WebCore::Frame&, const WebCore::IntPoint&, bool isInteractingWithFocusedElement);
1196     RefPtr<WebCore::Range> rangeForGranularityAtPoint(WebCore::Frame&, const WebCore::IntPoint&, uint32_t granularity, bool isInteractingWithFocusedElement);
1197
1198     void sendPositionInformation(InteractionInformationAtPosition&&);
1199     InteractionInformationAtPosition positionInformation(const InteractionInformationRequest&);
1200     WebAutocorrectionContext autocorrectionContext();
1201     bool applyAutocorrectionInternal(const String& correction, const String& originalText);
1202 #endif
1203
1204 #if PLATFORM(IOS_FAMILY) && ENABLE(DATA_INTERACTION)
1205     void requestDragStart(const WebCore::IntPoint& clientPosition, const WebCore::IntPoint& globalPosition);
1206     void requestAdditionalItemsForDragSession(const WebCore::IntPoint& clientPosition, const WebCore::IntPoint& globalPosition);
1207 #endif
1208
1209 #if !PLATFORM(COCOA) && !PLATFORM(WPE)
1210     static const char* interpretKeyEvent(const WebCore::KeyboardEvent*);
1211 #endif
1212
1213     bool performDefaultBehaviorForKeyEvent(const WebKeyboardEvent&);
1214
1215 #if PLATFORM(MAC)
1216     bool executeKeypressCommandsInternal(const Vector<WebCore::KeypressCommand>&, WebCore::KeyboardEvent*);
1217 #endif
1218
1219     void updateDrawingAreaLayerTreeFreezeState();
1220     bool markLayersVolatileImmediatelyIfPossible();
1221     void layerVolatilityTimerFired();
1222     void callVolatilityCompletionHandlers(bool succeeded);
1223
1224     String sourceForFrame(WebFrame*);
1225
1226     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&);
1227
1228     // Actions
1229     void tryClose();
1230     void platformDidReceiveLoadParameters(const LoadParameters&);
1231     void loadRequest(LoadParameters&&);
1232     void loadData(LoadParameters&&);
1233     void loadAlternateHTML(LoadParameters&&);
1234     void navigateToPDFLinkWithSimulatedClick(const String& url, WebCore::IntPoint documentPoint, WebCore::IntPoint screenPoint);
1235     void reload(uint64_t navigationID, uint32_t reloadOptions, SandboxExtension::Handle&&);
1236     void goToBackForwardItem(uint64_t navigationID, const WebCore::BackForwardItemIdentifier&, WebCore::FrameLoadType, WebCore::ShouldTreatAsContinuingLoad, Optional<WebsitePoliciesData>&&);
1237     void tryRestoreScrollPosition();
1238     void setInitialFocus(bool forward, bool isKeyboardEventValid, const WebKeyboardEvent&, CallbackID);
1239     void updateIsInWindow(bool isInitialState = false);
1240     void visibilityDidChange();
1241     void setActivityState(OptionSet<WebCore::ActivityState::Flag>, ActivityStateChangeID, const Vector<CallbackID>& callbackIDs);
1242     void validateCommand(const String&, CallbackID);
1243     void executeEditCommand(const String&, const String&);
1244     void setEditable(bool);
1245
1246     void increaseListLevel();
1247     void decreaseListLevel();
1248     void changeListType();
1249
1250     void setBaseWritingDirection(WebCore::WritingDirection);
1251
1252     void setNeedsFontAttributes(bool);
1253
1254     void mouseEvent(const WebMouseEvent&);
1255     void keyEvent(const WebKeyboardEvent&);
1256
1257 #if ENABLE(IOS_TOUCH_EVENTS)
1258     void touchEventSync(const WebTouchEvent&, CompletionHandler<void(bool)>&&);
1259     void updatePotentialTapSecurityOrigin(const WebTouchEvent&, bool wasHandled);
1260 #elif ENABLE(TOUCH_EVENTS)
1261     void touchEvent(const WebTouchEvent&);
1262 #endif
1263
1264 #if ENABLE(POINTER_EVENTS)
1265     void cancelPointer(WebCore::PointerID, const WebCore::IntPoint&);
1266 #endif
1267
1268 #if ENABLE(CONTEXT_MENUS)
1269     void contextMenuHidden() { m_isShowingContextMenu = false; }
1270     void contextMenuForKeyEvent();
1271 #endif
1272
1273     static bool scroll(WebCore::Page*, WebCore::ScrollDirection, WebCore::ScrollGranularity);
1274     static bool logicalScroll(WebCore::Page*, WebCore::ScrollLogicalDirection, WebCore::ScrollGranularity);
1275
1276     void loadURLInFrame(URL&&, uint64_t frameID);
1277
1278     enum class WasRestoredByAPIRequest { No, Yes };
1279     void restoreSessionInternal(const Vector<BackForwardListItemState>&, WasRestoredByAPIRequest, WebBackForwardListProxy::OverwriteExistingItem);
1280     void restoreSession(const Vector<BackForwardListItemState>&);
1281     void didRemoveBackForwardItem(const WebCore::BackForwardItemIdentifier&);
1282     void updateBackForwardListForReattach(const Vector<WebKit::BackForwardListItemState>&);
1283     void setCurrentHistoryItemForReattach(WebKit::BackForwardListItemState&&);
1284
1285     void requestFontAttributesAtSelectionStart(CallbackID);
1286
1287 #if ENABLE(REMOTE_INSPECTOR)
1288     void setIndicating(bool);
1289 #endif
1290
1291     void setBackgroundColor(const Optional<WebCore::Color>&);
1292
1293 #if PLATFORM(COCOA)
1294     void setTopContentInsetFenced(float, IPC::Attachment);
1295 #endif
1296     void setTopContentInset(float);
1297
1298     void viewWillStartLiveResize();
1299     void viewWillEndLiveResize();
1300
1301     void getContentsAsString(CallbackID);
1302 #if ENABLE(MHTML)
1303     void getContentsAsMHTMLData(CallbackID);
1304 #endif
1305     void getMainResourceDataOfFrame(uint64_t frameID, CallbackID);
1306     void getResourceDataFromFrame(uint64_t frameID, const String& resourceURL, CallbackID);
1307     void getRenderTreeExternalRepresentation(CallbackID);
1308     void getSelectionOrContentsAsString(CallbackID);
1309     void getSelectionAsWebArchiveData(CallbackID);
1310     void getSourceForFrame(uint64_t frameID, CallbackID);
1311     void getWebArchiveOfFrame(uint64_t frameID, CallbackID);
1312     void runJavaScript(const String&, bool forceUserGesture, Optional<String> worldName, CallbackID);
1313     void runJavaScriptInMainFrame(const String&, bool forceUserGesture, CallbackID);
1314     void runJavaScriptInMainFrameScriptWorld(const String&, bool forceUserGesture, const String& worldName, CallbackID);
1315     void forceRepaint(CallbackID);
1316     void takeSnapshot(WebCore::IntRect snapshotRect, WebCore::IntSize bitmapSize, uint32_t options, CallbackID);
1317
1318     void preferencesDidChange(const WebPreferencesStore&);
1319     void updatePreferences(const WebPreferencesStore&);
1320     void updatePreferencesGenerated(const WebPreferencesStore&);
1321
1322 #if PLATFORM(IOS_FAMILY)
1323     bool parentProcessHasServiceWorkerEntitlement() const;
1324 #else
1325     bool parentProcessHasServiceWorkerEntitlement() const { return true; }
1326 #endif
1327
1328     void didReceivePolicyDecision(uint64_t frameID, uint64_t listenerID, WebCore::PolicyCheckIdentifier, WebCore::PolicyAction, uint64_t navigationID, const DownloadID&, Optional<WebsitePoliciesData>&&);
1329     void continueWillSubmitForm(uint64_t frameID, uint64_t listenerID);
1330     void setUserAgent(const String&);
1331     void setCustomTextEncodingName(const String&);
1332     void suspendActiveDOMObjectsAndAnimations();
1333     void resumeActiveDOMObjectsAndAnimations();
1334
1335 #if PLATFORM(COCOA)
1336     void performDictionaryLookupAtLocation(const WebCore::FloatPoint&);
1337     void performDictionaryLookupOfCurrentSelection();
1338     void performDictionaryLookupForRange(WebCore::Frame&, WebCore::Range&, NSDictionary *options, WebCore::TextIndicatorPresentationTransition);
1339     WebCore::DictionaryPopupInfo dictionaryPopupInfoForRange(WebCore::Frame&, WebCore::Range&, NSDictionary *options, WebCore::TextIndicatorPresentationTransition);
1340 #if ENABLE(PDFKIT_PLUGIN)
1341     WebCore::DictionaryPopupInfo dictionaryPopupInfoForSelectionInPDFPlugin(PDFSelection *, PDFPlugin&, NSDictionary *options, WebCore::TextIndicatorPresentationTransition);
1342 #endif
1343
1344     void windowAndViewFramesChanged(const WebCore::FloatRect& windowFrameInScreenCoordinates, const WebCore::FloatRect& windowFrameInUnflippedScreenCoordinates, const WebCore::FloatRect& viewFrameInWindowCoordinates, const WebCore::FloatPoint& accessibilityViewCoordinates);
1345
1346     RetainPtr<PDFDocument> pdfDocumentForPrintingFrame(WebCore::Frame*);
1347     void computePagesForPrintingPDFDocument(uint64_t frameID, const PrintInfo&, Vector<WebCore::IntRect>& resultPageRects);
1348     void drawPDFDocument(CGContextRef, PDFDocument *, const PrintInfo&, const WebCore::IntRect&);
1349     void drawPagesToPDFFromPDFDocument(CGContextRef, PDFDocument *, const PrintInfo&, uint32_t first, uint32_t count);
1350 #endif
1351
1352     void setMainFrameIsScrollable(bool);
1353
1354     void unapplyEditCommand(WebUndoStepID commandID);
1355     void reapplyEditCommand(WebUndoStepID commandID);
1356     void didRemoveEditCommand(WebUndoStepID commandID);
1357
1358     void findString(const String&, uint32_t findOptions, uint32_t maxMatchCount);
1359     void findStringMatches(const String&, uint32_t findOptions, uint32_t maxMatchCount);
1360     void getImageForFindMatch(uint32_t matchIndex);
1361     void selectFindMatch(uint32_t matchIndex);
1362     void hideFindUI();
1363     void countStringMatches(const String&, uint32_t findOptions, uint32_t maxMatchCount);
1364     void replaceMatches(const Vector<uint32_t>& matchIndices, const String& replacementText, bool selectionOnly, CallbackID);
1365
1366 #if USE(COORDINATED_GRAPHICS)
1367     void sendViewportAttributesChanged(const WebCore::ViewportArguments&);
1368 #endif
1369
1370     void didChangeSelectedIndexForActivePopupMenu(int32_t newIndex);
1371     void setTextForActivePopupMenu(int32_t index);
1372
1373 #if PLATFORM(GTK)
1374     void failedToShowPopupMenu();
1375 #endif
1376
1377     void didChooseFilesForOpenPanel(const Vector<String>&);
1378     void didCancelForOpenPanel();
1379
1380 #if PLATFORM(IOS_FAMILY)
1381     void didChooseFilesForOpenPanelWithDisplayStringAndIcon(const Vector<String>&, const String& displayString, const IPC::DataReference& iconData);
1382 #endif
1383
1384 #if ENABLE(SANDBOX_EXTENSIONS)
1385     void extendSandboxForFilesFromOpenPanel(SandboxExtension::HandleArray&&);
1386 #endif
1387
1388     void didReceiveGeolocationPermissionDecision(uint64_t geolocationID, bool allowed);
1389
1390     void didReceiveNotificationPermissionDecision(uint64_t notificationID, bool allowed);
1391
1392 #if ENABLE(MEDIA_STREAM)
1393     void userMediaAccessWasGranted(uint64_t userMediaID, WebCore::CaptureDevice&& audioDeviceUID, WebCore::CaptureDevice&& videoDeviceUID, String&& mediaDeviceIdentifierHashSalt);
1394     void userMediaAccessWasDenied(uint64_t userMediaID, uint64_t reason, String&& invalidConstraint);
1395
1396     void didCompleteMediaDeviceEnumeration(uint64_t userMediaID, const Vector<WebCore::CaptureDevice>& devices, String&& deviceIdentifierHashSalt, bool originHasPersistentAccess);
1397 #endif
1398
1399 #if ENABLE(WEB_RTC)
1400     void disableICECandidateFiltering();
1401     void enableICECandidateFiltering();
1402 #endif
1403
1404 #if ENABLE(WEB_RTC) && USE(LIBWEBRTC)
1405     void disableEnumeratingAllNetworkInterfaces();
1406     void enableEnumeratingAllNetworkInterfaces();
1407 #endif
1408
1409     void stopAllMediaPlayback();
1410     void suspendAllMediaPlayback();
1411     void resumeAllMediaPlayback();
1412
1413     void advanceToNextMisspelling(bool startBeforeSelection);
1414     void changeSpellingToWord(const String& word);
1415
1416 #if USE(APPKIT)
1417     void uppercaseWord();
1418     void lowercaseWord();
1419     void capitalizeWord();
1420 #endif
1421
1422 #if ENABLE(CONTEXT_MENUS)
1423     void didSelectItemFromActiveContextMenu(const WebContextMenuItemData&);
1424 #endif
1425
1426     void changeSelectedIndex(int32_t index);
1427     void setCanStartMediaTimerFired();
1428
1429     static bool platformCanHandleRequest(const WebCore::ResourceRequest&);
1430
1431     static PluginView* focusedPluginViewForFrame(WebCore::Frame&);
1432
1433     static RefPtr<WebCore::Range> rangeFromEditingRange(WebCore::Frame&, const EditingRange&, EditingRangeIsRelativeTo = EditingRangeIsRelativeTo::EditableRoot);
1434
1435     void reportUsedFeatures();
1436
1437     void updateWebsitePolicies(WebsitePoliciesData&&);
1438
1439     void changeFont(WebCore::FontChanges&&);
1440     void changeFontAttributes(WebCore::FontAttributeChanges&&);
1441
1442 #if PLATFORM(MAC)
1443     void performImmediateActionHitTestAtLocation(WebCore::FloatPoint);
1444     std::tuple<RefPtr<WebCore::Range>, NSDictionary *> lookupTextAtLocation(WebCore::FloatPoint);
1445     void immediateActionDidUpdate();
1446     void immediateActionDidCancel();
1447     void immediateActionDidComplete();
1448
1449     void dataDetectorsDidPresentUI(WebCore::PageOverlay::PageOverlayID);
1450     void dataDetectorsDidChangeUI(WebCore::PageOverlay::PageOverlayID);
1451     void dataDetectorsDidHideUI(WebCore::PageOverlay::PageOverlayID);
1452
1453     void handleAcceptedCandidate(WebCore::TextCheckingResult);
1454 #endif
1455
1456 #if PLATFORM(COCOA)
1457     void requestActiveNowPlayingSessionInfo(CallbackID);
1458     RetainPtr<NSData> accessibilityRemoteTokenData() const;
1459     void accessibilityTransferRemoteToken(RetainPtr<NSData>);
1460 #endif
1461
1462     void setShouldDispatchFakeMouseMoveEvents(bool dispatch) { m_shouldDispatchFakeMouseMoveEvents = dispatch; }
1463
1464 #if ENABLE(WIRELESS_PLAYBACK_TARGET) && !PLATFORM(IOS_FAMILY)
1465     void playbackTargetSelected(uint64_t, const WebCore::MediaPlaybackTargetContext& outputDevice) const;
1466     void playbackTargetAvailabilityDidChange(uint64_t, bool);
1467     void setShouldPlayToPlaybackTarget(uint64_t, bool);
1468 #endif
1469
1470     void clearWheelEventTestTrigger();
1471
1472     void setShouldScaleViewToFitDocument(bool);
1473
1474     void pageStoppedScrolling();
1475
1476 #if ENABLE(VIDEO) && USE(GSTREAMER)
1477     void didEndRequestInstallMissingMediaPlugins(uint32_t result);
1478 #endif
1479
1480     void setResourceCachingDisabled(bool);
1481     void setUserInterfaceLayoutDirection(uint32_t);
1482
1483     bool canPluginHandleResponse(const WebCore::ResourceResponse&);
1484
1485 #if USE(QUICK_LOOK)
1486     void didReceivePasswordForQuickLookDocument(const String&);
1487 #endif
1488
1489     void simulateDeviceOrientationChange(double alpha, double beta, double gamma);
1490
1491     void frameBecameRemote(uint64_t frameID, WebCore::GlobalFrameIdentifier&& remoteFrameIdentifier, WebCore::GlobalWindowIdentifier&& remoteWindowIdentifier);
1492
1493     void registerURLSchemeHandler(uint64_t identifier, const String& scheme);
1494
1495     void urlSchemeTaskDidPerformRedirection(uint64_t handlerIdentifier, uint64_t taskIdentifier, WebCore::ResourceResponse&&, WebCore::ResourceRequest&&);
1496     void urlSchemeTaskDidReceiveResponse(uint64_t handlerIdentifier, uint64_t taskIdentifier, const WebCore::ResourceResponse&);
1497     void urlSchemeTaskDidReceiveData(uint64_t handlerIdentifier, uint64_t taskIdentifier, const IPC::DataReference&);
1498     void urlSchemeTaskDidComplete(uint64_t handlerIdentifier, uint64_t taskIdentifier, const WebCore::ResourceError&);
1499
1500     void setIsSuspended(bool);
1501
1502     RefPtr<WebImage> snapshotAtSize(const WebCore::IntRect&, const WebCore::IntSize& bitmapSize, SnapshotOptions);
1503     RefPtr<WebImage> snapshotNode(WebCore::Node&, SnapshotOptions, unsigned maximumPixelCount = std::numeric_limits<unsigned>::max());
1504 #if USE(CF)
1505     RetainPtr<CFDataRef> pdfSnapshotAtSize(const WebCore::IntRect&, const WebCore::IntSize& bitmapSize, SnapshotOptions);
1506 #endif
1507
1508 #if ENABLE(ATTACHMENT_ELEMENT)
1509     RefPtr<WebCore::HTMLAttachmentElement> attachmentElementWithIdentifier(const String& identifier) const;
1510 #endif
1511
1512     bool canShowMIMEType(const String&, const Function<bool(const String&, WebCore::PluginData::AllowedPluginTypes)>& supportsPlugin) const;
1513
1514     void cancelGesturesBlockedOnSynchronousReplies();
1515
1516     uint64_t m_pageID;
1517
1518     std::unique_ptr<WebCore::Page> m_page;
1519     RefPtr<WebFrame> m_mainFrame;
1520
1521     RefPtr<WebPageGroupProxy> m_pageGroup;
1522
1523     String m_userAgent;
1524
1525     WebCore::IntSize m_viewSize;
1526     std::unique_ptr<DrawingArea> m_drawingArea;
1527     bool m_shouldResetDrawingAreaAfterSuspend { false };
1528
1529     HashSet<PluginView*> m_pluginViews;
1530     bool m_hasSeenPlugin { false };
1531
1532     HashMap<uint64_t, RefPtr<WebCore::TextCheckingRequest>> m_pendingTextCheckingRequestMap;
1533
1534     bool m_useFixedLayout { false };
1535     bool m_drawsBackground { true };
1536
1537     WebCore::Color m_underlayColor;
1538
1539     bool m_isInRedo { false };
1540     bool m_isClosed { false };
1541     bool m_tabToLinks { false };
1542     
1543     bool m_asynchronousPluginInitializationEnabled { false };
1544     bool m_asynchronousPluginInitializationEnabledForAllPlugins { false };
1545     bool m_artificialPluginInitializationDelayEnabled { false };
1546     bool m_scrollingPerformanceLoggingEnabled { false };
1547     bool m_mainFrameIsScrollable { true };
1548
1549     bool m_alwaysShowsHorizontalScroller { false };
1550     bool m_alwaysShowsVerticalScroller { false };
1551
1552 #if PLATFORM(IOS_FAMILY)
1553     bool m_ignoreViewportScalingConstraints { false };
1554 #endif
1555
1556 #if ENABLE(PRIMARY_SNAPSHOTTED_PLUGIN_HEURISTIC)
1557     bool m_readyToFindPrimarySnapshottedPlugin { false };
1558     bool m_didFindPrimarySnapshottedPlugin { false };
1559     unsigned m_numberOfPrimarySnapshotDetectionAttempts { 0 };
1560     String m_primaryPlugInPageOrigin;
1561     String m_primaryPlugInOrigin;
1562     String m_primaryPlugInMimeType;
1563     RunLoop::Timer<WebPage> m_determinePrimarySnapshottedPlugInTimer;
1564 #endif
1565
1566     // The layer hosting mode.
1567     LayerHostingMode m_layerHostingMode;
1568
1569 #if PLATFORM(COCOA)
1570     bool m_pdfPluginEnabled { false };
1571     bool m_hasCachedWindowFrame { false };
1572
1573     // The frame of the containing window in screen coordinates.
1574     WebCore::FloatRect m_windowFrameInScreenCoordinates;
1575
1576     // The frame of the containing window in unflipped screen coordinates.
1577     WebCore::FloatRect m_windowFrameInUnflippedScreenCoordinates;
1578
1579     // The frame of the view in window coordinates.
1580     WebCore::FloatRect m_viewFrameInWindowCoordinates;
1581
1582     // The accessibility position of the view.
1583     WebCore::FloatPoint m_accessibilityPosition;
1584     
1585     RetainPtr<WKAccessibilityWebPageObject> m_mockAccessibilityElement;
1586 #endif
1587
1588 #if PLATFORM(COCOA) || PLATFORM(GTK)
1589     std::unique_ptr<ViewGestureGeometryCollector> m_viewGestureGeometryCollector;
1590 #endif
1591
1592 #if PLATFORM(COCOA)
1593     RetainPtr<NSDictionary> m_dataDetectionContext;
1594 #endif
1595
1596 #if HAVE(ACCESSIBILITY) && PLATFORM(GTK)
1597     GRefPtr<WebPageAccessibilityObject> m_accessibilityObject;
1598 #endif
1599
1600 #if PLATFORM(GTK) && USE(TEXTURE_MAPPER_GL)
1601     // Our view's window in the UI process.
1602     uint64_t m_nativeWindowHandle { 0 };
1603 #endif
1604
1605 #if !PLATFORM(IOS_FAMILY)
1606     RefPtr<PageBanner> m_headerBanner;
1607     RefPtr<PageBanner> m_footerBanner;
1608 #endif
1609
1610     RunLoop::Timer<WebPage> m_setCanStartMediaTimer;
1611     bool m_mayStartMediaWhenInWindow { false };
1612
1613     HashMap<WebUndoStepID, RefPtr<WebUndoStep>> m_undoStepMap;
1614
1615 #if ENABLE(CONTEXT_MENUS)
1616     std::unique_ptr<API::InjectedBundle::PageContextMenuClient> m_contextMenuClient;
1617 #endif
1618     std::unique_ptr<API::InjectedBundle::EditorClient> m_editorClient;
1619     std::unique_ptr<API::InjectedBundle::FormClient> m_formClient;
1620     std::unique_ptr<API::InjectedBundle::PageLoaderClient> m_loaderClient;
1621     InjectedBundlePagePolicyClient m_policyClient;
1622     std::unique_ptr<API::InjectedBundle::ResourceLoadClient> m_resourceLoadClient;
1623     std::unique_ptr<API::InjectedBundle::PageUIClient> m_uiClient;
1624 #if ENABLE(FULLSCREEN_API)
1625     InjectedBundlePageFullScreenClient m_fullScreenClient;
1626 #endif
1627
1628     UniqueRef<FindController> m_findController;
1629
1630     RefPtr<WebInspector> m_inspector;
1631     RefPtr<WebInspectorUI> m_inspectorUI;
1632     RefPtr<RemoteWebInspectorUI> m_remoteInspectorUI;
1633     std::unique_ptr<WebPageInspectorTargetController> m_inspectorTargetController;
1634
1635 #if (PLATFORM(IOS_FAMILY) && HAVE(AVKIT)) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))
1636     RefPtr<PlaybackSessionManager> m_playbackSessionManager;
1637     RefPtr<VideoFullscreenManager> m_videoFullscreenManager;
1638 #endif
1639
1640 #if PLATFORM(IOS_FAMILY)
1641     bool m_allowsMediaDocumentInlinePlayback { false };
1642     RefPtr<WebCore::Range> m_startingGestureRange;
1643 #endif
1644
1645 #if ENABLE(FULLSCREEN_API)
1646     RefPtr<WebFullScreenManager> m_fullScreenManager;
1647 #endif
1648
1649     RefPtr<WebPopupMenu> m_activePopupMenu;
1650
1651 #if ENABLE(CONTEXT_MENUS)
1652     RefPtr<WebContextMenu> m_contextMenu;
1653 #endif
1654
1655 #if ENABLE(INPUT_TYPE_COLOR)
1656     WebColorChooser* m_activeColorChooser { nullptr };
1657 #endif
1658
1659 #if ENABLE(DATALIST_ELEMENT)
1660     WebDataListSuggestionPicker* m_activeDataListSuggestionPicker { nullptr };
1661 #endif
1662
1663     RefPtr<WebOpenPanelResultListener> m_activeOpenPanelResultListener;
1664     RefPtr<NotificationPermissionRequestManager> m_notificationPermissionRequestManager;
1665
1666     Ref<WebUserContentController> m_userContentController;
1667
1668 #if ENABLE(GEOLOCATION)
1669     UniqueRef<GeolocationPermissionRequestManager> m_geolocationPermissionRequestManager;
1670 #endif
1671
1672 #if ENABLE(MEDIA_STREAM)
1673     UniqueRef<UserMediaPermissionRequestManager> m_userMediaPermissionRequestManager;
1674 #endif
1675
1676     std::unique_ptr<WebCore::PrintContext> m_printContext;
1677 #if PLATFORM(GTK)
1678     RefPtr<WebPrintOperationGtk> m_printOperation;
1679 #endif
1680
1681     SandboxExtensionTracker m_sandboxExtensionTracker;
1682
1683     RefPtr<SandboxExtension> m_pendingDropSandboxExtension;
1684     Vector<RefPtr<SandboxExtension>> m_pendingDropExtensionsForFileUpload;
1685
1686     PAL::HysteresisActivity m_pageScrolledHysteresis;
1687
1688     bool m_canRunBeforeUnloadConfirmPanel { false };
1689
1690     bool m_canRunModal { false };
1691     bool m_isRunningModal { false };
1692
1693 #if ENABLE(DRAG_SUPPORT)
1694     bool m_isStartingDrag { false };
1695 #endif
1696
1697     bool m_cachedMainFrameIsPinnedToLeftSide { true };
1698     bool m_cachedMainFrameIsPinnedToRightSide { true };
1699     bool m_cachedMainFrameIsPinnedToTopSide { true };
1700     bool m_cachedMainFrameIsPinnedToBottomSide { true };
1701     bool m_canShortCircuitHorizontalWheelEvents { false };
1702     bool m_hasWheelEventHandlers { false };
1703
1704     unsigned m_cachedPageCount { 0 };
1705
1706     HashSet<unsigned long> m_trackedNetworkResourceRequestIdentifiers;
1707
1708     WebCore::IntSize m_viewLayoutSize;
1709     bool m_autoSizingShouldExpandToViewHeight { false };
1710     Optional<WebCore::IntSize> m_viewportSizeForCSSViewportUnits;
1711
1712     bool m_userIsInteracting { false };
1713     bool m_isFocusingElementDueToUserInteraction { false };
1714     bool m_hasEverFocusedElementDueToUserInteractionSincePageTransition { false };
1715     bool m_needsHiddenContentEditableQuirk { false };
1716     bool m_needsPlainTextQuirk { false };
1717     bool m_changingActivityState { false };
1718
1719 #if ENABLE(CONTEXT_MENUS)
1720     bool m_isShowingContextMenu { false };
1721 #endif
1722
1723     RefPtr<WebCore::Element> m_focusedElement;
1724     bool m_hasPendingBlurNotification { false };
1725     bool m_hasPendingEditorStateUpdate { false };
1726
1727 #if ENABLE(IOS_TOUCH_EVENTS)
1728     CompletionHandler<void(bool)> m_pendingSynchronousTouchEventReply;
1729 #endif
1730     
1731 #if PLATFORM(IOS_FAMILY)
1732     RefPtr<WebCore::Range> m_currentWordRange;
1733     RefPtr<WebCore::Node> m_interactionNode;
1734     WebCore::IntPoint m_lastInteractionLocation;
1735     
1736     enum SelectionAnchor { Start, End };
1737     SelectionAnchor m_selectionAnchor { Start };
1738
1739     RefPtr<WebCore::Node> m_potentialTapNode;
1740     WebCore::FloatPoint m_potentialTapLocation;
1741     RefPtr<WebCore::SecurityOrigin> m_potentialTapSecurityOrigin;
1742
1743     WebCore::ViewportConfiguration m_viewportConfiguration;
1744
1745     bool m_hasReceivedVisibleContentRectsAfterDidCommitLoad { false };
1746     bool m_hasRestoredExposedContentRectAfterDidCommitLoad { false };
1747     bool m_scaleWasSetByUIProcess { false };
1748     bool m_userHasChangedPageScaleFactor { false };
1749     bool m_hasStablePageScaleFactor { true };
1750     bool m_useTestingViewportConfiguration { false };
1751     bool m_isInStableState { true };
1752     bool m_forceAlwaysUserScalable { false };
1753     MonotonicTime m_oldestNonStableUpdateVisibleContentRectsTimestamp;
1754     Seconds m_estimatedLatency { 0 };
1755     WebCore::FloatSize m_screenSize;
1756     WebCore::FloatSize m_availableScreenSize;
1757     WebCore::FloatSize m_overrideScreenSize;
1758     RefPtr<WebCore::Range> m_currentBlockSelection;
1759     WebCore::IntRect m_blockRectForTextSelection;
1760
1761     RefPtr<WebCore::Range> m_initialSelection;
1762     WebCore::VisibleSelection m_storedSelectionForAccessibility { WebCore::VisibleSelection() };
1763     WebCore::IntSize m_blockSelectionDesiredSize;
1764     WebCore::FloatSize m_maximumUnobscuredSize;
1765     int32_t m_deviceOrientation { 0 };
1766     bool m_inDynamicSizeUpdate { false };
1767     HashMap<std::pair<WebCore::IntSize, double>, WebCore::IntPoint> m_dynamicSizeUpdateHistory;
1768     RefPtr<WebCore::Node> m_pendingSyntheticClickNode;
1769     WebCore::FloatPoint m_pendingSyntheticClickLocation;
1770     WebCore::FloatRect m_previousExposedContentRect;
1771     OptionSet<WebKit::WebEvent::Modifier> m_pendingSyntheticClickModifiers;
1772     FocusedElementIdentifier m_currentFocusedElementIdentifier { 0 };
1773     Optional<DynamicViewportSizeUpdateID> m_pendingDynamicViewportSizeUpdateID;
1774     double m_lastTransactionPageScaleFactor { 0 };
1775     uint64_t m_lastTransactionIDWithScaleChange { 0 };
1776
1777     CompletionHandler<void(InteractionInformationAtPosition&&)> m_pendingSynchronousPositionInformationReply;
1778 #endif
1779
1780     WebCore::Timer m_layerVolatilityTimer;
1781     Vector<WTF::Function<void (bool)>> m_markLayersAsVolatileCompletionHandlers;
1782     bool m_isSuspendedUnderLock { false };
1783
1784     HashSet<String, ASCIICaseInsensitiveHash> m_mimeTypesWithCustomContentProviders;
1785     Optional<WebCore::Color> m_backgroundColor { WebCore::Color::white };
1786
1787     HashSet<unsigned> m_activeRenderingSuppressionTokens;
1788     unsigned m_maximumRenderingSuppressionToken { 0 };
1789     
1790     WebCore::ScrollPinningBehavior m_scrollPinningBehavior { WebCore::DoNotPin };
1791     Optional<WebCore::ScrollbarOverlayStyle> m_scrollbarOverlayStyle;
1792
1793     bool m_useAsyncScrolling { false };
1794
1795     OptionSet<WebCore::ActivityState::Flag> m_activityState;
1796
1797     bool m_processSuppressionEnabled;
1798     UserActivity m_userActivity;
1799     PAL::HysteresisActivity m_userActivityHysteresis;
1800
1801     uint64_t m_pendingNavigationID { 0 };
1802     Optional<WebsitePoliciesData> m_pendingWebsitePolicies;
1803
1804     bool m_mainFrameProgressCompleted { false };
1805     bool m_shouldDispatchFakeMouseMoveEvents { true };
1806     bool m_isEditorStateMissingPostLayoutData { false };
1807     bool m_isSelectingTextWhileInsertingAsynchronously { false };
1808
1809     enum class EditorStateIsContentEditable { No, Yes, Unset };
1810     mutable EditorStateIsContentEditable m_lastEditorStateWasContentEditable { EditorStateIsContentEditable::Unset };
1811
1812 #if PLATFORM(GTK)
1813     bool m_inputMethodEnabled { false };
1814 #endif
1815
1816 #if ENABLE(VIDEO) && USE(GSTREAMER)
1817     RefPtr<WebCore::MediaPlayerRequestInstallMissingPluginsCallback> m_installMediaPluginsCallback;
1818 #endif
1819
1820 #if USE(OS_STATE)
1821     WallTime m_loadCommitTime;
1822 #endif
1823
1824     WebCore::UserInterfaceLayoutDirection m_userInterfaceLayoutDirection { WebCore::UserInterfaceLayoutDirection::LTR };
1825
1826     const String m_overrideContentSecurityPolicy;
1827     const Optional<double> m_cpuLimit;
1828
1829 #if PLATFORM(WPE)
1830     IPC::Attachment m_hostFileDescriptor;
1831 #endif
1832
1833     HashMap<String, RefPtr<WebURLSchemeHandlerProxy>> m_schemeToURLSchemeHandlerProxyMap;
1834     HashMap<uint64_t, WebURLSchemeHandlerProxy*> m_identifierToURLSchemeHandlerProxyMap;
1835
1836     HashMap<uint64_t, WTF::Function<void(bool granted)>> m_storageAccessResponseCallbackMap;
1837     HashMap<ShareSheetCallbackID, WTF::Function<void(bool completed)>> m_shareSheetResponseCallbackMap;
1838
1839 #if ENABLE(APPLICATION_MANIFEST)
1840     HashMap<uint64_t, uint64_t> m_applicationManifestFetchCallbackMap;
1841 #endif
1842
1843     OptionSet<LayerTreeFreezeReason> m_LayerTreeFreezeReasons;
1844     bool m_isSuspended { false };
1845     bool m_needsFontAttributes { false };
1846 };
1847
1848 } // namespace WebKit
1849