Add support for using the current text selection as the find string on iOS
[WebKit-https.git] / Source / WebKit / WebProcess / WebPage / WebPage.h
1 /*
2  * Copyright (C) 2010-2018 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 "WebUserContentController.h"
54 #include "WebsitePoliciesData.h"
55 #include <JavaScriptCore/InspectorFrontendChannel.h>
56 #include <WebCore/ActivityState.h>
57 #include <WebCore/DictionaryPopupInfo.h>
58 #include <WebCore/DisabledAdaptations.h>
59 #include <WebCore/FrameLoaderTypes.h>
60 #include <WebCore/HTMLMenuElement.h>
61 #include <WebCore/HTMLMenuItemElement.h>
62 #include <WebCore/IntRect.h>
63 #include <WebCore/IntSizeHash.h>
64 #include <WebCore/Page.h>
65 #include <WebCore/PageOverlay.h>
66 #include <WebCore/PluginData.h>
67 #include <WebCore/SecurityPolicyViolationEvent.h>
68 #include <WebCore/ShareData.h>
69 #include <WebCore/UserActivity.h>
70 #include <WebCore/UserContentTypes.h>
71 #include <WebCore/UserInterfaceLayoutDirection.h>
72 #include <WebCore/UserScriptTypes.h>
73 #include <WebCore/VisibilityState.h>
74 #include <WebCore/WebCoreKeyboardUIMode.h>
75 #include <memory>
76 #include <pal/HysteresisActivity.h>
77 #include <wtf/HashMap.h>
78 #include <wtf/MonotonicTime.h>
79 #include <wtf/RefPtr.h>
80 #include <wtf/RunLoop.h>
81 #include <wtf/Seconds.h>
82 #include <wtf/WallTime.h>
83 #include <wtf/text/WTFString.h>
84
85 #if HAVE(ACCESSIBILITY) && PLATFORM(GTK)
86 #include "WebPageAccessibilityObject.h"
87 #include <wtf/glib/GRefPtr.h>
88 #endif
89
90 #if PLATFORM(GTK)
91 #include "ArgumentCodersGtk.h"
92 #include "WebPrintOperationGtk.h"
93 #endif
94
95 #if PLATFORM(IOS_FAMILY)
96 #include "GestureTypes.h"
97 #include "WebPageMessages.h"
98 #include <WebCore/IntPointHash.h>
99 #include <WebCore/ViewportConfiguration.h>
100 #endif
101
102 #if ENABLE(APPLICATION_MANIFEST)
103 #include <WebCore/ApplicationManifest.h>
104 #endif
105
106 #if ENABLE(IOS_TOUCH_EVENTS)
107 #include <WebKitAdditions/PlatformTouchEventIOS.h>
108 #elif ENABLE(TOUCH_EVENTS)
109 #include <WebCore/PlatformTouchEvent.h>
110 #endif
111
112 #if ENABLE(DATA_DETECTION)
113 #include <WebCore/DataDetection.h>
114 #endif
115
116 #if ENABLE(MAC_GESTURE_EVENTS)
117 #include <WebKitAdditions/PlatformGestureEventMac.h>
118 #endif
119
120 #if PLATFORM(COCOA)
121 #include "DynamicViewportSizeUpdate.h"
122 #include <WebCore/VisibleSelection.h>
123 #include <wtf/RetainPtr.h>
124 OBJC_CLASS CALayer;
125 OBJC_CLASS NSArray;
126 OBJC_CLASS NSDictionary;
127 OBJC_CLASS NSObject;
128 OBJC_CLASS WKAccessibilityWebPageObject;
129 #endif
130
131 namespace API {
132 class Array;
133 }
134
135 namespace IPC {
136 class Connection;
137 class Decoder;
138 class FormDataReference;
139 }
140
141 namespace WebCore {
142
143 class CaptureDevice;
144 class DocumentLoader;
145 class DragData;
146 class FontAttributeChanges;
147 class FontChanges;
148 class Frame;
149 class FrameSelection;
150 class FrameView;
151 class GraphicsContext;
152 class HTMLMenuElement;
153 class HTMLMenuItemElement;
154 class HTMLPlugInElement;
155 class HTMLPlugInImageElement;
156 class IntPoint;
157 class KeyboardEvent;
158 class MediaPlaybackTargetContext;
159 class MediaPlayerRequestInstallMissingPluginsCallback;
160 class Page;
161 class PrintContext;
162 class Range;
163 class ResourceRequest;
164 class ResourceResponse;
165 class SelectionRect;
166 class SharedBuffer;
167 class SubstituteData;
168 class TextCheckingRequest;
169 class VisiblePosition;
170
171 enum SyntheticClickType : int8_t;
172 enum class DragHandlingMethod : uint8_t;
173 enum class ShouldTreatAsContinuingLoad : bool;
174 enum class TextIndicatorPresentationTransition : uint8_t;
175 enum class WritingDirection : uint8_t;
176
177 struct BackForwardItemIdentifier;
178 struct CompositionUnderline;
179 struct DictationAlternative;
180 struct GlobalFrameIdentifier;
181 struct GlobalWindowIdentifier;
182 struct Highlight;
183 struct KeypressCommand;
184 struct PromisedAttachmentInfo;
185 struct TextCheckingResult;
186 struct ViewportArguments;
187
188 #if ENABLE(ATTACHMENT_ELEMENT)
189 class HTMLAttachmentElement;
190 #endif
191 }
192
193 namespace WebKit {
194
195 class DataReference;
196 class DrawingArea;
197 class DownloadID;
198 class FindController;
199 class GamepadData;
200 class GeolocationPermissionRequestManager;
201 class MediaDeviceSandboxExtensions;
202 class NotificationPermissionRequestManager;
203 class PDFPlugin;
204 class PageBanner;
205 class PluginView;
206 class RemoteWebInspectorUI;
207 class UserMediaPermissionRequestManager;
208 class ViewGestureGeometryCollector;
209 class VisibleContentRectUpdateInfo;
210 class WebColorChooser;
211 class WebContextMenu;
212 class WebContextMenuItemData;
213 class WebDataListSuggestionPicker;
214 class WebDocumentLoader;
215 class WebEvent;
216 class PlaybackSessionManager;
217 class VideoFullscreenManager;
218 class WebFrame;
219 class WebFullScreenManager;
220 class WebGestureEvent;
221 class WebImage;
222 class WebInspector;
223 class WebInspectorClient;
224 class WebInspectorUI;
225 class WebKeyboardEvent;
226 class WebMouseEvent;
227 class WebNotificationClient;
228 class WebOpenPanelResultListener;
229 class WebPageGroupProxy;
230 class WebPageInspectorTargetController;
231 class WebPageOverlay;
232 class WebPopupMenu;
233 class WebTouchEvent;
234 class WebURLSchemeHandlerProxy;
235 class WebUndoStep;
236 class WebUserContentController;
237 class WebWheelEvent;
238 class RemoteLayerTreeTransaction;
239
240 enum FindOptions : uint16_t;
241 enum class DragControllerAction : uint8_t;
242 enum class WebPolicyAction : uint8_t;
243
244 struct AttributedString;
245 struct DataDetectionResult;
246 struct BackForwardListItemState;
247 struct EditorState;
248 struct InteractionInformationAtPosition;
249 struct InteractionInformationRequest;
250 struct LoadParameters;
251 struct PrintInfo;
252 struct WebPageCreationParameters;
253 struct WebPreferencesStore;
254 struct WebSelectionData;
255 struct WebsitePoliciesData;
256
257 using SnapshotOptions = uint32_t;
258 using WKEventModifiers = uint32_t;
259
260 class WebPage : public API::ObjectImpl<API::Object::Type::BundlePage>, public IPC::MessageReceiver, public IPC::MessageSender, public CanMakeWeakPtr<WebPage> {
261 public:
262     static Ref<WebPage> create(uint64_t pageID, WebPageCreationParameters&&);
263     virtual ~WebPage();
264
265     void reinitializeWebPage(WebPageCreationParameters&&);
266
267     void close();
268
269     static WebPage* fromCorePage(WebCore::Page*);
270
271     WebCore::Page* corePage() const { return m_page.get(); }
272     uint64_t pageID() const { return m_pageID; }
273     PAL::SessionID sessionID() const { return m_page->sessionID(); }
274     bool usesEphemeralSession() const { return m_page->usesEphemeralSession(); }
275
276     void setSessionID(PAL::SessionID);
277
278     void setSize(const WebCore::IntSize&);
279     const WebCore::IntSize& size() const { return m_viewSize; }
280     WebCore::IntRect bounds() const { return WebCore::IntRect(WebCore::IntPoint(), size()); }
281
282     DrawingArea* drawingArea() const { return m_drawingArea.get(); }
283
284 #if ENABLE(ASYNC_SCROLLING)
285     WebCore::ScrollingCoordinator* scrollingCoordinator() const;
286 #endif
287
288     WebPageGroupProxy* pageGroup() const { return m_pageGroup.get(); }
289
290     void scrollMainFrameIfNotAtMaxScrollPosition(const WebCore::IntSize& scrollOffset);
291
292     bool scrollBy(uint32_t scrollDirection, uint32_t scrollGranularity);
293
294     void centerSelectionInVisibleArea();
295
296 #if PLATFORM(COCOA)
297     void willCommitLayerTree(RemoteLayerTreeTransaction&);
298     void didFlushLayerTreeAtTime(MonotonicTime);
299 #endif
300
301     void willDisplayPage();
302
303     enum class LazyCreationPolicy { UseExistingOnly, CreateIfNeeded };
304
305     WebInspector* inspector(LazyCreationPolicy = LazyCreationPolicy::CreateIfNeeded);
306     WebInspectorUI* inspectorUI();
307     RemoteWebInspectorUI* remoteInspectorUI();
308     bool isInspectorPage() { return !!m_inspectorUI || !!m_remoteInspectorUI; }
309
310     void inspectorFrontendCountChanged(unsigned);
311
312 #if PLATFORM(IOS_FAMILY) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))
313     PlaybackSessionManager& playbackSessionManager();
314     VideoFullscreenManager& videoFullscreenManager();
315     void videoControlsManagerDidChange();
316 #endif
317
318 #if PLATFORM(IOS_FAMILY)
319     void setAllowsMediaDocumentInlinePlayback(bool);
320     bool allowsMediaDocumentInlinePlayback() const { return m_allowsMediaDocumentInlinePlayback; }
321 #endif
322
323 #if ENABLE(FULLSCREEN_API)
324     WebFullScreenManager* fullScreenManager();
325 #endif
326
327     void addConsoleMessage(uint64_t frameID, MessageSource, MessageLevel, const String&, uint64_t requestID = 0);
328     void sendCSPViolationReport(uint64_t frameID, const URL& reportURL, IPC::FormDataReference&&);
329     void enqueueSecurityPolicyViolationEvent(uint64_t frameID, WebCore::SecurityPolicyViolationEvent::Init&&);
330
331     // -- Called by the DrawingArea.
332     // FIXME: We could genericize these into a DrawingArea client interface. Would that be beneficial?
333     void drawRect(WebCore::GraphicsContext&, const WebCore::IntRect&);
334     void layoutIfNeeded();
335
336     // -- Called from WebCore clients.
337     bool handleEditingKeyboardEvent(WebCore::KeyboardEvent*);
338
339     void didStartPageTransition();
340     void didCompletePageTransition();
341     void didCommitLoad(WebFrame*);
342     void willReplaceMultipartContent(const WebFrame&);
343     void didReplaceMultipartContent(const WebFrame&);
344     void didFinishLoad(WebFrame*);
345     void show();
346     String userAgent(const URL&) const;
347     String userAgent(WebFrame*, const URL&) const;
348     String platformUserAgent(const URL&) const;
349     WebCore::KeyboardUIMode keyboardUIMode();
350
351     void didInsertMenuElement(WebCore::HTMLMenuElement&);
352     void didRemoveMenuElement(WebCore::HTMLMenuElement&);
353     void didInsertMenuItemElement(WebCore::HTMLMenuItemElement&);
354     void didRemoveMenuItemElement(WebCore::HTMLMenuItemElement&);
355
356     const String& overrideContentSecurityPolicy() const { return m_overrideContentSecurityPolicy; }
357
358     WebUndoStep* webUndoStep(uint64_t);
359     void addWebUndoStep(uint64_t, WebUndoStep*);
360     void removeWebEditCommand(uint64_t);
361     bool isInRedo() const { return m_isInRedo; }
362
363     bool isAlwaysOnLoggingAllowed() const;
364     void setActivePopupMenu(WebPopupMenu*);
365
366     void setHiddenPageDOMTimerThrottlingIncreaseLimit(Seconds limit)
367     {
368         m_page->setDOMTimerAlignmentIntervalIncreaseLimit(limit);
369     }
370
371 #if ENABLE(INPUT_TYPE_COLOR)
372     WebColorChooser* activeColorChooser() const { return m_activeColorChooser; }
373     void setActiveColorChooser(WebColorChooser*);
374     void didChooseColor(const WebCore::Color&);
375     void didEndColorPicker();
376 #endif
377
378 #if ENABLE(DATALIST_ELEMENT)
379     void setActiveDataListSuggestionPicker(WebDataListSuggestionPicker*);
380     void didSelectDataListOption(const String&);
381     void didCloseSuggestions();
382 #endif
383
384     WebOpenPanelResultListener* activeOpenPanelResultListener() const { return m_activeOpenPanelResultListener.get(); }
385     void setActiveOpenPanelResultListener(Ref<WebOpenPanelResultListener>&&);
386
387     void didReceiveMessage(IPC::Connection&, IPC::Decoder&) override;
388     void didReceiveSyncMessage(IPC::Connection&, IPC::Decoder&, std::unique_ptr<IPC::Encoder>&) override;
389
390     // -- InjectedBundle methods
391 #if ENABLE(CONTEXT_MENUS)
392     void setInjectedBundleContextMenuClient(std::unique_ptr<API::InjectedBundle::PageContextMenuClient>&&);
393 #endif
394     void setInjectedBundleEditorClient(std::unique_ptr<API::InjectedBundle::EditorClient>&&);
395     void setInjectedBundleFormClient(std::unique_ptr<API::InjectedBundle::FormClient>&&);
396     void setInjectedBundlePageLoaderClient(std::unique_ptr<API::InjectedBundle::PageLoaderClient>&&);
397     void initializeInjectedBundlePolicyClient(WKBundlePagePolicyClientBase*);
398     void setInjectedBundleResourceLoadClient(std::unique_ptr<API::InjectedBundle::ResourceLoadClient>&&);
399     void setInjectedBundleUIClient(std::unique_ptr<API::InjectedBundle::PageUIClient>&&);
400 #if ENABLE(FULLSCREEN_API)
401     void initializeInjectedBundleFullScreenClient(WKBundlePageFullScreenClientBase*);
402 #endif
403
404 #if ENABLE(CONTEXT_MENUS)
405     API::InjectedBundle::PageContextMenuClient& injectedBundleContextMenuClient() { return *m_contextMenuClient; }
406 #endif
407     API::InjectedBundle::EditorClient& injectedBundleEditorClient() { return *m_editorClient; }
408     API::InjectedBundle::FormClient& injectedBundleFormClient() { return *m_formClient; }
409     API::InjectedBundle::PageLoaderClient& injectedBundleLoaderClient() { return *m_loaderClient; }
410     InjectedBundlePagePolicyClient& injectedBundlePolicyClient() { return m_policyClient; }
411     API::InjectedBundle::ResourceLoadClient& injectedBundleResourceLoadClient() { return *m_resourceLoadClient; }
412     API::InjectedBundle::PageUIClient& injectedBundleUIClient() { return *m_uiClient; }
413 #if ENABLE(FULLSCREEN_API)
414     InjectedBundlePageFullScreenClient& injectedBundleFullScreenClient() { return m_fullScreenClient; }
415 #endif
416
417     bool findStringFromInjectedBundle(const String&, FindOptions);
418     void findStringMatchesFromInjectedBundle(const String&, FindOptions);
419     void replaceStringMatchesFromInjectedBundle(const Vector<uint32_t>& matchIndices, const String& replacementText, bool selectionOnly);
420
421     WebFrame* mainWebFrame() const { return m_mainFrame.get(); }
422
423     WebCore::Frame* mainFrame() const; // May return nullptr.
424     WebCore::FrameView* mainFrameView() const; // May return nullptr.
425
426     RefPtr<WebCore::Range> currentSelectionAsRange();
427
428 #if ENABLE(NETSCAPE_PLUGIN_API)
429     RefPtr<Plugin> createPlugin(WebFrame*, WebCore::HTMLPlugInElement*, const Plugin::Parameters&, String& newMIMEType);
430 #endif
431
432 #if ENABLE(WEBGL)
433     WebCore::WebGLLoadPolicy webGLPolicyForURL(WebFrame*, const URL&);
434     WebCore::WebGLLoadPolicy resolveWebGLPolicyForURL(WebFrame*, const URL&);
435 #endif
436     
437     enum class IncludePostLayoutDataHint { No, Yes };
438     EditorState editorState(IncludePostLayoutDataHint = IncludePostLayoutDataHint::Yes) const;
439     void updateEditorStateAfterLayoutIfEditabilityChanged();
440
441     String renderTreeExternalRepresentation() const;
442     String renderTreeExternalRepresentationForPrinting() const;
443     uint64_t renderTreeSize() const;
444
445     void setTracksRepaints(bool);
446     bool isTrackingRepaints() const;
447     void resetTrackedRepaints();
448     Ref<API::Array> trackedRepaintRects();
449
450     void executeEditingCommand(const String& commandName, const String& argument);
451     bool isEditingCommandEnabled(const String& commandName);
452     void clearMainFrameName();
453     void sendClose();
454
455     void suspendForProcessSwap();
456
457     void sendSetWindowFrame(const WebCore::FloatRect&);
458
459     double textZoomFactor() const;
460     void setTextZoomFactor(double);
461     double pageZoomFactor() const;
462     void setPageZoomFactor(double);
463     void setPageAndTextZoomFactors(double pageZoomFactor, double textZoomFactor);
464     void windowScreenDidChange(uint32_t);
465     String dumpHistoryForTesting(const String& directory);
466     void clearHistory();
467
468     void accessibilitySettingsDidChange();
469 #if ENABLE(ACCESSIBILITY_EVENTS)
470     void updateAccessibilityEventsEnabled(bool);
471 #endif
472
473     void scalePage(double scale, const WebCore::IntPoint& origin);
474     void scalePageInViewCoordinates(double scale, WebCore::IntPoint centerInViewCoordinates);
475     double pageScaleFactor() const;
476     double totalScaleFactor() const;
477     double viewScaleFactor() const;
478     void scaleView(double scale);
479
480     void setUseFixedLayout(bool);
481     bool useFixedLayout() const { return m_useFixedLayout; }
482     bool setFixedLayoutSize(const WebCore::IntSize&);
483     WebCore::IntSize fixedLayoutSize() const;
484
485     void listenForLayoutMilestones(OptionSet<WebCore::LayoutMilestone>);
486
487     void setSuppressScrollbarAnimations(bool);
488     
489     void setEnableVerticalRubberBanding(bool);
490     void setEnableHorizontalRubberBanding(bool);
491     
492     void setBackgroundExtendsBeyondPage(bool);
493
494     void setPaginationMode(uint32_t /* WebCore::Pagination::Mode */);
495     void setPaginationBehavesLikeColumns(bool);
496     void setPageLength(double);
497     void setGapBetweenPages(double);
498     void setPaginationLineGridEnabled(bool);
499     
500     void postInjectedBundleMessage(const String& messageName, const UserData&);
501
502     bool drawsBackground() const { return m_drawsBackground; }
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     void setUseDarkAppearance(bool);
541 #endif
542
543     bool windowIsFocused() const;
544     bool windowAndWebPageAreFocused() const;
545
546 #if !PLATFORM(IOS_FAMILY)
547     void setHeaderPageBanner(PageBanner*);
548     PageBanner* headerPageBanner();
549     void setFooterPageBanner(PageBanner*);
550     PageBanner* footerPageBanner();
551
552     void hidePageBanners();
553     void showPageBanners();
554     
555     void setHeaderBannerHeightForTesting(int);
556     void setFooterBannerHeightForTesting(int);
557 #endif
558
559     WebCore::IntPoint screenToRootView(const WebCore::IntPoint&);
560     WebCore::IntRect rootViewToScreen(const WebCore::IntRect&);
561     
562 #if PLATFORM(IOS_FAMILY)
563     WebCore::IntPoint accessibilityScreenToRootView(const WebCore::IntPoint&);
564     WebCore::IntRect rootViewToAccessibilityScreen(const WebCore::IntRect&);
565 #endif
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 prepareToSendUserMediaPermissionRequest();
585     void captureDevicesChanged();
586 #endif
587
588     void elementDidFocus(WebCore::Element&);
589     void elementDidRefocus(WebCore::Element&);
590     void elementDidBlur(WebCore::Element&);
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&, uint64_t lastLayerTreeTransactionId);
614     void potentialTapAtPosition(uint64_t requestID, const WebCore::FloatPoint&);
615     void commitPotentialTap(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, bool& correctionApplied);
646     void requestAutocorrectionContext(CallbackID);
647     void getAutocorrectionContext(String& beforeText, String& markedText, String& selectedText, String& afterText, uint64_t& location, uint64_t& length);
648     void getPositionInformation(const InteractionInformationRequest&, 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     WebCore::IntRect rectForElementAtInteractionLocation();
659     void updateSelectionAppearance();
660     void getSelectionContext(CallbackID);
661     void handleTwoFingerTapAtPoint(const WebCore::IntPoint&, uint64_t requestID);
662     void handleStylusSingleTapAtPoint(const WebCore::IntPoint&, uint64_t requestID);
663     void getRectsForGranularityWithSelectionOffset(uint32_t, int32_t, CallbackID);
664     void getRectsAtSelectionOffsetWithText(int32_t, const String&, CallbackID);
665     void storeSelectionForAccessibility(bool);
666     void startAutoscrollAtPosition(const WebCore::FloatPoint&);
667     void cancelAutoscroll();
668
669     void contentSizeCategoryDidChange(const String&);
670
671     Seconds eventThrottlingDelay() const;
672
673     void showInspectorHighlight(const WebCore::Highlight&);
674     void hideInspectorHighlight();
675
676     void showInspectorIndication();
677     void hideInspectorIndication();
678
679     void enableInspectorNodeSearch();
680     void disableInspectorNodeSearch();
681
682     bool forceAlwaysUserScalable() const { return m_forceAlwaysUserScalable; }
683     void setForceAlwaysUserScalable(bool);
684 #endif
685
686 #if PLATFORM(IOS_FAMILY) && ENABLE(IOS_TOUCH_EVENTS)
687     void dispatchAsynchronousTouchEvents(const Vector<WebTouchEvent, 1>& queue);
688 #endif
689
690     bool hasRichlyEditableSelection() const;
691
692     enum class LayerTreeFreezeReason {
693         PageTransition          = 1 << 0,
694         BackgroundApplication   = 1 << 1,
695         ProcessSuspended        = 1 << 2,
696         PageSuspended           = 1 << 3,
697         Printing                = 1 << 4,
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 didConcludeEditDataInteraction();
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     void storageAccessResponse(bool wasGranted, uint64_t contextId);
1113 #endif
1114
1115     void showShareSheet(WebCore::ShareDataWithParsedURL&, WTF::CompletionHandler<void(bool)>&& callback);
1116     void didCompleteShareSheet(bool wasCompleted, ShareSheetCallbackID contextId);
1117     
1118 #if ENABLE(ATTACHMENT_ELEMENT)
1119     void insertAttachment(const String& identifier, Optional<uint64_t>&& fileSize, const String& fileName, const String& contentType, CallbackID);
1120     void updateAttachmentAttributes(const String& identifier, Optional<uint64_t>&& fileSize, const String& contentType, const String& fileName, const IPC::DataReference& enclosingImageData, CallbackID);
1121 #endif
1122
1123 #if ENABLE(APPLICATION_MANIFEST)
1124     void getApplicationManifest(CallbackID);
1125     void didFinishLoadingApplicationManifest(uint64_t, const Optional<WebCore::ApplicationManifest>&);
1126 #endif
1127
1128     void updateCurrentModifierState(OptionSet<WebCore::PlatformEvent::Modifier> modifiers);
1129
1130     UserContentControllerIdentifier userContentControllerIdentifier() const { return m_userContentController->identifier(); }
1131
1132     WebCore::UserInterfaceLayoutDirection userInterfaceLayoutDirection() const { return m_userInterfaceLayoutDirection; }
1133
1134     bool isSuspended() const { return m_isSuspended; }
1135
1136     void didReceiveWebPageMessage(IPC::Connection&, IPC::Decoder&);
1137
1138 private:
1139     WebPage(uint64_t pageID, WebPageCreationParameters&&);
1140
1141     void updateThrottleState();
1142     void updateUserActivity();
1143
1144     // IPC::MessageSender
1145     IPC::Connection* messageSenderConnection() override;
1146     uint64_t messageSenderDestinationID() override;
1147
1148     void platformInitialize();
1149     void platformDetach();
1150     void platformEditorState(WebCore::Frame&, EditorState& result, IncludePostLayoutDataHint) const;
1151     void sendEditorStateUpdate();
1152     void scheduleFullEditorStateUpdate();
1153
1154 #if PLATFORM(COCOA)
1155     void sendTouchBarMenuDataAddedUpdate(WebCore::HTMLMenuElement&);
1156     void sendTouchBarMenuDataRemovedUpdate(WebCore::HTMLMenuElement&);
1157     void sendTouchBarMenuItemDataAddedUpdate(WebCore::HTMLMenuItemElement&);
1158     void sendTouchBarMenuItemDataRemovedUpdate(WebCore::HTMLMenuItemElement&);
1159 #endif
1160
1161     void didReceiveSyncWebPageMessage(IPC::Connection&, IPC::Decoder&, std::unique_ptr<IPC::Encoder>&);
1162
1163 #if PLATFORM(IOS_FAMILY)
1164     void resetViewportDefaultConfiguration(WebFrame* mainFrame, bool hasMobileDocType = false);
1165     enum class ZoomToInitialScale { No, Yes };
1166     void viewportConfigurationChanged(ZoomToInitialScale = ZoomToInitialScale::No);
1167     void updateViewportSizeForCSSViewportUnits();
1168
1169     static void convertSelectionRectsToRootView(WebCore::FrameView*, Vector<WebCore::SelectionRect>&);
1170     RefPtr<WebCore::Range> rangeForWebSelectionAtPosition(const WebCore::IntPoint&, const WebCore::VisiblePosition&, SelectionFlags&);
1171     void getFocusedElementInformation(FocusedElementInformation&);
1172     void platformInitializeAccessibility();
1173     void handleSyntheticClick(WebCore::Node* nodeRespondingToClick, const WebCore::FloatPoint& location);
1174     void completeSyntheticClick(WebCore::Node* nodeRespondingToClick, const WebCore::FloatPoint& location, WebCore::SyntheticClickType);
1175     void sendTapHighlightForNodeIfNecessary(uint64_t requestID, WebCore::Node*);
1176     void resetTextAutosizing();
1177     WebCore::VisiblePosition visiblePositionInFocusedNodeForPoint(const WebCore::Frame&, const WebCore::IntPoint&, bool isInteractingWithFocusedElement);
1178     RefPtr<WebCore::Range> rangeForGranularityAtPoint(WebCore::Frame&, const WebCore::IntPoint&, uint32_t granularity, bool isInteractingWithFocusedElement);
1179 #endif
1180
1181 #if PLATFORM(IOS_FAMILY) && ENABLE(DATA_INTERACTION)
1182     void requestStartDataInteraction(const WebCore::IntPoint& clientPosition, const WebCore::IntPoint& globalPosition);
1183     void requestAdditionalItemsForDragSession(const WebCore::IntPoint& clientPosition, const WebCore::IntPoint& globalPosition);
1184 #endif
1185
1186 #if !PLATFORM(COCOA) && !PLATFORM(WPE)
1187     static const char* interpretKeyEvent(const WebCore::KeyboardEvent*);
1188 #endif
1189
1190     bool performDefaultBehaviorForKeyEvent(const WebKeyboardEvent&);
1191
1192 #if PLATFORM(MAC)
1193     bool executeKeypressCommandsInternal(const Vector<WebCore::KeypressCommand>&, WebCore::KeyboardEvent*);
1194 #endif
1195
1196     void updateDrawingAreaLayerTreeFreezeState();
1197     bool markLayersVolatileImmediatelyIfPossible();
1198     void layerVolatilityTimerFired();
1199     void callVolatilityCompletionHandlers(bool succeeded);
1200
1201     String sourceForFrame(WebFrame*);
1202
1203     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&);
1204
1205     // Actions
1206     void tryClose();
1207     void platformDidReceiveLoadParameters(const LoadParameters&);
1208     void loadRequest(LoadParameters&&);
1209     void loadData(LoadParameters&&);
1210     void loadAlternateHTML(LoadParameters&&);
1211     void navigateToPDFLinkWithSimulatedClick(const String& url, WebCore::IntPoint documentPoint, WebCore::IntPoint screenPoint);
1212     void reload(uint64_t navigationID, uint32_t reloadOptions, SandboxExtension::Handle&&);
1213     void goToBackForwardItem(uint64_t navigationID, const WebCore::BackForwardItemIdentifier&, WebCore::FrameLoadType, WebCore::ShouldTreatAsContinuingLoad, Optional<WebsitePoliciesData>&&);
1214     void tryRestoreScrollPosition();
1215     void setInitialFocus(bool forward, bool isKeyboardEventValid, const WebKeyboardEvent&, CallbackID);
1216     void updateIsInWindow(bool isInitialState = false);
1217     void visibilityDidChange();
1218     void setActivityState(OptionSet<WebCore::ActivityState::Flag>, ActivityStateChangeID, const Vector<CallbackID>& callbackIDs);
1219     void validateCommand(const String&, CallbackID);
1220     void executeEditCommand(const String&, const String&);
1221     void setEditable(bool);
1222
1223     void increaseListLevel();
1224     void decreaseListLevel();
1225     void changeListType();
1226
1227     void setBaseWritingDirection(WebCore::WritingDirection);
1228
1229     void setNeedsFontAttributes(bool);
1230
1231     void mouseEvent(const WebMouseEvent&);
1232     void keyEvent(const WebKeyboardEvent&);
1233
1234 #if ENABLE(IOS_TOUCH_EVENTS)
1235     void touchEventSync(const WebTouchEvent&, bool& handled);
1236     void updatePotentialTapSecurityOrigin(const WebTouchEvent&, bool wasHandled);
1237 #elif ENABLE(TOUCH_EVENTS)
1238     void touchEvent(const WebTouchEvent&);
1239 #endif
1240
1241 #if ENABLE(CONTEXT_MENUS)
1242     void contextMenuHidden() { m_isShowingContextMenu = false; }
1243     void contextMenuForKeyEvent();
1244 #endif
1245
1246     static bool scroll(WebCore::Page*, WebCore::ScrollDirection, WebCore::ScrollGranularity);
1247     static bool logicalScroll(WebCore::Page*, WebCore::ScrollLogicalDirection, WebCore::ScrollGranularity);
1248
1249     void loadURLInFrame(URL&&, uint64_t frameID);
1250
1251     enum class WasRestoredByAPIRequest { No, Yes };
1252     void restoreSessionInternal(const Vector<BackForwardListItemState>&, WasRestoredByAPIRequest, WebBackForwardListProxy::OverwriteExistingItem);
1253     void restoreSession(const Vector<BackForwardListItemState>&);
1254     void didRemoveBackForwardItem(const WebCore::BackForwardItemIdentifier&);
1255     void updateBackForwardListForReattach(const Vector<WebKit::BackForwardListItemState>&);
1256     void setCurrentHistoryItemForReattach(WebKit::BackForwardListItemState&&);
1257
1258     void requestFontAttributesAtSelectionStart(CallbackID);
1259
1260 #if ENABLE(REMOTE_INSPECTOR)
1261     void setIndicating(bool);
1262 #endif
1263
1264     void setDrawsBackground(bool);
1265
1266 #if PLATFORM(COCOA)
1267     void setTopContentInsetFenced(float, IPC::Attachment);
1268 #endif
1269     void setTopContentInset(float);
1270
1271     void viewWillStartLiveResize();
1272     void viewWillEndLiveResize();
1273
1274     void getContentsAsString(CallbackID);
1275 #if ENABLE(MHTML)
1276     void getContentsAsMHTMLData(CallbackID);
1277 #endif
1278     void getMainResourceDataOfFrame(uint64_t frameID, CallbackID);
1279     void getResourceDataFromFrame(uint64_t frameID, const String& resourceURL, CallbackID);
1280     void getRenderTreeExternalRepresentation(CallbackID);
1281     void getSelectionOrContentsAsString(CallbackID);
1282     void getSelectionAsWebArchiveData(CallbackID);
1283     void getSourceForFrame(uint64_t frameID, CallbackID);
1284     void getWebArchiveOfFrame(uint64_t frameID, CallbackID);
1285     void runJavaScript(const String&, bool forceUserGesture, Optional<String> worldName, CallbackID);
1286     void runJavaScriptInMainFrame(const String&, bool forceUserGesture, CallbackID);
1287     void runJavaScriptInMainFrameScriptWorld(const String&, bool forceUserGesture, const String& worldName, CallbackID);
1288     void forceRepaint(CallbackID);
1289     void takeSnapshot(WebCore::IntRect snapshotRect, WebCore::IntSize bitmapSize, uint32_t options, CallbackID);
1290
1291     void preferencesDidChange(const WebPreferencesStore&);
1292     void updatePreferences(const WebPreferencesStore&);
1293     void updatePreferencesGenerated(const WebPreferencesStore&);
1294
1295 #if PLATFORM(IOS_FAMILY)
1296     bool parentProcessHasServiceWorkerEntitlement() const;
1297 #else
1298     bool parentProcessHasServiceWorkerEntitlement() const { return true; }
1299 #endif
1300
1301     void didReceivePolicyDecision(uint64_t frameID, uint64_t listenerID, WebPolicyAction, uint64_t navigationID, const DownloadID&, Optional<WebsitePoliciesData>&&);
1302     void continueWillSubmitForm(uint64_t frameID, uint64_t listenerID);
1303     void setUserAgent(const String&);
1304     void setCustomTextEncodingName(const String&);
1305     void suspendActiveDOMObjectsAndAnimations();
1306     void resumeActiveDOMObjectsAndAnimations();
1307
1308 #if PLATFORM(COCOA)
1309     void performDictionaryLookupAtLocation(const WebCore::FloatPoint&);
1310     void performDictionaryLookupOfCurrentSelection();
1311     void performDictionaryLookupForRange(WebCore::Frame&, WebCore::Range&, NSDictionary *options, WebCore::TextIndicatorPresentationTransition);
1312     WebCore::DictionaryPopupInfo dictionaryPopupInfoForRange(WebCore::Frame&, WebCore::Range&, NSDictionary *options, WebCore::TextIndicatorPresentationTransition);
1313 #if ENABLE(PDFKIT_PLUGIN)
1314     WebCore::DictionaryPopupInfo dictionaryPopupInfoForSelectionInPDFPlugin(PDFSelection *, PDFPlugin&, NSDictionary *options, WebCore::TextIndicatorPresentationTransition);
1315 #endif
1316
1317     void windowAndViewFramesChanged(const WebCore::FloatRect& windowFrameInScreenCoordinates, const WebCore::FloatRect& windowFrameInUnflippedScreenCoordinates, const WebCore::FloatRect& viewFrameInWindowCoordinates, const WebCore::FloatPoint& accessibilityViewCoordinates);
1318
1319     RetainPtr<PDFDocument> pdfDocumentForPrintingFrame(WebCore::Frame*);
1320     void computePagesForPrintingPDFDocument(uint64_t frameID, const PrintInfo&, Vector<WebCore::IntRect>& resultPageRects);
1321     void drawPDFDocument(CGContextRef, PDFDocument *, const PrintInfo&, const WebCore::IntRect&);
1322     void drawPagesToPDFFromPDFDocument(CGContextRef, PDFDocument *, const PrintInfo&, uint32_t first, uint32_t count);
1323 #endif
1324
1325     void setMainFrameIsScrollable(bool);
1326
1327     void unapplyEditCommand(uint64_t commandID);
1328     void reapplyEditCommand(uint64_t commandID);
1329     void didRemoveEditCommand(uint64_t commandID);
1330
1331     void findString(const String&, uint32_t findOptions, uint32_t maxMatchCount);
1332     void findStringMatches(const String&, uint32_t findOptions, uint32_t maxMatchCount);
1333     void getImageForFindMatch(uint32_t matchIndex);
1334     void selectFindMatch(uint32_t matchIndex);
1335     void hideFindUI();
1336     void countStringMatches(const String&, uint32_t findOptions, uint32_t maxMatchCount);
1337     void replaceMatches(const Vector<uint32_t>& matchIndices, const String& replacementText, bool selectionOnly, CallbackID);
1338
1339 #if USE(COORDINATED_GRAPHICS)
1340     void sendViewportAttributesChanged(const WebCore::ViewportArguments&);
1341 #endif
1342
1343     void didChangeSelectedIndexForActivePopupMenu(int32_t newIndex);
1344     void setTextForActivePopupMenu(int32_t index);
1345
1346 #if PLATFORM(GTK)
1347     void failedToShowPopupMenu();
1348 #endif
1349
1350     void didChooseFilesForOpenPanel(const Vector<String>&);
1351     void didCancelForOpenPanel();
1352
1353 #if PLATFORM(IOS_FAMILY)
1354     void didChooseFilesForOpenPanelWithDisplayStringAndIcon(const Vector<String>&, const String& displayString, const IPC::DataReference& iconData);
1355 #endif
1356
1357 #if ENABLE(SANDBOX_EXTENSIONS)
1358     void extendSandboxForFilesFromOpenPanel(SandboxExtension::HandleArray&&);
1359 #endif
1360
1361     void didReceiveGeolocationPermissionDecision(uint64_t geolocationID, bool allowed);
1362
1363     void didReceiveNotificationPermissionDecision(uint64_t notificationID, bool allowed);
1364
1365 #if ENABLE(MEDIA_STREAM)
1366     void userMediaAccessWasGranted(uint64_t userMediaID, WebCore::CaptureDevice&& audioDeviceUID, WebCore::CaptureDevice&& videoDeviceUID, String&& mediaDeviceIdentifierHashSalt);
1367     void userMediaAccessWasDenied(uint64_t userMediaID, uint64_t reason, String&& invalidConstraint);
1368
1369     void didCompleteMediaDeviceEnumeration(uint64_t userMediaID, const Vector<WebCore::CaptureDevice>& devices, String&& deviceIdentifierHashSalt, bool originHasPersistentAccess);
1370 #endif
1371
1372 #if ENABLE(MEDIA_STREAM) && ENABLE(SANDBOX_EXTENSIONS)
1373     void grantUserMediaDeviceSandboxExtensions(MediaDeviceSandboxExtensions&&);
1374     void revokeUserMediaDeviceSandboxExtensions(const Vector<String>&);
1375 #endif
1376
1377 #if ENABLE(WEB_RTC)
1378     void disableICECandidateFiltering();
1379     void enableICECandidateFiltering();
1380 #endif
1381
1382 #if ENABLE(WEB_RTC) && USE(LIBWEBRTC)
1383     void disableEnumeratingAllNetworkInterfaces();
1384     void enableEnumeratingAllNetworkInterfaces();
1385 #endif
1386
1387     void advanceToNextMisspelling(bool startBeforeSelection);
1388     void changeSpellingToWord(const String& word);
1389
1390 #if USE(APPKIT)
1391     void uppercaseWord();
1392     void lowercaseWord();
1393     void capitalizeWord();
1394 #endif
1395
1396 #if ENABLE(CONTEXT_MENUS)
1397     void didSelectItemFromActiveContextMenu(const WebContextMenuItemData&);
1398 #endif
1399
1400     void changeSelectedIndex(int32_t index);
1401     void setCanStartMediaTimerFired();
1402
1403     static bool platformCanHandleRequest(const WebCore::ResourceRequest&);
1404
1405     static PluginView* focusedPluginViewForFrame(WebCore::Frame&);
1406
1407     static RefPtr<WebCore::Range> rangeFromEditingRange(WebCore::Frame&, const EditingRange&, EditingRangeIsRelativeTo = EditingRangeIsRelativeTo::EditableRoot);
1408
1409     void reportUsedFeatures();
1410
1411     void updateWebsitePolicies(WebsitePoliciesData&&);
1412
1413     void changeFont(WebCore::FontChanges&&);
1414     void changeFontAttributes(WebCore::FontAttributeChanges&&);
1415
1416 #if PLATFORM(MAC)
1417     void performImmediateActionHitTestAtLocation(WebCore::FloatPoint);
1418     std::tuple<RefPtr<WebCore::Range>, NSDictionary *> lookupTextAtLocation(WebCore::FloatPoint);
1419     void immediateActionDidUpdate();
1420     void immediateActionDidCancel();
1421     void immediateActionDidComplete();
1422
1423     void dataDetectorsDidPresentUI(WebCore::PageOverlay::PageOverlayID);
1424     void dataDetectorsDidChangeUI(WebCore::PageOverlay::PageOverlayID);
1425     void dataDetectorsDidHideUI(WebCore::PageOverlay::PageOverlayID);
1426
1427     void handleAcceptedCandidate(WebCore::TextCheckingResult);
1428 #endif
1429
1430 #if PLATFORM(COCOA)
1431     void requestActiveNowPlayingSessionInfo(CallbackID);
1432 #endif
1433
1434     void setShouldDispatchFakeMouseMoveEvents(bool dispatch) { m_shouldDispatchFakeMouseMoveEvents = dispatch; }
1435
1436 #if ENABLE(WIRELESS_PLAYBACK_TARGET) && !PLATFORM(IOS_FAMILY)
1437     void playbackTargetSelected(uint64_t, const WebCore::MediaPlaybackTargetContext& outputDevice) const;
1438     void playbackTargetAvailabilityDidChange(uint64_t, bool);
1439     void setShouldPlayToPlaybackTarget(uint64_t, bool);
1440 #endif
1441
1442     void clearWheelEventTestTrigger();
1443
1444     void setShouldScaleViewToFitDocument(bool);
1445
1446     void pageStoppedScrolling();
1447
1448 #if ENABLE(VIDEO) && USE(GSTREAMER)
1449     void didEndRequestInstallMissingMediaPlugins(uint32_t result);
1450 #endif
1451
1452     void setResourceCachingDisabled(bool);
1453     void setUserInterfaceLayoutDirection(uint32_t);
1454
1455     bool canPluginHandleResponse(const WebCore::ResourceResponse&);
1456
1457 #if USE(QUICK_LOOK)
1458     void didReceivePasswordForQuickLookDocument(const String&);
1459 #endif
1460
1461     void frameBecameRemote(uint64_t frameID, WebCore::GlobalFrameIdentifier&& remoteFrameIdentifier, WebCore::GlobalWindowIdentifier&& remoteWindowIdentifier);
1462
1463     void registerURLSchemeHandler(uint64_t identifier, const String& scheme);
1464
1465     void urlSchemeTaskDidPerformRedirection(uint64_t handlerIdentifier, uint64_t taskIdentifier, WebCore::ResourceResponse&&, WebCore::ResourceRequest&&);
1466     void urlSchemeTaskDidReceiveResponse(uint64_t handlerIdentifier, uint64_t taskIdentifier, const WebCore::ResourceResponse&);
1467     void urlSchemeTaskDidReceiveData(uint64_t handlerIdentifier, uint64_t taskIdentifier, const IPC::DataReference&);
1468     void urlSchemeTaskDidComplete(uint64_t handlerIdentifier, uint64_t taskIdentifier, const WebCore::ResourceError&);
1469
1470     void setIsSuspended(bool);
1471
1472     RefPtr<WebImage> snapshotAtSize(const WebCore::IntRect&, const WebCore::IntSize& bitmapSize, SnapshotOptions);
1473     RefPtr<WebImage> snapshotNode(WebCore::Node&, SnapshotOptions, unsigned maximumPixelCount = std::numeric_limits<unsigned>::max());
1474 #if USE(CF)
1475     RetainPtr<CFDataRef> pdfSnapshotAtSize(const WebCore::IntRect&, const WebCore::IntSize& bitmapSize, SnapshotOptions);
1476 #endif
1477
1478 #if ENABLE(ATTACHMENT_ELEMENT)
1479     RefPtr<WebCore::HTMLAttachmentElement> attachmentElementWithIdentifier(const String& identifier) const;
1480 #endif
1481
1482     bool canShowMIMEType(const String&, const Function<bool(const String&, WebCore::PluginData::AllowedPluginTypes)>& supportsPlugin) const;
1483
1484     uint64_t m_pageID;
1485
1486     std::unique_ptr<WebCore::Page> m_page;
1487     RefPtr<WebFrame> m_mainFrame;
1488
1489     RefPtr<WebPageGroupProxy> m_pageGroup;
1490
1491     String m_userAgent;
1492
1493     WebCore::IntSize m_viewSize;
1494     std::unique_ptr<DrawingArea> m_drawingArea;
1495     bool m_shouldResetDrawingAreaAfterSuspend { false };
1496
1497     HashSet<PluginView*> m_pluginViews;
1498     bool m_hasSeenPlugin { false };
1499
1500     HashMap<uint64_t, RefPtr<WebCore::TextCheckingRequest>> m_pendingTextCheckingRequestMap;
1501
1502     bool m_useFixedLayout { false };
1503     bool m_drawsBackground { true };
1504
1505     WebCore::Color m_underlayColor;
1506
1507     bool m_isInRedo { false };
1508     bool m_isClosed { false };
1509     bool m_tabToLinks { false };
1510     
1511     bool m_asynchronousPluginInitializationEnabled { false };
1512     bool m_asynchronousPluginInitializationEnabledForAllPlugins { false };
1513     bool m_artificialPluginInitializationDelayEnabled { false };
1514     bool m_scrollingPerformanceLoggingEnabled { false };
1515     bool m_mainFrameIsScrollable { true };
1516
1517     bool m_alwaysShowsHorizontalScroller { false };
1518     bool m_alwaysShowsVerticalScroller { false };
1519
1520 #if PLATFORM(IOS_FAMILY)
1521     bool m_ignoreViewportScalingConstraints { false };
1522 #endif
1523
1524 #if ENABLE(PRIMARY_SNAPSHOTTED_PLUGIN_HEURISTIC)
1525     bool m_readyToFindPrimarySnapshottedPlugin { false };
1526     bool m_didFindPrimarySnapshottedPlugin { false };
1527     unsigned m_numberOfPrimarySnapshotDetectionAttempts { 0 };
1528     String m_primaryPlugInPageOrigin;
1529     String m_primaryPlugInOrigin;
1530     String m_primaryPlugInMimeType;
1531     RunLoop::Timer<WebPage> m_determinePrimarySnapshottedPlugInTimer;
1532 #endif
1533
1534     // The layer hosting mode.
1535     LayerHostingMode m_layerHostingMode;
1536
1537 #if PLATFORM(COCOA)
1538     bool m_pdfPluginEnabled { false };
1539     bool m_hasCachedWindowFrame { false };
1540
1541     // The frame of the containing window in screen coordinates.
1542     WebCore::FloatRect m_windowFrameInScreenCoordinates;
1543
1544     // The frame of the containing window in unflipped screen coordinates.
1545     WebCore::FloatRect m_windowFrameInUnflippedScreenCoordinates;
1546
1547     // The frame of the view in window coordinates.
1548     WebCore::FloatRect m_viewFrameInWindowCoordinates;
1549
1550     // The accessibility position of the view.
1551     WebCore::FloatPoint m_accessibilityPosition;
1552     
1553     RetainPtr<WKAccessibilityWebPageObject> m_mockAccessibilityElement;
1554
1555     UniqueRef<ViewGestureGeometryCollector> m_viewGestureGeometryCollector;
1556
1557     RetainPtr<NSDictionary> m_dataDetectionContext;
1558 #endif
1559
1560 #if HAVE(ACCESSIBILITY) && PLATFORM(GTK)
1561     GRefPtr<WebPageAccessibilityObject> m_accessibilityObject;
1562 #endif
1563
1564 #if PLATFORM(GTK) && USE(TEXTURE_MAPPER_GL)
1565     // Our view's window in the UI process.
1566     uint64_t m_nativeWindowHandle { 0 };
1567 #endif
1568
1569 #if !PLATFORM(IOS_FAMILY)
1570     RefPtr<PageBanner> m_headerBanner;
1571     RefPtr<PageBanner> m_footerBanner;
1572 #endif
1573
1574     RunLoop::Timer<WebPage> m_setCanStartMediaTimer;
1575     bool m_mayStartMediaWhenInWindow { false };
1576
1577     HashMap<uint64_t, RefPtr<WebUndoStep>> m_undoStepMap;
1578
1579 #if ENABLE(CONTEXT_MENUS)
1580     std::unique_ptr<API::InjectedBundle::PageContextMenuClient> m_contextMenuClient;
1581 #endif
1582     std::unique_ptr<API::InjectedBundle::EditorClient> m_editorClient;
1583     std::unique_ptr<API::InjectedBundle::FormClient> m_formClient;
1584     std::unique_ptr<API::InjectedBundle::PageLoaderClient> m_loaderClient;
1585     InjectedBundlePagePolicyClient m_policyClient;
1586     std::unique_ptr<API::InjectedBundle::ResourceLoadClient> m_resourceLoadClient;
1587     std::unique_ptr<API::InjectedBundle::PageUIClient> m_uiClient;
1588 #if ENABLE(FULLSCREEN_API)
1589     InjectedBundlePageFullScreenClient m_fullScreenClient;
1590 #endif
1591
1592     UniqueRef<FindController> m_findController;
1593
1594     RefPtr<WebInspector> m_inspector;
1595     RefPtr<WebInspectorUI> m_inspectorUI;
1596     RefPtr<RemoteWebInspectorUI> m_remoteInspectorUI;
1597     std::unique_ptr<WebPageInspectorTargetController> m_inspectorTargetController;
1598
1599 #if (PLATFORM(IOS_FAMILY) && HAVE(AVKIT)) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))
1600     RefPtr<PlaybackSessionManager> m_playbackSessionManager;
1601     RefPtr<VideoFullscreenManager> m_videoFullscreenManager;
1602 #endif
1603
1604 #if PLATFORM(IOS_FAMILY)
1605     bool m_allowsMediaDocumentInlinePlayback { false };
1606     RefPtr<WebCore::Range> m_startingGestureRange;
1607 #endif
1608
1609 #if ENABLE(FULLSCREEN_API)
1610     RefPtr<WebFullScreenManager> m_fullScreenManager;
1611 #endif
1612
1613     RefPtr<WebPopupMenu> m_activePopupMenu;
1614
1615 #if ENABLE(CONTEXT_MENUS)
1616     RefPtr<WebContextMenu> m_contextMenu;
1617 #endif
1618
1619 #if ENABLE(INPUT_TYPE_COLOR)
1620     WebColorChooser* m_activeColorChooser { nullptr };
1621 #endif
1622
1623 #if ENABLE(DATALIST_ELEMENT)
1624     WebDataListSuggestionPicker* m_activeDataListSuggestionPicker { nullptr };
1625 #endif
1626
1627     RefPtr<WebOpenPanelResultListener> m_activeOpenPanelResultListener;
1628     RefPtr<NotificationPermissionRequestManager> m_notificationPermissionRequestManager;
1629
1630     Ref<WebUserContentController> m_userContentController;
1631
1632 #if ENABLE(GEOLOCATION)
1633     UniqueRef<GeolocationPermissionRequestManager> m_geolocationPermissionRequestManager;
1634 #endif
1635
1636 #if ENABLE(MEDIA_STREAM)
1637     UniqueRef<UserMediaPermissionRequestManager> m_userMediaPermissionRequestManager;
1638 #endif
1639
1640     std::unique_ptr<WebCore::PrintContext> m_printContext;
1641 #if PLATFORM(GTK)
1642     RefPtr<WebPrintOperationGtk> m_printOperation;
1643 #endif
1644
1645     SandboxExtensionTracker m_sandboxExtensionTracker;
1646
1647     RefPtr<SandboxExtension> m_pendingDropSandboxExtension;
1648     Vector<RefPtr<SandboxExtension>> m_pendingDropExtensionsForFileUpload;
1649
1650     PAL::HysteresisActivity m_pageScrolledHysteresis;
1651
1652     bool m_canRunBeforeUnloadConfirmPanel { false };
1653
1654     bool m_canRunModal { false };
1655     bool m_isRunningModal { false };
1656
1657 #if ENABLE(DRAG_SUPPORT)
1658     bool m_isStartingDrag { false };
1659 #endif
1660
1661     bool m_cachedMainFrameIsPinnedToLeftSide { true };
1662     bool m_cachedMainFrameIsPinnedToRightSide { true };
1663     bool m_cachedMainFrameIsPinnedToTopSide { true };
1664     bool m_cachedMainFrameIsPinnedToBottomSide { true };
1665     bool m_canShortCircuitHorizontalWheelEvents { false };
1666     bool m_hasWheelEventHandlers { false };
1667
1668     unsigned m_cachedPageCount { 0 };
1669
1670     HashSet<unsigned long> m_trackedNetworkResourceRequestIdentifiers;
1671
1672     WebCore::IntSize m_viewLayoutSize;
1673     bool m_autoSizingShouldExpandToViewHeight { false };
1674     Optional<WebCore::IntSize> m_viewportSizeForCSSViewportUnits;
1675
1676     bool m_userIsInteracting { false };
1677     bool m_isFocusingElementDueToUserInteraction { false };
1678     bool m_hasEverFocusedElementDueToUserInteractionSincePageTransition { false };
1679     bool m_needsHiddenContentEditableQuirk { false };
1680     bool m_needsPlainTextQuirk { false };
1681     bool m_changingActivityState { false };
1682
1683 #if ENABLE(CONTEXT_MENUS)
1684     bool m_isShowingContextMenu { false };
1685 #endif
1686
1687     RefPtr<WebCore::Element> m_focusedElement;
1688     bool m_hasPendingBlurNotification { false };
1689     bool m_hasPendingEditorStateUpdate { false };
1690     
1691 #if PLATFORM(IOS_FAMILY)
1692     RefPtr<WebCore::Range> m_currentWordRange;
1693     RefPtr<WebCore::Node> m_interactionNode;
1694     WebCore::IntPoint m_lastInteractionLocation;
1695     
1696     enum SelectionAnchor { Start, End };
1697     SelectionAnchor m_selectionAnchor { Start };
1698
1699     RefPtr<WebCore::Node> m_potentialTapNode;
1700     WebCore::FloatPoint m_potentialTapLocation;
1701     RefPtr<WebCore::SecurityOrigin> m_potentialTapSecurityOrigin;
1702
1703     WebCore::ViewportConfiguration m_viewportConfiguration;
1704     bool m_hasReceivedVisibleContentRectsAfterDidCommitLoad { false };
1705     bool m_scaleWasSetByUIProcess { false };
1706     bool m_userHasChangedPageScaleFactor { false };
1707     bool m_hasStablePageScaleFactor { true };
1708     bool m_useTestingViewportConfiguration { false };
1709     bool m_isInStableState { true };
1710     bool m_forceAlwaysUserScalable { false };
1711     MonotonicTime m_oldestNonStableUpdateVisibleContentRectsTimestamp;
1712     Seconds m_estimatedLatency { 0 };
1713     WebCore::FloatSize m_screenSize;
1714     WebCore::FloatSize m_availableScreenSize;
1715     WebCore::FloatSize m_overrideScreenSize;
1716     RefPtr<WebCore::Range> m_currentBlockSelection;
1717     WebCore::IntRect m_blockRectForTextSelection;
1718
1719     RefPtr<WebCore::Range> m_initialSelection;
1720     WebCore::VisibleSelection m_storedSelectionForAccessibility { WebCore::VisibleSelection() };
1721     WebCore::IntSize m_blockSelectionDesiredSize;
1722     WebCore::FloatSize m_maximumUnobscuredSize;
1723     int32_t m_deviceOrientation { 0 };
1724     bool m_inDynamicSizeUpdate { false };
1725     HashMap<std::pair<WebCore::IntSize, double>, WebCore::IntPoint> m_dynamicSizeUpdateHistory;
1726     RefPtr<WebCore::Node> m_pendingSyntheticClickNode;
1727     WebCore::FloatPoint m_pendingSyntheticClickLocation;
1728     WebCore::FloatRect m_previousExposedContentRect;
1729     FocusedElementIdentifier m_currentFocusedElementIdentifier { 0 };
1730     Optional<DynamicViewportSizeUpdateID> m_pendingDynamicViewportSizeUpdateID;
1731     double m_lastTransactionPageScaleFactor { 0 };
1732     uint64_t m_lastTransactionIDWithScaleChange { 0 };
1733 #endif
1734
1735     WebCore::Timer m_layerVolatilityTimer;
1736     Vector<WTF::Function<void (bool)>> m_markLayersAsVolatileCompletionHandlers;
1737     bool m_isSuspendedUnderLock { false };
1738
1739     HashSet<String, ASCIICaseInsensitiveHash> m_mimeTypesWithCustomContentProviders;
1740     WebCore::Color m_backgroundColor { WebCore::Color::white };
1741
1742     HashSet<unsigned> m_activeRenderingSuppressionTokens;
1743     unsigned m_maximumRenderingSuppressionToken { 0 };
1744     
1745     WebCore::ScrollPinningBehavior m_scrollPinningBehavior { WebCore::DoNotPin };
1746     Optional<WebCore::ScrollbarOverlayStyle> m_scrollbarOverlayStyle;
1747
1748     bool m_useAsyncScrolling { false };
1749
1750     OptionSet<WebCore::ActivityState::Flag> m_activityState;
1751
1752     bool m_processSuppressionEnabled;
1753     UserActivity m_userActivity;
1754     PAL::HysteresisActivity m_userActivityHysteresis;
1755
1756     uint64_t m_pendingNavigationID { 0 };
1757     Optional<WebsitePoliciesData> m_pendingWebsitePolicies;
1758
1759     bool m_mainFrameProgressCompleted { false };
1760     bool m_shouldDispatchFakeMouseMoveEvents { true };
1761     bool m_isEditorStateMissingPostLayoutData { false };
1762     bool m_isSelectingTextWhileInsertingAsynchronously { false };
1763
1764     enum class EditorStateIsContentEditable { No, Yes, Unset };
1765     mutable EditorStateIsContentEditable m_lastEditorStateWasContentEditable { EditorStateIsContentEditable::Unset };
1766
1767 #if PLATFORM(GTK)
1768     bool m_inputMethodEnabled { false };
1769 #endif
1770
1771 #if ENABLE(VIDEO) && USE(GSTREAMER)
1772     RefPtr<WebCore::MediaPlayerRequestInstallMissingPluginsCallback> m_installMediaPluginsCallback;
1773 #endif
1774
1775 #if USE(OS_STATE)
1776     WallTime m_loadCommitTime;
1777 #endif
1778
1779     WebCore::UserInterfaceLayoutDirection m_userInterfaceLayoutDirection { WebCore::UserInterfaceLayoutDirection::LTR };
1780
1781     const String m_overrideContentSecurityPolicy;
1782     const Optional<double> m_cpuLimit;
1783
1784     HashMap<String, RefPtr<WebURLSchemeHandlerProxy>> m_schemeToURLSchemeHandlerProxyMap;
1785     HashMap<uint64_t, WebURLSchemeHandlerProxy*> m_identifierToURLSchemeHandlerProxyMap;
1786
1787     HashMap<uint64_t, WTF::Function<void(bool granted)>> m_storageAccessResponseCallbackMap;
1788     HashMap<ShareSheetCallbackID, WTF::Function<void(bool completed)>> m_shareSheetResponseCallbackMap;
1789
1790 #if ENABLE(APPLICATION_MANIFEST)
1791     HashMap<uint64_t, uint64_t> m_applicationManifestFetchCallbackMap;
1792 #endif
1793
1794     OptionSet<LayerTreeFreezeReason> m_LayerTreeFreezeReasons;
1795     bool m_isSuspended { false };
1796     bool m_needsFontAttributes { false };
1797 #if PLATFORM(MAC)
1798     bool m_shouldAttachDrawingAreaOnPageTransition { false };
1799 #endif
1800 };
1801
1802 } // namespace WebKit
1803