Unreviewed, rolling out r241486.
[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     bool drawsBackground() const { return m_drawsBackground; }
505
506     void setUnderlayColor(const WebCore::Color& color) { m_underlayColor = color; }
507     WebCore::Color underlayColor() const { return m_underlayColor; }
508
509     void stopLoading();
510     void stopLoadingFrame(uint64_t frameID);
511     bool defersLoading() const;
512     void setDefersLoading(bool deferLoading);
513
514     void enterAcceleratedCompositingMode(WebCore::GraphicsLayer*);
515     void exitAcceleratedCompositingMode();
516
517     void addPluginView(PluginView*);
518     void removePluginView(PluginView*);
519
520     bool isVisible() const { return m_activityState.contains(WebCore::ActivityState::IsVisible); }
521     bool isVisibleOrOccluded() const { return m_activityState.contains(WebCore::ActivityState::IsVisibleOrOccluded); }
522
523     LayerHostingMode layerHostingMode() const { return m_layerHostingMode; }
524     void setLayerHostingMode(LayerHostingMode);
525
526 #if PLATFORM(COCOA)
527     void updatePluginsActiveAndFocusedState();
528     const WebCore::FloatRect& windowFrameInScreenCoordinates() const { return m_windowFrameInScreenCoordinates; }
529     const WebCore::FloatRect& windowFrameInUnflippedScreenCoordinates() const { return m_windowFrameInUnflippedScreenCoordinates; }
530     const WebCore::FloatRect& viewFrameInWindowCoordinates() const { return m_viewFrameInWindowCoordinates; }
531
532     bool hasCachedWindowFrame() const { return m_hasCachedWindowFrame; }
533
534     void updateHeaderAndFooterLayersForDeviceScaleChange(float scaleFactor);
535 #endif
536
537 #if PLATFORM(MAC)
538     void setTopOverhangImage(WebImage*);
539     void setBottomOverhangImage(WebImage*);
540     
541     void setUseSystemAppearance(bool);
542 #endif
543
544     void setUseDarkAppearance(bool);
545
546     bool windowIsFocused() const;
547     bool windowAndWebPageAreFocused() const;
548
549 #if !PLATFORM(IOS_FAMILY)
550     void setHeaderPageBanner(PageBanner*);
551     PageBanner* headerPageBanner();
552     void setFooterPageBanner(PageBanner*);
553     PageBanner* footerPageBanner();
554
555     void hidePageBanners();
556     void showPageBanners();
557     
558     void setHeaderBannerHeightForTesting(int);
559     void setFooterBannerHeightForTesting(int);
560 #endif
561
562     WebCore::IntPoint screenToRootView(const WebCore::IntPoint&);
563     WebCore::IntRect rootViewToScreen(const WebCore::IntRect&);
564     WebCore::IntPoint accessibilityScreenToRootView(const WebCore::IntPoint&);
565     WebCore::IntRect rootViewToAccessibilityScreen(const WebCore::IntRect&);
566     
567     RefPtr<WebImage> scaledSnapshotWithOptions(const WebCore::IntRect&, double additionalScaleFactor, SnapshotOptions);
568
569     static const WebEvent* currentEvent();
570
571     FindController& findController() { return m_findController.get(); }
572
573 #if ENABLE(GEOLOCATION)
574     GeolocationPermissionRequestManager& geolocationPermissionRequestManager() { return m_geolocationPermissionRequestManager.get(); }
575 #endif
576
577 #if PLATFORM(IOS_FAMILY)
578     void savePageState(WebCore::HistoryItem&);
579     void restorePageState(const WebCore::HistoryItem&);
580 #endif
581
582 #if ENABLE(MEDIA_STREAM)
583     UserMediaPermissionRequestManager& userMediaPermissionRequestManager() { return m_userMediaPermissionRequestManager; }
584     void captureDevicesChanged();
585 #endif
586
587     void elementDidFocus(WebCore::Element&);
588     void elementDidRefocus(WebCore::Element&);
589     void elementDidBlur(WebCore::Element&);
590     void focusedElementDidChangeInputMode(WebCore::Element&, WebCore::InputMode);
591     void resetFocusedElementForFrame(WebFrame*);
592
593     void disabledAdaptationsDidChange(const OptionSet<WebCore::DisabledAdaptations>&);
594     void viewportPropertiesDidChange(const WebCore::ViewportArguments&);
595     void executeEditCommandWithCallback(const String&, const String& argument, CallbackID);
596
597 #if PLATFORM(IOS_FAMILY)
598     WebCore::FloatSize screenSize() const;
599     WebCore::FloatSize availableScreenSize() const;
600     WebCore::FloatSize overrideScreenSize() const;
601     int32_t deviceOrientation() const { return m_deviceOrientation; }
602     void didReceiveMobileDocType(bool);
603
604     void setUseTestingViewportConfiguration(bool useTestingViewport) { m_useTestingViewportConfiguration = useTestingViewport; }
605     bool isUsingTestingViewportConfiguration() const { return m_useTestingViewportConfiguration; }
606
607     double minimumPageScaleFactor() const;
608     double maximumPageScaleFactor() const;
609     double maximumPageScaleFactorIgnoringAlwaysScalable() const;
610     bool allowsUserScaling() const;
611     bool hasStablePageScaleFactor() const { return m_hasStablePageScaleFactor; }
612
613     void handleTap(const WebCore::IntPoint&, OptionSet<WebKit::WebEvent::Modifier>, uint64_t lastLayerTreeTransactionId);
614     void potentialTapAtPosition(uint64_t requestID, const WebCore::FloatPoint&);
615     void commitPotentialTap(OptionSet<WebKit::WebEvent::Modifier>, uint64_t lastLayerTreeTransactionId);
616     void commitPotentialTapFailed();
617     void cancelPotentialTap();
618     void cancelPotentialTapInFrame(WebFrame&);
619     void tapHighlightAtPosition(uint64_t requestID, const WebCore::FloatPoint&);
620
621     void inspectorNodeSearchMovedToPosition(const WebCore::FloatPoint&);
622     void inspectorNodeSearchEndedAtPosition(const WebCore::FloatPoint&);
623
624     void blurFocusedElement();
625     void requestFocusedElementInformation(CallbackID);
626     void selectWithGesture(const WebCore::IntPoint&, uint32_t granularity, uint32_t gestureType, uint32_t gestureState, bool isInteractingWithFocusedElement, CallbackID);
627     void updateSelectionWithTouches(const WebCore::IntPoint&, uint32_t touches, bool baseIsStart, CallbackID);
628     void selectWithTwoTouches(const WebCore::IntPoint& from, const WebCore::IntPoint& to, uint32_t gestureType, uint32_t gestureState, CallbackID);
629     void extendSelection(uint32_t granularity);
630     void selectWordBackward();
631     void moveSelectionByOffset(int32_t offset, CallbackID);
632     void selectTextWithGranularityAtPoint(const WebCore::IntPoint&, uint32_t granularity, bool isInteractingWithFocusedElement, CallbackID);
633     void selectPositionAtBoundaryWithDirection(const WebCore::IntPoint&, uint32_t granularity, uint32_t direction, bool isInteractingWithFocusedElement, CallbackID);
634     void moveSelectionAtBoundaryWithDirection(uint32_t granularity, uint32_t direction, CallbackID);
635     void selectPositionAtPoint(const WebCore::IntPoint&, bool isInteractingWithFocusedElement, CallbackID);
636     void beginSelectionInDirection(uint32_t direction, CallbackID);
637     void updateSelectionWithExtentPoint(const WebCore::IntPoint&, bool isInteractingWithFocusedElement, CallbackID);
638     void updateSelectionWithExtentPointAndBoundary(const WebCore::IntPoint&, uint32_t granularity, bool isInteractingWithFocusedElement, CallbackID);
639
640     void requestDictationContext(CallbackID);
641     void replaceDictatedText(const String& oldText, const String& newText);
642     void replaceSelectedText(const String& oldText, const String& newText);
643     void requestAutocorrectionData(const String& textForAutocorrection, CallbackID);
644     void applyAutocorrection(const String& correction, const String& originalText, CallbackID);
645     void syncApplyAutocorrection(const String& correction, const String& originalText, CompletionHandler<void(bool)>&&);
646     void requestAutocorrectionContext(CallbackID);
647     void autocorrectionContextSync(CompletionHandler<void(WebAutocorrectionContext&&)>&&);
648     void getPositionInformation(const InteractionInformationRequest&, CompletionHandler<void(InteractionInformationAtPosition&&)>&&);
649     void requestPositionInformation(const InteractionInformationRequest&);
650     void startInteractionWithElementAtPosition(const WebCore::IntPoint&);
651     void stopInteraction();
652     void performActionOnElement(uint32_t action);
653     void focusNextFocusedElement(bool isForward, CallbackID);
654     void autofillLoginCredentials(const String&, const String&);
655     void setFocusedElementValue(const String&);
656     void setFocusedElementValueAsNumber(double);
657     void setFocusedElementSelectedIndex(uint32_t index, bool allowMultipleSelection);
658     void updateSelectionAppearance();
659     void getSelectionContext(CallbackID);
660     void handleTwoFingerTapAtPoint(const WebCore::IntPoint&, OptionSet<WebKit::WebEvent::Modifier>, uint64_t requestID);
661     void handleStylusSingleTapAtPoint(const WebCore::IntPoint&, uint64_t requestID);
662     void getRectsForGranularityWithSelectionOffset(uint32_t, int32_t, CallbackID);
663     void getRectsAtSelectionOffsetWithText(int32_t, const String&, CallbackID);
664     void storeSelectionForAccessibility(bool);
665     void startAutoscrollAtPosition(const WebCore::FloatPoint&);
666     void cancelAutoscroll();
667
668     void contentSizeCategoryDidChange(const String&);
669
670     Seconds eventThrottlingDelay() const;
671
672     void showInspectorHighlight(const WebCore::Highlight&);
673     void hideInspectorHighlight();
674
675     void showInspectorIndication();
676     void hideInspectorIndication();
677
678     void enableInspectorNodeSearch();
679     void disableInspectorNodeSearch();
680
681     bool forceAlwaysUserScalable() const { return m_forceAlwaysUserScalable; }
682     void setForceAlwaysUserScalable(bool);
683 #endif
684
685 #if PLATFORM(IOS_FAMILY) && ENABLE(IOS_TOUCH_EVENTS)
686     void dispatchAsynchronousTouchEvents(const Vector<WebTouchEvent, 1>& queue);
687 #endif
688
689     bool hasRichlyEditableSelection() const;
690
691     enum class LayerTreeFreezeReason {
692         PageTransition          = 1 << 0,
693         BackgroundApplication   = 1 << 1,
694         ProcessSuspended        = 1 << 2,
695         PageSuspended           = 1 << 3,
696         Printing                = 1 << 4,
697         ProcessSwap             = 1 << 5,
698     };
699     void freezeLayerTree(LayerTreeFreezeReason);
700     void unfreezeLayerTree(LayerTreeFreezeReason);
701
702     void markLayersVolatile(WTF::Function<void (bool)>&& completionHandler = { });
703     void cancelMarkLayersVolatile();
704
705     NotificationPermissionRequestManager* notificationPermissionRequestManager();
706
707     void pageDidScroll();
708
709 #if ENABLE(CONTEXT_MENUS)
710     WebContextMenu* contextMenu();
711     WebContextMenu* contextMenuAtPointInWindow(const WebCore::IntPoint&);
712 #endif
713
714     bool hasLocalDataForURL(const URL&);
715
716     static bool canHandleRequest(const WebCore::ResourceRequest&);
717
718     class SandboxExtensionTracker {
719     public:
720         ~SandboxExtensionTracker();
721
722         void invalidate();
723
724         void beginLoad(WebFrame*, SandboxExtension::Handle&&);
725         void beginReload(WebFrame*, SandboxExtension::Handle&&);
726         void willPerformLoadDragDestinationAction(RefPtr<SandboxExtension>&& pendingDropSandboxExtension);
727         void didStartProvisionalLoad(WebFrame*);
728         void didCommitProvisionalLoad(WebFrame*);
729         void didFailProvisionalLoad(WebFrame*);
730
731     private:
732         void setPendingProvisionalSandboxExtension(RefPtr<SandboxExtension>&&);
733
734         RefPtr<SandboxExtension> m_pendingProvisionalSandboxExtension;
735         RefPtr<SandboxExtension> m_provisionalSandboxExtension;
736         RefPtr<SandboxExtension> m_committedSandboxExtension;
737     };
738
739     SandboxExtensionTracker& sandboxExtensionTracker() { return m_sandboxExtensionTracker; }
740
741 #if PLATFORM(GTK)
742     void setComposition(const String& text, const Vector<WebCore::CompositionUnderline>& underlines, uint64_t selectionStart, uint64_t selectionEnd, uint64_t replacementRangeStart, uint64_t replacementRangeLength);
743     void confirmComposition(const String& text, int64_t selectionStart, int64_t selectionLength);
744     void cancelComposition();
745
746     void collapseSelectionInFrame(uint64_t frameID);
747 #endif
748
749 #if PLATFORM (GTK) && HAVE(GTK_GESTURES)
750     void getCenterForZoomGesture(const WebCore::IntPoint& centerInViewCoordinates, WebCore::IntPoint& result);
751 #endif
752
753     void didApplyStyle();
754     void didChangeSelection();
755     void didChangeContents();
756     void discardedComposition();
757     void canceledComposition();
758     void didUpdateComposition();
759     void didEndUserTriggeredSelectionChanges();
760
761 #if PLATFORM(COCOA)
762     void registerUIProcessAccessibilityTokens(const IPC::DataReference& elemenToken, const IPC::DataReference& windowToken);
763     WKAccessibilityWebPageObject* accessibilityRemoteObject();
764     NSObject *accessibilityObjectForMainFramePlugin();
765     const WebCore::FloatPoint& accessibilityPosition() const { return m_accessibilityPosition; }
766     
767     void sendComplexTextInputToPlugin(uint64_t pluginComplexTextInputIdentifier, const String& textInput);
768
769     void setTextAsync(const String&);
770     void insertTextAsync(const String& text, const EditingRange& replacementRange, bool registerUndoGroup = false, uint32_t editingRangeIsRelativeTo = (uint32_t)EditingRangeIsRelativeTo::EditableRoot, bool suppressSelectionUpdate = false);
771     void getMarkedRangeAsync(CallbackID);
772     void getSelectedRangeAsync(CallbackID);
773     void characterIndexForPointAsync(const WebCore::IntPoint&, CallbackID);
774     void firstRectForCharacterRangeAsync(const EditingRange&, CallbackID);
775     void setCompositionAsync(const String& text, const Vector<WebCore::CompositionUnderline>& underlines, const EditingRange& selectionRange, const EditingRange& replacementRange);
776     void confirmCompositionAsync();
777
778     void readSelectionFromPasteboard(const WTF::String& pasteboardName, bool& result);
779     void getStringSelectionForPasteboard(WTF::String& stringValue);
780     void getDataSelectionForPasteboard(const WTF::String pasteboardType, SharedMemory::Handle& handle, uint64_t& size);
781     void shouldDelayWindowOrderingEvent(const WebKit::WebMouseEvent&, bool& result);
782     void acceptsFirstMouse(int eventNumber, const WebKit::WebMouseEvent&, bool& result);
783     bool performNonEditingBehaviorForSelector(const String&, WebCore::KeyboardEvent*);
784 #endif
785
786 #if PLATFORM(MAC)
787     void insertDictatedTextAsync(const String& text, const EditingRange& replacementRange, const Vector<WebCore::DictationAlternative>& dictationAlternativeLocations, bool registerUndoGroup = false);
788     void attributedSubstringForCharacterRangeAsync(const EditingRange&, CallbackID);
789     void fontAtSelection(CallbackID);
790 #endif
791
792 #if PLATFORM(COCOA) && ENABLE(SERVICE_CONTROLS)
793     void replaceSelectionWithPasteboardData(const Vector<String>& types, const IPC::DataReference&);
794 #endif
795
796 #if HAVE(ACCESSIBILITY) && PLATFORM(GTK)
797     void updateAccessibilityTree();
798 #endif
799
800     void setCompositionForTesting(const String& compositionString, uint64_t from, uint64_t length, bool suppressUnderline);
801     bool hasCompositionForTesting();
802     void confirmCompositionForTesting(const String& compositionString);
803
804 #if PLATFORM(COCOA)
805     bool isSpeaking();
806     void speak(const String&);
807     void stopSpeaking();
808
809     void performDictionaryLookupForSelection(WebCore::Frame&, const WebCore::VisibleSelection&, WebCore::TextIndicatorPresentationTransition);
810 #endif
811
812     bool isSmartInsertDeleteEnabled();
813     void setSmartInsertDeleteEnabled(bool);
814
815     bool isSelectTrailingWhitespaceEnabled() const;
816     void setSelectTrailingWhitespaceEnabled(bool);
817
818     void replaceSelectionWithText(WebCore::Frame*, const String&);
819     void clearSelection();
820     void restoreSelectionInFocusedEditableElement();
821
822 #if ENABLE(DRAG_SUPPORT) && PLATFORM(GTK)
823     void performDragControllerAction(DragControllerAction, const WebCore::IntPoint& clientPosition, const WebCore::IntPoint& globalPosition, uint64_t draggingSourceOperationMask, WebSelectionData&&, uint32_t flags);
824 #endif
825
826 #if ENABLE(DRAG_SUPPORT) && !PLATFORM(GTK)
827     void performDragControllerAction(DragControllerAction, const WebCore::DragData&, SandboxExtension::Handle&&, SandboxExtension::HandleArray&&);
828 #endif
829
830 #if ENABLE(DRAG_SUPPORT)
831     void dragEnded(WebCore::IntPoint clientPosition, WebCore::IntPoint globalPosition, uint64_t operation);
832
833     void willPerformLoadDragDestinationAction();
834     void mayPerformUploadDragDestinationAction();
835
836     void willStartDrag() { ASSERT(!m_isStartingDrag); m_isStartingDrag = true; }
837     void didStartDrag();
838     void dragCancelled();
839 #endif
840
841     void beginPrinting(uint64_t frameID, const PrintInfo&);
842     void endPrinting();
843     void computePagesForPrinting(uint64_t frameID, const PrintInfo&, CallbackID);
844     void computePagesForPrintingImpl(uint64_t frameID, const PrintInfo&, Vector<WebCore::IntRect>& pageRects, double& totalScaleFactor);
845
846 #if PLATFORM(COCOA)
847     void drawRectToImage(uint64_t frameID, const PrintInfo&, const WebCore::IntRect&, const WebCore::IntSize&, CallbackID);
848     void drawPagesToPDF(uint64_t frameID, const PrintInfo&, uint32_t first, uint32_t count, CallbackID);
849     void drawPagesToPDFImpl(uint64_t frameID, const PrintInfo&, uint32_t first, uint32_t count, RetainPtr<CFMutableDataRef>& pdfPageData);
850 #endif
851
852 #if PLATFORM(IOS_FAMILY)
853     void computePagesForPrintingAndDrawToPDF(uint64_t frameID, const PrintInfo&, CallbackID, Messages::WebPage::ComputePagesForPrintingAndDrawToPDF::DelayedReply&&);
854 #endif
855
856 #if PLATFORM(GTK)
857     void drawPagesForPrinting(uint64_t frameID, const PrintInfo&, CallbackID);
858     void didFinishPrintOperation(const WebCore::ResourceError&, CallbackID);
859 #endif
860
861     void addResourceRequest(unsigned long, const WebCore::ResourceRequest&);
862     void removeResourceRequest(unsigned long);
863
864     void setMediaVolume(float);
865     void setMuted(WebCore::MediaProducer::MutedStateFlags);
866     void setMayStartMediaWhenInWindow(bool);
867     void stopMediaCapture();
868
869 #if ENABLE(MEDIA_SESSION)
870     void handleMediaEvent(uint32_t /* WebCore::MediaEventType */);
871     void setVolumeOfMediaElement(double, uint64_t);
872 #endif
873
874     void updateMainFrameScrollOffsetPinning();
875
876     bool mainFrameHasCustomContentProvider() const;
877     void addMIMETypeWithCustomContentProvider(const String&);
878
879     void mainFrameDidLayout();
880
881     bool canRunBeforeUnloadConfirmPanel() const { return m_canRunBeforeUnloadConfirmPanel; }
882     void setCanRunBeforeUnloadConfirmPanel(bool canRunBeforeUnloadConfirmPanel) { m_canRunBeforeUnloadConfirmPanel = canRunBeforeUnloadConfirmPanel; }
883
884     bool canRunModal() const { return m_canRunModal; }
885     void setCanRunModal(bool canRunModal) { m_canRunModal = canRunModal; }
886
887     void runModal();
888
889     void setDeviceScaleFactor(float);
890     float deviceScaleFactor() const;
891
892     void forceRepaintWithoutCallback();
893
894     void unmarkAllMisspellings();
895     void unmarkAllBadGrammar();
896
897 #if PLATFORM(COCOA)
898     void handleAlternativeTextUIResult(const String&);
899 #endif
900
901     // For testing purpose.
902     void simulateMouseDown(int button, WebCore::IntPoint, int clickCount, WKEventModifiers, WallTime);
903     void simulateMouseUp(int button, WebCore::IntPoint, int clickCount, WKEventModifiers, WallTime);
904     void simulateMouseMotion(WebCore::IntPoint, WallTime);
905
906 #if ENABLE(CONTEXT_MENUS)
907     void contextMenuShowing() { m_isShowingContextMenu = true; }
908 #endif
909
910     void wheelEvent(const WebWheelEvent&);
911
912     void wheelEventHandlersChanged(bool);
913     void recomputeShortCircuitHorizontalWheelEventsState();
914
915 #if ENABLE(MAC_GESTURE_EVENTS)
916     void gestureEvent(const WebGestureEvent&);
917 #endif
918
919     void updateVisibilityState(bool isInitialState = false);
920
921 #if PLATFORM(IOS_FAMILY)
922     void setViewportConfigurationViewLayoutSize(const WebCore::FloatSize&, double scaleFactor, double minimumEffectiveDeviceWidth);
923     void setMaximumUnobscuredSize(const WebCore::FloatSize&);
924     void setDeviceOrientation(int32_t);
925     void setOverrideViewportArguments(const Optional<WebCore::ViewportArguments>&);
926     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);
927     Optional<float> scaleFromUIProcess(const VisibleContentRectUpdateInfo&) const;
928     void updateVisibleContentRects(const VisibleContentRectUpdateInfo&, MonotonicTime oldestTimestamp);
929     bool scaleWasSetByUIProcess() const { return m_scaleWasSetByUIProcess; }
930     void willStartUserTriggeredZooming();
931     void applicationWillResignActive();
932     void applicationDidEnterBackground(bool isSuspendedUnderLock);
933     void applicationDidFinishSnapshottingAfterEnteringBackground();
934     void applicationWillEnterForeground(bool isSuspendedUnderLock);
935     void applicationDidBecomeActive();
936     void completePendingSyntheticClickForContentChangeObserver();
937
938     bool platformPrefersTextLegibilityBasedZoomScaling() const;
939     const WebCore::ViewportConfiguration& viewportConfiguration() const { return m_viewportConfiguration; }
940
941     void hardwareKeyboardAvailabilityChanged();
942
943     void updateStringForFind(const String&);
944 #endif
945
946 #if ENABLE(IOS_TOUCH_EVENTS)
947     void dispatchTouchEvent(const WebTouchEvent&, bool& handled);
948 #endif
949
950 #if PLATFORM(GTK) && USE(TEXTURE_MAPPER_GL)
951     uint64_t nativeWindowHandle() { return m_nativeWindowHandle; }
952 #endif
953
954     bool shouldUseCustomContentProviderForResponse(const WebCore::ResourceResponse&);
955
956     bool asynchronousPluginInitializationEnabled() const { return m_asynchronousPluginInitializationEnabled; }
957     void setAsynchronousPluginInitializationEnabled(bool enabled) { m_asynchronousPluginInitializationEnabled = enabled; }
958     bool asynchronousPluginInitializationEnabledForAllPlugins() const { return m_asynchronousPluginInitializationEnabledForAllPlugins; }
959     void setAsynchronousPluginInitializationEnabledForAllPlugins(bool enabled) { m_asynchronousPluginInitializationEnabledForAllPlugins = enabled; }
960     bool artificialPluginInitializationDelayEnabled() const { return m_artificialPluginInitializationDelayEnabled; }
961     void setArtificialPluginInitializationDelayEnabled(bool enabled) { m_artificialPluginInitializationDelayEnabled = enabled; }
962     void setTabToLinksEnabled(bool enabled) { m_tabToLinks = enabled; }
963     bool tabToLinksEnabled() const { return m_tabToLinks; }
964
965     bool scrollingPerformanceLoggingEnabled() const { return m_scrollingPerformanceLoggingEnabled; }
966     void setScrollingPerformanceLoggingEnabled(bool);
967
968 #if PLATFORM(COCOA)
969     bool shouldUsePDFPlugin() const;
970     bool pdfPluginEnabled() const { return m_pdfPluginEnabled; }
971     void setPDFPluginEnabled(bool enabled) { m_pdfPluginEnabled = enabled; }
972
973     NSDictionary *dataDetectionContext() const { return m_dataDetectionContext.get(); }
974 #endif
975
976     void savePDFToFileInDownloadsFolder(const String& suggestedFilename, const URL& originatingURL, const uint8_t* data, unsigned long size);
977
978 #if PLATFORM(COCOA)
979     void savePDFToTemporaryFolderAndOpenWithNativeApplication(const String& suggestedFilename, const String& originatingURLString, const uint8_t* data, unsigned long size, const String& pdfUUID);
980 #endif
981
982     bool mainFrameIsScrollable() const { return m_mainFrameIsScrollable; }
983
984     void setAlwaysShowsHorizontalScroller(bool);
985     void setAlwaysShowsVerticalScroller(bool);
986
987     bool alwaysShowsHorizontalScroller() const { return m_alwaysShowsHorizontalScroller; };
988     bool alwaysShowsVerticalScroller() const { return m_alwaysShowsVerticalScroller; };
989
990     void setViewLayoutSize(const WebCore::IntSize&);
991     WebCore::IntSize viewLayoutSize() const { return m_viewLayoutSize; }
992
993     void setAutoSizingShouldExpandToViewHeight(bool shouldExpand);
994     bool autoSizingShouldExpandToViewHeight() { return m_autoSizingShouldExpandToViewHeight; }
995
996     void setViewportSizeForCSSViewportUnits(Optional<WebCore::IntSize>);
997     Optional<WebCore::IntSize> viewportSizeForCSSViewportUnits() const { return m_viewportSizeForCSSViewportUnits; }
998
999     bool canShowMIMEType(const String& MIMEType) const;
1000     bool canShowResponse(const WebCore::ResourceResponse&) const;
1001
1002     void addTextCheckingRequest(uint64_t requestID, Ref<WebCore::TextCheckingRequest>&&);
1003     void didFinishCheckingText(uint64_t requestID, const Vector<WebCore::TextCheckingResult>&);
1004     void didCancelCheckingText(uint64_t requestID);
1005
1006 #if ENABLE(PRIMARY_SNAPSHOTTED_PLUGIN_HEURISTIC)
1007     void determinePrimarySnapshottedPlugIn();
1008     void determinePrimarySnapshottedPlugInTimerFired();
1009     void resetPrimarySnapshottedPlugIn();
1010     bool matchesPrimaryPlugIn(const String& pageOrigin, const String& pluginOrigin, const String& mimeType) const;
1011     bool plugInIntersectsSearchRect(WebCore::HTMLPlugInImageElement& pluginImageElement);
1012     bool plugInIsPrimarySize(WebCore::HTMLPlugInImageElement& pluginImageElement, unsigned &pluginArea);
1013 #endif
1014
1015 #if ENABLE(DATA_DETECTION)
1016     void setDataDetectionResults(NSArray *);
1017     void detectDataInAllFrames(uint64_t, CompletionHandler<void(const DataDetectionResult&)>&&);
1018     void removeDataDetectedLinks(CompletionHandler<void(const DataDetectionResult&)>&&);
1019 #endif
1020
1021     unsigned extendIncrementalRenderingSuppression();
1022     void stopExtendingIncrementalRenderingSuppression(unsigned token);
1023     bool shouldExtendIncrementalRenderingSuppression() { return !m_activeRenderingSuppressionTokens.isEmpty(); }
1024
1025     WebCore::ScrollPinningBehavior scrollPinningBehavior() { return m_scrollPinningBehavior; }
1026     void setScrollPinningBehavior(uint32_t /* WebCore::ScrollPinningBehavior */ pinning);
1027
1028     Optional<WebCore::ScrollbarOverlayStyle> scrollbarOverlayStyle() { return m_scrollbarOverlayStyle; }
1029     void setScrollbarOverlayStyle(Optional<uint32_t /* WebCore::ScrollbarOverlayStyle */> scrollbarStyle);
1030
1031     Ref<WebCore::DocumentLoader> createDocumentLoader(WebCore::Frame&, const WebCore::ResourceRequest&, const WebCore::SubstituteData&);
1032     void updateCachedDocumentLoader(WebDocumentLoader&, WebCore::Frame&);
1033
1034     void getBytecodeProfile(CallbackID);
1035     void getSamplingProfilerOutput(CallbackID);
1036     
1037 #if ENABLE(SERVICE_CONTROLS) || ENABLE(TELEPHONE_NUMBER_DETECTION)
1038     void handleTelephoneNumberClick(const String& number, const WebCore::IntPoint&);
1039     void handleSelectionServiceClick(WebCore::FrameSelection&, const Vector<String>& telephoneNumbers, const WebCore::IntPoint&);
1040 #endif
1041
1042     void didChangeScrollOffsetForFrame(WebCore::Frame*);
1043
1044     void setMainFrameProgressCompleted(bool completed) { m_mainFrameProgressCompleted = completed; }
1045     bool shouldDispatchFakeMouseMoveEvents() const { return m_shouldDispatchFakeMouseMoveEvents; }
1046
1047     void postMessage(const String& messageName, API::Object* messageBody);
1048     void postSynchronousMessageForTesting(const String& messageName, API::Object* messageBody, RefPtr<API::Object>& returnData);
1049     void postMessageIgnoringFullySynchronousMode(const String& messageName, API::Object* messageBody);
1050
1051 #if PLATFORM(GTK)
1052     void setInputMethodState(bool);
1053 #endif
1054
1055     void imageOrMediaDocumentSizeChanged(const WebCore::IntSize&);
1056
1057 #if ENABLE(VIDEO) && USE(GSTREAMER)
1058     void requestInstallMissingMediaPlugins(const String& details, const String& description, WebCore::MediaPlayerRequestInstallMissingPluginsCallback&);
1059 #endif
1060
1061     void addUserScript(String&& source, WebCore::UserContentInjectedFrames, WebCore::UserScriptInjectionTime);
1062     void addUserStyleSheet(const String& source, WebCore::UserContentInjectedFrames);
1063     void removeAllUserContent();
1064
1065     void dispatchDidReachLayoutMilestone(OptionSet<WebCore::LayoutMilestone>);
1066
1067     void didRestoreScrollPosition();
1068
1069     bool isControlledByAutomation() const;
1070     void setControlledByAutomation(bool);
1071
1072     void connectInspector(const String& targetId, Inspector::FrontendChannel::ConnectionType);
1073     void disconnectInspector(const String& targetId);
1074     void sendMessageToTargetBackend(const String& targetId, const String& message);
1075
1076     void insertNewlineInQuotedContent();
1077
1078 #if USE(OS_STATE)
1079     WallTime loadCommitTime() const { return m_loadCommitTime; }
1080 #endif
1081
1082 #if ENABLE(GAMEPAD)
1083     void gamepadActivity(const Vector<GamepadData>&, bool shouldMakeGamepadsVisible);
1084 #endif
1085     
1086 #if ENABLE(POINTER_LOCK)
1087     void didAcquirePointerLock();
1088     void didNotAcquirePointerLock();
1089     void didLosePointerLock();
1090 #endif
1091
1092     void didGetLoadDecisionForIcon(bool decision, CallbackID loadIdentifier, OptionalCallbackID);
1093     void setUseIconLoadingClient(bool);
1094
1095 #if ENABLE(DATA_INTERACTION)
1096     void didConcludeEditDrag();
1097 #endif
1098
1099     WebURLSchemeHandlerProxy* urlSchemeHandlerForScheme(const String&);
1100     void stopAllURLSchemeTasks();
1101
1102     Optional<double> cpuLimit() const { return m_cpuLimit; }
1103
1104     static PluginView* pluginViewForFrame(WebCore::Frame*);
1105
1106     void sendPartialEditorStateAndSchedulePostLayoutUpdate();
1107     void flushPendingEditorStateUpdate();
1108
1109 #if ENABLE(RESOURCE_LOAD_STATISTICS)
1110     void hasStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, CompletionHandler<void(bool)>&& callback);
1111     void requestStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, CompletionHandler<void(bool)>&& callback);
1112 #endif
1113
1114     void showShareSheet(WebCore::ShareDataWithParsedURL&, WTF::CompletionHandler<void(bool)>&& callback);
1115     void didCompleteShareSheet(bool wasCompleted, ShareSheetCallbackID contextId);
1116     
1117 #if ENABLE(ATTACHMENT_ELEMENT)
1118     void insertAttachment(const String& identifier, Optional<uint64_t>&& fileSize, const String& fileName, const String& contentType, CallbackID);
1119     void updateAttachmentAttributes(const String& identifier, Optional<uint64_t>&& fileSize, const String& contentType, const String& fileName, const IPC::DataReference& enclosingImageData, CallbackID);
1120 #endif
1121
1122 #if ENABLE(APPLICATION_MANIFEST)
1123     void getApplicationManifest(CallbackID);
1124     void didFinishLoadingApplicationManifest(uint64_t, const Optional<WebCore::ApplicationManifest>&);
1125 #endif
1126
1127 #if PLATFORM(WPE)
1128     int releaseHostFileDescriptor() { return m_hostFileDescriptor.releaseFileDescriptor(); }
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     bool requestDOMPasteAccess();
1149     WebCore::IntRect rectForElementAtInteractionLocation() const;
1150
1151 private:
1152     WebPage(uint64_t pageID, WebPageCreationParameters&&);
1153
1154     void updateThrottleState();
1155     void updateUserActivity();
1156
1157     // IPC::MessageSender
1158     IPC::Connection* messageSenderConnection() const override;
1159     uint64_t messageSenderDestinationID() const override;
1160
1161     void platformInitialize();
1162     void platformDetach();
1163     void platformEditorState(WebCore::Frame&, EditorState& result, IncludePostLayoutDataHint) const;
1164     void sendEditorStateUpdate();
1165     void scheduleFullEditorStateUpdate();
1166
1167 #if PLATFORM(COCOA)
1168     void sendTouchBarMenuDataAddedUpdate(WebCore::HTMLMenuElement&);
1169     void sendTouchBarMenuDataRemovedUpdate(WebCore::HTMLMenuElement&);
1170     void sendTouchBarMenuItemDataAddedUpdate(WebCore::HTMLMenuItemElement&);
1171     void sendTouchBarMenuItemDataRemovedUpdate(WebCore::HTMLMenuItemElement&);
1172 #endif
1173
1174     void didReceiveSyncWebPageMessage(IPC::Connection&, IPC::Decoder&, std::unique_ptr<IPC::Encoder>&);
1175
1176 #if PLATFORM(IOS_FAMILY)
1177     void resetViewportDefaultConfiguration(WebFrame* mainFrame, bool hasMobileDocType = false);
1178     enum class ZoomToInitialScale { No, Yes };
1179     void viewportConfigurationChanged(ZoomToInitialScale = ZoomToInitialScale::No);
1180     void updateViewportSizeForCSSViewportUnits();
1181
1182     static void convertSelectionRectsToRootView(WebCore::FrameView*, Vector<WebCore::SelectionRect>&);
1183     RefPtr<WebCore::Range> rangeForWebSelectionAtPosition(const WebCore::IntPoint&, const WebCore::VisiblePosition&, SelectionFlags&);
1184     void getFocusedElementInformation(FocusedElementInformation&);
1185     void platformInitializeAccessibility();
1186     void handleSyntheticClick(WebCore::Node* nodeRespondingToClick, const WebCore::FloatPoint& location, OptionSet<WebKit::WebEvent::Modifier>);
1187     void completeSyntheticClick(WebCore::Node* nodeRespondingToClick, const WebCore::FloatPoint& location, OptionSet<WebKit::WebEvent::Modifier>, WebCore::SyntheticClickType);
1188     void sendTapHighlightForNodeIfNecessary(uint64_t requestID, WebCore::Node*);
1189     void resetTextAutosizing();
1190     WebCore::VisiblePosition visiblePositionInFocusedNodeForPoint(const WebCore::Frame&, const WebCore::IntPoint&, bool isInteractingWithFocusedElement);
1191     RefPtr<WebCore::Range> rangeForGranularityAtPoint(WebCore::Frame&, const WebCore::IntPoint&, uint32_t granularity, bool isInteractingWithFocusedElement);
1192
1193     void sendPositionInformation(InteractionInformationAtPosition&&);
1194     InteractionInformationAtPosition positionInformation(const InteractionInformationRequest&);
1195     WebAutocorrectionContext autocorrectionContext();
1196     bool applyAutocorrectionInternal(const String& correction, const String& originalText);
1197 #endif
1198
1199 #if PLATFORM(IOS_FAMILY) && ENABLE(DATA_INTERACTION)
1200     void requestDragStart(const WebCore::IntPoint& clientPosition, const WebCore::IntPoint& globalPosition);
1201     void requestAdditionalItemsForDragSession(const WebCore::IntPoint& clientPosition, const WebCore::IntPoint& globalPosition);
1202 #endif
1203
1204 #if !PLATFORM(COCOA) && !PLATFORM(WPE)
1205     static const char* interpretKeyEvent(const WebCore::KeyboardEvent*);
1206 #endif
1207
1208     bool performDefaultBehaviorForKeyEvent(const WebKeyboardEvent&);
1209
1210 #if PLATFORM(MAC)
1211     bool executeKeypressCommandsInternal(const Vector<WebCore::KeypressCommand>&, WebCore::KeyboardEvent*);
1212 #endif
1213
1214     void updateDrawingAreaLayerTreeFreezeState();
1215     bool markLayersVolatileImmediatelyIfPossible();
1216     void layerVolatilityTimerFired();
1217     void callVolatilityCompletionHandlers(bool succeeded);
1218
1219     String sourceForFrame(WebFrame*);
1220
1221     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&);
1222
1223     // Actions
1224     void tryClose();
1225     void platformDidReceiveLoadParameters(const LoadParameters&);
1226     void loadRequest(LoadParameters&&);
1227     void loadData(LoadParameters&&);
1228     void loadAlternateHTML(LoadParameters&&);
1229     void navigateToPDFLinkWithSimulatedClick(const String& url, WebCore::IntPoint documentPoint, WebCore::IntPoint screenPoint);
1230     void reload(uint64_t navigationID, uint32_t reloadOptions, SandboxExtension::Handle&&);
1231     void goToBackForwardItem(uint64_t navigationID, const WebCore::BackForwardItemIdentifier&, WebCore::FrameLoadType, WebCore::ShouldTreatAsContinuingLoad, Optional<WebsitePoliciesData>&&);
1232     void tryRestoreScrollPosition();
1233     void setInitialFocus(bool forward, bool isKeyboardEventValid, const WebKeyboardEvent&, CallbackID);
1234     void updateIsInWindow(bool isInitialState = false);
1235     void visibilityDidChange();
1236     void setActivityState(OptionSet<WebCore::ActivityState::Flag>, ActivityStateChangeID, const Vector<CallbackID>& callbackIDs);
1237     void validateCommand(const String&, CallbackID);
1238     void executeEditCommand(const String&, const String&);
1239     void setEditable(bool);
1240
1241     void increaseListLevel();
1242     void decreaseListLevel();
1243     void changeListType();
1244
1245     void setBaseWritingDirection(WebCore::WritingDirection);
1246
1247     void setNeedsFontAttributes(bool);
1248
1249     void mouseEvent(const WebMouseEvent&);
1250     void keyEvent(const WebKeyboardEvent&);
1251
1252 #if ENABLE(IOS_TOUCH_EVENTS)
1253     void touchEventSync(const WebTouchEvent&, CompletionHandler<void(bool)>&&);
1254     void updatePotentialTapSecurityOrigin(const WebTouchEvent&, bool wasHandled);
1255 #elif ENABLE(TOUCH_EVENTS)
1256     void touchEvent(const WebTouchEvent&);
1257 #endif
1258
1259 #if ENABLE(POINTER_EVENTS)
1260     void cancelPointer(WebCore::PointerID, const WebCore::IntPoint&);
1261 #endif
1262
1263 #if ENABLE(CONTEXT_MENUS)
1264     void contextMenuHidden() { m_isShowingContextMenu = false; }
1265     void contextMenuForKeyEvent();
1266 #endif
1267
1268     static bool scroll(WebCore::Page*, WebCore::ScrollDirection, WebCore::ScrollGranularity);
1269     static bool logicalScroll(WebCore::Page*, WebCore::ScrollLogicalDirection, WebCore::ScrollGranularity);
1270
1271     void loadURLInFrame(URL&&, uint64_t frameID);
1272
1273     enum class WasRestoredByAPIRequest { No, Yes };
1274     void restoreSessionInternal(const Vector<BackForwardListItemState>&, WasRestoredByAPIRequest, WebBackForwardListProxy::OverwriteExistingItem);
1275     void restoreSession(const Vector<BackForwardListItemState>&);
1276     void didRemoveBackForwardItem(const WebCore::BackForwardItemIdentifier&);
1277     void updateBackForwardListForReattach(const Vector<WebKit::BackForwardListItemState>&);
1278     void setCurrentHistoryItemForReattach(WebKit::BackForwardListItemState&&);
1279
1280     void requestFontAttributesAtSelectionStart(CallbackID);
1281
1282 #if ENABLE(REMOTE_INSPECTOR)
1283     void setIndicating(bool);
1284 #endif
1285
1286     void setDrawsBackground(bool);
1287
1288 #if PLATFORM(COCOA)
1289     void setTopContentInsetFenced(float, IPC::Attachment);
1290 #endif
1291     void setTopContentInset(float);
1292
1293     void viewWillStartLiveResize();
1294     void viewWillEndLiveResize();
1295
1296     void getContentsAsString(CallbackID);
1297 #if ENABLE(MHTML)
1298     void getContentsAsMHTMLData(CallbackID);
1299 #endif
1300     void getMainResourceDataOfFrame(uint64_t frameID, CallbackID);
1301     void getResourceDataFromFrame(uint64_t frameID, const String& resourceURL, CallbackID);
1302     void getRenderTreeExternalRepresentation(CallbackID);
1303     void getSelectionOrContentsAsString(CallbackID);
1304     void getSelectionAsWebArchiveData(CallbackID);
1305     void getSourceForFrame(uint64_t frameID, CallbackID);
1306     void getWebArchiveOfFrame(uint64_t frameID, CallbackID);
1307     void runJavaScript(const String&, bool forceUserGesture, Optional<String> worldName, CallbackID);
1308     void runJavaScriptInMainFrame(const String&, bool forceUserGesture, CallbackID);
1309     void runJavaScriptInMainFrameScriptWorld(const String&, bool forceUserGesture, const String& worldName, CallbackID);
1310     void forceRepaint(CallbackID);
1311     void takeSnapshot(WebCore::IntRect snapshotRect, WebCore::IntSize bitmapSize, uint32_t options, CallbackID);
1312
1313     void preferencesDidChange(const WebPreferencesStore&);
1314     void updatePreferences(const WebPreferencesStore&);
1315     void updatePreferencesGenerated(const WebPreferencesStore&);
1316
1317 #if PLATFORM(IOS_FAMILY)
1318     bool parentProcessHasServiceWorkerEntitlement() const;
1319 #else
1320     bool parentProcessHasServiceWorkerEntitlement() const { return true; }
1321 #endif
1322
1323     void didReceivePolicyDecision(uint64_t frameID, uint64_t listenerID, WebCore::PolicyCheckIdentifier, WebCore::PolicyAction, uint64_t navigationID, const DownloadID&, Optional<WebsitePoliciesData>&&);
1324     void continueWillSubmitForm(uint64_t frameID, uint64_t listenerID);
1325     void setUserAgent(const String&);
1326     void setCustomTextEncodingName(const String&);
1327     void suspendActiveDOMObjectsAndAnimations();
1328     void resumeActiveDOMObjectsAndAnimations();
1329
1330 #if PLATFORM(COCOA)
1331     void performDictionaryLookupAtLocation(const WebCore::FloatPoint&);
1332     void performDictionaryLookupOfCurrentSelection();
1333     void performDictionaryLookupForRange(WebCore::Frame&, WebCore::Range&, NSDictionary *options, WebCore::TextIndicatorPresentationTransition);
1334     WebCore::DictionaryPopupInfo dictionaryPopupInfoForRange(WebCore::Frame&, WebCore::Range&, NSDictionary *options, WebCore::TextIndicatorPresentationTransition);
1335 #if ENABLE(PDFKIT_PLUGIN)
1336     WebCore::DictionaryPopupInfo dictionaryPopupInfoForSelectionInPDFPlugin(PDFSelection *, PDFPlugin&, NSDictionary *options, WebCore::TextIndicatorPresentationTransition);
1337 #endif
1338
1339     void windowAndViewFramesChanged(const WebCore::FloatRect& windowFrameInScreenCoordinates, const WebCore::FloatRect& windowFrameInUnflippedScreenCoordinates, const WebCore::FloatRect& viewFrameInWindowCoordinates, const WebCore::FloatPoint& accessibilityViewCoordinates);
1340
1341     RetainPtr<PDFDocument> pdfDocumentForPrintingFrame(WebCore::Frame*);
1342     void computePagesForPrintingPDFDocument(uint64_t frameID, const PrintInfo&, Vector<WebCore::IntRect>& resultPageRects);
1343     void drawPDFDocument(CGContextRef, PDFDocument *, const PrintInfo&, const WebCore::IntRect&);
1344     void drawPagesToPDFFromPDFDocument(CGContextRef, PDFDocument *, const PrintInfo&, uint32_t first, uint32_t count);
1345 #endif
1346
1347     void setMainFrameIsScrollable(bool);
1348
1349     void unapplyEditCommand(WebUndoStepID commandID);
1350     void reapplyEditCommand(WebUndoStepID commandID);
1351     void didRemoveEditCommand(WebUndoStepID commandID);
1352
1353     void findString(const String&, uint32_t findOptions, uint32_t maxMatchCount);
1354     void findStringMatches(const String&, uint32_t findOptions, uint32_t maxMatchCount);
1355     void getImageForFindMatch(uint32_t matchIndex);
1356     void selectFindMatch(uint32_t matchIndex);
1357     void hideFindUI();
1358     void countStringMatches(const String&, uint32_t findOptions, uint32_t maxMatchCount);
1359     void replaceMatches(const Vector<uint32_t>& matchIndices, const String& replacementText, bool selectionOnly, CallbackID);
1360
1361 #if USE(COORDINATED_GRAPHICS)
1362     void sendViewportAttributesChanged(const WebCore::ViewportArguments&);
1363 #endif
1364
1365     void didChangeSelectedIndexForActivePopupMenu(int32_t newIndex);
1366     void setTextForActivePopupMenu(int32_t index);
1367
1368 #if PLATFORM(GTK)
1369     void failedToShowPopupMenu();
1370 #endif
1371
1372     void didChooseFilesForOpenPanel(const Vector<String>&);
1373     void didCancelForOpenPanel();
1374
1375 #if PLATFORM(IOS_FAMILY)
1376     void didChooseFilesForOpenPanelWithDisplayStringAndIcon(const Vector<String>&, const String& displayString, const IPC::DataReference& iconData);
1377 #endif
1378
1379 #if ENABLE(SANDBOX_EXTENSIONS)
1380     void extendSandboxForFilesFromOpenPanel(SandboxExtension::HandleArray&&);
1381 #endif
1382
1383     void didReceiveGeolocationPermissionDecision(uint64_t geolocationID, bool allowed);
1384
1385     void didReceiveNotificationPermissionDecision(uint64_t notificationID, bool allowed);
1386
1387 #if ENABLE(MEDIA_STREAM)
1388     void userMediaAccessWasGranted(uint64_t userMediaID, WebCore::CaptureDevice&& audioDeviceUID, WebCore::CaptureDevice&& videoDeviceUID, String&& mediaDeviceIdentifierHashSalt);
1389     void userMediaAccessWasDenied(uint64_t userMediaID, uint64_t reason, String&& invalidConstraint);
1390
1391     void didCompleteMediaDeviceEnumeration(uint64_t userMediaID, const Vector<WebCore::CaptureDevice>& devices, String&& deviceIdentifierHashSalt, bool originHasPersistentAccess);
1392 #endif
1393
1394 #if ENABLE(MEDIA_STREAM) && ENABLE(SANDBOX_EXTENSIONS)
1395     void grantUserMediaDeviceSandboxExtensions(MediaDeviceSandboxExtensions&&);
1396     void revokeUserMediaDeviceSandboxExtensions(const Vector<String>&);
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 #endif
1459
1460     void setShouldDispatchFakeMouseMoveEvents(bool dispatch) { m_shouldDispatchFakeMouseMoveEvents = dispatch; }
1461
1462 #if ENABLE(WIRELESS_PLAYBACK_TARGET) && !PLATFORM(IOS_FAMILY)
1463     void playbackTargetSelected(uint64_t, const WebCore::MediaPlaybackTargetContext& outputDevice) const;
1464     void playbackTargetAvailabilityDidChange(uint64_t, bool);
1465     void setShouldPlayToPlaybackTarget(uint64_t, bool);
1466 #endif
1467
1468     void clearWheelEventTestTrigger();
1469
1470     void setShouldScaleViewToFitDocument(bool);
1471
1472     void pageStoppedScrolling();
1473
1474 #if ENABLE(VIDEO) && USE(GSTREAMER)
1475     void didEndRequestInstallMissingMediaPlugins(uint32_t result);
1476 #endif
1477
1478     void setResourceCachingDisabled(bool);
1479     void setUserInterfaceLayoutDirection(uint32_t);
1480
1481     bool canPluginHandleResponse(const WebCore::ResourceResponse&);
1482
1483 #if USE(QUICK_LOOK)
1484     void didReceivePasswordForQuickLookDocument(const String&);
1485 #endif
1486
1487     void simulateDeviceOrientationChange(double alpha, double beta, double gamma);
1488
1489     void frameBecameRemote(uint64_t frameID, WebCore::GlobalFrameIdentifier&& remoteFrameIdentifier, WebCore::GlobalWindowIdentifier&& remoteWindowIdentifier);
1490
1491     void registerURLSchemeHandler(uint64_t identifier, const String& scheme);
1492
1493     void urlSchemeTaskDidPerformRedirection(uint64_t handlerIdentifier, uint64_t taskIdentifier, WebCore::ResourceResponse&&, WebCore::ResourceRequest&&);
1494     void urlSchemeTaskDidReceiveResponse(uint64_t handlerIdentifier, uint64_t taskIdentifier, const WebCore::ResourceResponse&);
1495     void urlSchemeTaskDidReceiveData(uint64_t handlerIdentifier, uint64_t taskIdentifier, const IPC::DataReference&);
1496     void urlSchemeTaskDidComplete(uint64_t handlerIdentifier, uint64_t taskIdentifier, const WebCore::ResourceError&);
1497
1498     void setIsSuspended(bool);
1499
1500     RefPtr<WebImage> snapshotAtSize(const WebCore::IntRect&, const WebCore::IntSize& bitmapSize, SnapshotOptions);
1501     RefPtr<WebImage> snapshotNode(WebCore::Node&, SnapshotOptions, unsigned maximumPixelCount = std::numeric_limits<unsigned>::max());
1502 #if USE(CF)
1503     RetainPtr<CFDataRef> pdfSnapshotAtSize(const WebCore::IntRect&, const WebCore::IntSize& bitmapSize, SnapshotOptions);
1504 #endif
1505
1506 #if ENABLE(ATTACHMENT_ELEMENT)
1507     RefPtr<WebCore::HTMLAttachmentElement> attachmentElementWithIdentifier(const String& identifier) const;
1508 #endif
1509
1510     bool canShowMIMEType(const String&, const Function<bool(const String&, WebCore::PluginData::AllowedPluginTypes)>& supportsPlugin) const;
1511
1512     void cancelGesturesBlockedOnSynchronousReplies();
1513
1514     uint64_t m_pageID;
1515
1516     std::unique_ptr<WebCore::Page> m_page;
1517     RefPtr<WebFrame> m_mainFrame;
1518
1519     RefPtr<WebPageGroupProxy> m_pageGroup;
1520
1521     String m_userAgent;
1522
1523     WebCore::IntSize m_viewSize;
1524     std::unique_ptr<DrawingArea> m_drawingArea;
1525     bool m_shouldResetDrawingAreaAfterSuspend { false };
1526
1527     HashSet<PluginView*> m_pluginViews;
1528     bool m_hasSeenPlugin { false };
1529
1530     HashMap<uint64_t, RefPtr<WebCore::TextCheckingRequest>> m_pendingTextCheckingRequestMap;
1531
1532     bool m_useFixedLayout { false };
1533     bool m_drawsBackground { true };
1534
1535     WebCore::Color m_underlayColor;
1536
1537     bool m_isInRedo { false };
1538     bool m_isClosed { false };
1539     bool m_tabToLinks { false };
1540     
1541     bool m_asynchronousPluginInitializationEnabled { false };
1542     bool m_asynchronousPluginInitializationEnabledForAllPlugins { false };
1543     bool m_artificialPluginInitializationDelayEnabled { false };
1544     bool m_scrollingPerformanceLoggingEnabled { false };
1545     bool m_mainFrameIsScrollable { true };
1546
1547     bool m_alwaysShowsHorizontalScroller { false };
1548     bool m_alwaysShowsVerticalScroller { false };
1549
1550 #if PLATFORM(IOS_FAMILY)
1551     bool m_ignoreViewportScalingConstraints { false };
1552 #endif
1553
1554 #if ENABLE(PRIMARY_SNAPSHOTTED_PLUGIN_HEURISTIC)
1555     bool m_readyToFindPrimarySnapshottedPlugin { false };
1556     bool m_didFindPrimarySnapshottedPlugin { false };
1557     unsigned m_numberOfPrimarySnapshotDetectionAttempts { 0 };
1558     String m_primaryPlugInPageOrigin;
1559     String m_primaryPlugInOrigin;
1560     String m_primaryPlugInMimeType;
1561     RunLoop::Timer<WebPage> m_determinePrimarySnapshottedPlugInTimer;
1562 #endif
1563
1564     // The layer hosting mode.
1565     LayerHostingMode m_layerHostingMode;
1566
1567 #if PLATFORM(COCOA)
1568     bool m_pdfPluginEnabled { false };
1569     bool m_hasCachedWindowFrame { false };
1570
1571     // The frame of the containing window in screen coordinates.
1572     WebCore::FloatRect m_windowFrameInScreenCoordinates;
1573
1574     // The frame of the containing window in unflipped screen coordinates.
1575     WebCore::FloatRect m_windowFrameInUnflippedScreenCoordinates;
1576
1577     // The frame of the view in window coordinates.
1578     WebCore::FloatRect m_viewFrameInWindowCoordinates;
1579
1580     // The accessibility position of the view.
1581     WebCore::FloatPoint m_accessibilityPosition;
1582     
1583     RetainPtr<WKAccessibilityWebPageObject> m_mockAccessibilityElement;
1584 #endif
1585
1586 #if PLATFORM(COCOA) || PLATFORM(GTK)
1587     std::unique_ptr<ViewGestureGeometryCollector> m_viewGestureGeometryCollector;
1588 #endif
1589
1590 #if PLATFORM(COCOA)
1591     RetainPtr<NSDictionary> m_dataDetectionContext;
1592 #endif
1593
1594 #if HAVE(ACCESSIBILITY) && PLATFORM(GTK)
1595     GRefPtr<WebPageAccessibilityObject> m_accessibilityObject;
1596 #endif
1597
1598 #if PLATFORM(GTK) && USE(TEXTURE_MAPPER_GL)
1599     // Our view's window in the UI process.
1600     uint64_t m_nativeWindowHandle { 0 };
1601 #endif
1602
1603 #if !PLATFORM(IOS_FAMILY)
1604     RefPtr<PageBanner> m_headerBanner;
1605     RefPtr<PageBanner> m_footerBanner;
1606 #endif
1607
1608     RunLoop::Timer<WebPage> m_setCanStartMediaTimer;
1609     bool m_mayStartMediaWhenInWindow { false };
1610
1611     HashMap<WebUndoStepID, RefPtr<WebUndoStep>> m_undoStepMap;
1612
1613 #if ENABLE(CONTEXT_MENUS)
1614     std::unique_ptr<API::InjectedBundle::PageContextMenuClient> m_contextMenuClient;
1615 #endif
1616     std::unique_ptr<API::InjectedBundle::EditorClient> m_editorClient;
1617     std::unique_ptr<API::InjectedBundle::FormClient> m_formClient;
1618     std::unique_ptr<API::InjectedBundle::PageLoaderClient> m_loaderClient;
1619     InjectedBundlePagePolicyClient m_policyClient;
1620     std::unique_ptr<API::InjectedBundle::ResourceLoadClient> m_resourceLoadClient;
1621     std::unique_ptr<API::InjectedBundle::PageUIClient> m_uiClient;
1622 #if ENABLE(FULLSCREEN_API)
1623     InjectedBundlePageFullScreenClient m_fullScreenClient;
1624 #endif
1625
1626     UniqueRef<FindController> m_findController;
1627
1628     RefPtr<WebInspector> m_inspector;
1629     RefPtr<WebInspectorUI> m_inspectorUI;
1630     RefPtr<RemoteWebInspectorUI> m_remoteInspectorUI;
1631     std::unique_ptr<WebPageInspectorTargetController> m_inspectorTargetController;
1632
1633 #if (PLATFORM(IOS_FAMILY) && HAVE(AVKIT)) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))
1634     RefPtr<PlaybackSessionManager> m_playbackSessionManager;
1635     RefPtr<VideoFullscreenManager> m_videoFullscreenManager;
1636 #endif
1637
1638 #if PLATFORM(IOS_FAMILY)
1639     bool m_allowsMediaDocumentInlinePlayback { false };
1640     RefPtr<WebCore::Range> m_startingGestureRange;
1641 #endif
1642
1643 #if ENABLE(FULLSCREEN_API)
1644     RefPtr<WebFullScreenManager> m_fullScreenManager;
1645 #endif
1646
1647     RefPtr<WebPopupMenu> m_activePopupMenu;
1648
1649 #if ENABLE(CONTEXT_MENUS)
1650     RefPtr<WebContextMenu> m_contextMenu;
1651 #endif
1652
1653 #if ENABLE(INPUT_TYPE_COLOR)
1654     WebColorChooser* m_activeColorChooser { nullptr };
1655 #endif
1656
1657 #if ENABLE(DATALIST_ELEMENT)
1658     WebDataListSuggestionPicker* m_activeDataListSuggestionPicker { nullptr };
1659 #endif
1660
1661     RefPtr<WebOpenPanelResultListener> m_activeOpenPanelResultListener;
1662     RefPtr<NotificationPermissionRequestManager> m_notificationPermissionRequestManager;
1663
1664     Ref<WebUserContentController> m_userContentController;
1665
1666 #if ENABLE(GEOLOCATION)
1667     UniqueRef<GeolocationPermissionRequestManager> m_geolocationPermissionRequestManager;
1668 #endif
1669
1670 #if ENABLE(MEDIA_STREAM)
1671     UniqueRef<UserMediaPermissionRequestManager> m_userMediaPermissionRequestManager;
1672 #endif
1673
1674     std::unique_ptr<WebCore::PrintContext> m_printContext;
1675 #if PLATFORM(GTK)
1676     RefPtr<WebPrintOperationGtk> m_printOperation;
1677 #endif
1678
1679     SandboxExtensionTracker m_sandboxExtensionTracker;
1680
1681     RefPtr<SandboxExtension> m_pendingDropSandboxExtension;
1682     Vector<RefPtr<SandboxExtension>> m_pendingDropExtensionsForFileUpload;
1683
1684     PAL::HysteresisActivity m_pageScrolledHysteresis;
1685
1686     bool m_canRunBeforeUnloadConfirmPanel { false };
1687
1688     bool m_canRunModal { false };
1689     bool m_isRunningModal { false };
1690
1691 #if ENABLE(DRAG_SUPPORT)
1692     bool m_isStartingDrag { false };
1693 #endif
1694
1695     bool m_cachedMainFrameIsPinnedToLeftSide { true };
1696     bool m_cachedMainFrameIsPinnedToRightSide { true };
1697     bool m_cachedMainFrameIsPinnedToTopSide { true };
1698     bool m_cachedMainFrameIsPinnedToBottomSide { true };
1699     bool m_canShortCircuitHorizontalWheelEvents { false };
1700     bool m_hasWheelEventHandlers { false };
1701
1702     unsigned m_cachedPageCount { 0 };
1703
1704     HashSet<unsigned long> m_trackedNetworkResourceRequestIdentifiers;
1705
1706     WebCore::IntSize m_viewLayoutSize;
1707     bool m_autoSizingShouldExpandToViewHeight { false };
1708     Optional<WebCore::IntSize> m_viewportSizeForCSSViewportUnits;
1709
1710     bool m_userIsInteracting { false };
1711     bool m_isFocusingElementDueToUserInteraction { false };
1712     bool m_hasEverFocusedElementDueToUserInteractionSincePageTransition { false };
1713     bool m_needsHiddenContentEditableQuirk { false };
1714     bool m_needsPlainTextQuirk { false };
1715     bool m_changingActivityState { false };
1716
1717 #if ENABLE(CONTEXT_MENUS)
1718     bool m_isShowingContextMenu { false };
1719 #endif
1720
1721     RefPtr<WebCore::Element> m_focusedElement;
1722     bool m_hasPendingBlurNotification { false };
1723     bool m_hasPendingEditorStateUpdate { false };
1724
1725 #if ENABLE(IOS_TOUCH_EVENTS)
1726     CompletionHandler<void(bool)> m_pendingSynchronousTouchEventReply;
1727 #endif
1728     
1729 #if PLATFORM(IOS_FAMILY)
1730     RefPtr<WebCore::Range> m_currentWordRange;
1731     RefPtr<WebCore::Node> m_interactionNode;
1732     WebCore::IntPoint m_lastInteractionLocation;
1733     
1734     enum SelectionAnchor { Start, End };
1735     SelectionAnchor m_selectionAnchor { Start };
1736
1737     RefPtr<WebCore::Node> m_potentialTapNode;
1738     WebCore::FloatPoint m_potentialTapLocation;
1739     RefPtr<WebCore::SecurityOrigin> m_potentialTapSecurityOrigin;
1740
1741     WebCore::ViewportConfiguration m_viewportConfiguration;
1742
1743     bool m_hasReceivedVisibleContentRectsAfterDidCommitLoad { false };
1744     bool m_hasRestoredExposedContentRectAfterDidCommitLoad { false };
1745     bool m_scaleWasSetByUIProcess { false };
1746     bool m_userHasChangedPageScaleFactor { false };
1747     bool m_hasStablePageScaleFactor { true };
1748     bool m_useTestingViewportConfiguration { false };
1749     bool m_isInStableState { true };
1750     bool m_forceAlwaysUserScalable { false };
1751     MonotonicTime m_oldestNonStableUpdateVisibleContentRectsTimestamp;
1752     Seconds m_estimatedLatency { 0 };
1753     WebCore::FloatSize m_screenSize;
1754     WebCore::FloatSize m_availableScreenSize;
1755     WebCore::FloatSize m_overrideScreenSize;
1756     RefPtr<WebCore::Range> m_currentBlockSelection;
1757     WebCore::IntRect m_blockRectForTextSelection;
1758
1759     RefPtr<WebCore::Range> m_initialSelection;
1760     WebCore::VisibleSelection m_storedSelectionForAccessibility { WebCore::VisibleSelection() };
1761     WebCore::IntSize m_blockSelectionDesiredSize;
1762     WebCore::FloatSize m_maximumUnobscuredSize;
1763     int32_t m_deviceOrientation { 0 };
1764     bool m_inDynamicSizeUpdate { false };
1765     HashMap<std::pair<WebCore::IntSize, double>, WebCore::IntPoint> m_dynamicSizeUpdateHistory;
1766     RefPtr<WebCore::Node> m_pendingSyntheticClickNode;
1767     WebCore::FloatPoint m_pendingSyntheticClickLocation;
1768     WebCore::FloatRect m_previousExposedContentRect;
1769     OptionSet<WebKit::WebEvent::Modifier> m_pendingSyntheticClickModifiers;
1770     FocusedElementIdentifier m_currentFocusedElementIdentifier { 0 };
1771     Optional<DynamicViewportSizeUpdateID> m_pendingDynamicViewportSizeUpdateID;
1772     double m_lastTransactionPageScaleFactor { 0 };
1773     uint64_t m_lastTransactionIDWithScaleChange { 0 };
1774
1775     CompletionHandler<void(InteractionInformationAtPosition&&)> m_pendingSynchronousPositionInformationReply;
1776 #endif
1777
1778     WebCore::Timer m_layerVolatilityTimer;
1779     Vector<WTF::Function<void (bool)>> m_markLayersAsVolatileCompletionHandlers;
1780     bool m_isSuspendedUnderLock { false };
1781
1782     HashSet<String, ASCIICaseInsensitiveHash> m_mimeTypesWithCustomContentProviders;
1783     WebCore::Color m_backgroundColor { WebCore::Color::white };
1784
1785     HashSet<unsigned> m_activeRenderingSuppressionTokens;
1786     unsigned m_maximumRenderingSuppressionToken { 0 };
1787     
1788     WebCore::ScrollPinningBehavior m_scrollPinningBehavior { WebCore::DoNotPin };
1789     Optional<WebCore::ScrollbarOverlayStyle> m_scrollbarOverlayStyle;
1790
1791     bool m_useAsyncScrolling { false };
1792
1793     OptionSet<WebCore::ActivityState::Flag> m_activityState;
1794
1795     bool m_processSuppressionEnabled;
1796     UserActivity m_userActivity;
1797     PAL::HysteresisActivity m_userActivityHysteresis;
1798
1799     uint64_t m_pendingNavigationID { 0 };
1800     Optional<WebsitePoliciesData> m_pendingWebsitePolicies;
1801
1802     bool m_mainFrameProgressCompleted { false };
1803     bool m_shouldDispatchFakeMouseMoveEvents { true };
1804     bool m_isEditorStateMissingPostLayoutData { false };
1805     bool m_isSelectingTextWhileInsertingAsynchronously { false };
1806
1807     enum class EditorStateIsContentEditable { No, Yes, Unset };
1808     mutable EditorStateIsContentEditable m_lastEditorStateWasContentEditable { EditorStateIsContentEditable::Unset };
1809
1810 #if PLATFORM(GTK)
1811     bool m_inputMethodEnabled { false };
1812 #endif
1813
1814 #if ENABLE(VIDEO) && USE(GSTREAMER)
1815     RefPtr<WebCore::MediaPlayerRequestInstallMissingPluginsCallback> m_installMediaPluginsCallback;
1816 #endif
1817
1818 #if USE(OS_STATE)
1819     WallTime m_loadCommitTime;
1820 #endif
1821
1822     WebCore::UserInterfaceLayoutDirection m_userInterfaceLayoutDirection { WebCore::UserInterfaceLayoutDirection::LTR };
1823
1824     const String m_overrideContentSecurityPolicy;
1825     const Optional<double> m_cpuLimit;
1826
1827 #if PLATFORM(WPE)
1828     IPC::Attachment m_hostFileDescriptor;
1829 #endif
1830
1831     HashMap<String, RefPtr<WebURLSchemeHandlerProxy>> m_schemeToURLSchemeHandlerProxyMap;
1832     HashMap<uint64_t, WebURLSchemeHandlerProxy*> m_identifierToURLSchemeHandlerProxyMap;
1833
1834     HashMap<uint64_t, WTF::Function<void(bool granted)>> m_storageAccessResponseCallbackMap;
1835     HashMap<ShareSheetCallbackID, WTF::Function<void(bool completed)>> m_shareSheetResponseCallbackMap;
1836
1837 #if ENABLE(APPLICATION_MANIFEST)
1838     HashMap<uint64_t, uint64_t> m_applicationManifestFetchCallbackMap;
1839 #endif
1840
1841     OptionSet<LayerTreeFreezeReason> m_LayerTreeFreezeReasons;
1842     bool m_isSuspended { false };
1843     bool m_needsFontAttributes { false };
1844 };
1845
1846 } // namespace WebKit
1847