[iOS] Replace "node assistance" terminology in WebKit with "focused element"
[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 #endif
943
944 #if ENABLE(IOS_TOUCH_EVENTS)
945     void dispatchTouchEvent(const WebTouchEvent&, bool& handled);
946 #endif
947
948 #if PLATFORM(GTK) && USE(TEXTURE_MAPPER_GL)
949     uint64_t nativeWindowHandle() { return m_nativeWindowHandle; }
950 #endif
951
952     bool shouldUseCustomContentProviderForResponse(const WebCore::ResourceResponse&);
953
954     bool asynchronousPluginInitializationEnabled() const { return m_asynchronousPluginInitializationEnabled; }
955     void setAsynchronousPluginInitializationEnabled(bool enabled) { m_asynchronousPluginInitializationEnabled = enabled; }
956     bool asynchronousPluginInitializationEnabledForAllPlugins() const { return m_asynchronousPluginInitializationEnabledForAllPlugins; }
957     void setAsynchronousPluginInitializationEnabledForAllPlugins(bool enabled) { m_asynchronousPluginInitializationEnabledForAllPlugins = enabled; }
958     bool artificialPluginInitializationDelayEnabled() const { return m_artificialPluginInitializationDelayEnabled; }
959     void setArtificialPluginInitializationDelayEnabled(bool enabled) { m_artificialPluginInitializationDelayEnabled = enabled; }
960     void setTabToLinksEnabled(bool enabled) { m_tabToLinks = enabled; }
961     bool tabToLinksEnabled() const { return m_tabToLinks; }
962
963     bool scrollingPerformanceLoggingEnabled() const { return m_scrollingPerformanceLoggingEnabled; }
964     void setScrollingPerformanceLoggingEnabled(bool);
965
966 #if PLATFORM(COCOA)
967     bool shouldUsePDFPlugin() const;
968     bool pdfPluginEnabled() const { return m_pdfPluginEnabled; }
969     void setPDFPluginEnabled(bool enabled) { m_pdfPluginEnabled = enabled; }
970
971     NSDictionary *dataDetectionContext() const { return m_dataDetectionContext.get(); }
972 #endif
973
974     void savePDFToFileInDownloadsFolder(const String& suggestedFilename, const URL& originatingURL, const uint8_t* data, unsigned long size);
975
976 #if PLATFORM(COCOA)
977     void savePDFToTemporaryFolderAndOpenWithNativeApplication(const String& suggestedFilename, const String& originatingURLString, const uint8_t* data, unsigned long size, const String& pdfUUID);
978 #endif
979
980     bool mainFrameIsScrollable() const { return m_mainFrameIsScrollable; }
981
982     void setAlwaysShowsHorizontalScroller(bool);
983     void setAlwaysShowsVerticalScroller(bool);
984
985     bool alwaysShowsHorizontalScroller() const { return m_alwaysShowsHorizontalScroller; };
986     bool alwaysShowsVerticalScroller() const { return m_alwaysShowsVerticalScroller; };
987
988     void setViewLayoutSize(const WebCore::IntSize&);
989     WebCore::IntSize viewLayoutSize() const { return m_viewLayoutSize; }
990
991     void setAutoSizingShouldExpandToViewHeight(bool shouldExpand);
992     bool autoSizingShouldExpandToViewHeight() { return m_autoSizingShouldExpandToViewHeight; }
993
994     void setViewportSizeForCSSViewportUnits(Optional<WebCore::IntSize>);
995     Optional<WebCore::IntSize> viewportSizeForCSSViewportUnits() const { return m_viewportSizeForCSSViewportUnits; }
996
997     bool canShowMIMEType(const String& MIMEType) const;
998     bool canShowResponse(const WebCore::ResourceResponse&) const;
999
1000     void addTextCheckingRequest(uint64_t requestID, Ref<WebCore::TextCheckingRequest>&&);
1001     void didFinishCheckingText(uint64_t requestID, const Vector<WebCore::TextCheckingResult>&);
1002     void didCancelCheckingText(uint64_t requestID);
1003
1004 #if ENABLE(PRIMARY_SNAPSHOTTED_PLUGIN_HEURISTIC)
1005     void determinePrimarySnapshottedPlugIn();
1006     void determinePrimarySnapshottedPlugInTimerFired();
1007     void resetPrimarySnapshottedPlugIn();
1008     bool matchesPrimaryPlugIn(const String& pageOrigin, const String& pluginOrigin, const String& mimeType) const;
1009     bool plugInIntersectsSearchRect(WebCore::HTMLPlugInImageElement& pluginImageElement);
1010     bool plugInIsPrimarySize(WebCore::HTMLPlugInImageElement& pluginImageElement, unsigned &pluginArea);
1011 #endif
1012
1013 #if ENABLE(DATA_DETECTION)
1014     void setDataDetectionResults(NSArray *);
1015     void detectDataInAllFrames(uint64_t, CompletionHandler<void(const DataDetectionResult&)>&&);
1016     void removeDataDetectedLinks(CompletionHandler<void(const DataDetectionResult&)>&&);
1017 #endif
1018
1019     unsigned extendIncrementalRenderingSuppression();
1020     void stopExtendingIncrementalRenderingSuppression(unsigned token);
1021     bool shouldExtendIncrementalRenderingSuppression() { return !m_activeRenderingSuppressionTokens.isEmpty(); }
1022
1023     WebCore::ScrollPinningBehavior scrollPinningBehavior() { return m_scrollPinningBehavior; }
1024     void setScrollPinningBehavior(uint32_t /* WebCore::ScrollPinningBehavior */ pinning);
1025
1026     Optional<WebCore::ScrollbarOverlayStyle> scrollbarOverlayStyle() { return m_scrollbarOverlayStyle; }
1027     void setScrollbarOverlayStyle(Optional<uint32_t /* WebCore::ScrollbarOverlayStyle */> scrollbarStyle);
1028
1029     Ref<WebCore::DocumentLoader> createDocumentLoader(WebCore::Frame&, const WebCore::ResourceRequest&, const WebCore::SubstituteData&);
1030     void updateCachedDocumentLoader(WebDocumentLoader&, WebCore::Frame&);
1031
1032     void getBytecodeProfile(CallbackID);
1033     void getSamplingProfilerOutput(CallbackID);
1034     
1035 #if ENABLE(SERVICE_CONTROLS) || ENABLE(TELEPHONE_NUMBER_DETECTION)
1036     void handleTelephoneNumberClick(const String& number, const WebCore::IntPoint&);
1037     void handleSelectionServiceClick(WebCore::FrameSelection&, const Vector<String>& telephoneNumbers, const WebCore::IntPoint&);
1038 #endif
1039
1040     void didChangeScrollOffsetForFrame(WebCore::Frame*);
1041
1042     void setMainFrameProgressCompleted(bool completed) { m_mainFrameProgressCompleted = completed; }
1043     bool shouldDispatchFakeMouseMoveEvents() const { return m_shouldDispatchFakeMouseMoveEvents; }
1044
1045     void postMessage(const String& messageName, API::Object* messageBody);
1046     void postSynchronousMessageForTesting(const String& messageName, API::Object* messageBody, RefPtr<API::Object>& returnData);
1047     void postMessageIgnoringFullySynchronousMode(const String& messageName, API::Object* messageBody);
1048
1049 #if PLATFORM(GTK)
1050     void setInputMethodState(bool);
1051 #endif
1052
1053     void imageOrMediaDocumentSizeChanged(const WebCore::IntSize&);
1054
1055 #if ENABLE(VIDEO) && USE(GSTREAMER)
1056     void requestInstallMissingMediaPlugins(const String& details, const String& description, WebCore::MediaPlayerRequestInstallMissingPluginsCallback&);
1057 #endif
1058
1059     void addUserScript(String&& source, WebCore::UserContentInjectedFrames, WebCore::UserScriptInjectionTime);
1060     void addUserStyleSheet(const String& source, WebCore::UserContentInjectedFrames);
1061     void removeAllUserContent();
1062
1063     void dispatchDidReachLayoutMilestone(OptionSet<WebCore::LayoutMilestone>);
1064
1065     void didRestoreScrollPosition();
1066
1067     bool isControlledByAutomation() const;
1068     void setControlledByAutomation(bool);
1069
1070     void connectInspector(const String& targetId, Inspector::FrontendChannel::ConnectionType);
1071     void disconnectInspector(const String& targetId);
1072     void sendMessageToTargetBackend(const String& targetId, const String& message);
1073
1074     void insertNewlineInQuotedContent();
1075
1076 #if USE(OS_STATE)
1077     WallTime loadCommitTime() const { return m_loadCommitTime; }
1078 #endif
1079
1080 #if ENABLE(GAMEPAD)
1081     void gamepadActivity(const Vector<GamepadData>&, bool shouldMakeGamepadsVisible);
1082 #endif
1083     
1084 #if ENABLE(POINTER_LOCK)
1085     void didAcquirePointerLock();
1086     void didNotAcquirePointerLock();
1087     void didLosePointerLock();
1088 #endif
1089
1090     void didGetLoadDecisionForIcon(bool decision, CallbackID loadIdentifier, OptionalCallbackID);
1091     void setUseIconLoadingClient(bool);
1092
1093 #if ENABLE(DATA_INTERACTION)
1094     void didConcludeEditDataInteraction();
1095 #endif
1096
1097     WebURLSchemeHandlerProxy* urlSchemeHandlerForScheme(const String&);
1098     void stopAllURLSchemeTasks();
1099
1100     Optional<double> cpuLimit() const { return m_cpuLimit; }
1101
1102     static PluginView* pluginViewForFrame(WebCore::Frame*);
1103
1104     void sendPartialEditorStateAndSchedulePostLayoutUpdate();
1105     void flushPendingEditorStateUpdate();
1106
1107 #if ENABLE(RESOURCE_LOAD_STATISTICS)
1108     void hasStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, CompletionHandler<void(bool)>&& callback);
1109     void requestStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, CompletionHandler<void(bool)>&& callback);
1110     void storageAccessResponse(bool wasGranted, uint64_t contextId);
1111 #endif
1112
1113     void showShareSheet(WebCore::ShareDataWithParsedURL&, WTF::CompletionHandler<void(bool)>&& callback);
1114     void didCompleteShareSheet(bool wasCompleted, ShareSheetCallbackID contextId);
1115     
1116 #if ENABLE(ATTACHMENT_ELEMENT)
1117     void insertAttachment(const String& identifier, Optional<uint64_t>&& fileSize, const String& fileName, const String& contentType, CallbackID);
1118     void updateAttachmentAttributes(const String& identifier, Optional<uint64_t>&& fileSize, const String& contentType, const String& fileName, const IPC::DataReference& enclosingImageData, CallbackID);
1119 #endif
1120
1121 #if ENABLE(APPLICATION_MANIFEST)
1122     void getApplicationManifest(CallbackID);
1123     void didFinishLoadingApplicationManifest(uint64_t, const Optional<WebCore::ApplicationManifest>&);
1124 #endif
1125
1126     void updateCurrentModifierState(OptionSet<WebCore::PlatformEvent::Modifier> modifiers);
1127
1128     UserContentControllerIdentifier userContentControllerIdentifier() const { return m_userContentController->identifier(); }
1129
1130     WebCore::UserInterfaceLayoutDirection userInterfaceLayoutDirection() const { return m_userInterfaceLayoutDirection; }
1131
1132     bool isSuspended() const { return m_isSuspended; }
1133
1134     void didReceiveWebPageMessage(IPC::Connection&, IPC::Decoder&);
1135
1136 private:
1137     WebPage(uint64_t pageID, WebPageCreationParameters&&);
1138
1139     void updateThrottleState();
1140     void updateUserActivity();
1141
1142     // IPC::MessageSender
1143     IPC::Connection* messageSenderConnection() override;
1144     uint64_t messageSenderDestinationID() override;
1145
1146     void platformInitialize();
1147     void platformDetach();
1148     void platformEditorState(WebCore::Frame&, EditorState& result, IncludePostLayoutDataHint) const;
1149     void sendEditorStateUpdate();
1150
1151 #if PLATFORM(COCOA)
1152     void sendTouchBarMenuDataAddedUpdate(WebCore::HTMLMenuElement&);
1153     void sendTouchBarMenuDataRemovedUpdate(WebCore::HTMLMenuElement&);
1154     void sendTouchBarMenuItemDataAddedUpdate(WebCore::HTMLMenuItemElement&);
1155     void sendTouchBarMenuItemDataRemovedUpdate(WebCore::HTMLMenuItemElement&);
1156 #endif
1157
1158     void didReceiveSyncWebPageMessage(IPC::Connection&, IPC::Decoder&, std::unique_ptr<IPC::Encoder>&);
1159
1160 #if PLATFORM(IOS_FAMILY)
1161     void resetViewportDefaultConfiguration(WebFrame* mainFrame, bool hasMobileDocType = false);
1162     enum class ZoomToInitialScale { No, Yes };
1163     void viewportConfigurationChanged(ZoomToInitialScale = ZoomToInitialScale::No);
1164     void updateViewportSizeForCSSViewportUnits();
1165
1166     static void convertSelectionRectsToRootView(WebCore::FrameView*, Vector<WebCore::SelectionRect>&);
1167     RefPtr<WebCore::Range> rangeForWebSelectionAtPosition(const WebCore::IntPoint&, const WebCore::VisiblePosition&, SelectionFlags&);
1168     void getFocusedElementInformation(FocusedElementInformation&);
1169     void platformInitializeAccessibility();
1170     void handleSyntheticClick(WebCore::Node* nodeRespondingToClick, const WebCore::FloatPoint& location);
1171     void completeSyntheticClick(WebCore::Node* nodeRespondingToClick, const WebCore::FloatPoint& location, WebCore::SyntheticClickType);
1172     void sendTapHighlightForNodeIfNecessary(uint64_t requestID, WebCore::Node*);
1173     void resetTextAutosizing();
1174     WebCore::VisiblePosition visiblePositionInFocusedNodeForPoint(const WebCore::Frame&, const WebCore::IntPoint&, bool isInteractingWithFocusedElement);
1175     RefPtr<WebCore::Range> rangeForGranularityAtPoint(WebCore::Frame&, const WebCore::IntPoint&, uint32_t granularity, bool isInteractingWithFocusedElement);
1176 #endif
1177
1178 #if PLATFORM(IOS_FAMILY) && ENABLE(DATA_INTERACTION)
1179     void requestStartDataInteraction(const WebCore::IntPoint& clientPosition, const WebCore::IntPoint& globalPosition);
1180     void requestAdditionalItemsForDragSession(const WebCore::IntPoint& clientPosition, const WebCore::IntPoint& globalPosition);
1181 #endif
1182
1183 #if !PLATFORM(COCOA) && !PLATFORM(WPE)
1184     static const char* interpretKeyEvent(const WebCore::KeyboardEvent*);
1185 #endif
1186
1187     bool performDefaultBehaviorForKeyEvent(const WebKeyboardEvent&);
1188
1189 #if PLATFORM(MAC)
1190     bool executeKeypressCommandsInternal(const Vector<WebCore::KeypressCommand>&, WebCore::KeyboardEvent*);
1191 #endif
1192
1193     void updateDrawingAreaLayerTreeFreezeState();
1194     bool markLayersVolatileImmediatelyIfPossible();
1195     void layerVolatilityTimerFired();
1196     void callVolatilityCompletionHandlers(bool succeeded);
1197
1198     String sourceForFrame(WebFrame*);
1199
1200     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&);
1201
1202     // Actions
1203     void tryClose();
1204     void platformDidReceiveLoadParameters(const LoadParameters&);
1205     void loadRequest(LoadParameters&&);
1206     void loadData(LoadParameters&&);
1207     void loadAlternateHTML(LoadParameters&&);
1208     void navigateToPDFLinkWithSimulatedClick(const String& url, WebCore::IntPoint documentPoint, WebCore::IntPoint screenPoint);
1209     void reload(uint64_t navigationID, uint32_t reloadOptions, SandboxExtension::Handle&&);
1210     void goToBackForwardItem(uint64_t navigationID, const WebCore::BackForwardItemIdentifier&, WebCore::FrameLoadType, WebCore::ShouldTreatAsContinuingLoad, Optional<WebsitePoliciesData>&&);
1211     void tryRestoreScrollPosition();
1212     void setInitialFocus(bool forward, bool isKeyboardEventValid, const WebKeyboardEvent&, CallbackID);
1213     void updateIsInWindow(bool isInitialState = false);
1214     void visibilityDidChange();
1215     void setActivityState(OptionSet<WebCore::ActivityState::Flag>, ActivityStateChangeID, const Vector<CallbackID>& callbackIDs);
1216     void validateCommand(const String&, CallbackID);
1217     void executeEditCommand(const String&, const String&);
1218     void setEditable(bool);
1219
1220     void increaseListLevel();
1221     void decreaseListLevel();
1222     void changeListType();
1223
1224     void setBaseWritingDirection(WebCore::WritingDirection);
1225
1226     void setNeedsFontAttributes(bool);
1227
1228     void mouseEvent(const WebMouseEvent&);
1229     void keyEvent(const WebKeyboardEvent&);
1230
1231 #if ENABLE(IOS_TOUCH_EVENTS)
1232     void touchEventSync(const WebTouchEvent&, bool& handled);
1233     void updatePotentialTapSecurityOrigin(const WebTouchEvent&, bool wasHandled);
1234 #elif ENABLE(TOUCH_EVENTS)
1235     void touchEvent(const WebTouchEvent&);
1236 #endif
1237
1238 #if ENABLE(CONTEXT_MENUS)
1239     void contextMenuHidden() { m_isShowingContextMenu = false; }
1240     void contextMenuForKeyEvent();
1241 #endif
1242
1243     static bool scroll(WebCore::Page*, WebCore::ScrollDirection, WebCore::ScrollGranularity);
1244     static bool logicalScroll(WebCore::Page*, WebCore::ScrollLogicalDirection, WebCore::ScrollGranularity);
1245
1246     void loadURLInFrame(URL&&, uint64_t frameID);
1247
1248     enum class WasRestoredByAPIRequest { No, Yes };
1249     void restoreSessionInternal(const Vector<BackForwardListItemState>&, WasRestoredByAPIRequest, WebBackForwardListProxy::OverwriteExistingItem);
1250     void restoreSession(const Vector<BackForwardListItemState>&);
1251     void didRemoveBackForwardItem(const WebCore::BackForwardItemIdentifier&);
1252     void updateBackForwardListForReattach(const Vector<WebKit::BackForwardListItemState>&);
1253     void setCurrentHistoryItemForReattach(WebKit::BackForwardListItemState&&);
1254
1255     void requestFontAttributesAtSelectionStart(CallbackID);
1256
1257 #if ENABLE(REMOTE_INSPECTOR)
1258     void setIndicating(bool);
1259 #endif
1260
1261     void setDrawsBackground(bool);
1262
1263 #if PLATFORM(COCOA)
1264     void setTopContentInsetFenced(float, IPC::Attachment);
1265 #endif
1266     void setTopContentInset(float);
1267
1268     void viewWillStartLiveResize();
1269     void viewWillEndLiveResize();
1270
1271     void getContentsAsString(CallbackID);
1272 #if ENABLE(MHTML)
1273     void getContentsAsMHTMLData(CallbackID);
1274 #endif
1275     void getMainResourceDataOfFrame(uint64_t frameID, CallbackID);
1276     void getResourceDataFromFrame(uint64_t frameID, const String& resourceURL, CallbackID);
1277     void getRenderTreeExternalRepresentation(CallbackID);
1278     void getSelectionOrContentsAsString(CallbackID);
1279     void getSelectionAsWebArchiveData(CallbackID);
1280     void getSourceForFrame(uint64_t frameID, CallbackID);
1281     void getWebArchiveOfFrame(uint64_t frameID, CallbackID);
1282     void runJavaScript(const String&, bool forceUserGesture, Optional<String> worldName, CallbackID);
1283     void runJavaScriptInMainFrame(const String&, bool forceUserGesture, CallbackID);
1284     void runJavaScriptInMainFrameScriptWorld(const String&, bool forceUserGesture, const String& worldName, CallbackID);
1285     void forceRepaint(CallbackID);
1286     void takeSnapshot(WebCore::IntRect snapshotRect, WebCore::IntSize bitmapSize, uint32_t options, CallbackID);
1287
1288     void preferencesDidChange(const WebPreferencesStore&);
1289     void updatePreferences(const WebPreferencesStore&);
1290     void updatePreferencesGenerated(const WebPreferencesStore&);
1291
1292 #if PLATFORM(IOS_FAMILY)
1293     bool parentProcessHasServiceWorkerEntitlement() const;
1294 #else
1295     bool parentProcessHasServiceWorkerEntitlement() const { return true; }
1296 #endif
1297
1298     void didReceivePolicyDecision(uint64_t frameID, uint64_t listenerID, WebPolicyAction, uint64_t navigationID, const DownloadID&, Optional<WebsitePoliciesData>&&);
1299     void continueWillSubmitForm(uint64_t frameID, uint64_t listenerID);
1300     void setUserAgent(const String&);
1301     void setCustomTextEncodingName(const String&);
1302     void suspendActiveDOMObjectsAndAnimations();
1303     void resumeActiveDOMObjectsAndAnimations();
1304
1305 #if PLATFORM(COCOA)
1306     void performDictionaryLookupAtLocation(const WebCore::FloatPoint&);
1307     void performDictionaryLookupOfCurrentSelection();
1308     void performDictionaryLookupForRange(WebCore::Frame&, WebCore::Range&, NSDictionary *options, WebCore::TextIndicatorPresentationTransition);
1309     WebCore::DictionaryPopupInfo dictionaryPopupInfoForRange(WebCore::Frame&, WebCore::Range&, NSDictionary *options, WebCore::TextIndicatorPresentationTransition);
1310 #if ENABLE(PDFKIT_PLUGIN)
1311     WebCore::DictionaryPopupInfo dictionaryPopupInfoForSelectionInPDFPlugin(PDFSelection *, PDFPlugin&, NSDictionary *options, WebCore::TextIndicatorPresentationTransition);
1312 #endif
1313
1314     void windowAndViewFramesChanged(const WebCore::FloatRect& windowFrameInScreenCoordinates, const WebCore::FloatRect& windowFrameInUnflippedScreenCoordinates, const WebCore::FloatRect& viewFrameInWindowCoordinates, const WebCore::FloatPoint& accessibilityViewCoordinates);
1315
1316     RetainPtr<PDFDocument> pdfDocumentForPrintingFrame(WebCore::Frame*);
1317     void computePagesForPrintingPDFDocument(uint64_t frameID, const PrintInfo&, Vector<WebCore::IntRect>& resultPageRects);
1318     void drawPDFDocument(CGContextRef, PDFDocument *, const PrintInfo&, const WebCore::IntRect&);
1319     void drawPagesToPDFFromPDFDocument(CGContextRef, PDFDocument *, const PrintInfo&, uint32_t first, uint32_t count);
1320 #endif
1321
1322     void setMainFrameIsScrollable(bool);
1323
1324     void unapplyEditCommand(uint64_t commandID);
1325     void reapplyEditCommand(uint64_t commandID);
1326     void didRemoveEditCommand(uint64_t commandID);
1327
1328     void findString(const String&, uint32_t findOptions, uint32_t maxMatchCount);
1329     void findStringMatches(const String&, uint32_t findOptions, uint32_t maxMatchCount);
1330     void getImageForFindMatch(uint32_t matchIndex);
1331     void selectFindMatch(uint32_t matchIndex);
1332     void hideFindUI();
1333     void countStringMatches(const String&, uint32_t findOptions, uint32_t maxMatchCount);
1334     void replaceMatches(const Vector<uint32_t>& matchIndices, const String& replacementText, bool selectionOnly, CallbackID);
1335
1336 #if USE(COORDINATED_GRAPHICS)
1337     void sendViewportAttributesChanged(const WebCore::ViewportArguments&);
1338 #endif
1339
1340     void didChangeSelectedIndexForActivePopupMenu(int32_t newIndex);
1341     void setTextForActivePopupMenu(int32_t index);
1342
1343 #if PLATFORM(GTK)
1344     void failedToShowPopupMenu();
1345 #endif
1346
1347     void didChooseFilesForOpenPanel(const Vector<String>&);
1348     void didCancelForOpenPanel();
1349
1350 #if PLATFORM(IOS_FAMILY)
1351     void didChooseFilesForOpenPanelWithDisplayStringAndIcon(const Vector<String>&, const String& displayString, const IPC::DataReference& iconData);
1352 #endif
1353
1354 #if ENABLE(SANDBOX_EXTENSIONS)
1355     void extendSandboxForFilesFromOpenPanel(SandboxExtension::HandleArray&&);
1356 #endif
1357
1358     void didReceiveGeolocationPermissionDecision(uint64_t geolocationID, bool allowed);
1359
1360     void didReceiveNotificationPermissionDecision(uint64_t notificationID, bool allowed);
1361
1362 #if ENABLE(MEDIA_STREAM)
1363     void userMediaAccessWasGranted(uint64_t userMediaID, WebCore::CaptureDevice&& audioDeviceUID, WebCore::CaptureDevice&& videoDeviceUID, String&& mediaDeviceIdentifierHashSalt);
1364     void userMediaAccessWasDenied(uint64_t userMediaID, uint64_t reason, String&& invalidConstraint);
1365
1366     void didCompleteMediaDeviceEnumeration(uint64_t userMediaID, const Vector<WebCore::CaptureDevice>& devices, String&& deviceIdentifierHashSalt, bool originHasPersistentAccess);
1367 #endif
1368
1369 #if ENABLE(MEDIA_STREAM) && ENABLE(SANDBOX_EXTENSIONS)
1370     void grantUserMediaDeviceSandboxExtensions(MediaDeviceSandboxExtensions&&);
1371     void revokeUserMediaDeviceSandboxExtensions(const Vector<String>&);
1372 #endif
1373
1374 #if ENABLE(WEB_RTC)
1375     void disableICECandidateFiltering();
1376     void enableICECandidateFiltering();
1377 #endif
1378
1379 #if ENABLE(WEB_RTC) && USE(LIBWEBRTC)
1380     void disableEnumeratingAllNetworkInterfaces();
1381     void enableEnumeratingAllNetworkInterfaces();
1382 #endif
1383
1384     void advanceToNextMisspelling(bool startBeforeSelection);
1385     void changeSpellingToWord(const String& word);
1386
1387 #if USE(APPKIT)
1388     void uppercaseWord();
1389     void lowercaseWord();
1390     void capitalizeWord();
1391 #endif
1392
1393 #if ENABLE(CONTEXT_MENUS)
1394     void didSelectItemFromActiveContextMenu(const WebContextMenuItemData&);
1395 #endif
1396
1397     void changeSelectedIndex(int32_t index);
1398     void setCanStartMediaTimerFired();
1399
1400     static bool platformCanHandleRequest(const WebCore::ResourceRequest&);
1401
1402     static PluginView* focusedPluginViewForFrame(WebCore::Frame&);
1403
1404     static RefPtr<WebCore::Range> rangeFromEditingRange(WebCore::Frame&, const EditingRange&, EditingRangeIsRelativeTo = EditingRangeIsRelativeTo::EditableRoot);
1405
1406     void reportUsedFeatures();
1407
1408     void updateWebsitePolicies(WebsitePoliciesData&&);
1409
1410     void changeFont(WebCore::FontChanges&&);
1411     void changeFontAttributes(WebCore::FontAttributeChanges&&);
1412
1413 #if PLATFORM(MAC)
1414     void performImmediateActionHitTestAtLocation(WebCore::FloatPoint);
1415     std::tuple<RefPtr<WebCore::Range>, NSDictionary *> lookupTextAtLocation(WebCore::FloatPoint);
1416     void immediateActionDidUpdate();
1417     void immediateActionDidCancel();
1418     void immediateActionDidComplete();
1419
1420     void dataDetectorsDidPresentUI(WebCore::PageOverlay::PageOverlayID);
1421     void dataDetectorsDidChangeUI(WebCore::PageOverlay::PageOverlayID);
1422     void dataDetectorsDidHideUI(WebCore::PageOverlay::PageOverlayID);
1423
1424     void handleAcceptedCandidate(WebCore::TextCheckingResult);
1425 #endif
1426
1427 #if PLATFORM(COCOA)
1428     void requestActiveNowPlayingSessionInfo(CallbackID);
1429 #endif
1430
1431     void setShouldDispatchFakeMouseMoveEvents(bool dispatch) { m_shouldDispatchFakeMouseMoveEvents = dispatch; }
1432
1433 #if ENABLE(WIRELESS_PLAYBACK_TARGET) && !PLATFORM(IOS_FAMILY)
1434     void playbackTargetSelected(uint64_t, const WebCore::MediaPlaybackTargetContext& outputDevice) const;
1435     void playbackTargetAvailabilityDidChange(uint64_t, bool);
1436     void setShouldPlayToPlaybackTarget(uint64_t, bool);
1437 #endif
1438
1439     void clearWheelEventTestTrigger();
1440
1441     void setShouldScaleViewToFitDocument(bool);
1442
1443     void pageStoppedScrolling();
1444
1445 #if ENABLE(VIDEO) && USE(GSTREAMER)
1446     void didEndRequestInstallMissingMediaPlugins(uint32_t result);
1447 #endif
1448
1449     void setResourceCachingDisabled(bool);
1450     void setUserInterfaceLayoutDirection(uint32_t);
1451
1452     bool canPluginHandleResponse(const WebCore::ResourceResponse&);
1453
1454 #if USE(QUICK_LOOK)
1455     void didReceivePasswordForQuickLookDocument(const String&);
1456 #endif
1457
1458     void frameBecameRemote(uint64_t frameID, WebCore::GlobalFrameIdentifier&& remoteFrameIdentifier, WebCore::GlobalWindowIdentifier&& remoteWindowIdentifier);
1459
1460     void registerURLSchemeHandler(uint64_t identifier, const String& scheme);
1461
1462     void urlSchemeTaskDidPerformRedirection(uint64_t handlerIdentifier, uint64_t taskIdentifier, WebCore::ResourceResponse&&, WebCore::ResourceRequest&&);
1463     void urlSchemeTaskDidReceiveResponse(uint64_t handlerIdentifier, uint64_t taskIdentifier, const WebCore::ResourceResponse&);
1464     void urlSchemeTaskDidReceiveData(uint64_t handlerIdentifier, uint64_t taskIdentifier, const IPC::DataReference&);
1465     void urlSchemeTaskDidComplete(uint64_t handlerIdentifier, uint64_t taskIdentifier, const WebCore::ResourceError&);
1466
1467     void setIsSuspended(bool);
1468
1469     RefPtr<WebImage> snapshotAtSize(const WebCore::IntRect&, const WebCore::IntSize& bitmapSize, SnapshotOptions);
1470     RefPtr<WebImage> snapshotNode(WebCore::Node&, SnapshotOptions, unsigned maximumPixelCount = std::numeric_limits<unsigned>::max());
1471 #if USE(CF)
1472     RetainPtr<CFDataRef> pdfSnapshotAtSize(const WebCore::IntRect&, const WebCore::IntSize& bitmapSize, SnapshotOptions);
1473 #endif
1474
1475 #if ENABLE(ATTACHMENT_ELEMENT)
1476     RefPtr<WebCore::HTMLAttachmentElement> attachmentElementWithIdentifier(const String& identifier) const;
1477 #endif
1478
1479     bool canShowMIMEType(const String&, const Function<bool(const String&, WebCore::PluginData::AllowedPluginTypes)>& supportsPlugin) const;
1480
1481     uint64_t m_pageID;
1482
1483     std::unique_ptr<WebCore::Page> m_page;
1484     RefPtr<WebFrame> m_mainFrame;
1485
1486     RefPtr<WebPageGroupProxy> m_pageGroup;
1487
1488     String m_userAgent;
1489
1490     WebCore::IntSize m_viewSize;
1491     std::unique_ptr<DrawingArea> m_drawingArea;
1492     bool m_shouldResetDrawingAreaAfterSuspend { false };
1493
1494     HashSet<PluginView*> m_pluginViews;
1495     bool m_hasSeenPlugin { false };
1496
1497     HashMap<uint64_t, RefPtr<WebCore::TextCheckingRequest>> m_pendingTextCheckingRequestMap;
1498
1499     bool m_useFixedLayout { false };
1500     bool m_drawsBackground { true };
1501
1502     WebCore::Color m_underlayColor;
1503
1504     bool m_isInRedo { false };
1505     bool m_isClosed { false };
1506     bool m_tabToLinks { false };
1507     
1508     bool m_asynchronousPluginInitializationEnabled { false };
1509     bool m_asynchronousPluginInitializationEnabledForAllPlugins { false };
1510     bool m_artificialPluginInitializationDelayEnabled { false };
1511     bool m_scrollingPerformanceLoggingEnabled { false };
1512     bool m_mainFrameIsScrollable { true };
1513
1514     bool m_alwaysShowsHorizontalScroller { false };
1515     bool m_alwaysShowsVerticalScroller { false };
1516
1517 #if PLATFORM(IOS_FAMILY)
1518     bool m_ignoreViewportScalingConstraints { false };
1519 #endif
1520
1521 #if ENABLE(PRIMARY_SNAPSHOTTED_PLUGIN_HEURISTIC)
1522     bool m_readyToFindPrimarySnapshottedPlugin { false };
1523     bool m_didFindPrimarySnapshottedPlugin { false };
1524     unsigned m_numberOfPrimarySnapshotDetectionAttempts { 0 };
1525     String m_primaryPlugInPageOrigin;
1526     String m_primaryPlugInOrigin;
1527     String m_primaryPlugInMimeType;
1528     RunLoop::Timer<WebPage> m_determinePrimarySnapshottedPlugInTimer;
1529 #endif
1530
1531     // The layer hosting mode.
1532     LayerHostingMode m_layerHostingMode;
1533
1534 #if PLATFORM(COCOA)
1535     bool m_pdfPluginEnabled { false };
1536     bool m_hasCachedWindowFrame { false };
1537
1538     // The frame of the containing window in screen coordinates.
1539     WebCore::FloatRect m_windowFrameInScreenCoordinates;
1540
1541     // The frame of the containing window in unflipped screen coordinates.
1542     WebCore::FloatRect m_windowFrameInUnflippedScreenCoordinates;
1543
1544     // The frame of the view in window coordinates.
1545     WebCore::FloatRect m_viewFrameInWindowCoordinates;
1546
1547     // The accessibility position of the view.
1548     WebCore::FloatPoint m_accessibilityPosition;
1549     
1550     RetainPtr<WKAccessibilityWebPageObject> m_mockAccessibilityElement;
1551
1552     UniqueRef<ViewGestureGeometryCollector> m_viewGestureGeometryCollector;
1553
1554     RetainPtr<NSDictionary> m_dataDetectionContext;
1555 #endif
1556
1557 #if HAVE(ACCESSIBILITY) && PLATFORM(GTK)
1558     GRefPtr<WebPageAccessibilityObject> m_accessibilityObject;
1559 #endif
1560
1561 #if PLATFORM(GTK) && USE(TEXTURE_MAPPER_GL)
1562     // Our view's window in the UI process.
1563     uint64_t m_nativeWindowHandle { 0 };
1564 #endif
1565
1566 #if !PLATFORM(IOS_FAMILY)
1567     RefPtr<PageBanner> m_headerBanner;
1568     RefPtr<PageBanner> m_footerBanner;
1569 #endif
1570
1571     RunLoop::Timer<WebPage> m_setCanStartMediaTimer;
1572     bool m_mayStartMediaWhenInWindow { false };
1573
1574     HashMap<uint64_t, RefPtr<WebUndoStep>> m_undoStepMap;
1575
1576 #if ENABLE(CONTEXT_MENUS)
1577     std::unique_ptr<API::InjectedBundle::PageContextMenuClient> m_contextMenuClient;
1578 #endif
1579     std::unique_ptr<API::InjectedBundle::EditorClient> m_editorClient;
1580     std::unique_ptr<API::InjectedBundle::FormClient> m_formClient;
1581     std::unique_ptr<API::InjectedBundle::PageLoaderClient> m_loaderClient;
1582     InjectedBundlePagePolicyClient m_policyClient;
1583     std::unique_ptr<API::InjectedBundle::ResourceLoadClient> m_resourceLoadClient;
1584     std::unique_ptr<API::InjectedBundle::PageUIClient> m_uiClient;
1585 #if ENABLE(FULLSCREEN_API)
1586     InjectedBundlePageFullScreenClient m_fullScreenClient;
1587 #endif
1588
1589     UniqueRef<FindController> m_findController;
1590
1591     RefPtr<WebInspector> m_inspector;
1592     RefPtr<WebInspectorUI> m_inspectorUI;
1593     RefPtr<RemoteWebInspectorUI> m_remoteInspectorUI;
1594     std::unique_ptr<WebPageInspectorTargetController> m_inspectorTargetController;
1595
1596 #if (PLATFORM(IOS_FAMILY) && HAVE(AVKIT)) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))
1597     RefPtr<PlaybackSessionManager> m_playbackSessionManager;
1598     RefPtr<VideoFullscreenManager> m_videoFullscreenManager;
1599 #endif
1600
1601 #if PLATFORM(IOS_FAMILY)
1602     bool m_allowsMediaDocumentInlinePlayback { false };
1603     RefPtr<WebCore::Range> m_startingGestureRange;
1604 #endif
1605
1606 #if ENABLE(FULLSCREEN_API)
1607     RefPtr<WebFullScreenManager> m_fullScreenManager;
1608 #endif
1609
1610     RefPtr<WebPopupMenu> m_activePopupMenu;
1611
1612 #if ENABLE(CONTEXT_MENUS)
1613     RefPtr<WebContextMenu> m_contextMenu;
1614 #endif
1615
1616 #if ENABLE(INPUT_TYPE_COLOR)
1617     WebColorChooser* m_activeColorChooser { nullptr };
1618 #endif
1619
1620 #if ENABLE(DATALIST_ELEMENT)
1621     WebDataListSuggestionPicker* m_activeDataListSuggestionPicker { nullptr };
1622 #endif
1623
1624     RefPtr<WebOpenPanelResultListener> m_activeOpenPanelResultListener;
1625     RefPtr<NotificationPermissionRequestManager> m_notificationPermissionRequestManager;
1626
1627     Ref<WebUserContentController> m_userContentController;
1628
1629 #if ENABLE(GEOLOCATION)
1630     UniqueRef<GeolocationPermissionRequestManager> m_geolocationPermissionRequestManager;
1631 #endif
1632
1633 #if ENABLE(MEDIA_STREAM)
1634     UniqueRef<UserMediaPermissionRequestManager> m_userMediaPermissionRequestManager;
1635 #endif
1636
1637     std::unique_ptr<WebCore::PrintContext> m_printContext;
1638 #if PLATFORM(GTK)
1639     RefPtr<WebPrintOperationGtk> m_printOperation;
1640 #endif
1641
1642     SandboxExtensionTracker m_sandboxExtensionTracker;
1643
1644     RefPtr<SandboxExtension> m_pendingDropSandboxExtension;
1645     Vector<RefPtr<SandboxExtension>> m_pendingDropExtensionsForFileUpload;
1646
1647     PAL::HysteresisActivity m_pageScrolledHysteresis;
1648
1649     bool m_canRunBeforeUnloadConfirmPanel { false };
1650
1651     bool m_canRunModal { false };
1652     bool m_isRunningModal { false };
1653
1654 #if ENABLE(DRAG_SUPPORT)
1655     bool m_isStartingDrag { false };
1656 #endif
1657
1658     bool m_cachedMainFrameIsPinnedToLeftSide { true };
1659     bool m_cachedMainFrameIsPinnedToRightSide { true };
1660     bool m_cachedMainFrameIsPinnedToTopSide { true };
1661     bool m_cachedMainFrameIsPinnedToBottomSide { true };
1662     bool m_canShortCircuitHorizontalWheelEvents { false };
1663     bool m_hasWheelEventHandlers { false };
1664
1665     unsigned m_cachedPageCount { 0 };
1666
1667     HashSet<unsigned long> m_trackedNetworkResourceRequestIdentifiers;
1668
1669     WebCore::IntSize m_viewLayoutSize;
1670     bool m_autoSizingShouldExpandToViewHeight { false };
1671     Optional<WebCore::IntSize> m_viewportSizeForCSSViewportUnits;
1672
1673     bool m_userIsInteracting { false };
1674     bool m_isFocusingElementDueToUserInteraction { false };
1675     bool m_hasEverFocusedElementDueToUserInteractionSincePageTransition { false };
1676     bool m_needsHiddenContentEditableQuirk { false };
1677     bool m_needsPlainTextQuirk { false };
1678     bool m_changingActivityState { false };
1679
1680 #if ENABLE(CONTEXT_MENUS)
1681     bool m_isShowingContextMenu { false };
1682 #endif
1683
1684     RefPtr<WebCore::Element> m_focusedElement;
1685     bool m_hasPendingBlurNotification { false };
1686     bool m_hasPendingEditorStateUpdate { false };
1687     
1688 #if PLATFORM(IOS_FAMILY)
1689     RefPtr<WebCore::Range> m_currentWordRange;
1690     RefPtr<WebCore::Node> m_interactionNode;
1691     WebCore::IntPoint m_lastInteractionLocation;
1692     
1693     enum SelectionAnchor { Start, End };
1694     SelectionAnchor m_selectionAnchor { Start };
1695
1696     RefPtr<WebCore::Node> m_potentialTapNode;
1697     WebCore::FloatPoint m_potentialTapLocation;
1698     RefPtr<WebCore::SecurityOrigin> m_potentialTapSecurityOrigin;
1699
1700     WebCore::ViewportConfiguration m_viewportConfiguration;
1701     bool m_hasReceivedVisibleContentRectsAfterDidCommitLoad { false };
1702     bool m_scaleWasSetByUIProcess { false };
1703     bool m_userHasChangedPageScaleFactor { false };
1704     bool m_hasStablePageScaleFactor { true };
1705     bool m_useTestingViewportConfiguration { false };
1706     bool m_isInStableState { true };
1707     bool m_forceAlwaysUserScalable { false };
1708     MonotonicTime m_oldestNonStableUpdateVisibleContentRectsTimestamp;
1709     Seconds m_estimatedLatency { 0 };
1710     WebCore::FloatSize m_screenSize;
1711     WebCore::FloatSize m_availableScreenSize;
1712     WebCore::FloatSize m_overrideScreenSize;
1713     RefPtr<WebCore::Range> m_currentBlockSelection;
1714     WebCore::IntRect m_blockRectForTextSelection;
1715
1716     RefPtr<WebCore::Range> m_initialSelection;
1717     WebCore::VisibleSelection m_storedSelectionForAccessibility { WebCore::VisibleSelection() };
1718     WebCore::IntSize m_blockSelectionDesiredSize;
1719     WebCore::FloatSize m_maximumUnobscuredSize;
1720     int32_t m_deviceOrientation { 0 };
1721     bool m_inDynamicSizeUpdate { false };
1722     HashMap<std::pair<WebCore::IntSize, double>, WebCore::IntPoint> m_dynamicSizeUpdateHistory;
1723     RefPtr<WebCore::Node> m_pendingSyntheticClickNode;
1724     WebCore::FloatPoint m_pendingSyntheticClickLocation;
1725     WebCore::FloatRect m_previousExposedContentRect;
1726     FocusedElementIdentifier m_currentFocusedElementIdentifier { 0 };
1727     Optional<DynamicViewportSizeUpdateID> m_pendingDynamicViewportSizeUpdateID;
1728     double m_lastTransactionPageScaleFactor { 0 };
1729     uint64_t m_lastTransactionIDWithScaleChange { 0 };
1730 #endif
1731
1732     WebCore::Timer m_layerVolatilityTimer;
1733     Vector<WTF::Function<void (bool)>> m_markLayersAsVolatileCompletionHandlers;
1734     bool m_isSuspendedUnderLock { false };
1735
1736     HashSet<String, ASCIICaseInsensitiveHash> m_mimeTypesWithCustomContentProviders;
1737     WebCore::Color m_backgroundColor { WebCore::Color::white };
1738
1739     HashSet<unsigned> m_activeRenderingSuppressionTokens;
1740     unsigned m_maximumRenderingSuppressionToken { 0 };
1741     
1742     WebCore::ScrollPinningBehavior m_scrollPinningBehavior { WebCore::DoNotPin };
1743     Optional<WebCore::ScrollbarOverlayStyle> m_scrollbarOverlayStyle;
1744
1745     bool m_useAsyncScrolling { false };
1746
1747     OptionSet<WebCore::ActivityState::Flag> m_activityState;
1748
1749     bool m_processSuppressionEnabled;
1750     UserActivity m_userActivity;
1751     PAL::HysteresisActivity m_userActivityHysteresis;
1752
1753     uint64_t m_pendingNavigationID { 0 };
1754     Optional<WebsitePoliciesData> m_pendingWebsitePolicies;
1755
1756     bool m_mainFrameProgressCompleted { false };
1757     bool m_shouldDispatchFakeMouseMoveEvents { true };
1758     bool m_isEditorStateMissingPostLayoutData { false };
1759     bool m_isSelectingTextWhileInsertingAsynchronously { false };
1760
1761     enum class EditorStateIsContentEditable { No, Yes, Unset };
1762     mutable EditorStateIsContentEditable m_lastEditorStateWasContentEditable { EditorStateIsContentEditable::Unset };
1763
1764 #if PLATFORM(GTK)
1765     bool m_inputMethodEnabled { false };
1766 #endif
1767
1768 #if ENABLE(VIDEO) && USE(GSTREAMER)
1769     RefPtr<WebCore::MediaPlayerRequestInstallMissingPluginsCallback> m_installMediaPluginsCallback;
1770 #endif
1771
1772 #if USE(OS_STATE)
1773     WallTime m_loadCommitTime;
1774 #endif
1775
1776     WebCore::UserInterfaceLayoutDirection m_userInterfaceLayoutDirection { WebCore::UserInterfaceLayoutDirection::LTR };
1777
1778     const String m_overrideContentSecurityPolicy;
1779     const Optional<double> m_cpuLimit;
1780
1781     HashMap<String, RefPtr<WebURLSchemeHandlerProxy>> m_schemeToURLSchemeHandlerProxyMap;
1782     HashMap<uint64_t, WebURLSchemeHandlerProxy*> m_identifierToURLSchemeHandlerProxyMap;
1783
1784     HashMap<uint64_t, WTF::Function<void(bool granted)>> m_storageAccessResponseCallbackMap;
1785     HashMap<ShareSheetCallbackID, WTF::Function<void(bool completed)>> m_shareSheetResponseCallbackMap;
1786
1787 #if ENABLE(APPLICATION_MANIFEST)
1788     HashMap<uint64_t, uint64_t> m_applicationManifestFetchCallbackMap;
1789 #endif
1790
1791     OptionSet<LayerTreeFreezeReason> m_LayerTreeFreezeReasons;
1792     bool m_isSuspended { false };
1793     bool m_needsFontAttributes { false };
1794 #if PLATFORM(MAC)
1795     bool m_shouldAttachDrawingAreaOnPageTransition { false };
1796 #endif
1797 };
1798
1799 } // namespace WebKit
1800