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