Make it possible to send an arbitrary IPC message from JavaScript
[WebKit-https.git] / Source / WebKit / WebProcess / WebPage / WebPage.h
1 /*
2  * Copyright (C) 2010-2020 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 "ContentAsStringIncludesChildFrames.h"
37 #include "DownloadID.h"
38 #include "DrawingAreaInfo.h"
39 #include "EditingRange.h"
40 #include "FocusedElementInformation.h"
41 #include "GeolocationIdentifier.h"
42 #include "InjectedBundlePageContextMenuClient.h"
43 #include "InjectedBundlePageFullScreenClient.h"
44 #include "InjectedBundlePagePolicyClient.h"
45 #include "LayerTreeContext.h"
46 #include "MessageReceiver.h"
47 #include "MessageSender.h"
48 #include "OptionalCallbackID.h"
49 #include "PDFPluginIdentifier.h"
50 #include "Plugin.h"
51 #include "PolicyDecision.h"
52 #include "SandboxExtension.h"
53 #include "ShareableBitmap.h"
54 #include "SharedMemory.h"
55 #include "StorageNamespaceIdentifier.h"
56 #include "TransactionID.h"
57 #include "UserData.h"
58 #include "WebBackForwardListProxy.h"
59 #include "WebPageMessagesReplies.h"
60 #include "WebURLSchemeHandler.h"
61 #include "WebUndoStepID.h"
62 #include "WebUserContentController.h"
63 #include "WebsitePoliciesData.h"
64 #include <JavaScriptCore/InspectorFrontendChannel.h>
65 #include <WebCore/ActivityState.h>
66 #include <WebCore/DictionaryPopupInfo.h>
67 #include <WebCore/DisabledAdaptations.h>
68 #include <WebCore/DragActions.h>
69 #include <WebCore/FrameLoaderTypes.h>
70 #include <WebCore/HTMLMenuElement.h>
71 #include <WebCore/HTMLMenuItemElement.h>
72 #include <WebCore/IntRect.h>
73 #include <WebCore/IntSizeHash.h>
74 #include <WebCore/Page.h>
75 #include <WebCore/PageIdentifier.h>
76 #include <WebCore/PageOverlay.h>
77 #include <WebCore/PluginData.h>
78 #include <WebCore/PointerCharacteristics.h>
79 #include <WebCore/PointerID.h>
80 #include <WebCore/RenderingMode.h>
81 #include <WebCore/SecurityPolicyViolationEvent.h>
82 #include <WebCore/ShareData.h>
83 #include <WebCore/SimpleRange.h>
84 #include <WebCore/TextManipulationController.h>
85 #include <WebCore/UserActivity.h>
86 #include <WebCore/UserContentTypes.h>
87 #include <WebCore/UserInterfaceLayoutDirection.h>
88 #include <WebCore/UserScriptTypes.h>
89 #include <WebCore/VisibilityState.h>
90 #include <WebCore/WebCoreKeyboardUIMode.h>
91 #include <memory>
92 #include <pal/HysteresisActivity.h>
93 #include <wtf/HashMap.h>
94 #include <wtf/MonotonicTime.h>
95 #include <wtf/RefPtr.h>
96 #include <wtf/RunLoop.h>
97 #include <wtf/Seconds.h>
98 #include <wtf/WallTime.h>
99 #include <wtf/text/WTFString.h>
100
101 #if ENABLE(ACCESSIBILITY) && USE(ATK)
102 typedef struct _AtkObject AtkObject;
103 #include <wtf/glib/GRefPtr.h>
104 #endif
105
106 #if PLATFORM(GTK)
107 #include "ArgumentCodersGtk.h"
108 #include "WebPrintOperationGtk.h"
109 #endif
110
111 #if PLATFORM(GTK) || PLATFORM(WPE)
112 #include "InputMethodState.h"
113 #endif
114
115 #if PLATFORM(IOS_FAMILY)
116 #include "GestureTypes.h"
117 #include <WebCore/IntPointHash.h>
118 #include <WebCore/WKContentObservation.h>
119 #endif
120
121 #if ENABLE(META_VIEWPORT)
122 #include <WebCore/ViewportConfiguration.h>
123 #endif
124
125 #if ENABLE(APPLICATION_MANIFEST)
126 #include <WebCore/ApplicationManifest.h>
127 #endif
128
129 #if ENABLE(IOS_TOUCH_EVENTS)
130 #include <WebKitAdditions/PlatformTouchEventIOS.h>
131 #elif ENABLE(TOUCH_EVENTS)
132 #include <WebCore/PlatformTouchEvent.h>
133 #endif
134
135 #if ENABLE(MAC_GESTURE_EVENTS)
136 #include <WebKitAdditions/PlatformGestureEventMac.h>
137 #endif
138
139 #if ENABLE(MEDIA_USAGE)
140 #include <WebCore/MediaSessionIdentifier.h>
141 #endif
142
143 #if PLATFORM(COCOA)
144 #include "DynamicViewportSizeUpdate.h"
145 #include <WebCore/VisibleSelection.h>
146 #include <wtf/RetainPtr.h>
147 OBJC_CLASS CALayer;
148 OBJC_CLASS NSArray;
149 OBJC_CLASS NSDictionary;
150 OBJC_CLASS NSObject;
151 OBJC_CLASS WKAccessibilityWebPageObject;
152 #endif
153
154 #define ENABLE_VIEWPORT_RESIZING PLATFORM(IOS_FAMILY)
155
156 namespace API {
157 class Array;
158 }
159
160 namespace IPC {
161 class Connection;
162 class DataReference;
163 class Decoder;
164 class FormDataReference;
165 }
166
167 namespace WebCore {
168
169 class CaptureDevice;
170 class DocumentLoader;
171 class DragData;
172 class FontAttributeChanges;
173 class FontChanges;
174 class Frame;
175 class FrameSelection;
176 class FrameView;
177 class GraphicsContext;
178 class HTMLImageElement;
179 class HTMLMenuElement;
180 class HTMLMenuItemElement;
181 class HTMLPlugInElement;
182 class HTMLPlugInImageElement;
183 class IntPoint;
184 class KeyboardEvent;
185 class MediaPlaybackTargetContext;
186 class MediaPlayerRequestInstallMissingPluginsCallback;
187 class Page;
188 class PrintContext;
189 class Range;
190 class ResourceRequest;
191 class ResourceResponse;
192 class SelectionData;
193 class SelectionRect;
194 class SharedBuffer;
195 class SubstituteData;
196 class TextCheckingRequest;
197 class VisiblePosition;
198
199 enum SyntheticClickType : int8_t;
200 enum class DOMPasteAccessResponse : uint8_t;
201 enum class DragApplicationFlags : uint8_t;
202 enum class DragHandlingMethod : uint8_t;
203 enum class EventMakesGamepadsVisible : bool;
204 enum class SelectionDirection : uint8_t;
205 enum class ShouldTreatAsContinuingLoad : bool;
206 enum class TextIndicatorPresentationTransition : uint8_t;
207 enum class TextGranularity : uint8_t;
208 enum class WritingDirection : uint8_t;
209
210 using PlatformDisplayID = uint32_t;
211
212 struct AttributedString;
213 struct BackForwardItemIdentifier;
214 struct CompositionHighlight;
215 struct CompositionUnderline;
216 struct DictationAlternative;
217 struct ElementContext;
218 struct GlobalFrameIdentifier;
219 struct GlobalWindowIdentifier;
220 struct Highlight;
221 struct KeypressCommand;
222 struct MediaUsageInfo;
223 struct PromisedAttachmentInfo;
224 struct RequestStorageAccessResult;
225 struct RunJavaScriptParameters;
226 struct TextCheckingResult;
227 struct ViewportArguments;
228
229 #if ENABLE(ATTACHMENT_ELEMENT)
230 class HTMLAttachmentElement;
231 #endif
232 }
233
234 namespace WebKit {
235
236 class DrawingArea;
237 class FindController;
238 class GamepadData;
239 class GeolocationPermissionRequestManager;
240 class LayerHostingContext;
241 class MediaDeviceSandboxExtensions;
242 class NotificationPermissionRequestManager;
243 class PDFPlugin;
244 class PageBanner;
245 class PluginView;
246 class RemoteWebInspectorUI;
247 class TextCheckingControllerProxy;
248 class UserMediaPermissionRequestManager;
249 class ViewGestureGeometryCollector;
250 class WebColorChooser;
251 class WebContextMenu;
252 class WebContextMenuItemData;
253 class WebDataListSuggestionPicker;
254 class WebDateTimeChooser;
255 class WebDocumentLoader;
256 class WebEvent;
257 class PlaybackSessionManager;
258 class VideoFullscreenManager;
259 class WebFrame;
260 class WebFullScreenManager;
261 class WebGestureEvent;
262 class WebImage;
263 class WebInspector;
264 class WebInspectorClient;
265 class WebInspectorUI;
266 class WebKeyboardEvent;
267 class WebMouseEvent;
268 class WebNotificationClient;
269 class WebOpenPanelResultListener;
270 class WebPageGroupProxy;
271 class WebPageInspectorTargetController;
272 class WebPageOverlay;
273 class WebPaymentCoordinator;
274 class WebPopupMenu;
275 class WebRemoteObjectRegistry;
276 class WebTouchEvent;
277 class WebURLSchemeHandlerProxy;
278 class WebUndoStep;
279 class WebUserContentController;
280 class WebWheelEvent;
281 class RemoteLayerTreeTransaction;
282
283 enum class FindOptions : uint16_t;
284 enum class DragControllerAction : uint8_t;
285 enum class SyntheticEditingCommandType : uint8_t;
286
287 struct BackForwardListItemState;
288 struct DataDetectionResult;
289 struct DocumentEditingContext;
290 struct DocumentEditingContextRequest;
291 struct EditorState;
292 struct FrameTreeNodeData;
293 struct FontInfo;
294 struct InsertTextOptions;
295 struct InteractionInformationAtPosition;
296 struct InteractionInformationRequest;
297 struct LoadParameters;
298 struct PrintInfo;
299 struct TextInputContext;
300 struct UserMessage;
301 struct WebAutocorrectionData;
302 struct WebAutocorrectionContext;
303 struct WebPageCreationParameters;
304 struct WebPreferencesStore;
305 struct WebsitePoliciesData;
306
307 #if ENABLE(UI_SIDE_COMPOSITING)
308 class VisibleContentRectUpdateInfo;
309 #endif
310
311 using SnapshotOptions = uint32_t;
312 using WKEventModifiers = uint32_t;
313
314 class WebPage : public API::ObjectImpl<API::Object::Type::BundlePage>, public IPC::MessageReceiver, public IPC::MessageSender, public CanMakeWeakPtr<WebPage> {
315 public:
316     static Ref<WebPage> create(WebCore::PageIdentifier, WebPageCreationParameters&&);
317
318     virtual ~WebPage();
319
320     void reinitializeWebPage(WebPageCreationParameters&&);
321
322     void close();
323
324     static WebPage& fromCorePage(WebCore::Page&);
325
326     WebCore::Page* corePage() const { return m_page.get(); }
327     WebCore::PageIdentifier identifier() const { return m_identifier; }
328     StorageNamespaceIdentifier sessionStorageNamespaceIdentifier() const { return makeObjectIdentifier<StorageNamespaceIdentifierType>(m_webPageProxyIdentifier.toUInt64()); }
329     PAL::SessionID sessionID() const;
330     bool usesEphemeralSession() const;
331
332     void setSize(const WebCore::IntSize&);
333     const WebCore::IntSize& size() const { return m_viewSize; }
334     WebCore::IntRect bounds() const { return WebCore::IntRect(WebCore::IntPoint(), size()); }
335
336     DrawingArea* drawingArea() const { return m_drawingArea.get(); }
337
338 #if ENABLE(ASYNC_SCROLLING)
339     WebCore::ScrollingCoordinator* scrollingCoordinator() const;
340 #endif
341
342     WebPageGroupProxy* pageGroup() const { return m_pageGroup.get(); }
343
344     void scrollMainFrameIfNotAtMaxScrollPosition(const WebCore::IntSize& scrollOffset);
345
346     bool scrollBy(uint32_t scrollDirection, uint32_t scrollGranularity);
347
348     void centerSelectionInVisibleArea();
349
350 #if ENABLE(UI_PROCESS_PDF_HUD)
351     void createPDFHUD(PDFPlugin&, const WebCore::IntRect&);
352     void updatePDFHUDLocation(PDFPlugin&, const WebCore::IntRect&);
353     void removePDFHUD(PDFPlugin&);
354     void zoomPDFIn(PDFPluginIdentifier);
355     void zoomPDFOut(PDFPluginIdentifier);
356     void savePDF(PDFPluginIdentifier, CompletionHandler<void(const String&, const URL&, const IPC::DataReference&)>&&);
357     void openPDFWithPreview(PDFPluginIdentifier, CompletionHandler<void(const String&, FrameInfoData&&, const IPC::DataReference&, const String&)>&&);
358 #endif
359
360 #if PLATFORM(COCOA)
361     void willCommitLayerTree(RemoteLayerTreeTransaction&);
362     void didFlushLayerTreeAtTime(MonotonicTime);
363 #endif
364
365     void layoutIfNeeded();
366     void updateRendering();
367     void finalizeRenderingUpdate(OptionSet<WebCore::FinalizeRenderingUpdateFlags>);
368
369     enum class LazyCreationPolicy { UseExistingOnly, CreateIfNeeded };
370
371     WebInspector* inspector(LazyCreationPolicy = LazyCreationPolicy::CreateIfNeeded);
372     WebInspectorUI* inspectorUI();
373     RemoteWebInspectorUI* remoteInspectorUI();
374     bool isInspectorPage() { return !!m_inspectorUI || !!m_remoteInspectorUI; }
375
376     void inspectorFrontendCountChanged(unsigned);
377
378 #if PLATFORM(IOS_FAMILY) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))
379     PlaybackSessionManager& playbackSessionManager();
380     void videoControlsManagerDidChange();
381 #endif
382
383 #if ENABLE(VIDEO_PRESENTATION_MODE)
384     VideoFullscreenManager& videoFullscreenManager();
385 #endif
386
387 #if PLATFORM(IOS_FAMILY)
388     void setAllowsMediaDocumentInlinePlayback(bool);
389     bool allowsMediaDocumentInlinePlayback() const { return m_allowsMediaDocumentInlinePlayback; }
390 #endif
391
392 #if ENABLE(FULLSCREEN_API)
393     WebFullScreenManager* fullScreenManager();
394 #endif
395
396     void addConsoleMessage(WebCore::FrameIdentifier, MessageSource, MessageLevel, const String&, uint64_t requestID = 0);
397     void sendCSPViolationReport(WebCore::FrameIdentifier, const URL& reportURL, IPC::FormDataReference&&);
398     void enqueueSecurityPolicyViolationEvent(WebCore::FrameIdentifier, WebCore::SecurityPolicyViolationEvent::Init&&);
399
400     // -- Called by the DrawingArea.
401     // FIXME: We could genericize these into a DrawingArea client interface. Would that be beneficial?
402     void drawRect(WebCore::GraphicsContext&, const WebCore::IntRect&);
403
404     // -- Called from WebCore clients.
405     bool handleEditingKeyboardEvent(WebCore::KeyboardEvent&);
406
407     void didStartPageTransition();
408     void didCompletePageTransition();
409     void didCommitLoad(WebFrame*);
410     void willReplaceMultipartContent(const WebFrame&);
411     void didReplaceMultipartContent(const WebFrame&);
412     void didFinishDocumentLoad(WebFrame&);
413     void didFinishLoad(WebFrame&);
414     void show();
415     String userAgent(const URL&) const;
416     String platformUserAgent(const URL&) const;
417     WebCore::KeyboardUIMode keyboardUIMode();
418
419     bool hoverSupportedByPrimaryPointingDevice() const;
420     bool hoverSupportedByAnyAvailablePointingDevice() const;
421     Optional<WebCore::PointerCharacteristics> pointerCharacteristicsOfPrimaryPointingDevice() const;
422     OptionSet<WebCore::PointerCharacteristics> pointerCharacteristicsOfAllAvailablePointingDevices() const;
423
424     void didInsertMenuElement(WebCore::HTMLMenuElement&);
425     void didRemoveMenuElement(WebCore::HTMLMenuElement&);
426     void didInsertMenuItemElement(WebCore::HTMLMenuItemElement&);
427     void didRemoveMenuItemElement(WebCore::HTMLMenuItemElement&);
428
429     void animationDidFinishForElement(const WebCore::Element&);
430
431     const String& overrideContentSecurityPolicy() const { return m_overrideContentSecurityPolicy; }
432
433     WebUndoStep* webUndoStep(WebUndoStepID);
434     void addWebUndoStep(WebUndoStepID, Ref<WebUndoStep>&&);
435     void removeWebEditCommand(WebUndoStepID);
436     bool isInRedo() const { return m_isInRedo; }
437
438     bool isAlwaysOnLoggingAllowed() const;
439     void setActivePopupMenu(WebPopupMenu*);
440
441     void setHiddenPageDOMTimerThrottlingIncreaseLimit(Seconds limit)
442     {
443         m_page->setDOMTimerAlignmentIntervalIncreaseLimit(limit);
444     }
445
446 #if ENABLE(INPUT_TYPE_COLOR)
447     WebColorChooser* activeColorChooser() const { return m_activeColorChooser; }
448     void setActiveColorChooser(WebColorChooser*);
449     void didChooseColor(const WebCore::Color&);
450     void didEndColorPicker();
451 #endif
452
453 #if ENABLE(DATALIST_ELEMENT)
454     void setActiveDataListSuggestionPicker(WebDataListSuggestionPicker&);
455     void didSelectDataListOption(const String&);
456     void didCloseSuggestions();
457 #endif
458
459 #if ENABLE(DATE_AND_TIME_INPUT_TYPES)
460     void setActiveDateTimeChooser(WebDateTimeChooser&);
461     void didChooseDate(const String&);
462     void didEndDateTimePicker();
463 #endif
464
465     WebOpenPanelResultListener* activeOpenPanelResultListener() const { return m_activeOpenPanelResultListener.get(); }
466     void setActiveOpenPanelResultListener(Ref<WebOpenPanelResultListener>&&);
467
468     void didReceiveMessage(IPC::Connection&, IPC::Decoder&) override;
469     void didReceiveSyncMessage(IPC::Connection&, IPC::Decoder&, std::unique_ptr<IPC::Encoder>&) override;
470
471     // -- InjectedBundle methods
472 #if ENABLE(CONTEXT_MENUS)
473     void setInjectedBundleContextMenuClient(std::unique_ptr<API::InjectedBundle::PageContextMenuClient>&&);
474 #endif
475     void setInjectedBundleEditorClient(std::unique_ptr<API::InjectedBundle::EditorClient>&&);
476     void setInjectedBundleFormClient(std::unique_ptr<API::InjectedBundle::FormClient>&&);
477     void setInjectedBundlePageLoaderClient(std::unique_ptr<API::InjectedBundle::PageLoaderClient>&&);
478     void initializeInjectedBundlePolicyClient(WKBundlePagePolicyClientBase*);
479     void setInjectedBundleResourceLoadClient(std::unique_ptr<API::InjectedBundle::ResourceLoadClient>&&);
480     void setInjectedBundleUIClient(std::unique_ptr<API::InjectedBundle::PageUIClient>&&);
481 #if ENABLE(FULLSCREEN_API)
482     void initializeInjectedBundleFullScreenClient(WKBundlePageFullScreenClientBase*);
483 #endif
484
485 #if ENABLE(CONTEXT_MENUS)
486     API::InjectedBundle::PageContextMenuClient& injectedBundleContextMenuClient() { return *m_contextMenuClient; }
487 #endif
488     API::InjectedBundle::EditorClient& injectedBundleEditorClient() { return *m_editorClient; }
489     API::InjectedBundle::FormClient& injectedBundleFormClient() { return *m_formClient; }
490     API::InjectedBundle::PageLoaderClient& injectedBundleLoaderClient() { return *m_loaderClient; }
491     InjectedBundlePagePolicyClient& injectedBundlePolicyClient() { return m_policyClient; }
492     API::InjectedBundle::ResourceLoadClient& injectedBundleResourceLoadClient() { return *m_resourceLoadClient; }
493     API::InjectedBundle::PageUIClient& injectedBundleUIClient() { return *m_uiClient; }
494 #if ENABLE(FULLSCREEN_API)
495     InjectedBundlePageFullScreenClient& injectedBundleFullScreenClient() { return m_fullScreenClient; }
496 #endif
497
498     bool findStringFromInjectedBundle(const String&, OptionSet<FindOptions>);
499     void findStringMatchesFromInjectedBundle(const String&, OptionSet<FindOptions>);
500     void replaceStringMatchesFromInjectedBundle(const Vector<uint32_t>& matchIndices, const String& replacementText, bool selectionOnly);
501
502     WebFrame& mainWebFrame() const { return m_mainFrame; }
503
504     WebCore::Frame* mainFrame() const; // May return nullptr.
505     WebCore::FrameView* mainFrameView() const; // May return nullptr.
506
507     Optional<WebCore::SimpleRange> currentSelectionAsRange();
508
509 #if ENABLE(NETSCAPE_PLUGIN_API)
510     RefPtr<Plugin> createPlugin(WebFrame*, WebCore::HTMLPlugInElement*, const Plugin::Parameters&, String& newMIMEType);
511 #endif
512
513 #if ENABLE(WEBGL)
514     WebCore::WebGLLoadPolicy webGLPolicyForURL(WebFrame*, const URL&);
515     WebCore::WebGLLoadPolicy resolveWebGLPolicyForURL(WebFrame*, const URL&);
516 #endif
517     
518     enum class ShouldPerformLayout { Default, Yes };
519     EditorState editorState(ShouldPerformLayout = ShouldPerformLayout::Default) const;
520     void updateEditorStateAfterLayoutIfEditabilityChanged();
521
522     // options are RenderTreeExternalRepresentationBehavior values.
523     String renderTreeExternalRepresentation(unsigned options = 0) const;
524     String renderTreeExternalRepresentationForPrinting() const;
525     uint64_t renderTreeSize() const;
526
527     void setTracksRepaints(bool);
528     bool isTrackingRepaints() const;
529     void resetTrackedRepaints();
530     Ref<API::Array> trackedRepaintRects();
531
532     void executeEditingCommand(const String& commandName, const String& argument);
533     bool isEditingCommandEnabled(const String& commandName);
534     void clearMainFrameName();
535     void sendClose();
536
537     void suspendForProcessSwap();
538
539     void sendSetWindowFrame(const WebCore::FloatRect&);
540
541     double textZoomFactor() const;
542     void setTextZoomFactor(double);
543     double pageZoomFactor() const;
544     void setPageZoomFactor(double);
545     void setPageAndTextZoomFactors(double pageZoomFactor, double textZoomFactor);
546     void windowScreenDidChange(WebCore::PlatformDisplayID, Optional<unsigned> nominalFramesPerSecond);
547     String dumpHistoryForTesting(const String& directory);
548     void clearHistory();
549
550     void accessibilitySettingsDidChange();
551     void screenPropertiesDidChange();
552
553     void scalePage(double scale, const WebCore::IntPoint& origin);
554     void scalePageInViewCoordinates(double scale, WebCore::IntPoint centerInViewCoordinates);
555     double pageScaleFactor() const;
556     double totalScaleFactor() const;
557     double viewScaleFactor() const;
558     void scaleView(double scale);
559
560     void setUseFixedLayout(bool);
561     bool useFixedLayout() const { return m_useFixedLayout; }
562     bool setFixedLayoutSize(const WebCore::IntSize&);
563     WebCore::IntSize fixedLayoutSize() const;
564
565     void listenForLayoutMilestones(OptionSet<WebCore::LayoutMilestone>);
566
567     void setSuppressScrollbarAnimations(bool);
568     
569     void setEnableVerticalRubberBanding(bool);
570     void setEnableHorizontalRubberBanding(bool);
571     
572     void setBackgroundExtendsBeyondPage(bool);
573
574     void setPaginationMode(uint32_t /* WebCore::Pagination::Mode */);
575     void setPaginationBehavesLikeColumns(bool);
576     void setPageLength(double);
577     void setGapBetweenPages(double);
578     void setPaginationLineGridEnabled(bool);
579     
580     void postInjectedBundleMessage(const String& messageName, const UserData&);
581
582     void setUnderlayColor(const WebCore::Color& color) { m_underlayColor = color; }
583     WebCore::Color underlayColor() const { return m_underlayColor; }
584
585     void stopLoading();
586     void stopLoadingFrame(WebCore::FrameIdentifier);
587     bool defersLoading() const;
588     void setDefersLoading(bool deferLoading);
589
590     void enterAcceleratedCompositingMode(WebCore::GraphicsLayer*);
591     void exitAcceleratedCompositingMode();
592
593     void addPluginView(PluginView*);
594     void removePluginView(PluginView*);
595
596     bool isVisible() const { return m_activityState.contains(WebCore::ActivityState::IsVisible); }
597     bool isVisibleOrOccluded() const { return m_activityState.contains(WebCore::ActivityState::IsVisibleOrOccluded); }
598
599     LayerHostingMode layerHostingMode() const { return m_layerHostingMode; }
600     void setLayerHostingMode(LayerHostingMode);
601
602 #if PLATFORM(COCOA)
603     void updatePluginsActiveAndFocusedState();
604     const WebCore::FloatRect& windowFrameInScreenCoordinates() const { return m_windowFrameInScreenCoordinates; }
605     const WebCore::FloatRect& windowFrameInUnflippedScreenCoordinates() const { return m_windowFrameInUnflippedScreenCoordinates; }
606     const WebCore::FloatRect& viewFrameInWindowCoordinates() const { return m_viewFrameInWindowCoordinates; }
607
608     bool hasCachedWindowFrame() const { return m_hasCachedWindowFrame; }
609
610     void updateHeaderAndFooterLayersForDeviceScaleChange(float scaleFactor);
611 #endif
612
613 #if PLATFORM(MAC)
614     void setTopOverhangImage(WebImage*);
615     void setBottomOverhangImage(WebImage*);
616     
617     void setUseSystemAppearance(bool);
618
619     void didEndMagnificationGesture();
620 #endif
621
622     void effectiveAppearanceDidChange(bool useDarkAppearance, bool useElevatedUserInterfaceLevel);
623
624     bool windowIsFocused() const;
625     bool windowAndWebPageAreFocused() const;
626
627 #if !PLATFORM(IOS_FAMILY)
628     void setHeaderPageBanner(PageBanner*);
629     PageBanner* headerPageBanner();
630     void setFooterPageBanner(PageBanner*);
631     PageBanner* footerPageBanner();
632
633     void hidePageBanners();
634     void showPageBanners();
635     
636     void setHeaderBannerHeightForTesting(int);
637     void setFooterBannerHeightForTesting(int);
638 #endif
639
640     WebCore::IntPoint screenToRootView(const WebCore::IntPoint&);
641     WebCore::IntRect rootViewToScreen(const WebCore::IntRect&);
642     WebCore::IntPoint accessibilityScreenToRootView(const WebCore::IntPoint&);
643     WebCore::IntRect rootViewToAccessibilityScreen(const WebCore::IntRect&);
644     
645     RefPtr<WebImage> scaledSnapshotWithOptions(const WebCore::IntRect&, double additionalScaleFactor, SnapshotOptions);
646
647     static const WebEvent* currentEvent();
648
649     FindController& findController() { return m_findController.get(); }
650
651 #if ENABLE(GEOLOCATION)
652     GeolocationPermissionRequestManager& geolocationPermissionRequestManager() { return m_geolocationPermissionRequestManager.get(); }
653 #endif
654
655 #if PLATFORM(IOS_FAMILY)
656     void savePageState(WebCore::HistoryItem&);
657     void restorePageState(const WebCore::HistoryItem&);
658 #endif
659
660 #if ENABLE(MEDIA_STREAM)
661     UserMediaPermissionRequestManager& userMediaPermissionRequestManager() { return m_userMediaPermissionRequestManager; }
662     void captureDevicesChanged();
663 #endif
664
665     void elementDidFocus(WebCore::Element&);
666     void elementDidRefocus(WebCore::Element&);
667     void elementDidBlur(WebCore::Element&);
668     void focusedElementDidChangeInputMode(WebCore::Element&, WebCore::InputMode);
669     void resetFocusedElementForFrame(WebFrame*);
670     void updateInputContextAfterBlurringAndRefocusingElementIfNeeded(WebCore::Element&);
671
672     void disabledAdaptationsDidChange(const OptionSet<WebCore::DisabledAdaptations>&);
673     void viewportPropertiesDidChange(const WebCore::ViewportArguments&);
674     void executeEditCommandWithCallback(const String&, const String& argument, CompletionHandler<void()>&&);
675     void selectAll();
676
677     void setCanShowPlaceholder(const WebCore::ElementContext&, bool);
678
679 #if PLATFORM(IOS_FAMILY)
680     void textInputContextsInRect(WebCore::FloatRect, CompletionHandler<void(const Vector<WebCore::ElementContext>&)>&&);
681     void focusTextInputContextAndPlaceCaret(const WebCore::ElementContext&, const WebCore::IntPoint&, CompletionHandler<void(bool)>&&);
682
683     bool shouldRevealCurrentSelectionAfterInsertion() const { return m_shouldRevealCurrentSelectionAfterInsertion; }
684     void setShouldRevealCurrentSelectionAfterInsertion(bool);
685
686     void insertTextPlaceholder(const WebCore::IntSize&, CompletionHandler<void(const Optional<WebCore::ElementContext>&)>&&);
687     void removeTextPlaceholder(const WebCore::ElementContext&, CompletionHandler<void()>&&);
688
689     WebCore::FloatSize screenSize() const;
690     WebCore::FloatSize availableScreenSize() const;
691     WebCore::FloatSize overrideScreenSize() const;
692     int32_t deviceOrientation() const { return m_deviceOrientation; }
693     void didReceiveMobileDocType(bool);
694     
695     bool screenIsBeingCaptured() const { return m_screenIsBeingCaptured; }
696     void setScreenIsBeingCaptured(bool);
697
698     double minimumPageScaleFactor() const;
699     double maximumPageScaleFactor() const;
700     double maximumPageScaleFactorIgnoringAlwaysScalable() const;
701     bool allowsUserScaling() const;
702     bool hasStablePageScaleFactor() const { return m_hasStablePageScaleFactor; }
703
704     void attemptSyntheticClick(const WebCore::IntPoint&, OptionSet<WebKit::WebEvent::Modifier>, TransactionID lastLayerTreeTransactionId);
705     void potentialTapAtPosition(uint64_t requestID, const WebCore::FloatPoint&, bool shouldRequestMagnificationInformation);
706     void commitPotentialTap(OptionSet<WebKit::WebEvent::Modifier>, TransactionID lastLayerTreeTransactionId, WebCore::PointerID);
707     void commitPotentialTapFailed();
708     void cancelPotentialTap();
709     void cancelPotentialTapInFrame(WebFrame&);
710     void tapHighlightAtPosition(uint64_t requestID, const WebCore::FloatPoint&);
711     void didRecognizeLongPress();
712     void handleDoubleTapForDoubleClickAtPoint(const WebCore::IntPoint&, OptionSet<WebKit::WebEvent::Modifier>, TransactionID lastLayerTreeTransactionId);
713
714     void inspectorNodeSearchMovedToPosition(const WebCore::FloatPoint&);
715     void inspectorNodeSearchEndedAtPosition(const WebCore::FloatPoint&);
716
717     void blurFocusedElement();
718     void requestFocusedElementInformation(CallbackID);
719     void selectWithGesture(const WebCore::IntPoint&, GestureType, GestureRecognizerState, bool isInteractingWithFocusedElement, CallbackID);
720     void updateSelectionWithTouches(const WebCore::IntPoint&, SelectionTouch, bool baseIsStart, CallbackID);
721     void selectWithTwoTouches(const WebCore::IntPoint& from, const WebCore::IntPoint& to, GestureType, GestureRecognizerState, CallbackID);
722     void extendSelection(WebCore::TextGranularity, CompletionHandler<void()>&&);
723     void selectWordBackward();
724     void moveSelectionByOffset(int32_t offset, CompletionHandler<void()>&&);
725     void selectTextWithGranularityAtPoint(const WebCore::IntPoint&, WebCore::TextGranularity, bool isInteractingWithFocusedElement, CompletionHandler<void()>&&);
726     void selectPositionAtBoundaryWithDirection(const WebCore::IntPoint&, WebCore::TextGranularity, WebCore::SelectionDirection, bool isInteractingWithFocusedElement, CompletionHandler<void()>&&);
727     void moveSelectionAtBoundaryWithDirection(WebCore::TextGranularity, WebCore::SelectionDirection, CompletionHandler<void()>&&);
728     void selectPositionAtPoint(const WebCore::IntPoint&, bool isInteractingWithFocusedElement, CompletionHandler<void()>&&);
729     void beginSelectionInDirection(WebCore::SelectionDirection, CallbackID);
730     void updateSelectionWithExtentPoint(const WebCore::IntPoint&, bool isInteractingWithFocusedElement, RespectSelectionAnchor, CallbackID);
731     void updateSelectionWithExtentPointAndBoundary(const WebCore::IntPoint&, WebCore::TextGranularity, bool isInteractingWithFocusedElement, CallbackID);
732
733     void requestDictationContext(CallbackID);
734     void replaceDictatedText(const String& oldText, const String& newText);
735     void replaceSelectedText(const String& oldText, const String& newText);
736     void requestAutocorrectionData(const String& textForAutocorrection, CompletionHandler<void(WebAutocorrectionData)>&& reply);
737     void applyAutocorrection(const String& correction, const String& originalText, CallbackID);
738     void syncApplyAutocorrection(const String& correction, const String& originalText, CompletionHandler<void(bool)>&&);
739     void requestAutocorrectionContext();
740     void getPositionInformation(const InteractionInformationRequest&, CompletionHandler<void(InteractionInformationAtPosition&&)>&&);
741     void requestPositionInformation(const InteractionInformationRequest&);
742     void startInteractionWithElementContextOrPosition(Optional<WebCore::ElementContext>&&, WebCore::IntPoint&&);
743     void stopInteraction();
744     void performActionOnElement(uint32_t action);
745     void focusNextFocusedElement(bool isForward, CompletionHandler<void()>&&);
746     void autofillLoginCredentials(const String&, const String&);
747     void setFocusedElementValue(const String&);
748     void setFocusedElementValueAsNumber(double);
749     void setFocusedElementSelectedIndex(uint32_t index, bool allowMultipleSelection);
750     void setIsShowingInputViewForFocusedElement(bool);
751     bool isShowingInputViewForFocusedElement() const { return m_isShowingInputViewForFocusedElement; }
752     void updateSelectionAppearance();
753     void getSelectionContext(CallbackID);
754     void handleTwoFingerTapAtPoint(const WebCore::IntPoint&, OptionSet<WebKit::WebEvent::Modifier>, uint64_t requestID);
755     void getRectsForGranularityWithSelectionOffset(WebCore::TextGranularity, int32_t, CallbackID);
756     void getRectsAtSelectionOffsetWithText(int32_t, const String&, CallbackID);
757     void storeSelectionForAccessibility(bool);
758     void startAutoscrollAtPosition(const WebCore::FloatPoint&);
759     void cancelAutoscroll();
760     void requestEvasionRectsAboveSelection(CompletionHandler<void(const Vector<WebCore::FloatRect>&)>&&);
761
762     void contentSizeCategoryDidChange(const String&);
763
764     Seconds eventThrottlingDelay() const;
765
766     void showInspectorHighlight(const WebCore::Highlight&);
767     void hideInspectorHighlight();
768
769     void showInspectorIndication();
770     void hideInspectorIndication();
771
772     void enableInspectorNodeSearch();
773     void disableInspectorNodeSearch();
774
775     bool forceAlwaysUserScalable() const { return m_forceAlwaysUserScalable; }
776     void setForceAlwaysUserScalable(bool);
777
778     void updateSelectionWithDelta(int64_t locationDelta, int64_t lengthDelta, CompletionHandler<void()>&&);
779     void requestDocumentEditingContext(WebKit::DocumentEditingContextRequest, CompletionHandler<void(WebKit::DocumentEditingContext)>&&);
780 #endif
781
782 #if PLATFORM(IOS_FAMILY) && ENABLE(IOS_TOUCH_EVENTS)
783     void dispatchAsynchronousTouchEvents(const Vector<std::pair<WebTouchEvent, Optional<CallbackID>>, 1>& queue);
784     void cancelAsynchronousTouchEvents(const Vector<std::pair<WebTouchEvent, Optional<CallbackID>>, 1>& queue);
785 #endif
786
787     bool hasRichlyEditableSelection() const;
788
789     enum class LayerTreeFreezeReason {
790         PageTransition          = 1 << 0,
791         BackgroundApplication   = 1 << 1,
792         ProcessSuspended        = 1 << 2,
793         PageSuspended           = 1 << 3,
794         Printing                = 1 << 4,
795         ProcessSwap             = 1 << 5,
796         SwipeAnimation          = 1 << 6,
797     };
798     void freezeLayerTree(LayerTreeFreezeReason);
799     void unfreezeLayerTree(LayerTreeFreezeReason);
800
801     void markLayersVolatile(CompletionHandler<void(bool)>&& completionHandler = { });
802     void cancelMarkLayersVolatile();
803
804     void freezeLayerTreeDueToSwipeAnimation();
805     void unfreezeLayerTreeDueToSwipeAnimation();
806
807     NotificationPermissionRequestManager* notificationPermissionRequestManager();
808
809     void pageDidScroll();
810
811 #if ENABLE(CONTEXT_MENUS)
812     WebContextMenu* contextMenu();
813     WebContextMenu* contextMenuAtPointInWindow(const WebCore::IntPoint&);
814 #endif
815
816     bool hasLocalDataForURL(const URL&);
817
818     static bool canHandleRequest(const WebCore::ResourceRequest&);
819
820     class SandboxExtensionTracker {
821     public:
822         ~SandboxExtensionTracker();
823
824         void invalidate();
825
826         void beginLoad(WebFrame*, SandboxExtension::Handle&&);
827         void beginReload(WebFrame*, SandboxExtension::Handle&&);
828         void willPerformLoadDragDestinationAction(RefPtr<SandboxExtension>&& pendingDropSandboxExtension);
829         void didStartProvisionalLoad(WebFrame*);
830         void didCommitProvisionalLoad(WebFrame*);
831         void didFailProvisionalLoad(WebFrame*);
832
833     private:
834         void setPendingProvisionalSandboxExtension(RefPtr<SandboxExtension>&&);
835         bool shouldReuseCommittedSandboxExtension(WebFrame*);
836
837         RefPtr<SandboxExtension> m_pendingProvisionalSandboxExtension;
838         RefPtr<SandboxExtension> m_provisionalSandboxExtension;
839         RefPtr<SandboxExtension> m_committedSandboxExtension;
840     };
841
842     SandboxExtensionTracker& sandboxExtensionTracker() { return m_sandboxExtensionTracker; }
843
844 #if PLATFORM(GTK) || PLATFORM(WPE)
845     void cancelComposition(const String& text);
846     void deleteSurrounding(int64_t offset, unsigned characterCount);
847 #endif
848
849 #if PLATFORM(GTK)
850     void collapseSelectionInFrame(WebCore::FrameIdentifier);
851     void showEmojiPicker(WebCore::Frame&);
852
853     void getCenterForZoomGesture(const WebCore::IntPoint& centerInViewCoordinates, CompletionHandler<void(WebCore::IntPoint&&)>&&);
854
855     void themeDidChange(String&&);
856 #endif
857
858     void didApplyStyle();
859     void didChangeSelection();
860     void didChangeOverflowScrollPosition();
861     void didChangeContents();
862     void discardedComposition();
863     void canceledComposition();
864     void didUpdateComposition();
865     void didEndUserTriggeredSelectionChanges();
866
867 #if PLATFORM(COCOA)
868     void registerUIProcessAccessibilityTokens(const IPC::DataReference& elemenToken, const IPC::DataReference& windowToken);
869     WKAccessibilityWebPageObject* accessibilityRemoteObject();
870     NSObject *accessibilityObjectForMainFramePlugin();
871     const WebCore::FloatPoint& accessibilityPosition() const { return m_accessibilityPosition; }
872     
873     void sendComplexTextInputToPlugin(uint64_t pluginComplexTextInputIdentifier, const String& textInput);
874
875     void setTextAsync(const String&);
876     void insertTextAsync(const String& text, const EditingRange& replacementRange, InsertTextOptions&&);
877     void hasMarkedText(CompletionHandler<void(bool)>&&);
878     void getMarkedRangeAsync(CompletionHandler<void(const EditingRange&)>&&);
879     void getSelectedRangeAsync(CompletionHandler<void(const EditingRange&)>&&);
880     void characterIndexForPointAsync(const WebCore::IntPoint&, CallbackID);
881     void firstRectForCharacterRangeAsync(const EditingRange&, CallbackID);
882     void setCompositionAsync(const String& text, const Vector<WebCore::CompositionUnderline>&, const Vector<WebCore::CompositionHighlight>&, const EditingRange& selectionRange, const EditingRange& replacementRange);
883     void confirmCompositionAsync();
884
885     void readSelectionFromPasteboard(const String& pasteboardName, CompletionHandler<void(bool&&)>&&);
886     void getStringSelectionForPasteboard(CompletionHandler<void(String&&)>&&);
887     void getDataSelectionForPasteboard(const String pasteboardType, CompletionHandler<void(SharedMemory::IPCHandle&&)>&&);
888     void shouldDelayWindowOrderingEvent(const WebKit::WebMouseEvent&, CompletionHandler<void(bool)>&&);
889     void acceptsFirstMouse(int eventNumber, const WebKit::WebMouseEvent&, CompletionHandler<void(bool)>&&);
890     bool performNonEditingBehaviorForSelector(const String&, WebCore::KeyboardEvent*);
891
892     void insertDictatedTextAsync(const String& text, const EditingRange& replacementRange, const Vector<WebCore::DictationAlternative>& dictationAlternativeLocations, InsertTextOptions&&);
893 #endif
894
895 #if PLATFORM(MAC)
896     void attributedSubstringForCharacterRangeAsync(const EditingRange&, CallbackID);
897     void fontAtSelection(CallbackID);
898 #endif
899
900 #if PLATFORM(COCOA) && ENABLE(SERVICE_CONTROLS)
901     void replaceSelectionWithPasteboardData(const Vector<String>& types, const IPC::DataReference&);
902 #endif
903
904     void setCompositionForTesting(const String& compositionString, uint64_t from, uint64_t length, bool suppressUnderline, const Vector<WebCore::CompositionHighlight>&);
905     bool hasCompositionForTesting();
906     void confirmCompositionForTesting(const String& compositionString);
907
908 #if PLATFORM(COCOA)
909     bool isSpeaking();
910     void speak(const String&);
911     void stopSpeaking();
912
913     void performDictionaryLookupForSelection(WebCore::Frame&, const WebCore::VisibleSelection&, WebCore::TextIndicatorPresentationTransition);
914 #endif
915
916     bool isSmartInsertDeleteEnabled();
917     void setSmartInsertDeleteEnabled(bool);
918
919     bool isSelectTrailingWhitespaceEnabled() const;
920     void setSelectTrailingWhitespaceEnabled(bool);
921
922     void replaceSelectionWithText(WebCore::Frame*, const String&);
923     void clearSelection();
924     void restoreSelectionInFocusedEditableElement();
925
926 #if ENABLE(DRAG_SUPPORT) && PLATFORM(GTK)
927     void performDragControllerAction(DragControllerAction, const WebCore::IntPoint& clientPosition, const WebCore::IntPoint& globalPosition, OptionSet<WebCore::DragOperation> draggingSourceOperationMask, WebCore::SelectionData&&, OptionSet<WebCore::DragApplicationFlags>);
928 #endif
929
930 #if ENABLE(DRAG_SUPPORT) && !PLATFORM(GTK)
931     void performDragControllerAction(DragControllerAction, const WebCore::DragData&, SandboxExtension::Handle&&, SandboxExtension::HandleArray&&);
932 #endif
933
934 #if ENABLE(DRAG_SUPPORT)
935     void dragEnded(WebCore::IntPoint clientPosition, WebCore::IntPoint globalPosition, OptionSet<WebCore::DragOperation>);
936
937     void willPerformLoadDragDestinationAction();
938     void mayPerformUploadDragDestinationAction();
939
940     void willStartDrag() { ASSERT(!m_isStartingDrag); m_isStartingDrag = true; }
941     void didStartDrag();
942     void dragCancelled();
943     OptionSet<WebCore::DragSourceAction> allowedDragSourceActions() const { return m_allowedDragSourceActions; }
944 #endif
945
946     void beginPrinting(WebCore::FrameIdentifier, const PrintInfo&);
947     void endPrinting();
948     void computePagesForPrinting(WebCore::FrameIdentifier, const PrintInfo&, CallbackID);
949     void computePagesForPrintingImpl(WebCore::FrameIdentifier, const PrintInfo&, Vector<WebCore::IntRect>& pageRects, double& totalScaleFactor, WebCore::FloatBoxExtent& computedMargin);
950
951 #if PLATFORM(COCOA)
952     void drawRectToImage(WebCore::FrameIdentifier, const PrintInfo&, const WebCore::IntRect&, const WebCore::IntSize&, CallbackID);
953     void drawPagesToPDF(WebCore::FrameIdentifier, const PrintInfo&, uint32_t first, uint32_t count, CallbackID);
954     void drawPagesToPDFImpl(WebCore::FrameIdentifier, const PrintInfo&, uint32_t first, uint32_t count, RetainPtr<CFMutableDataRef>& pdfPageData);
955 #endif
956
957 #if PLATFORM(IOS_FAMILY)
958     void computePagesForPrintingAndDrawToPDF(WebCore::FrameIdentifier, const PrintInfo&, CallbackID, Messages::WebPage::ComputePagesForPrintingAndDrawToPDFDelayedReply&&);
959 #endif
960
961     void drawToPDF(WebCore::FrameIdentifier, const Optional<WebCore::FloatRect>&, CallbackID);
962
963 #if PLATFORM(GTK)
964     void drawPagesForPrinting(WebCore::FrameIdentifier, const PrintInfo&, CallbackID);
965     void didFinishPrintOperation(const WebCore::ResourceError&, CallbackID);
966 #endif
967
968     void addResourceRequest(unsigned long, const WebCore::ResourceRequest&);
969     void removeResourceRequest(unsigned long);
970
971     void setMediaVolume(float);
972     void setMuted(WebCore::MediaProducer::MutedStateFlags);
973     void setMayStartMediaWhenInWindow(bool);
974     void stopMediaCapture();
975
976     void updateMainFrameScrollOffsetPinning();
977
978     bool mainFrameHasCustomContentProvider() const;
979     void addMIMETypeWithCustomContentProvider(const String&);
980
981     void mainFrameDidLayout();
982
983     bool canRunBeforeUnloadConfirmPanel() const { return m_canRunBeforeUnloadConfirmPanel; }
984     void setCanRunBeforeUnloadConfirmPanel(bool canRunBeforeUnloadConfirmPanel) { m_canRunBeforeUnloadConfirmPanel = canRunBeforeUnloadConfirmPanel; }
985
986     bool canRunModal() const { return m_canRunModal; }
987     void setCanRunModal(bool canRunModal) { m_canRunModal = canRunModal; }
988
989     void runModal();
990
991     void setDeviceScaleFactor(float);
992     float deviceScaleFactor() const;
993
994     void forceRepaintWithoutCallback();
995
996     void unmarkAllMisspellings();
997     void unmarkAllBadGrammar();
998
999 #if PLATFORM(COCOA)
1000     void handleAlternativeTextUIResult(const String&);
1001 #endif
1002
1003     // For testing purpose.
1004     void simulateMouseDown(int button, WebCore::IntPoint, int clickCount, WKEventModifiers, WallTime);
1005     void simulateMouseUp(int button, WebCore::IntPoint, int clickCount, WKEventModifiers, WallTime);
1006     void simulateMouseMotion(WebCore::IntPoint, WallTime);
1007
1008 #if ENABLE(CONTEXT_MENUS)
1009     void contextMenuShowing() { m_isShowingContextMenu = true; }
1010 #endif
1011
1012     void wheelEvent(const WebWheelEvent&);
1013
1014     void wheelEventHandlersChanged(bool);
1015     void recomputeShortCircuitHorizontalWheelEventsState();
1016
1017 #if ENABLE(MAC_GESTURE_EVENTS)
1018     void gestureEvent(const WebGestureEvent&);
1019 #endif
1020
1021     void updateVisibilityState(bool isInitialState = false);
1022
1023 #if PLATFORM(IOS_FAMILY)
1024     void setMaximumUnobscuredSize(const WebCore::FloatSize&);
1025     void setDeviceOrientation(int32_t);
1026     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, double minimumEffectiveDeviceWidth, DynamicViewportSizeUpdateID);
1027     bool scaleWasSetByUIProcess() const { return m_scaleWasSetByUIProcess; }
1028     void willStartUserTriggeredZooming();
1029     void applicationWillResignActive();
1030     void applicationDidEnterBackground(bool isSuspendedUnderLock);
1031     void applicationDidFinishSnapshottingAfterEnteringBackground();
1032     void applicationWillEnterForeground(bool isSuspendedUnderLock);
1033     void applicationDidBecomeActive();
1034     void applicationDidEnterBackgroundForMedia(bool isSuspendedUnderLock);
1035     void applicationWillEnterForegroundForMedia(bool isSuspendedUnderLock);
1036     void didFinishContentChangeObserving(WKContentChange);
1037
1038     bool platformPrefersTextLegibilityBasedZoomScaling() const;
1039
1040     void hardwareKeyboardAvailabilityChanged(bool keyboardIsAttached);
1041     bool hardwareKeyboardIsAttached() const { return m_keyboardIsAttached; }
1042
1043     void updateStringForFind(const String&);
1044     
1045     bool canShowWhileLocked() const { return m_canShowWhileLocked; }
1046 #endif
1047
1048 #if ENABLE(META_VIEWPORT)
1049     void setViewportConfigurationViewLayoutSize(const WebCore::FloatSize&, double scaleFactor, double minimumEffectiveDeviceWidth);
1050     void setOverrideViewportArguments(const Optional<WebCore::ViewportArguments>&);
1051     const WebCore::ViewportConfiguration& viewportConfiguration() const { return m_viewportConfiguration; }
1052
1053     void setUseTestingViewportConfiguration(bool useTestingViewport) { m_useTestingViewportConfiguration = useTestingViewport; }
1054     bool isUsingTestingViewportConfiguration() const { return m_useTestingViewportConfiguration; }
1055 #endif
1056
1057 #if ENABLE(UI_SIDE_COMPOSITING)
1058     Optional<float> scaleFromUIProcess(const VisibleContentRectUpdateInfo&) const;
1059     void updateVisibleContentRects(const VisibleContentRectUpdateInfo&, MonotonicTime oldestTimestamp);
1060 #endif
1061
1062 #if ENABLE(IOS_TOUCH_EVENTS)
1063     void dispatchTouchEvent(const WebTouchEvent&, bool& handled);
1064 #endif
1065
1066     bool shouldUseCustomContentProviderForResponse(const WebCore::ResourceResponse&);
1067
1068     bool asynchronousPluginInitializationEnabled() const { return m_asynchronousPluginInitializationEnabled; }
1069     void setAsynchronousPluginInitializationEnabled(bool enabled) { m_asynchronousPluginInitializationEnabled = enabled; }
1070     bool asynchronousPluginInitializationEnabledForAllPlugins() const { return m_asynchronousPluginInitializationEnabledForAllPlugins; }
1071     void setAsynchronousPluginInitializationEnabledForAllPlugins(bool enabled) { m_asynchronousPluginInitializationEnabledForAllPlugins = enabled; }
1072     bool artificialPluginInitializationDelayEnabled() const { return m_artificialPluginInitializationDelayEnabled; }
1073     void setArtificialPluginInitializationDelayEnabled(bool enabled) { m_artificialPluginInitializationDelayEnabled = enabled; }
1074     void setTabToLinksEnabled(bool enabled) { m_tabToLinks = enabled; }
1075     bool tabToLinksEnabled() const { return m_tabToLinks; }
1076
1077     bool scrollingPerformanceLoggingEnabled() const { return m_scrollingPerformanceLoggingEnabled; }
1078     void setScrollingPerformanceLoggingEnabled(bool);
1079
1080 #if PLATFORM(COCOA)
1081     bool shouldUsePDFPlugin() const;
1082     bool pdfPluginEnabled() const { return m_pdfPluginEnabled; }
1083     void setPDFPluginEnabled(bool enabled) { m_pdfPluginEnabled = enabled; }
1084
1085     NSDictionary *dataDetectionContext() const { return m_dataDetectionContext.get(); }
1086 #endif
1087
1088 #if ENABLE(PDFKIT_PLUGIN) && !ENABLE(UI_PROCESS_PDF_HUD)
1089     void savePDFToFileInDownloadsFolder(const String& suggestedFilename, const URL& originatingURL, const uint8_t* data, unsigned long size);
1090     void savePDFToTemporaryFolderAndOpenWithNativeApplication(const String& suggestedFilename, FrameInfoData&&, const uint8_t* data, unsigned long size, const String& pdfUUID);
1091 #endif
1092
1093     bool mainFrameIsScrollable() const { return m_mainFrameIsScrollable; }
1094
1095     void setAlwaysShowsHorizontalScroller(bool);
1096     void setAlwaysShowsVerticalScroller(bool);
1097
1098     bool alwaysShowsHorizontalScroller() const { return m_alwaysShowsHorizontalScroller; };
1099     bool alwaysShowsVerticalScroller() const { return m_alwaysShowsVerticalScroller; };
1100
1101     void setMinimumSizeForAutoLayout(const WebCore::IntSize&);
1102     WebCore::IntSize minimumSizeForAutoLayout() const { return m_minimumSizeForAutoLayout; }
1103
1104     void setSizeToContentAutoSizeMaximumSize(const WebCore::IntSize&);
1105     WebCore::IntSize sizeToContentAutoSizeMaximumSize() const { return m_sizeToContentAutoSizeMaximumSize; }
1106
1107     void setAutoSizingShouldExpandToViewHeight(bool shouldExpand);
1108     bool autoSizingShouldExpandToViewHeight() { return m_autoSizingShouldExpandToViewHeight; }
1109
1110     void setViewportSizeForCSSViewportUnits(Optional<WebCore::IntSize>);
1111     Optional<WebCore::IntSize> viewportSizeForCSSViewportUnits() const { return m_viewportSizeForCSSViewportUnits; }
1112
1113     bool canShowMIMEType(const String& MIMEType) const;
1114     bool canShowResponse(const WebCore::ResourceResponse&) const;
1115
1116     void addTextCheckingRequest(uint64_t requestID, Ref<WebCore::TextCheckingRequest>&&);
1117     void didFinishCheckingText(uint64_t requestID, const Vector<WebCore::TextCheckingResult>&);
1118     void didCancelCheckingText(uint64_t requestID);
1119
1120 #if ENABLE(PRIMARY_SNAPSHOTTED_PLUGIN_HEURISTIC)
1121     void determinePrimarySnapshottedPlugIn();
1122     void determinePrimarySnapshottedPlugInTimerFired();
1123     void resetPrimarySnapshottedPlugIn();
1124     bool matchesPrimaryPlugIn(const String& pageOrigin, const String& pluginOrigin, const String& mimeType) const;
1125     bool plugInIntersectsSearchRect(WebCore::HTMLPlugInImageElement& pluginImageElement);
1126     bool plugInIsPrimarySize(WebCore::HTMLPlugInImageElement& pluginImageElement, unsigned &pluginArea);
1127 #endif
1128
1129 #if ENABLE(DATA_DETECTION)
1130     void setDataDetectionResults(NSArray *);
1131     void detectDataInAllFrames(uint64_t, CompletionHandler<void(const DataDetectionResult&)>&&);
1132     void removeDataDetectedLinks(CompletionHandler<void(const DataDetectionResult&)>&&);
1133 #endif
1134
1135     unsigned extendIncrementalRenderingSuppression();
1136     void stopExtendingIncrementalRenderingSuppression(unsigned token);
1137     bool shouldExtendIncrementalRenderingSuppression() { return !m_activeRenderingSuppressionTokens.isEmpty(); }
1138
1139     WebCore::ScrollPinningBehavior scrollPinningBehavior() { return m_scrollPinningBehavior; }
1140     void setScrollPinningBehavior(uint32_t /* WebCore::ScrollPinningBehavior */ pinning);
1141
1142     Optional<WebCore::ScrollbarOverlayStyle> scrollbarOverlayStyle() { return m_scrollbarOverlayStyle; }
1143     void setScrollbarOverlayStyle(Optional<uint32_t /* WebCore::ScrollbarOverlayStyle */> scrollbarStyle);
1144
1145     Ref<WebCore::DocumentLoader> createDocumentLoader(WebCore::Frame&, const WebCore::ResourceRequest&, const WebCore::SubstituteData&);
1146     void updateCachedDocumentLoader(WebDocumentLoader&, WebCore::Frame&);
1147
1148     void getBytecodeProfile(CallbackID);
1149     void getSamplingProfilerOutput(CallbackID);
1150     
1151 #if ENABLE(SERVICE_CONTROLS) || ENABLE(TELEPHONE_NUMBER_DETECTION)
1152     void handleTelephoneNumberClick(const String& number, const WebCore::IntPoint&);
1153     void handleSelectionServiceClick(WebCore::FrameSelection&, const Vector<String>& telephoneNumbers, const WebCore::IntPoint&);
1154 #endif
1155
1156     void didChangeScrollOffsetForFrame(WebCore::Frame*);
1157
1158     void setMainFrameProgressCompleted(bool completed) { m_mainFrameProgressCompleted = completed; }
1159     bool shouldDispatchFakeMouseMoveEvents() const { return m_shouldDispatchFakeMouseMoveEvents; }
1160
1161     void postMessage(const String& messageName, API::Object* messageBody);
1162     void postSynchronousMessageForTesting(const String& messageName, API::Object* messageBody, RefPtr<API::Object>& returnData);
1163     void postMessageIgnoringFullySynchronousMode(const String& messageName, API::Object* messageBody);
1164
1165 #if PLATFORM(GTK) || PLATFORM(WPE)
1166     void setInputMethodState(WebCore::Element*);
1167 #endif
1168
1169     void imageOrMediaDocumentSizeChanged(const WebCore::IntSize&);
1170
1171 #if ENABLE(VIDEO) && USE(GSTREAMER)
1172     void requestInstallMissingMediaPlugins(const String& details, const String& description, WebCore::MediaPlayerRequestInstallMissingPluginsCallback&);
1173 #endif
1174
1175     void addUserScript(String&& source, InjectedBundleScriptWorld&, WebCore::UserContentInjectedFrames, WebCore::UserScriptInjectionTime);
1176     void addUserStyleSheet(const String& source, WebCore::UserContentInjectedFrames);
1177     void removeAllUserContent();
1178
1179     void dispatchDidReachLayoutMilestone(OptionSet<WebCore::LayoutMilestone>);
1180
1181     void didRestoreScrollPosition();
1182
1183     bool isControlledByAutomation() const;
1184     void setControlledByAutomation(bool);
1185
1186     void connectInspector(const String& targetId, Inspector::FrontendChannel::ConnectionType);
1187     void disconnectInspector(const String& targetId);
1188     void sendMessageToTargetBackend(const String& targetId, const String& message);
1189
1190     void insertNewlineInQuotedContent();
1191
1192 #if USE(OS_STATE)
1193     WallTime loadCommitTime() const { return m_loadCommitTime; }
1194 #endif
1195
1196 #if ENABLE(GAMEPAD)
1197     void gamepadActivity(const Vector<GamepadData>&, WebCore::EventMakesGamepadsVisible);
1198 #endif
1199     
1200 #if ENABLE(POINTER_LOCK)
1201     void didAcquirePointerLock();
1202     void didNotAcquirePointerLock();
1203     void didLosePointerLock();
1204 #endif
1205
1206     void didGetLoadDecisionForIcon(bool decision, CallbackID loadIdentifier, OptionalCallbackID);
1207     void setUseIconLoadingClient(bool);
1208
1209 #if PLATFORM(IOS_FAMILY) && ENABLE(DRAG_SUPPORT)
1210     void didConcludeEditDrag();
1211     void didConcludeDrop();
1212 #endif
1213
1214     void didFinishLoadingImageForElement(WebCore::HTMLImageElement&);
1215
1216     WebURLSchemeHandlerProxy* urlSchemeHandlerForScheme(const String&);
1217     void stopAllURLSchemeTasks();
1218
1219     Optional<double> cpuLimit() const { return m_cpuLimit; }
1220
1221     static PluginView* pluginViewForFrame(WebCore::Frame*);
1222
1223     void flushPendingEditorStateUpdate();
1224
1225 #if ENABLE(RESOURCE_LOAD_STATISTICS)
1226     void hasStorageAccess(WebCore::RegistrableDomain&& subFrameDomain, WebCore::RegistrableDomain&& topFrameDomain, WebFrame&, CompletionHandler<void(bool)>&&);
1227     void requestStorageAccess(WebCore::RegistrableDomain&& subFrameDomain, WebCore::RegistrableDomain&& topFrameDomain, WebFrame&, WebCore::StorageAccessScope, CompletionHandler<void(WebCore::RequestStorageAccessResult)>&&);
1228     bool hasPageLevelStorageAccess(const WebCore::RegistrableDomain& topLevelDomain, const WebCore::RegistrableDomain& resourceDomain) const;
1229     void addDomainWithPageLevelStorageAccess(const WebCore::RegistrableDomain& topLevelDomain, const WebCore::RegistrableDomain& resourceDomain);
1230     void clearPageLevelStorageAccess();
1231     void wasLoadedWithDataTransferFromPrevalentResource();
1232     void didLoadFromRegistrableDomain(WebCore::RegistrableDomain&&);
1233     void clearLoadedSubresourceDomains();
1234     void getLoadedSubresourceDomains(CompletionHandler<void(Vector<WebCore::RegistrableDomain>)>&&);
1235     const HashSet<WebCore::RegistrableDomain>& loadedSubresourceDomains() const { return m_loadedSubresourceDomains; }
1236 #endif
1237
1238 #if ENABLE(DEVICE_ORIENTATION)
1239     void shouldAllowDeviceOrientationAndMotionAccess(WebCore::FrameIdentifier, FrameInfoData&&, bool mayPrompt, CompletionHandler<void(WebCore::DeviceOrientationOrMotionPermissionState)>&&);
1240 #endif
1241
1242     void showShareSheet(WebCore::ShareDataWithParsedURL&, CompletionHandler<void(bool)>&& callback);
1243     
1244 #if ENABLE(ATTACHMENT_ELEMENT)
1245     void insertAttachment(const String& identifier, Optional<uint64_t>&& fileSize, const String& fileName, const String& contentType, CallbackID);
1246     void updateAttachmentAttributes(const String& identifier, Optional<uint64_t>&& fileSize, const String& contentType, const String& fileName, const IPC::DataReference& enclosingImageData, CallbackID);
1247     void updateAttachmentIcon(const String& identifier, const ShareableBitmap::Handle& qlThumbnailHandle);
1248 #endif
1249
1250 #if ENABLE(APPLICATION_MANIFEST)
1251     void getApplicationManifest(CallbackID);
1252     void didFinishLoadingApplicationManifest(uint64_t, const Optional<WebCore::ApplicationManifest>&);
1253 #endif
1254
1255 #if USE(WPE_RENDERER)
1256     int hostFileDescriptor() const { return m_hostFileDescriptor.fileDescriptor(); }
1257 #endif
1258
1259     void updateCurrentModifierState(OptionSet<WebCore::PlatformEvent::Modifier> modifiers);
1260
1261     UserContentControllerIdentifier userContentControllerIdentifier() const { return m_userContentController->identifier(); }
1262
1263     WebCore::UserInterfaceLayoutDirection userInterfaceLayoutDirection() const { return m_userInterfaceLayoutDirection; }
1264
1265     bool isSuspended() const { return m_isSuspended; }
1266
1267     void didReceiveWebPageMessage(IPC::Connection&, IPC::Decoder&);
1268
1269     template<typename T>
1270     bool sendSyncWithDelayedReply(T&& message, typename T::Reply&& reply)
1271     {
1272         cancelGesturesBlockedOnSynchronousReplies();
1273         return sendSync(WTFMove(message), WTFMove(reply), Seconds::infinity(), IPC::SendSyncOption::InformPlatformProcessWillSuspend);
1274     }
1275
1276     WebCore::DOMPasteAccessResponse requestDOMPasteAccess(const String& originIdentifier);
1277     WebCore::IntRect rectForElementAtInteractionLocation() const;
1278
1279     const Optional<WebCore::Color>& backgroundColor() const { return m_backgroundColor; }
1280
1281     void suspendAllMediaBuffering();
1282     void resumeAllMediaBuffering();
1283
1284     void configureLoggingChannel(const String&, WTFLogChannelState, WTFLogLevel);
1285
1286     RefPtr<WebCore::Element> elementForContext(const WebCore::ElementContext&) const;
1287     Optional<WebCore::ElementContext> contextForElement(WebCore::Element&) const;
1288
1289     void startTextManipulations(Vector<WebCore::TextManipulationController::ExclusionRule>&&, CompletionHandler<void()>&&);
1290     void completeTextManipulation(const Vector<WebCore::TextManipulationController::ManipulationItem>&, CompletionHandler<void(bool allFailed, const Vector<WebCore::TextManipulationController::ManipulationFailure>&)>&&);
1291
1292 #if ENABLE(APPLE_PAY)
1293     WebPaymentCoordinator* paymentCoordinator();
1294 #endif
1295
1296 #if ENABLE(PLATFORM_DRIVEN_TEXT_CHECKING)
1297     TextCheckingControllerProxy& textCheckingController() { return m_textCheckingControllerProxy.get(); }
1298 #endif
1299
1300 #if PLATFORM(COCOA)
1301     void setRemoteObjectRegistry(WebRemoteObjectRegistry*);
1302     WebRemoteObjectRegistry* remoteObjectRegistry();
1303 #endif
1304
1305     WebPageProxyIdentifier webPageProxyIdentifier() const { return m_webPageProxyIdentifier; }
1306
1307     void scheduleIntrinsicContentSizeUpdate(const WebCore::IntSize&);
1308     void flushPendingIntrinsicContentSizeUpdate();
1309     void updateIntrinsicContentSizeIfNeeded(const WebCore::IntSize&);
1310
1311     void scheduleFullEditorStateUpdate();
1312     bool isThrottleable() const;
1313
1314     bool userIsInteracting() const { return m_userIsInteracting; }
1315     void setUserIsInteracting(bool userIsInteracting) { m_userIsInteracting = userIsInteracting; }
1316
1317     bool firstFlushAfterCommit() const { return m_firstFlushAfterCommit; }
1318     void setFirstFlushAfterCommit(bool f) { m_firstFlushAfterCommit = f; }
1319
1320 #if PLATFORM(IOS_FAMILY)
1321     // This excludes layout overflow, includes borders.
1322     static WebCore::IntRect rootViewBoundsForElement(const WebCore::Element&);
1323     // These include layout overflow for overflow:visible elements, but exclude borders.
1324     static WebCore::IntRect absoluteInteractionBoundsForElement(const WebCore::Element&);
1325     static WebCore::IntRect rootViewInteractionBoundsForElement(const WebCore::Element&);
1326
1327     InteractionInformationAtPosition positionInformation(const InteractionInformationRequest&);
1328     
1329 #endif // PLATFORM(IOS_FAMILY)
1330
1331 #if USE(QUICK_LOOK)
1332     void didStartLoadForQuickLookDocumentInMainFrame(const String& fileName, const String& uti);
1333     void didFinishLoadForQuickLookDocumentInMainFrame(const WebCore::SharedBuffer&);
1334     void requestPasswordForQuickLookDocumentInMainFrame(const String& fileName, CompletionHandler<void(const String&)>&&);
1335 #endif
1336
1337     const String& overriddenMediaType() const { return m_overriddenMediaType; }
1338     void setOverriddenMediaType(const String&);
1339
1340     void updateCORSDisablingPatterns(Vector<String>&&);
1341
1342 #if ENABLE(IPC_TESTING_API)
1343     bool ipcTestingAPIEnabled() const { return m_ipcTestingAPIEnabled; }
1344     uint64_t webPageProxyID() const { return messageSenderDestinationID(); }
1345     uint64_t visitedLinkTableID() const { return m_visitedLinkTableID; }
1346 #endif
1347
1348     void getProcessDisplayName(CompletionHandler<void(String&&)>&&);
1349
1350     WebCore::AllowsContentJavaScript allowsContentJavaScriptFromMostRecentNavigation() const { return m_allowsContentJavaScriptFromMostRecentNavigation; }
1351     void setAllowsContentJavaScriptFromMostRecentNavigation(WebCore::AllowsContentJavaScript allows) { m_allowsContentJavaScriptFromMostRecentNavigation = allows; }
1352
1353     void getAllFrames(CompletionHandler<void(FrameTreeNodeData&&)>&&);
1354
1355 #if ENABLE(APP_BOUND_DOMAINS)
1356     void notifyPageOfAppBoundBehavior();
1357     void setIsNavigatingToAppBoundDomain(Optional<NavigatingToAppBoundDomain>, WebFrame*);
1358     bool needsInAppBrowserPrivacyQuirks() { return m_needsInAppBrowserPrivacyQuirks; }
1359 #endif
1360
1361     bool shouldUseRemoteRenderingFor(WebCore::RenderingPurpose);
1362
1363 #if ENABLE(MEDIA_USAGE)
1364     void addMediaUsageManagerSession(WebCore::MediaSessionIdentifier, const String&, const URL&);
1365     void updateMediaUsageManagerSessionState(WebCore::MediaSessionIdentifier, const WebCore::MediaUsageInfo&);
1366     void removeMediaUsageManagerSession(WebCore::MediaSessionIdentifier);
1367 #endif
1368
1369 #if PLATFORM(WIN)
1370     uint64_t nativeWindowHandle() { return m_nativeWindowHandle; }
1371 #endif
1372
1373     static void updatePreferencesGenerated(const WebPreferencesStore&);
1374
1375     void synchronizeCORSDisablingPatternsWithNetworkProcess();
1376
1377 private:
1378     WebPage(WebCore::PageIdentifier, WebPageCreationParameters&&);
1379
1380     void updateThrottleState();
1381
1382     // IPC::MessageSender
1383     IPC::Connection* messageSenderConnection() const override;
1384     uint64_t messageSenderDestinationID() const override;
1385
1386     void platformInitialize();
1387     void platformReinitialize();
1388     void platformDetach();
1389     void getPlatformEditorState(WebCore::Frame&, EditorState&) const;
1390     bool platformNeedsLayoutForEditorState(const WebCore::Frame&) const;
1391     void platformWillPerformEditingCommand();
1392     void sendEditorStateUpdate();
1393     void getPlatformEditorStateCommon(const WebCore::Frame&, EditorState&) const;
1394
1395 #if HAVE(TOUCH_BAR)
1396     void sendTouchBarMenuDataAddedUpdate(WebCore::HTMLMenuElement&);
1397     void sendTouchBarMenuDataRemovedUpdate(WebCore::HTMLMenuElement&);
1398     void sendTouchBarMenuItemDataAddedUpdate(WebCore::HTMLMenuItemElement&);
1399     void sendTouchBarMenuItemDataRemovedUpdate(WebCore::HTMLMenuItemElement&);
1400 #endif
1401
1402     void didReceiveSyncWebPageMessage(IPC::Connection&, IPC::Decoder&, std::unique_ptr<IPC::Encoder>&);
1403
1404 #if PLATFORM(IOS_FAMILY)
1405     void updateViewportSizeForCSSViewportUnits();
1406
1407     void getFocusedElementInformation(FocusedElementInformation&);
1408     void platformInitializeAccessibility();
1409     void generateSyntheticEditingCommand(SyntheticEditingCommandType);
1410     void handleSyntheticClick(WebCore::Node& nodeRespondingToClick, const WebCore::FloatPoint& location, OptionSet<WebKit::WebEvent::Modifier>, WebCore::PointerID = WebCore::mousePointerID);
1411     void completeSyntheticClick(WebCore::Node& nodeRespondingToClick, const WebCore::FloatPoint& location, OptionSet<WebKit::WebEvent::Modifier>, WebCore::SyntheticClickType, WebCore::PointerID = WebCore::mousePointerID);
1412     void sendTapHighlightForNodeIfNecessary(uint64_t requestID, WebCore::Node*);
1413     WebCore::VisiblePosition visiblePositionInFocusedNodeForPoint(const WebCore::Frame&, const WebCore::IntPoint&, bool isInteractingWithFocusedElement);
1414     Optional<WebCore::SimpleRange> rangeForGranularityAtPoint(WebCore::Frame&, const WebCore::IntPoint&, WebCore::TextGranularity, bool isInteractingWithFocusedElement);
1415     void setFocusedFrameBeforeSelectingTextAtLocation(const WebCore::IntPoint&);
1416     void dispatchSyntheticMouseEventsForSelectionGesture(SelectionTouch, const WebCore::IntPoint&);
1417
1418     void sendPositionInformation(InteractionInformationAtPosition&&);
1419     RefPtr<ShareableBitmap> shareableBitmapSnapshotForNode(WebCore::Element&);
1420     WebAutocorrectionContext autocorrectionContext();
1421     bool applyAutocorrectionInternal(const String& correction, const String& originalText);
1422 #endif
1423
1424 #if ENABLE(META_VIEWPORT)
1425     void resetViewportDefaultConfiguration(WebFrame* mainFrame, bool hasMobileDocType = false);
1426     enum class ZoomToInitialScale { No, Yes };
1427     void viewportConfigurationChanged(ZoomToInitialScale = ZoomToInitialScale::No);
1428     bool shouldIgnoreMetaViewport() const;
1429 #endif
1430
1431 #if ENABLE(TEXT_AUTOSIZING)
1432     void textAutoSizingAdjustmentTimerFired();
1433     void resetTextAutosizing();
1434     void resetIdempotentTextAutosizingIfNeeded(double previousInitialScale);
1435 #endif
1436
1437 #if ENABLE(VIEWPORT_RESIZING)
1438     void shrinkToFitContent(ZoomToInitialScale = ZoomToInitialScale::No);
1439 #endif
1440
1441 #if PLATFORM(IOS_FAMILY) && ENABLE(DRAG_SUPPORT)
1442     void requestDragStart(const WebCore::IntPoint& clientPosition, const WebCore::IntPoint& globalPosition, OptionSet<WebCore::DragSourceAction> allowedActionsMask);
1443     void requestAdditionalItemsForDragSession(const WebCore::IntPoint& clientPosition, const WebCore::IntPoint& globalPosition, OptionSet<WebCore::DragSourceAction> allowedActionsMask);
1444     void insertDroppedImagePlaceholders(const Vector<WebCore::IntSize>&, CompletionHandler<void(const Vector<WebCore::IntRect>&, Optional<WebCore::TextIndicatorData>)>&& reply);
1445     void computeAndSendEditDragSnapshot();
1446 #endif
1447
1448 #if !PLATFORM(COCOA) && !PLATFORM(WPE)
1449     static const char* interpretKeyEvent(const WebCore::KeyboardEvent*);
1450 #endif
1451
1452     bool performDefaultBehaviorForKeyEvent(const WebKeyboardEvent&);
1453     bool handleKeyEventByRelinquishingFocusToChrome(const WebCore::KeyboardEvent&);
1454
1455 #if PLATFORM(MAC)
1456     bool executeKeypressCommandsInternal(const Vector<WebCore::KeypressCommand>&, WebCore::KeyboardEvent*);
1457 #endif
1458
1459     void testProcessIncomingSyncMessagesWhenWaitingForSyncReply(Messages::WebPage::TestProcessIncomingSyncMessagesWhenWaitingForSyncReplyDelayedReply&&);
1460
1461     void updateDrawingAreaLayerTreeFreezeState();
1462     bool markLayersVolatileImmediatelyIfPossible();
1463     void layerVolatilityTimerFired();
1464     void callVolatilityCompletionHandlers(bool succeeded);
1465
1466     String sourceForFrame(WebFrame*);
1467
1468     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&, Optional<NavigatingToAppBoundDomain>, WebCore::ShouldOpenExternalURLsPolicy = WebCore::ShouldOpenExternalURLsPolicy::ShouldNotAllow);
1469
1470     // Actions
1471     void tryClose(CompletionHandler<void(bool)>&&);
1472     void platformDidReceiveLoadParameters(const LoadParameters&);
1473     void loadRequest(LoadParameters&&);
1474     NO_RETURN void loadRequestWaitingForProcessLaunch(LoadParameters&&, URL&&, WebPageProxyIdentifier, bool);
1475     void loadData(LoadParameters&&);
1476     void loadAlternateHTML(LoadParameters&&);
1477     void navigateToPDFLinkWithSimulatedClick(const String& url, WebCore::IntPoint documentPoint, WebCore::IntPoint screenPoint);
1478     void reload(uint64_t navigationID, uint32_t reloadOptions, SandboxExtension::Handle&&);
1479     void goToBackForwardItem(uint64_t navigationID, const WebCore::BackForwardItemIdentifier&, WebCore::FrameLoadType, WebCore::ShouldTreatAsContinuingLoad, Optional<WebsitePoliciesData>&&);
1480     void tryRestoreScrollPosition();
1481     void setInitialFocus(bool forward, bool isKeyboardEventValid, const WebKeyboardEvent&, CompletionHandler<void()>&&);
1482     void updateIsInWindow(bool isInitialState = false);
1483     void visibilityDidChange();
1484     void setActivityState(OptionSet<WebCore::ActivityState::Flag>, ActivityStateChangeID, const Vector<CallbackID>& callbackIDs);
1485     void validateCommand(const String&, CallbackID);
1486     void executeEditCommand(const String&, const String&);
1487     void setEditable(bool);
1488
1489     void didChangeSelectionOrOverflowScrollPosition();
1490
1491     void increaseListLevel();
1492     void decreaseListLevel();
1493     void changeListType();
1494
1495     void setBaseWritingDirection(WebCore::WritingDirection);
1496
1497     void setNeedsFontAttributes(bool);
1498
1499     void mouseEvent(const WebMouseEvent&);
1500     void keyEvent(const WebKeyboardEvent&);
1501
1502 #if ENABLE(IOS_TOUCH_EVENTS)
1503     void touchEventSync(const WebTouchEvent&, CompletionHandler<void(bool)>&&);
1504     void resetPotentialTapSecurityOrigin();
1505     void updatePotentialTapSecurityOrigin(const WebTouchEvent&, bool wasHandled);
1506 #elif ENABLE(TOUCH_EVENTS)
1507     void touchEvent(const WebTouchEvent&);
1508 #endif
1509
1510     void cancelPointer(WebCore::PointerID, const WebCore::IntPoint&);
1511     void touchWithIdentifierWasRemoved(WebCore::PointerID);
1512
1513 #if ENABLE(CONTEXT_MENUS)
1514     void contextMenuHidden() { m_isShowingContextMenu = false; }
1515 #endif
1516 #if ENABLE(CONTEXT_MENU_EVENT)
1517     void contextMenuForKeyEvent();
1518 #endif
1519
1520     static bool scroll(WebCore::Page*, WebCore::ScrollDirection, WebCore::ScrollGranularity);
1521     static bool logicalScroll(WebCore::Page*, WebCore::ScrollLogicalDirection, WebCore::ScrollGranularity);
1522
1523     void loadURLInFrame(URL&&, const String& referrer, WebCore::FrameIdentifier);
1524     void loadDataInFrame(IPC::DataReference&&, String&& MIMEType, String&& encodingName, URL&& baseURL, WebCore::FrameIdentifier);
1525
1526     enum class WasRestoredByAPIRequest { No, Yes };
1527     void restoreSessionInternal(const Vector<BackForwardListItemState>&, WasRestoredByAPIRequest, WebBackForwardListProxy::OverwriteExistingItem);
1528     void restoreSession(const Vector<BackForwardListItemState>&);
1529     void didRemoveBackForwardItem(const WebCore::BackForwardItemIdentifier&);
1530     void updateBackForwardListForReattach(const Vector<WebKit::BackForwardListItemState>&);
1531     void setCurrentHistoryItemForReattach(WebKit::BackForwardListItemState&&);
1532
1533     void requestFontAttributesAtSelectionStart(CallbackID);
1534
1535 #if ENABLE(REMOTE_INSPECTOR)
1536     void setIndicating(bool);
1537 #endif
1538
1539     void setBackgroundColor(const Optional<WebCore::Color>&);
1540
1541 #if PLATFORM(COCOA)
1542     void setTopContentInsetFenced(float, const WTF::MachSendRight&);
1543 #endif
1544     void setTopContentInset(float);
1545
1546     void viewWillStartLiveResize();
1547     void viewWillEndLiveResize();
1548
1549     void getContentsAsString(ContentAsStringIncludesChildFrames, CallbackID);
1550 #if PLATFORM(COCOA)
1551     void getContentsAsAttributedString(CompletionHandler<void(const WebCore::AttributedString&)>&&);
1552 #endif
1553 #if ENABLE(MHTML)
1554     void getContentsAsMHTMLData(CallbackID);
1555 #endif
1556     void getMainResourceDataOfFrame(WebCore::FrameIdentifier, CallbackID);
1557     void getResourceDataFromFrame(WebCore::FrameIdentifier, const String& resourceURL, CallbackID);
1558     void getRenderTreeExternalRepresentation(CallbackID);
1559     void getSelectionOrContentsAsString(CallbackID);
1560     void getSelectionAsWebArchiveData(CallbackID);
1561     void getSourceForFrame(WebCore::FrameIdentifier, CallbackID);
1562     void getWebArchiveOfFrame(WebCore::FrameIdentifier, CallbackID);
1563     void runJavaScript(WebFrame*, WebCore::RunJavaScriptParameters&&, ContentWorldIdentifier, CompletionHandler<void(const IPC::DataReference&, const Optional<WebCore::ExceptionDetails>&)>&&);
1564     void runJavaScriptInFrameInScriptWorld(WebCore::RunJavaScriptParameters&&, Optional<WebCore::FrameIdentifier>, const std::pair<ContentWorldIdentifier, String>& worldData, CompletionHandler<void(const IPC::DataReference&, const Optional<WebCore::ExceptionDetails>&)>&&);
1565     void forceRepaint(CallbackID);
1566     void takeSnapshot(WebCore::IntRect snapshotRect, WebCore::IntSize bitmapSize, uint32_t options, CallbackID);
1567
1568     void preferencesDidChange(const WebPreferencesStore&);
1569     void updatePreferences(const WebPreferencesStore&);
1570     void updateSettingsGenerated(const WebPreferencesStore&);
1571
1572 #if PLATFORM(IOS_FAMILY)
1573     bool parentProcessHasServiceWorkerEntitlement() const;
1574     void disableServiceWorkerEntitlement();
1575     void clearServiceWorkerEntitlementOverride(CompletionHandler<void()>&&);
1576 #else
1577     bool parentProcessHasServiceWorkerEntitlement() const { return true; }
1578     void disableServiceWorkerEntitlement() { }
1579     void clearServiceWorkerEntitlementOverride(CompletionHandler<void()>&& completionHandler) { completionHandler(); }
1580 #endif
1581
1582     void didReceivePolicyDecision(WebCore::FrameIdentifier, uint64_t listenerID, PolicyDecision&&);
1583     void continueWillSubmitForm(WebCore::FrameIdentifier, uint64_t listenerID);
1584     void setUserAgent(const String&);
1585     void setCustomTextEncodingName(const String&);
1586     void suspendActiveDOMObjectsAndAnimations();
1587     void resumeActiveDOMObjectsAndAnimations();
1588
1589 #if PLATFORM(COCOA)
1590     void performDictionaryLookupAtLocation(const WebCore::FloatPoint&);
1591     void performDictionaryLookupOfCurrentSelection();
1592     void performDictionaryLookupForRange(WebCore::Frame&, const WebCore::SimpleRange&, NSDictionary *options, WebCore::TextIndicatorPresentationTransition);
1593     WebCore::DictionaryPopupInfo dictionaryPopupInfoForRange(WebCore::Frame&, const WebCore::SimpleRange&, NSDictionary *options, WebCore::TextIndicatorPresentationTransition);
1594 #if ENABLE(PDFKIT_PLUGIN)
1595     WebCore::DictionaryPopupInfo dictionaryPopupInfoForSelectionInPDFPlugin(PDFSelection *, PDFPlugin&, NSDictionary *options, WebCore::TextIndicatorPresentationTransition);
1596 #endif
1597
1598     void windowAndViewFramesChanged(const WebCore::FloatRect& windowFrameInScreenCoordinates, const WebCore::FloatRect& windowFrameInUnflippedScreenCoordinates, const WebCore::FloatRect& viewFrameInWindowCoordinates, const WebCore::FloatPoint& accessibilityViewCoordinates);
1599
1600     RetainPtr<PDFDocument> pdfDocumentForPrintingFrame(WebCore::Frame*);
1601     void computePagesForPrintingPDFDocument(WebCore::FrameIdentifier, const PrintInfo&, Vector<WebCore::IntRect>& resultPageRects);
1602     void drawPDFDocument(CGContextRef, PDFDocument *, const PrintInfo&, const WebCore::IntRect&);
1603     void drawPagesToPDFFromPDFDocument(CGContextRef, PDFDocument *, const PrintInfo&, uint32_t first, uint32_t count);
1604 #endif
1605
1606 #if HAVE(APP_ACCENT_COLORS)
1607     void setAccentColor(WebCore::Color);
1608 #endif
1609
1610     void setMainFrameIsScrollable(bool);
1611
1612     void unapplyEditCommand(WebUndoStepID commandID);
1613     void reapplyEditCommand(WebUndoStepID commandID);
1614     void didRemoveEditCommand(WebUndoStepID commandID);
1615
1616     void findString(const String&, OptionSet<FindOptions>, uint32_t maxMatchCount, CompletionHandler<void(bool)>&&);
1617     void findStringMatches(const String&, OptionSet<FindOptions>, uint32_t maxMatchCount);
1618     void getImageForFindMatch(uint32_t matchIndex);
1619     void selectFindMatch(uint32_t matchIndex);
1620     void indicateFindMatch(uint32_t matchIndex);
1621     void hideFindUI();
1622     void countStringMatches(const String&, OptionSet<FindOptions>, uint32_t maxMatchCount);
1623     void replaceMatches(const Vector<uint32_t>& matchIndices, const String& replacementText, bool selectionOnly, CallbackID);
1624
1625 #if USE(COORDINATED_GRAPHICS)
1626     void sendViewportAttributesChanged(const WebCore::ViewportArguments&);
1627 #endif
1628
1629     void didChangeSelectedIndexForActivePopupMenu(int32_t newIndex);
1630     void setTextForActivePopupMenu(int32_t index);
1631
1632 #if PLATFORM(GTK)
1633     void failedToShowPopupMenu();
1634 #endif
1635
1636     void didChooseFilesForOpenPanel(const Vector<String>& files, const Vector<String>& replacementFiles);
1637     void didCancelForOpenPanel();
1638
1639 #if PLATFORM(IOS_FAMILY)
1640     void didChooseFilesForOpenPanelWithDisplayStringAndIcon(const Vector<String>&, const String& displayString, const IPC::DataReference& iconData, WebKit::SandboxExtension::Handle&&, WebKit::SandboxExtension::Handle&&);
1641     bool isTransparentOrFullyClipped(const WebCore::Element&) const;
1642 #endif
1643
1644 #if ENABLE(SANDBOX_EXTENSIONS)
1645     void extendSandboxForFilesFromOpenPanel(SandboxExtension::HandleArray&&);
1646 #endif
1647
1648     void didReceiveGeolocationPermissionDecision(GeolocationIdentifier, const String& authorizationToken);
1649
1650     void didReceiveNotificationPermissionDecision(uint64_t notificationID, bool allowed);
1651
1652 #if ENABLE(MEDIA_STREAM)
1653     void userMediaAccessWasGranted(uint64_t userMediaID, WebCore::CaptureDevice&& audioDeviceUID, WebCore::CaptureDevice&& videoDeviceUID, String&& mediaDeviceIdentifierHashSalt, SandboxExtension::Handle&&, CompletionHandler<void()>&&);
1654     void userMediaAccessWasDenied(uint64_t userMediaID, uint64_t reason, String&& invalidConstraint);
1655
1656 #endif
1657
1658     void stopAllMediaPlayback();
1659     void suspendAllMediaPlayback();
1660     void resumeAllMediaPlayback();
1661
1662     void advanceToNextMisspelling(bool startBeforeSelection);
1663     void changeSpellingToWord(const String& word);
1664
1665 #if USE(APPKIT)
1666     void uppercaseWord();
1667     void lowercaseWord();
1668     void capitalizeWord();
1669 #endif
1670
1671     bool shouldDispatchSyntheticMouseEventsWhenModifyingSelection() const;
1672     void platformDidSelectAll();
1673     
1674     void setHasResourceLoadClient(bool);
1675     void setCanUseCredentialStorage(bool);
1676
1677 #if ENABLE(CONTEXT_MENUS)
1678     void didSelectItemFromActiveContextMenu(const WebContextMenuItemData&);
1679 #endif
1680
1681     void changeSelectedIndex(int32_t index);
1682     void setCanStartMediaTimerFired();
1683
1684     static bool platformCanHandleRequest(const WebCore::ResourceRequest&);
1685
1686     static PluginView* focusedPluginViewForFrame(WebCore::Frame&);
1687
1688     void reportUsedFeatures();
1689
1690     void updateWebsitePolicies(WebsitePoliciesData&&);
1691     void notifyUserScripts();
1692
1693     void changeFont(WebCore::FontChanges&&);
1694     void changeFontAttributes(WebCore::FontAttributeChanges&&);
1695
1696 #if PLATFORM(MAC)
1697     void performImmediateActionHitTestAtLocation(WebCore::FloatPoint);
1698     Optional<std::tuple<WebCore::SimpleRange, NSDictionary *>> lookupTextAtLocation(WebCore::FloatPoint);
1699     void immediateActionDidUpdate();
1700     void immediateActionDidCancel();
1701     void immediateActionDidComplete();
1702
1703     void dataDetectorsDidPresentUI(WebCore::PageOverlay::PageOverlayID);
1704     void dataDetectorsDidChangeUI(WebCore::PageOverlay::PageOverlayID);
1705     void dataDetectorsDidHideUI(WebCore::PageOverlay::PageOverlayID);
1706
1707     void handleAcceptedCandidate(WebCore::TextCheckingResult);
1708 #endif
1709
1710 #if PLATFORM(COCOA)
1711     void requestActiveNowPlayingSessionInfo(CallbackID);
1712     RetainPtr<NSData> accessibilityRemoteTokenData() const;
1713     void accessibilityTransferRemoteToken(RetainPtr<NSData>);
1714 #endif
1715
1716     void setShouldDispatchFakeMouseMoveEvents(bool dispatch) { m_shouldDispatchFakeMouseMoveEvents = dispatch; }
1717
1718 #if ENABLE(WIRELESS_PLAYBACK_TARGET) && !PLATFORM(IOS_FAMILY)
1719     void playbackTargetSelected(WebCore::PlaybackTargetClientContextIdentifier, const WebCore::MediaPlaybackTargetContext& outputDevice) const;
1720     void playbackTargetAvailabilityDidChange(WebCore::PlaybackTargetClientContextIdentifier, bool);
1721     void setShouldPlayToPlaybackTarget(WebCore::PlaybackTargetClientContextIdentifier, bool);
1722     void playbackTargetPickerWasDismissed(WebCore::PlaybackTargetClientContextIdentifier);
1723 #endif
1724
1725     void clearWheelEventTestMonitor();
1726
1727     void setShouldScaleViewToFitDocument(bool);
1728
1729     void pageStoppedScrolling();
1730
1731 #if ENABLE(VIDEO) && USE(GSTREAMER)
1732     void didEndRequestInstallMissingMediaPlugins(uint32_t result);
1733 #endif
1734
1735     void setUserInterfaceLayoutDirection(uint32_t);
1736
1737     bool canPluginHandleResponse(const WebCore::ResourceResponse&);
1738
1739     void simulateDeviceOrientationChange(double alpha, double beta, double gamma);
1740
1741 #if USE(SYSTEM_PREVIEW)
1742     void systemPreviewActionTriggered(WebCore::SystemPreviewInfo, const String& message);
1743 #endif
1744
1745 #if ENABLE(SPEECH_SYNTHESIS)
1746     void speakingErrorOccurred();
1747     void boundaryEventOccurred(bool wordBoundary, unsigned charIndex);
1748     void voicesDidChange();
1749 #endif
1750
1751     void frameBecameRemote(WebCore::FrameIdentifier, WebCore::GlobalFrameIdentifier&& remoteFrameIdentifier, WebCore::GlobalWindowIdentifier&& remoteWindowIdentifier);
1752
1753     void registerURLSchemeHandler(uint64_t identifier, const String& scheme);
1754
1755     void urlSchemeTaskDidPerformRedirection(uint64_t handlerIdentifier, uint64_t taskIdentifier, WebCore::ResourceResponse&&, WebCore::ResourceRequest&&);
1756     void urlSchemeTaskDidReceiveResponse(uint64_t handlerIdentifier, uint64_t taskIdentifier, const WebCore::ResourceResponse&);
1757     void urlSchemeTaskDidReceiveData(uint64_t handlerIdentifier, uint64_t taskIdentifier, const IPC::DataReference&);
1758     void urlSchemeTaskDidComplete(uint64_t handlerIdentifier, uint64_t taskIdentifier, const WebCore::ResourceError&);
1759
1760     void setIsTakingSnapshotsForApplicationSuspension(bool);
1761     void setNeedsDOMWindowResizeEvent();
1762
1763     void setIsSuspended(bool);
1764
1765     RefPtr<WebImage> snapshotAtSize(const WebCore::IntRect&, const WebCore::IntSize& bitmapSize, SnapshotOptions);
1766     RefPtr<WebImage> snapshotNode(WebCore::Node&, SnapshotOptions, unsigned maximumPixelCount = std::numeric_limits<unsigned>::max());
1767 #if PLATFORM(COCOA)
1768     RetainPtr<CFDataRef> pdfSnapshotAtSize(WebCore::IntRect, WebCore::IntSize bitmapSize, SnapshotOptions);
1769 #endif
1770
1771 #if ENABLE(ATTACHMENT_ELEMENT)
1772     RefPtr<WebCore::HTMLAttachmentElement> attachmentElementWithIdentifier(const String& identifier) const;
1773 #endif
1774
1775     bool canShowMIMEType(const String&, const Function<bool(const String&, WebCore::PluginData::AllowedPluginTypes)>& supportsPlugin) const;
1776
1777     void cancelGesturesBlockedOnSynchronousReplies();
1778
1779     bool shouldDispatchUpdateAfterFocusingElement(const WebCore::Element&) const;
1780
1781     void updateMockAccessibilityElementAfterCommittingLoad();
1782
1783     void paintSnapshotAtSize(const WebCore::IntRect&, const WebCore::IntSize&, SnapshotOptions, WebCore::Frame&, WebCore::FrameView&, WebCore::GraphicsContext&);
1784
1785 #if PLATFORM(GTK) || PLATFORM(WPE)
1786     void sendMessageToWebExtension(UserMessage&&);
1787     void sendMessageToWebExtensionWithReply(UserMessage&&, CompletionHandler<void(UserMessage&&)>&&);
1788 #endif
1789
1790     void platformDidScalePage();
1791
1792     WebCore::PageIdentifier m_identifier;
1793
1794     std::unique_ptr<WebCore::Page> m_page;
1795     Ref<WebFrame> m_mainFrame;
1796
1797     RefPtr<WebPageGroupProxy> m_pageGroup;
1798
1799     String m_userAgent;
1800
1801     WebCore::IntSize m_viewSize;
1802     std::unique_ptr<DrawingArea> m_drawingArea;
1803
1804     HashSet<PluginView*> m_pluginViews;
1805     bool m_hasSeenPlugin { false };
1806
1807     HashMap<uint64_t, RefPtr<WebCore::TextCheckingRequest>> m_pendingTextCheckingRequestMap;
1808
1809     bool m_useFixedLayout { false };
1810
1811     WebCore::Color m_underlayColor;
1812
1813 #if ENABLE(UI_PROCESS_PDF_HUD)
1814     HashMap<PDFPluginIdentifier, WeakPtr<PDFPlugin>> m_pdfPlugInsWithHUD;
1815 #endif
1816
1817     bool m_isInRedo { false };
1818     bool m_isClosed { false };
1819     bool m_tabToLinks { false };
1820     
1821     bool m_asynchronousPluginInitializationEnabled { false };
1822     bool m_asynchronousPluginInitializationEnabledForAllPlugins { false };
1823     bool m_artificialPluginInitializationDelayEnabled { false };
1824     bool m_scrollingPerformanceLoggingEnabled { false };
1825     bool m_mainFrameIsScrollable { true };
1826
1827     bool m_alwaysShowsHorizontalScroller { false };
1828     bool m_alwaysShowsVerticalScroller { false };
1829
1830     bool m_shouldRenderCanvasInGPUProcess { false };
1831 #if ENABLE(APP_BOUND_DOMAINS)
1832     bool m_needsInAppBrowserPrivacyQuirks { false };
1833 #endif
1834 #if ENABLE(PRIMARY_SNAPSHOTTED_PLUGIN_HEURISTIC)
1835     bool m_readyToFindPrimarySnapshottedPlugin { false };
1836     bool m_didFindPrimarySnapshottedPlugin { false };
1837     unsigned m_numberOfPrimarySnapshotDetectionAttempts { 0 };
1838     String m_primaryPlugInPageOrigin;
1839     String m_primaryPlugInOrigin;
1840     String m_primaryPlugInMimeType;
1841     RunLoop::Timer<WebPage> m_determinePrimarySnapshottedPlugInTimer;
1842 #endif
1843
1844     // The layer hosting mode.
1845     LayerHostingMode m_layerHostingMode;
1846
1847 #if PLATFORM(COCOA)
1848     bool m_pdfPluginEnabled { false };
1849     bool m_hasCachedWindowFrame { false };
1850
1851     // The frame of the containing window in screen coordinates.
1852     WebCore::FloatRect m_windowFrameInScreenCoordinates;
1853
1854     // The frame of the containing window in unflipped screen coordinates.
1855     WebCore::FloatRect m_windowFrameInUnflippedScreenCoordinates;
1856
1857     // The frame of the view in window coordinates.
1858     WebCore::FloatRect m_viewFrameInWindowCoordinates;
1859
1860     // The accessibility position of the view.
1861     WebCore::FloatPoint m_accessibilityPosition;
1862     
1863     RetainPtr<WKAccessibilityWebPageObject> m_mockAccessibilityElement;
1864 #endif
1865
1866 #if ENABLE(PLATFORM_DRIVEN_TEXT_CHECKING)
1867     UniqueRef<TextCheckingControllerProxy> m_textCheckingControllerProxy;
1868 #endif
1869
1870 #if PLATFORM(COCOA) || (PLATFORM(GTK) && !USE(GTK4))
1871     std::unique_ptr<ViewGestureGeometryCollector> m_viewGestureGeometryCollector;
1872 #endif
1873
1874 #if PLATFORM(COCOA)
1875     RetainPtr<NSDictionary> m_dataDetectionContext;
1876 #endif
1877
1878 #if ENABLE(ACCESSIBILITY) && USE(ATK)
1879     GRefPtr<AtkObject> m_accessibilityObject;
1880 #endif
1881
1882 #if PLATFORM(WIN)
1883     uint64_t m_nativeWindowHandle { 0 };
1884 #endif
1885
1886 #if !PLATFORM(IOS_FAMILY)
1887     RefPtr<PageBanner> m_headerBanner;
1888     RefPtr<PageBanner> m_footerBanner;
1889 #endif
1890
1891     RunLoop::Timer<WebPage> m_setCanStartMediaTimer;
1892     bool m_mayStartMediaWhenInWindow { false };
1893
1894     HashMap<WebUndoStepID, RefPtr<WebUndoStep>> m_undoStepMap;
1895
1896 #if ENABLE(CONTEXT_MENUS)
1897     std::unique_ptr<API::InjectedBundle::PageContextMenuClient> m_contextMenuClient;
1898 #endif
1899     std::unique_ptr<API::InjectedBundle::EditorClient> m_editorClient;
1900     std::unique_ptr<API::InjectedBundle::FormClient> m_formClient;
1901     std::unique_ptr<API::InjectedBundle::PageLoaderClient> m_loaderClient;
1902     InjectedBundlePagePolicyClient m_policyClient;
1903     std::unique_ptr<API::InjectedBundle::ResourceLoadClient> m_resourceLoadClient;
1904     std::unique_ptr<API::InjectedBundle::PageUIClient> m_uiClient;
1905 #if ENABLE(FULLSCREEN_API)
1906     InjectedBundlePageFullScreenClient m_fullScreenClient;
1907 #endif
1908
1909     UniqueRef<FindController> m_findController;
1910
1911     RefPtr<WebInspector> m_inspector;
1912     RefPtr<WebInspectorUI> m_inspectorUI;
1913     RefPtr<RemoteWebInspectorUI> m_remoteInspectorUI;
1914     std::unique_ptr<WebPageInspectorTargetController> m_inspectorTargetController;
1915
1916 #if ENABLE(VIDEO_PRESENTATION_MODE)
1917     RefPtr<PlaybackSessionManager> m_playbackSessionManager;
1918     RefPtr<VideoFullscreenManager> m_videoFullscreenManager;
1919 #endif
1920
1921 #if PLATFORM(IOS_FAMILY)
1922     bool m_allowsMediaDocumentInlinePlayback { false };
1923     Optional<WebCore::SimpleRange> m_startingGestureRange;
1924 #endif
1925
1926 #if ENABLE(FULLSCREEN_API)
1927     RefPtr<WebFullScreenManager> m_fullScreenManager;
1928 #endif
1929
1930     RefPtr<WebPopupMenu> m_activePopupMenu;
1931
1932 #if ENABLE(CONTEXT_MENUS)
1933     RefPtr<WebContextMenu> m_contextMenu;
1934 #endif
1935
1936 #if ENABLE(INPUT_TYPE_COLOR)
1937     WebColorChooser* m_activeColorChooser { nullptr };
1938 #endif
1939
1940 #if ENABLE(DATALIST_ELEMENT)
1941     WeakPtr<WebDataListSuggestionPicker> m_activeDataListSuggestionPicker;
1942 #endif
1943
1944 #if ENABLE(DATE_AND_TIME_INPUT_TYPES)
1945     WeakPtr<WebDateTimeChooser> m_activeDateTimeChooser;
1946 #endif
1947
1948     RefPtr<WebOpenPanelResultListener> m_activeOpenPanelResultListener;
1949     RefPtr<NotificationPermissionRequestManager> m_notificationPermissionRequestManager;
1950
1951     Ref<WebUserContentController> m_userContentController;
1952
1953 #if ENABLE(GEOLOCATION)
1954     UniqueRef<GeolocationPermissionRequestManager> m_geolocationPermissionRequestManager;
1955 #endif
1956
1957 #if ENABLE(MEDIA_STREAM)
1958     UniqueRef<UserMediaPermissionRequestManager> m_userMediaPermissionRequestManager;
1959 #endif
1960
1961     std::unique_ptr<WebCore::PrintContext> m_printContext;
1962 #if PLATFORM(GTK)
1963     RefPtr<WebPrintOperationGtk> m_printOperation;
1964 #endif
1965
1966     SandboxExtensionTracker m_sandboxExtensionTracker;
1967
1968     RefPtr<SandboxExtension> m_pendingDropSandboxExtension;
1969     Vector<RefPtr<SandboxExtension>> m_pendingDropExtensionsForFileUpload;
1970
1971     PAL::HysteresisActivity m_pageScrolledHysteresis;
1972
1973     bool m_canRunBeforeUnloadConfirmPanel { false };
1974
1975     bool m_canRunModal { false };
1976     bool m_isRunningModal { false };
1977
1978 #if ENABLE(DRAG_SUPPORT)
1979     bool m_isStartingDrag { false };
1980     OptionSet<WebCore::DragSourceAction> m_allowedDragSourceActions { WebCore::anyDragSourceAction() };
1981 #endif
1982
1983 #if PLATFORM(IOS_FAMILY) && ENABLE(DRAG_SUPPORT)
1984     HashSet<RefPtr<WebCore::HTMLImageElement>> m_pendingImageElementsForDropSnapshot;
1985     Optional<WebCore::SimpleRange> m_rangeForDropSnapshot;
1986 #endif
1987
1988     bool m_cachedMainFrameIsPinnedToLeftSide { true };
1989     bool m_cachedMainFrameIsPinnedToRightSide { true };
1990     bool m_cachedMainFrameIsPinnedToTopSide { true };
1991     bool m_cachedMainFrameIsPinnedToBottomSide { true };
1992     bool m_canShortCircuitHorizontalWheelEvents { false };
1993     bool m_hasWheelEventHandlers { false };
1994
1995     unsigned m_cachedPageCount { 0 };
1996
1997     HashSet<unsigned long> m_trackedNetworkResourceRequestIdentifiers;
1998
1999     WebCore::IntSize m_minimumSizeForAutoLayout;
2000     WebCore::IntSize m_sizeToContentAutoSizeMaximumSize;
2001     bool m_autoSizingShouldExpandToViewHeight { false };
2002     Optional<WebCore::IntSize> m_viewportSizeForCSSViewportUnits;
2003
2004     bool m_userIsInteracting { false };
2005     bool m_hasEverFocusedElementDueToUserInteractionSincePageTransition { false };
2006
2007 #if HAVE(TOUCH_BAR)
2008     bool m_isTouchBarUpdateSupressedForHiddenContentEditable { false };
2009     bool m_isNeverRichlyEditableForTouchBar { false };
2010 #endif
2011     OptionSet<WebCore::ActivityState::Flag> m_lastActivityStateChanges;
2012
2013 #if ENABLE(CONTEXT_MENUS)
2014     bool m_isShowingContextMenu { false };
2015 #endif
2016
2017     RefPtr<WebCore::Element> m_focusedElement;
2018     RefPtr<WebCore::Element> m_recentlyBlurredElement;
2019     bool m_hasPendingInputContextUpdateAfterBlurringAndRefocusingElement { false };
2020     bool m_hasPendingEditorStateUpdate { false };
2021
2022 #if ENABLE(IOS_TOUCH_EVENTS)
2023     CompletionHandler<void(bool)> m_pendingSynchronousTouchEventReply;
2024 #endif
2025
2026 #if ENABLE(META_VIEWPORT)
2027     WebCore::ViewportConfiguration m_viewportConfiguration;
2028     bool m_useTestingViewportConfiguration { false };
2029     bool m_forceAlwaysUserScalable { false };
2030 #endif
2031
2032 #if PLATFORM(IOS_FAMILY)
2033     Optional<WebCore::SimpleRange> m_currentWordRange;
2034     RefPtr<WebCore::Node> m_interactionNode;
2035     WebCore::IntPoint m_lastInteractionLocation;
2036
2037     bool m_isShowingInputViewForFocusedElement { false };
2038     bool m_hasHandledSyntheticClick { false };
2039     
2040     enum SelectionAnchor { Start, End };
2041     SelectionAnchor m_selectionAnchor { Start };
2042
2043     RefPtr<WebCore::Node> m_potentialTapNode;
2044     WebCore::FloatPoint m_potentialTapLocation;
2045     RefPtr<WebCore::SecurityOrigin> m_potentialTapSecurityOrigin;
2046
2047     bool m_hasReceivedVisibleContentRectsAfterDidCommitLoad { false };
2048     bool m_hasRestoredExposedContentRectAfterDidCommitLoad { false };
2049     bool m_scaleWasSetByUIProcess { false };
2050     bool m_userHasChangedPageScaleFactor { false };
2051     bool m_hasStablePageScaleFactor { true };
2052     bool m_isInStableState { true };
2053     bool m_shouldRevealCurrentSelectionAfterInsertion { true };
2054     bool m_screenIsBeingCaptured { false };
2055     MonotonicTime m_oldestNonStableUpdateVisibleContentRectsTimestamp;
2056     Seconds m_estimatedLatency { 0 };
2057     WebCore::FloatSize m_screenSize;
2058     WebCore::FloatSize m_availableScreenSize;
2059     WebCore::FloatSize m_overrideScreenSize;
2060
2061     Optional<WebCore::SimpleRange> m_initialSelection;
2062     WebCore::VisibleSelection m_storedSelectionForAccessibility { WebCore::VisibleSelection() };
2063     WebCore::FloatSize m_maximumUnobscuredSize;
2064     int32_t m_deviceOrientation { 0 };
2065     bool m_keyboardIsAttached { false };
2066     bool m_canShowWhileLocked { false };
2067     bool m_inDynamicSizeUpdate { false };
2068     HashMap<std::pair<WebCore::IntSize, double>, WebCore::IntPoint> m_dynamicSizeUpdateHistory;
2069     RefPtr<WebCore::Node> m_pendingSyntheticClickNode;
2070     WebCore::FloatPoint m_pendingSyntheticClickLocation;
2071     WebCore::FloatRect m_previousExposedContentRect;
2072     OptionSet<WebKit::WebEvent::Modifier> m_pendingSyntheticClickModifiers;
2073     WebCore::PointerID m_pendingSyntheticClickPointerId { 0 };
2074     FocusedElementIdentifier m_currentFocusedElementIdentifier { 0 };
2075     Optional<DynamicViewportSizeUpdateID> m_pendingDynamicViewportSizeUpdateID;
2076     double m_lastTransactionPageScaleFactor { 0 };
2077     TransactionID m_lastTransactionIDWithScaleChange;
2078
2079     CompletionHandler<void(InteractionInformationAtPosition&&)> m_pendingSynchronousPositionInformationReply;
2080     Optional<std::pair<TransactionID, double>> m_lastLayerTreeTransactionIdAndPageScaleBeforeScalingPage;
2081 #endif
2082
2083     WebCore::Timer m_layerVolatilityTimer;
2084     Vector<CompletionHandler<void(bool)>> m_markLayersAsVolatileCompletionHandlers;
2085     bool m_isSuspendedUnderLock { false };
2086
2087     HashSet<String, ASCIICaseInsensitiveHash> m_mimeTypesWithCustomContentProviders;
2088     Optional<WebCore::Color> m_backgroundColor { WebCore::Color::white };
2089
2090     HashSet<unsigned> m_activeRenderingSuppressionTokens;
2091     unsigned m_maximumRenderingSuppressionToken { 0 };
2092     
2093     WebCore::ScrollPinningBehavior m_scrollPinningBehavior { WebCore::DoNotPin };
2094     Optional<WebCore::ScrollbarOverlayStyle> m_scrollbarOverlayStyle;
2095
2096     bool m_useAsyncScrolling { false };
2097
2098     OptionSet<WebCore::ActivityState::Flag> m_activityState;
2099
2100     bool m_isAppNapEnabled { true };
2101     UserActivity m_userActivity;
2102
2103     uint64_t m_pendingNavigationID { 0 };
2104     Optional<WebsitePoliciesData> m_pendingWebsitePolicies;
2105
2106     bool m_mainFrameProgressCompleted { false };
2107     bool m_shouldDispatchFakeMouseMoveEvents { true };
2108     bool m_isSelectingTextWhileInsertingAsynchronously { false };
2109
2110     enum class EditorStateIsContentEditable { No, Yes, Unset };
2111     mutable EditorStateIsContentEditable m_lastEditorStateWasContentEditable { EditorStateIsContentEditable::Unset };
2112
2113 #if PLATFORM(GTK) || PLATFORM(WPE)
2114     Optional<InputMethodState> m_inputMethodState;
2115 #endif
2116
2117 #if ENABLE(VIDEO) && USE(GSTREAMER)
2118     RefPtr<WebCore::MediaPlayerRequestInstallMissingPluginsCallback> m_installMediaPluginsCallback;
2119 #endif
2120
2121 #if USE(OS_STATE)
2122     WallTime m_loadCommitTime;
2123 #endif
2124
2125     WebCore::UserInterfaceLayoutDirection m_userInterfaceLayoutDirection { WebCore::UserInterfaceLayoutDirection::LTR };
2126
2127     const String m_overrideContentSecurityPolicy;
2128     const Optional<double> m_cpuLimit;
2129
2130 #if USE(WPE_RENDERER)
2131     IPC::Attachment m_hostFileDescriptor;
2132 #endif
2133
2134     HashMap<String, RefPtr<WebURLSchemeHandlerProxy>> m_schemeToURLSchemeHandlerProxyMap;
2135     HashMap<uint64_t, WebURLSchemeHandlerProxy*> m_identifierToURLSchemeHandlerProxyMap;
2136
2137     HashMap<uint64_t, Function<void(bool granted)>> m_storageAccessResponseCallbackMap;
2138
2139 #if ENABLE(APPLICATION_MANIFEST)
2140     HashMap<uint64_t, uint64_t> m_applicationManifestFetchCallbackMap;
2141 #endif
2142
2143     OptionSet<LayerTreeFreezeReason> m_layerTreeFreezeReasons;
2144     bool m_isSuspended { false };
2145     bool m_needsFontAttributes { false };
2146     bool m_firstFlushAfterCommit { false };
2147 #if PLATFORM(COCOA)
2148     WeakPtr<WebRemoteObjectRegistry> m_remoteObjectRegistry;
2149 #endif
2150     WebPageProxyIdentifier m_webPageProxyIdentifier;
2151     Optional<WebCore::IntSize> m_pendingIntrinsicContentSize;
2152     WebCore::IntSize m_lastSentIntrinsicContentSize;
2153 #if HAVE(VISIBILITY_PROPAGATION_VIEW)
2154     std::unique_ptr<LayerHostingContext> m_contextForVisibilityPropagation;
2155 #endif
2156 #if ENABLE(TEXT_AUTOSIZING)
2157     WebCore::Timer m_textAutoSizingAdjustmentTimer;
2158 #endif
2159
2160 #if ENABLE(RESOURCE_LOAD_STATISTICS)
2161     HashMap<WebCore::RegistrableDomain, WebCore::RegistrableDomain> m_domainsWithPageLevelStorageAccess;
2162     HashSet<WebCore::RegistrableDomain> m_loadedSubresourceDomains;
2163 #endif
2164
2165     String m_overriddenMediaType;
2166     String m_processDisplayName;
2167     WebCore::AllowsContentJavaScript m_allowsContentJavaScriptFromMostRecentNavigation { WebCore::AllowsContentJavaScript::Yes };
2168
2169 #if PLATFORM(GTK)
2170     String m_themeName;
2171 #endif
2172     
2173 #if ENABLE(APP_BOUND_DOMAINS)
2174     bool m_limitsNavigationsToAppBoundDomains { false };
2175     bool m_navigationHasOccured { false };
2176 #endif
2177     bool m_canUseCredentialStorage { true };
2178
2179     Vector<String> m_corsDisablingPatterns;
2180
2181 #if ENABLE(IPC_TESTING_API)
2182     bool m_ipcTestingAPIEnabled { false };
2183     uint64_t m_visitedLinkTableID;
2184 #endif
2185 };
2186
2187 #if !PLATFORM(IOS_FAMILY)
2188 inline void WebPage::platformWillPerformEditingCommand() { }
2189 inline bool WebPage::platformNeedsLayoutForEditorState(const WebCore::Frame&) const { return false; }
2190 #endif
2191
2192 } // namespace WebKit
2193