Expose and test fixedLayoutSize via modern WebKit SPI
[WebKit-https.git] / Source / WebKit2 / WebProcess / WebPage / WebPage.h
1 /*
2  * Copyright (C) 2010, 2011, 2013 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 #ifndef WebPage_h
27 #define WebPage_h
28
29 #include "APIInjectedBundleFormClient.h"
30 #include "APIInjectedBundlePageContextMenuClient.h"
31 #include "APIInjectedBundlePageUIClient.h"
32 #include "APIObject.h"
33 #include "DictionaryPopupInfo.h"
34 #include "FindController.h"
35 #include "GeolocationPermissionRequestManager.h"
36 #include "ImageOptions.h"
37 #include "InjectedBundlePageDiagnosticLoggingClient.h"
38 #include "InjectedBundlePageEditorClient.h"
39 #include "InjectedBundlePageFullScreenClient.h"
40 #include "InjectedBundlePageLoaderClient.h"
41 #include "InjectedBundlePagePolicyClient.h"
42 #include "InjectedBundlePageResourceLoadClient.h"
43 #include "LayerTreeHost.h"
44 #include "MessageReceiver.h"
45 #include "MessageSender.h"
46 #include "Plugin.h"
47 #include "SandboxExtension.h"
48 #include "ShareableBitmap.h"
49 #include "UserData.h"
50 #include "UserMediaPermissionRequestManager.h"
51 #include <WebCore/DictationAlternative.h>
52 #include <WebCore/DragData.h>
53 #include <WebCore/Editor.h>
54 #include <WebCore/FrameLoaderTypes.h>
55 #include <WebCore/HitTestResult.h>
56 #include <WebCore/IntRect.h>
57 #include <WebCore/IntSizeHash.h>
58 #include <WebCore/Page.h>
59 #include <WebCore/PageOverlay.h>
60 #include <WebCore/PageVisibilityState.h>
61 #include <WebCore/ScrollTypes.h>
62 #include <WebCore/TextChecking.h>
63 #include <WebCore/TextIndicator.h>
64 #include <WebCore/UserActivity.h>
65 #include <WebCore/ViewState.h>
66 #include <WebCore/ViewportConfiguration.h>
67 #include <WebCore/WebCoreKeyboardUIMode.h>
68 #include <memory>
69 #include <wtf/HashMap.h>
70 #include <wtf/PassRefPtr.h>
71 #include <wtf/RefPtr.h>
72 #include <wtf/RunLoop.h>
73 #include <wtf/text/WTFString.h>
74
75 #if HAVE(ACCESSIBILITY) && (PLATFORM(GTK) || PLATFORM(EFL))
76 #include "WebPageAccessibilityObject.h"
77 #include <wtf/gobject/GRefPtr.h>
78 #endif
79
80 #if PLATFORM(GTK)
81 #include "ArgumentCodersGtk.h"
82 #include "WebPrintOperationGtk.h"
83 #endif
84
85 #if PLATFORM(IOS)
86 #include "GestureTypes.h"
87 #import "WebPageMessages.h"
88 #endif
89
90 #if ENABLE(IOS_TOUCH_EVENTS)
91 #include <WebKitAdditions/PlatformTouchEventIOS.h>
92 #elif ENABLE(TOUCH_EVENTS)
93 #include <WebCore/PlatformTouchEvent.h>
94 #endif
95
96 #if ENABLE(CONTEXT_MENUS)
97 #include "InjectedBundlePageContextMenuClient.h"
98 #endif
99
100 #if PLATFORM(COCOA)
101 #include "ViewGestureGeometryCollector.h"
102 #include <wtf/RetainPtr.h>
103 OBJC_CLASS CALayer;
104 OBJC_CLASS NSDictionary;
105 OBJC_CLASS NSObject;
106 OBJC_CLASS WKAccessibilityWebPageObject;
107
108 #define ENABLE_PRIMARY_SNAPSHOTTED_PLUGIN_HEURISTIC 1
109 #endif
110
111 namespace API {
112 class Array;
113 }
114
115 namespace IPC {
116 class ArgumentDecoder;
117 class Connection;
118 }
119
120 namespace WebCore {
121 class DocumentLoader;
122 class GraphicsContext;
123 class Frame;
124 class FrameView;
125 class HTMLPlugInElement;
126 class HTMLPlugInImageElement;
127 class IntPoint;
128 class KeyboardEvent;
129 class MediaPlaybackTarget;
130 class Page;
131 class PrintContext;
132 class Range;
133 class ResourceResponse;
134 class ResourceRequest;
135 class SharedBuffer;
136 class SubstituteData;
137 class TextCheckingRequest;
138 class URL;
139 class VisibleSelection;
140 struct Highlight;
141 struct KeypressCommand;
142 struct TextCheckingResult;
143 }
144
145 namespace WebKit {
146 class DrawingArea;
147 class InjectedBundleBackForwardList;
148 class NotificationPermissionRequestManager;
149 class PageBanner;
150 class PluginView;
151 class VisibleContentRectUpdateInfo;
152 class WebColorChooser;
153 class WebContextMenu;
154 class WebContextMenuItemData;
155 class WebEvent;
156 class WebFrame;
157 class WebFullScreenManager;
158 class WebImage;
159 class WebInspector;
160 class WebInspectorClient;
161 class WebInspectorUI;
162 class WebKeyboardEvent;
163 class WebMouseEvent;
164 class WebNotificationClient;
165 class WebOpenPanelResultListener;
166 class WebPageGroupProxy;
167 class WebPageOverlay;
168 class WebPopupMenu;
169 class WebUndoStep;
170 class WebUserContentController;
171 class WebVideoFullscreenManager;
172 class WebWheelEvent;
173 struct AssistedNodeInformation;
174 struct AttributedString;
175 struct BackForwardListItemState;
176 struct EditingRange;
177 struct EditorState;
178 struct InteractionInformationAtPosition;
179 struct PrintInfo;
180 struct WebPageCreationParameters;
181 struct WebPreferencesStore;
182
183 #if PLATFORM(COCOA)
184 class RemoteLayerTreeTransaction;
185 #endif
186
187 #if ENABLE(TOUCH_EVENTS)
188 class WebTouchEvent;
189 #endif
190
191 class WebPage : public API::ObjectImpl<API::Object::Type::BundlePage>, public IPC::MessageReceiver, public IPC::MessageSender {
192 public:
193     static PassRefPtr<WebPage> create(uint64_t pageID, const WebPageCreationParameters&);
194     virtual ~WebPage();
195
196     void reinitializeWebPage(const WebPageCreationParameters&);
197
198     void close();
199
200     static WebPage* fromCorePage(WebCore::Page*);
201
202     WebCore::Page* corePage() const { return m_page.get(); }
203     uint64_t pageID() const { return m_pageID; }
204     WebCore::SessionID sessionID() const { return m_page->sessionID(); }
205     bool usesEphemeralSession() const { return m_page->usesEphemeralSession(); }
206
207     void setSessionID(WebCore::SessionID);
208
209     void setSize(const WebCore::IntSize&);
210     const WebCore::IntSize& size() const { return m_viewSize; }
211     WebCore::IntRect bounds() const { return WebCore::IntRect(WebCore::IntPoint(), size()); }
212     
213     InjectedBundleBackForwardList* backForwardList();
214     DrawingArea* drawingArea() const { return m_drawingArea.get(); }
215 #if ENABLE(ASYNC_SCROLLING)
216     WebCore::ScrollingCoordinator* scrollingCoordinator() const;
217 #endif
218
219     WebPageGroupProxy* pageGroup() const { return m_pageGroup.get(); }
220
221     void scrollMainFrameIfNotAtMaxScrollPosition(const WebCore::IntSize& scrollOffset);
222
223     bool scrollBy(uint32_t scrollDirection, uint32_t scrollGranularity);
224
225     void centerSelectionInVisibleArea();
226
227 #if PLATFORM(COCOA)
228     void willCommitLayerTree(RemoteLayerTreeTransaction&);
229     void didFlushLayerTreeAtTime(std::chrono::milliseconds);
230 #endif
231
232     WebInspector* inspector();
233     WebInspectorUI* inspectorUI();
234     bool isInspectorPage() { return !!m_inspectorUI; }
235
236 #if PLATFORM(IOS)
237     WebVideoFullscreenManager* videoFullscreenManager();
238 #endif
239
240 #if ENABLE(FULLSCREEN_API)
241     WebFullScreenManager* fullScreenManager();
242 #endif
243
244     // -- Called by the DrawingArea.
245     // FIXME: We could genericize these into a DrawingArea client interface. Would that be beneficial?
246     void drawRect(WebCore::GraphicsContext&, const WebCore::IntRect&);
247     void layoutIfNeeded();
248
249     // -- Called from WebCore clients.
250     bool handleEditingKeyboardEvent(WebCore::KeyboardEvent*);
251
252     void didStartPageTransition();
253     void didCompletePageTransition();
254     void didCommitLoad(WebFrame*);
255     void didFinishLoad(WebFrame*);
256     void show();
257     String userAgent(const WebCore::URL&) const;
258     String userAgent(WebFrame*, const WebCore::URL&) const;
259     String platformUserAgent(const WebCore::URL&) const;
260     WebCore::IntRect windowResizerRect() const;
261     WebCore::KeyboardUIMode keyboardUIMode();
262
263     WebUndoStep* webUndoStep(uint64_t);
264     void addWebUndoStep(uint64_t, WebUndoStep*);
265     void removeWebEditCommand(uint64_t);
266     bool isInRedo() const { return m_isInRedo; }
267
268     void setActivePopupMenu(WebPopupMenu*);
269
270 #if ENABLE(INPUT_TYPE_COLOR)
271     WebColorChooser* activeColorChooser() const { return m_activeColorChooser; }
272     void setActiveColorChooser(WebColorChooser*);
273     void didChooseColor(const WebCore::Color&);
274     void didEndColorPicker();
275 #endif
276
277     WebOpenPanelResultListener* activeOpenPanelResultListener() const { return m_activeOpenPanelResultListener.get(); }
278     void setActiveOpenPanelResultListener(PassRefPtr<WebOpenPanelResultListener>);
279
280     void didReceiveMessage(IPC::Connection&, IPC::MessageDecoder&) override;
281     void didReceiveSyncMessage(IPC::Connection&, IPC::MessageDecoder&, std::unique_ptr<IPC::MessageEncoder>&) override;
282
283     // -- InjectedBundle methods
284 #if ENABLE(CONTEXT_MENUS)
285     void setInjectedBundleContextMenuClient(std::unique_ptr<API::InjectedBundle::PageContextMenuClient>);
286 #endif
287     void initializeInjectedBundleEditorClient(WKBundlePageEditorClientBase*);
288     void setInjectedBundleFormClient(std::unique_ptr<API::InjectedBundle::FormClient>);
289     void initializeInjectedBundleLoaderClient(WKBundlePageLoaderClientBase*);
290     void initializeInjectedBundlePolicyClient(WKBundlePagePolicyClientBase*);
291     void initializeInjectedBundleResourceLoadClient(WKBundlePageResourceLoadClientBase*);
292     void setInjectedBundleUIClient(std::unique_ptr<API::InjectedBundle::PageUIClient>);
293 #if ENABLE(FULLSCREEN_API)
294     void initializeInjectedBundleFullScreenClient(WKBundlePageFullScreenClientBase*);
295 #endif
296     void initializeInjectedBundleDiagnosticLoggingClient(WKBundlePageDiagnosticLoggingClientBase*);
297
298 #if ENABLE(CONTEXT_MENUS)
299     API::InjectedBundle::PageContextMenuClient& injectedBundleContextMenuClient() { return *m_contextMenuClient.get(); }
300 #endif
301     InjectedBundlePageEditorClient& injectedBundleEditorClient() { return m_editorClient; }
302     API::InjectedBundle::FormClient& injectedBundleFormClient() { return *m_formClient.get(); }
303     InjectedBundlePageLoaderClient& injectedBundleLoaderClient() { return m_loaderClient; }
304     InjectedBundlePagePolicyClient& injectedBundlePolicyClient() { return m_policyClient; }
305     InjectedBundlePageResourceLoadClient& injectedBundleResourceLoadClient() { return m_resourceLoadClient; }
306     API::InjectedBundle::PageUIClient& injectedBundleUIClient() { return *m_uiClient.get(); }
307     InjectedBundlePageDiagnosticLoggingClient& injectedBundleDiagnosticLoggingClient() { return m_logDiagnosticMessageClient; }
308 #if ENABLE(FULLSCREEN_API)
309     InjectedBundlePageFullScreenClient& injectedBundleFullScreenClient() { return m_fullScreenClient; }
310 #endif
311
312     bool findStringFromInjectedBundle(const String&, FindOptions);
313
314     WebFrame* mainWebFrame() const { return m_mainFrame.get(); }
315
316     WebCore::MainFrame* mainFrame() const; // May return 0.
317     WebCore::FrameView* mainFrameView() const; // May return 0.
318
319     PassRefPtr<WebCore::Range> currentSelectionAsRange();
320
321 #if ENABLE(NETSCAPE_PLUGIN_API)
322     PassRefPtr<Plugin> createPlugin(WebFrame*, WebCore::HTMLPlugInElement*, const Plugin::Parameters&, String& newMIMEType);
323 #endif
324
325 #if ENABLE(WEBGL)
326     WebCore::WebGLLoadPolicy webGLPolicyForURL(WebFrame*, const String&);
327     WebCore::WebGLLoadPolicy resolveWebGLPolicyForURL(WebFrame*, const String&);
328 #endif // ENABLE(WEBGL)
329     
330     EditorState editorState() const;
331
332     String renderTreeExternalRepresentation() const;
333     String renderTreeExternalRepresentationForPrinting() const;
334     uint64_t renderTreeSize() const;
335
336     void setTracksRepaints(bool);
337     bool isTrackingRepaints() const;
338     void resetTrackedRepaints();
339     PassRefPtr<API::Array> trackedRepaintRects();
340
341     void executeEditingCommand(const String& commandName, const String& argument);
342     bool isEditingCommandEnabled(const String& commandName);
343     void clearMainFrameName();
344     void sendClose();
345
346     void sendSetWindowFrame(const WebCore::FloatRect&);
347
348     double textZoomFactor() const;
349     void setTextZoomFactor(double);
350     double pageZoomFactor() const;
351     void setPageZoomFactor(double);
352     void setPageAndTextZoomFactors(double pageZoomFactor, double textZoomFactor);
353     void windowScreenDidChange(uint32_t);
354
355     void scalePage(double scale, const WebCore::IntPoint& origin);
356     void scalePageInViewCoordinates(double scale, WebCore::IntPoint centerInViewCoordinates);
357     double pageScaleFactor() const;
358
359     void setUseFixedLayout(bool);
360     bool useFixedLayout() const { return m_useFixedLayout; }
361     void setFixedLayoutSize(const WebCore::IntSize&);
362     WebCore::IntSize fixedLayoutSize() const;
363
364     void listenForLayoutMilestones(uint32_t /* LayoutMilestones */);
365
366     void setSuppressScrollbarAnimations(bool);
367     
368     void setEnableVerticalRubberBanding(bool);
369     void setEnableHorizontalRubberBanding(bool);
370     
371     void setBackgroundExtendsBeyondPage(bool);
372
373     void setPaginationMode(uint32_t /* WebCore::Pagination::Mode */);
374     void setPaginationBehavesLikeColumns(bool);
375     void setPageLength(double);
376     void setGapBetweenPages(double);
377
378     void postInjectedBundleMessage(const String& messageName, const UserData&);
379
380     bool drawsBackground() const { return m_drawsBackground; }
381     bool drawsTransparentBackground() const { return m_drawsTransparentBackground; }
382
383     void setUnderlayColor(const WebCore::Color& color) { m_underlayColor = color; }
384     WebCore::Color underlayColor() const { return m_underlayColor; }
385
386     void stopLoading();
387     void stopLoadingFrame(uint64_t frameID);
388     bool defersLoading() const;
389     void setDefersLoading(bool deferLoading);
390
391     void enterAcceleratedCompositingMode(WebCore::GraphicsLayer*);
392     void exitAcceleratedCompositingMode();
393
394     void addPluginView(PluginView*);
395     void removePluginView(PluginView*);
396
397     bool isVisible() const { return m_viewState & WebCore::ViewState::IsVisible; }
398     bool isVisibleOrOccluded() const { return m_viewState & WebCore::ViewState::IsVisibleOrOccluded; }
399
400     LayerHostingMode layerHostingMode() const { return m_layerHostingMode; }
401     void setLayerHostingMode(unsigned);
402
403 #if PLATFORM(COCOA)
404     void updatePluginsActiveAndFocusedState();
405     const WebCore::FloatRect& windowFrameInScreenCoordinates() const { return m_windowFrameInScreenCoordinates; }
406     const WebCore::FloatRect& windowFrameInUnflippedScreenCoordinates() const { return m_windowFrameInUnflippedScreenCoordinates; }
407     const WebCore::FloatRect& viewFrameInWindowCoordinates() const { return m_viewFrameInWindowCoordinates; }
408
409     bool hasCachedWindowFrame() const { return m_hasCachedWindowFrame; }
410
411 #if !PLATFORM(IOS)
412     void setTopOverhangImage(PassRefPtr<WebImage>);
413     void setBottomOverhangImage(PassRefPtr<WebImage>);
414 #endif // !PLATFORM(IOS)
415
416     void updateHeaderAndFooterLayersForDeviceScaleChange(float scaleFactor);
417 #endif // PLATFORM(COCOA)
418
419     bool windowIsFocused() const;
420     bool windowAndWebPageAreFocused() const;
421
422 #if !PLATFORM(IOS)
423     void setHeaderPageBanner(PassRefPtr<PageBanner>);
424     PageBanner* headerPageBanner();
425     void setFooterPageBanner(PassRefPtr<PageBanner>);
426     PageBanner* footerPageBanner();
427
428     void hidePageBanners();
429     void showPageBanners();
430     
431 #endif // !PLATFORM(IOS)
432
433     WebCore::IntPoint screenToRootView(const WebCore::IntPoint&);
434     WebCore::IntRect rootViewToScreen(const WebCore::IntRect&);
435     
436 #if PLATFORM(IOS)
437     WebCore::IntPoint accessibilityScreenToRootView(const WebCore::IntPoint&);
438     WebCore::IntRect rootViewToAccessibilityScreen(const WebCore::IntRect&);
439 #endif
440     
441     PassRefPtr<WebImage> scaledSnapshotWithOptions(const WebCore::IntRect&, double additionalScaleFactor, SnapshotOptions);
442     PassRefPtr<WebImage> snapshotAtSize(const WebCore::IntRect&, const WebCore::IntSize& bitmapSize, SnapshotOptions);
443     PassRefPtr<WebImage> snapshotNode(WebCore::Node&, SnapshotOptions, unsigned maximumPixelCount = std::numeric_limits<unsigned>::max());
444
445     static const WebEvent* currentEvent();
446
447     FindController& findController() { return m_findController; }
448
449 #if ENABLE(GEOLOCATION)
450     GeolocationPermissionRequestManager& geolocationPermissionRequestManager() { return m_geolocationPermissionRequestManager; }
451 #endif
452
453 #if PLATFORM(IOS) || PLATFORM(EFL)
454     void savePageState(WebCore::HistoryItem&);
455     void restorePageState(const WebCore::HistoryItem&);
456 #endif
457
458 #if ENABLE(MEDIA_STREAM)
459     UserMediaPermissionRequestManager& userMediaPermissionRequestManager() { return m_userMediaPermissionRequestManager; }
460 #endif
461
462 #if PLATFORM(IOS)
463     WebCore::FloatSize screenSize() const;
464     WebCore::FloatSize availableScreenSize() const;
465     int32_t deviceOrientation() const { return m_deviceOrientation; }
466     void viewportPropertiesDidChange(const WebCore::ViewportArguments&);
467     void didReceiveMobileDocType(bool);
468
469     void setUseTestingViewportConfiguration(bool useTestingViewport) { m_useTestingViewportConfiguration = useTestingViewport; }
470     bool isUsingTestingViewportConfiguration() const { return m_useTestingViewportConfiguration; }
471
472     double minimumPageScaleFactor() const;
473     double maximumPageScaleFactor() const;
474     bool allowsUserScaling() const;
475     bool hasStablePageScaleFactor() const { return m_hasStablePageScaleFactor; }
476
477     void handleTap(const WebCore::IntPoint&, uint64_t lastLayerTreeTranscationId);
478     void potentialTapAtPosition(uint64_t requestID, const WebCore::FloatPoint&);
479     void commitPotentialTap(uint64_t lastLayerTreeTranscationId);
480     void commitPotentialTapFailed();
481     void cancelPotentialTap();
482     void tapHighlightAtPosition(uint64_t requestID, const WebCore::FloatPoint&);
483
484     void inspectorNodeSearchMovedToPosition(const WebCore::FloatPoint&);
485     void inspectorNodeSearchEndedAtPosition(const WebCore::FloatPoint&);
486
487     void blurAssistedNode();
488     void selectWithGesture(const WebCore::IntPoint&, uint32_t granularity, uint32_t gestureType, uint32_t gestureState, uint64_t callbackID);
489     void updateSelectionWithTouches(const WebCore::IntPoint& point, uint32_t touches, bool baseIsStart, uint64_t callbackID);
490     void updateBlockSelectionWithTouch(const WebCore::IntPoint&, uint32_t touch, uint32_t handlePosition);
491     void selectWithTwoTouches(const WebCore::IntPoint& from, const WebCore::IntPoint& to, uint32_t gestureType, uint32_t gestureState, uint64_t callbackID);
492     void extendSelection(uint32_t granularity);
493     void selectWordBackward();
494     void moveSelectionByOffset(int32_t offset, uint64_t callbackID);
495     void selectTextWithGranularityAtPoint(const WebCore::IntPoint&, uint32_t granularity, uint64_t callbackID);
496     void selectPositionAtBoundaryWithDirection(const WebCore::IntPoint&, uint32_t granularity, uint32_t direction, uint64_t callbackID);
497     void selectPositionAtPoint(const WebCore::IntPoint&, uint64_t callbackID);
498     void beginSelectionInDirection(uint32_t direction, uint64_t callbackID);
499     void updateSelectionWithExtentPoint(const WebCore::IntPoint&, uint64_t callbackID);
500
501     void elementDidFocus(WebCore::Node*);
502     void elementDidBlur(WebCore::Node*);
503     void requestDictationContext(uint64_t callbackID);
504     void replaceDictatedText(const String& oldText, const String& newText);
505     void replaceSelectedText(const String& oldText, const String& newText);
506     void requestAutocorrectionData(const String& textForAutocorrection, uint64_t callbackID);
507     void applyAutocorrection(const String& correction, const String& originalText, uint64_t callbackID);
508     void syncApplyAutocorrection(const String& correction, const String& originalText, bool& correctionApplied);
509     void requestAutocorrectionContext(uint64_t callbackID);
510     void getAutocorrectionContext(String& beforeText, String& markedText, String& selectedText, String& afterText, uint64_t& location, uint64_t& length);
511     void getPositionInformation(const WebCore::IntPoint&, InteractionInformationAtPosition&);
512     void requestPositionInformation(const WebCore::IntPoint&);
513     void startInteractionWithElementAtPosition(const WebCore::IntPoint&);
514     void stopInteraction();
515     void performActionOnElement(uint32_t action);
516     void focusNextAssistedNode(bool isForward, uint64_t callbackID);
517     void setAssistedNodeValue(const String&);
518     void setAssistedNodeValueAsNumber(double);
519     void setAssistedNodeSelectedIndex(uint32_t index, bool allowMultipleSelection);
520     void resetAssistedNodeForFrame(WebFrame*);
521     WebCore::IntRect rectForElementAtInteractionLocation();
522     void updateSelectionAppearance();
523
524 #if ENABLE(IOS_TOUCH_EVENTS)
525     void dispatchAsynchronousTouchEvents(const Vector<WebTouchEvent, 1>& queue);
526 #endif
527
528     void contentSizeCategoryDidChange(const String&);
529     void executeEditCommandWithCallback(const String&, uint64_t callbackID);
530
531     std::chrono::milliseconds eventThrottlingDelay() const;
532
533     void showInspectorHighlight(const WebCore::Highlight&);
534     void hideInspectorHighlight();
535
536     void showInspectorIndication();
537     void hideInspectorIndication();
538
539     void enableInspectorNodeSearch();
540     void disableInspectorNodeSearch();
541 #endif
542
543     NotificationPermissionRequestManager* notificationPermissionRequestManager();
544
545     void pageDidScroll();
546 #if USE(TILED_BACKING_STORE)
547     void pageDidRequestScroll(const WebCore::IntPoint&);
548     void setFixedVisibleContentRect(const WebCore::IntRect&);
549     void sendViewportAttributesChanged();
550 #endif
551
552 #if ENABLE(CONTEXT_MENUS)
553     WebContextMenu* contextMenu();
554     WebContextMenu* contextMenuAtPointInWindow(const WebCore::IntPoint&);
555 #endif
556     
557     bool hasLocalDataForURL(const WebCore::URL&);
558     String cachedResponseMIMETypeForURL(const WebCore::URL&);
559     String cachedSuggestedFilenameForURL(const WebCore::URL&);
560     PassRefPtr<WebCore::SharedBuffer> cachedResponseDataForURL(const WebCore::URL&);
561
562     static bool canHandleRequest(const WebCore::ResourceRequest&);
563
564     class SandboxExtensionTracker {
565     public:
566         ~SandboxExtensionTracker();
567
568         void invalidate();
569
570         void beginLoad(WebFrame*, const SandboxExtension::Handle& handle);
571         void willPerformLoadDragDestinationAction(PassRefPtr<SandboxExtension> pendingDropSandboxExtension);
572         void didStartProvisionalLoad(WebFrame*);
573         void didCommitProvisionalLoad(WebFrame*);
574         void didFailProvisionalLoad(WebFrame*);
575
576     private:
577         void setPendingProvisionalSandboxExtension(PassRefPtr<SandboxExtension>);
578
579         RefPtr<SandboxExtension> m_pendingProvisionalSandboxExtension;
580         RefPtr<SandboxExtension> m_provisionalSandboxExtension;
581         RefPtr<SandboxExtension> m_committedSandboxExtension;
582     };
583
584     SandboxExtensionTracker& sandboxExtensionTracker() { return m_sandboxExtensionTracker; }
585
586 #if PLATFORM(EFL)
587     void setThemePath(const String&);
588 #endif
589
590 #if USE(COORDINATED_GRAPHICS_MULTIPROCESS)
591     void commitPageTransitionViewport();
592 #endif
593
594 #if PLATFORM(GTK)
595     void setComposition(const String& text, const Vector<WebCore::CompositionUnderline>& underlines, uint64_t selectionStart, uint64_t selectionEnd, uint64_t replacementRangeStart, uint64_t replacementRangeLength);
596     void confirmComposition(const String& text, int64_t selectionStart, int64_t selectionLength);
597     void cancelComposition();
598 #endif
599
600 #if PLATFORM (GTK) && HAVE(GTK_GESTURES)
601     void getCenterForZoomGesture(const WebCore::IntPoint& centerInViewCoordinates, WebCore::IntPoint& result);
602 #endif
603
604     void didChangeSelection();
605     void discardedComposition();
606
607 #if PLATFORM(COCOA)
608     void registerUIProcessAccessibilityTokens(const IPC::DataReference& elemenToken, const IPC::DataReference& windowToken);
609     WKAccessibilityWebPageObject* accessibilityRemoteObject();
610     NSObject *accessibilityObjectForMainFramePlugin();
611     const WebCore::FloatPoint& accessibilityPosition() const { return m_accessibilityPosition; }
612     
613     void sendComplexTextInputToPlugin(uint64_t pluginComplexTextInputIdentifier, const String& textInput);
614
615     void insertTextAsync(const String& text, const EditingRange& replacementRange, bool registerUndoGroup = false);
616     void getMarkedRangeAsync(uint64_t callbackID);
617     void getSelectedRangeAsync(uint64_t callbackID);
618     void characterIndexForPointAsync(const WebCore::IntPoint&, uint64_t callbackID);
619     void firstRectForCharacterRangeAsync(const EditingRange&, uint64_t callbackID);
620     void setCompositionAsync(const String& text, Vector<WebCore::CompositionUnderline> underlines, const EditingRange& selectionRange, const EditingRange& replacementRange);
621     void confirmCompositionAsync();
622
623 #if PLATFORM(MAC)
624     void insertDictatedTextAsync(const String& text, const EditingRange& replacementRange, const Vector<WebCore::DictationAlternative>& dictationAlternativeLocations, bool registerUndoGroup = false);
625     void attributedSubstringForCharacterRangeAsync(const EditingRange&, uint64_t callbackID);
626     void fontAtSelection(uint64_t callbackID);
627 #if !USE(ASYNC_NSTEXTINPUTCLIENT)
628     void insertText(const String& text, const EditingRange& replacementRange, bool& handled, EditorState& newState);
629     void setComposition(const String& text, Vector<WebCore::CompositionUnderline> underlines, const EditingRange& selectionRange, const EditingRange& replacementRange, EditorState& newState);
630     void confirmComposition(EditorState& newState);
631     void insertDictatedText(const String& text, const EditingRange& replacementRange, const Vector<WebCore::DictationAlternative>& dictationAlternativeLocations, bool& handled, EditorState& newState);
632     void getAttributedSubstringFromRange(const EditingRange&, AttributedString&);
633     void getMarkedRange(EditingRange&);
634     void getSelectedRange(EditingRange&);
635     void characterIndexForPoint(const WebCore::IntPoint point, uint64_t& result);
636     void firstRectForCharacterRange(const EditingRange&, WebCore::IntRect& resultRect);
637     void executeKeypressCommands(const Vector<WebCore::KeypressCommand>&, bool& handled, EditorState& newState);
638     void cancelComposition(EditorState& newState);
639 #endif
640 #endif
641
642     void readSelectionFromPasteboard(const WTF::String& pasteboardName, bool& result);
643     void getStringSelectionForPasteboard(WTF::String& stringValue);
644     void getDataSelectionForPasteboard(const WTF::String pasteboardType, SharedMemory::Handle& handle, uint64_t& size);
645     void shouldDelayWindowOrderingEvent(const WebKit::WebMouseEvent&, bool& result);
646     void acceptsFirstMouse(int eventNumber, const WebKit::WebMouseEvent&, bool& result);
647     bool performNonEditingBehaviorForSelector(const String&, WebCore::KeyboardEvent*);
648
649 #if ENABLE(SERVICE_CONTROLS)
650     void replaceSelectionWithPasteboardData(const Vector<String>& types, const IPC::DataReference&);
651 #endif
652
653 #elif PLATFORM(EFL)
654     void confirmComposition(const String& compositionString);
655     void setComposition(const WTF::String& compositionString, const WTF::Vector<WebCore::CompositionUnderline>& underlines, uint64_t cursorPosition);
656     void cancelComposition();
657 #endif
658
659 #if HAVE(ACCESSIBILITY) && (PLATFORM(GTK) || PLATFORM(EFL))
660     void updateAccessibilityTree();
661 #endif
662
663     void setCompositionForTesting(const String& compositionString, uint64_t from, uint64_t length);
664     bool hasCompositionForTesting();
665     void confirmCompositionForTesting(const String& compositionString);
666
667     // FIXME: This a dummy message, to avoid breaking the build for platforms that don't require
668     // any synchronous messages, and should be removed when <rdar://problem/8775115> is fixed.
669     void dummy(bool&);
670
671 #if PLATFORM(COCOA)
672     bool isSpeaking();
673     void speak(const String&);
674     void stopSpeaking();
675
676     void performDictionaryLookupForSelection(WebCore::Frame*, const WebCore::VisibleSelection&, WebCore::TextIndicatorPresentationTransition);
677 #endif
678
679     bool isSmartInsertDeleteEnabled();
680     void setSmartInsertDeleteEnabled(bool);
681
682     bool isSelectTrailingWhitespaceEnabled();
683     void setSelectTrailingWhitespaceEnabled(bool);
684
685     void replaceSelectionWithText(WebCore::Frame*, const String&);
686     void clearSelection();
687     void restoreSelectionInFocusedEditableElement();
688
689 #if ENABLE(DRAG_SUPPORT)
690 #if PLATFORM(GTK)
691     void performDragControllerAction(uint64_t action, WebCore::DragData);
692 #else
693     void performDragControllerAction(uint64_t action, WebCore::IntPoint clientPosition, WebCore::IntPoint globalPosition, uint64_t draggingSourceOperationMask, const WTF::String& dragStorageName, uint32_t flags, const SandboxExtension::Handle&, const SandboxExtension::HandleArray&);
694 #endif
695     void dragEnded(WebCore::IntPoint clientPosition, WebCore::IntPoint globalPosition, uint64_t operation);
696
697     void willPerformLoadDragDestinationAction();
698     void mayPerformUploadDragDestinationAction();
699
700     void willStartDrag() { ASSERT(!m_isStartingDrag); m_isStartingDrag = true; }
701     void didStartDrag() { ASSERT(m_isStartingDrag); m_isStartingDrag = false; }
702 #endif // ENABLE(DRAG_SUPPORT)
703
704     void beginPrinting(uint64_t frameID, const PrintInfo&);
705     void endPrinting();
706     void computePagesForPrinting(uint64_t frameID, const PrintInfo&, uint64_t callbackID);
707     void computePagesForPrintingImpl(uint64_t frameID, const PrintInfo&, Vector<WebCore::IntRect>& pageRects, double& totalScaleFactor);
708 #if PLATFORM(COCOA)
709     void drawRectToImage(uint64_t frameID, const PrintInfo&, const WebCore::IntRect&, const WebCore::IntSize&, uint64_t callbackID);
710     void drawPagesToPDF(uint64_t frameID, const PrintInfo&, uint32_t first, uint32_t count, uint64_t callbackID);
711     void drawPagesToPDFImpl(uint64_t frameID, const PrintInfo&, uint32_t first, uint32_t count, RetainPtr<CFMutableDataRef>& pdfPageData);
712 #if PLATFORM(IOS)
713     void computePagesForPrintingAndStartDrawingToPDF(uint64_t frameID, const PrintInfo&, uint32_t firstPage, PassRefPtr<Messages::WebPage::ComputePagesForPrintingAndStartDrawingToPDF::DelayedReply>);
714 #endif
715 #elif PLATFORM(GTK)
716     void drawPagesForPrinting(uint64_t frameID, const PrintInfo&, uint64_t callbackID);
717     void didFinishPrintOperation(const WebCore::ResourceError&, uint64_t callbackID);
718 #endif
719
720     void addResourceRequest(unsigned long, const WebCore::ResourceRequest&);
721     void removeResourceRequest(unsigned long);
722
723     void setMediaVolume(float);
724     void setMuted(bool);
725     void setMayStartMediaWhenInWindow(bool);
726
727     void updateMainFrameScrollOffsetPinning();
728
729     bool mainFrameHasCustomContentProvider() const;
730     void addMIMETypeWithCustomContentProvider(const String&);
731
732     void mainFrameDidLayout();
733
734     bool canRunBeforeUnloadConfirmPanel() const { return m_canRunBeforeUnloadConfirmPanel; }
735     void setCanRunBeforeUnloadConfirmPanel(bool canRunBeforeUnloadConfirmPanel) { m_canRunBeforeUnloadConfirmPanel = canRunBeforeUnloadConfirmPanel; }
736
737     bool canRunModal() const { return m_canRunModal; }
738     void setCanRunModal(bool canRunModal) { m_canRunModal = canRunModal; }
739
740     void runModal();
741
742     void setDeviceScaleFactor(float);
743     float deviceScaleFactor() const;
744
745     void forceRepaintWithoutCallback();
746
747     void unmarkAllMisspellings();
748     void unmarkAllBadGrammar();
749 #if PLATFORM(COCOA)
750     void handleAlternativeTextUIResult(const String&);
751 #endif
752
753     // For testing purpose.
754     void simulateMouseDown(int button, WebCore::IntPoint, int clickCount, WKEventModifiers, double time);
755     void simulateMouseUp(int button, WebCore::IntPoint, int clickCount, WKEventModifiers, double time);
756     void simulateMouseMotion(WebCore::IntPoint, double time);
757
758 #if ENABLE(CONTEXT_MENUS)
759     void contextMenuShowing() { m_isShowingContextMenu = true; }
760 #endif
761
762     void wheelEvent(const WebWheelEvent&);
763
764     void wheelEventHandlersChanged(bool);
765     void recomputeShortCircuitHorizontalWheelEventsState();
766
767     void updateVisibilityState(bool isInitialState = false);
768
769 #if PLATFORM(IOS)
770     void setViewportConfigurationMinimumLayoutSize(const WebCore::FloatSize&);
771     void setMaximumUnobscuredSize(const WebCore::FloatSize&);
772     void setDeviceOrientation(int32_t);
773     void dynamicViewportSizeUpdate(const WebCore::FloatSize& minimumLayoutSize, const WebCore::FloatSize& maximumUnobscuredSize, const WebCore::FloatRect& targetExposedContentRect, const WebCore::FloatRect& targetUnobscuredRect, const WebCore::FloatRect& targetUnobscuredRectInScrollViewCoordinates, double scale, int32_t deviceOrientation);
774     void synchronizeDynamicViewportUpdate(double& newTargetScale, WebCore::FloatPoint& newScrollPosition, uint64_t& nextValidLayerTreeTransactionID);
775     void updateVisibleContentRects(const VisibleContentRectUpdateInfo&, double oldestTimestamp);
776     bool scaleWasSetByUIProcess() const { return m_scaleWasSetByUIProcess; }
777     void willStartUserTriggeredZooming();
778     void applicationWillResignActive();
779     void applicationWillEnterForeground();
780     void applicationDidBecomeActive();
781     void zoomToRect(WebCore::FloatRect, double minimumScale, double maximumScale);
782     void completePendingSyntheticClickForContentChangeObserver();
783 #endif
784
785 #if ENABLE(IOS_TOUCH_EVENTS)
786     void dispatchTouchEvent(const WebTouchEvent&, bool& handled);
787 #endif
788
789 #if PLATFORM(GTK) && USE(TEXTURE_MAPPER_GL)
790     uint64_t nativeWindowHandle() { return m_nativeWindowHandle; }
791 #endif
792
793     bool shouldUseCustomContentProviderForResponse(const WebCore::ResourceResponse&);
794     bool canPluginHandleResponse(const WebCore::ResourceResponse& response);
795
796     bool asynchronousPluginInitializationEnabled() const { return m_asynchronousPluginInitializationEnabled; }
797     void setAsynchronousPluginInitializationEnabled(bool enabled) { m_asynchronousPluginInitializationEnabled = enabled; }
798     bool asynchronousPluginInitializationEnabledForAllPlugins() const { return m_asynchronousPluginInitializationEnabledForAllPlugins; }
799     void setAsynchronousPluginInitializationEnabledForAllPlugins(bool enabled) { m_asynchronousPluginInitializationEnabledForAllPlugins = enabled; }
800     bool artificialPluginInitializationDelayEnabled() const { return m_artificialPluginInitializationDelayEnabled; }
801     void setArtificialPluginInitializationDelayEnabled(bool enabled) { m_artificialPluginInitializationDelayEnabled = enabled; }
802     void setTabToLinksEnabled(bool enabled) { m_tabToLinks = enabled; }
803     bool tabToLinksEnabled() const { return m_tabToLinks; }
804
805     bool scrollingPerformanceLoggingEnabled() const { return m_scrollingPerformanceLoggingEnabled; }
806     void setScrollingPerformanceLoggingEnabled(bool);
807
808 #if PLATFORM(COCOA)
809     bool shouldUsePDFPlugin() const;
810     bool pdfPluginEnabled() const { return m_pdfPluginEnabled; }
811     void setPDFPluginEnabled(bool enabled) { m_pdfPluginEnabled = enabled; }
812 #endif
813
814     void savePDFToFileInDownloadsFolder(const String& suggestedFilename, const String& originatingURLString, const uint8_t* data, unsigned long size);
815 #if PLATFORM(COCOA)
816     void savePDFToTemporaryFolderAndOpenWithNativeApplication(const String& suggestedFilename, const String& originatingURLString, const uint8_t* data, unsigned long size, const String& pdfUUID);
817 #endif
818
819     bool mainFrameIsScrollable() const { return m_mainFrameIsScrollable; }
820
821     void setMinimumLayoutSize(const WebCore::IntSize&);
822     WebCore::IntSize minimumLayoutSize() const { return m_minimumLayoutSize; }
823
824     void setAutoSizingShouldExpandToViewHeight(bool shouldExpand);
825     bool autoSizingShouldExpandToViewHeight() { return m_autoSizingShouldExpandToViewHeight; }
826
827     bool canShowMIMEType(const String& MIMEType) const;
828
829     void addTextCheckingRequest(uint64_t requestID, PassRefPtr<WebCore::TextCheckingRequest>);
830     void didFinishCheckingText(uint64_t requestID, const Vector<WebCore::TextCheckingResult>&);
831     void didCancelCheckingText(uint64_t requestID);
832
833 #if ENABLE(PRIMARY_SNAPSHOTTED_PLUGIN_HEURISTIC)
834     void determinePrimarySnapshottedPlugIn();
835     void determinePrimarySnapshottedPlugInTimerFired();
836     void resetPrimarySnapshottedPlugIn();
837     bool matchesPrimaryPlugIn(const String& pageOrigin, const String& pluginOrigin, const String& mimeType) const;
838     bool plugInIntersectsSearchRect(WebCore::HTMLPlugInImageElement& pluginImageElement);
839     bool plugInIsPrimarySize(WebCore::HTMLPlugInImageElement& pluginImageElement, unsigned &pluginArea);
840 #endif
841
842     unsigned extendIncrementalRenderingSuppression();
843     void stopExtendingIncrementalRenderingSuppression(unsigned token);
844     bool shouldExtendIncrementalRenderingSuppression() { return !m_activeRenderingSuppressionTokens.isEmpty(); }
845
846     WebCore::ScrollPinningBehavior scrollPinningBehavior() { return m_scrollPinningBehavior; }
847     void setScrollPinningBehavior(uint32_t /* WebCore::ScrollPinningBehavior */ pinning);
848
849     PassRefPtr<WebCore::DocumentLoader> createDocumentLoader(WebCore::Frame&, const WebCore::ResourceRequest&, const WebCore::SubstituteData&);
850
851     void getBytecodeProfile(uint64_t callbackID);
852     
853     // Some platforms require accessibility-enabled processes to spin the run loop so that the WebProcess doesn't hang.
854     // While this is not ideal, it does not have to be applied to every platform at the moment.
855     static bool synchronousMessagesShouldSpinRunLoop();
856
857 #if ENABLE(SERVICE_CONTROLS) || ENABLE(TELEPHONE_NUMBER_DETECTION)
858     void handleTelephoneNumberClick(const String& number, const WebCore::IntPoint&);
859     void handleSelectionServiceClick(WebCore::FrameSelection&, const Vector<String>& telephoneNumbers, const WebCore::IntPoint&);
860 #endif
861
862     void didChangeScrollOffsetForFrame(WebCore::Frame*);
863
864     void setMainFrameProgressCompleted(bool completed) { m_mainFrameProgressCompleted = completed; }
865     bool shouldDispatchFakeMouseMoveEvents() const { return m_shouldDispatchFakeMouseMoveEvents; }
866
867     void setPageActivityState(WebCore::PageActivityState::Flags);
868
869     void postMessage(const String& messageName, API::Object* messageBody);
870     void postSynchronousMessage(const String& messageName, API::Object* messageBody, RefPtr<API::Object>& returnData);
871
872 private:
873     WebPage(uint64_t pageID, const WebPageCreationParameters&);
874
875     // IPC::MessageSender
876     virtual IPC::Connection* messageSenderConnection() override;
877     virtual uint64_t messageSenderDestinationID() override;
878
879     void platformInitialize();
880     void platformDetach();
881     void platformEditorState(WebCore::Frame&, EditorState& result) const;
882
883     void didReceiveWebPageMessage(IPC::Connection&, IPC::MessageDecoder&);
884     void didReceiveSyncWebPageMessage(IPC::Connection&, IPC::MessageDecoder&, std::unique_ptr<IPC::MessageEncoder>&);
885
886 #if PLATFORM(IOS)
887     void resetViewportDefaultConfiguration(WebFrame* mainFrame);
888     void viewportConfigurationChanged();
889     void updateViewportSizeForCSSViewportUnits();
890
891     static void convertSelectionRectsToRootView(WebCore::FrameView*, Vector<WebCore::SelectionRect>&);
892     PassRefPtr<WebCore::Range> rangeForWebSelectionAtPosition(const WebCore::IntPoint&, const WebCore::VisiblePosition&, SelectionFlags&);
893     PassRefPtr<WebCore::Range> rangeForBlockAtPoint(const WebCore::IntPoint&);
894     void computeExpandAndShrinkThresholdsForHandle(const WebCore::IntPoint&, SelectionHandlePosition, float& growThreshold, float& shrinkThreshold);
895     PassRefPtr<WebCore::Range> changeBlockSelection(const WebCore::IntPoint&, SelectionHandlePosition, float& growThreshold, float& shrinkThreshold, SelectionFlags&);
896     PassRefPtr<WebCore::Range> expandedRangeFromHandle(WebCore::Range*, SelectionHandlePosition);
897     PassRefPtr<WebCore::Range> contractedRangeFromHandle(WebCore::Range* currentRange, SelectionHandlePosition, SelectionFlags&);
898     void getAssistedNodeInformation(AssistedNodeInformation&);
899     void platformInitializeAccessibility();
900     void handleSyntheticClick(WebCore::Node* nodeRespondingToClick, const WebCore::FloatPoint& location);
901     void completeSyntheticClick(WebCore::Node* nodeRespondingToClick, const WebCore::FloatPoint& location);
902     void sendTapHighlightForNodeIfNecessary(uint64_t requestID, WebCore::Node*);
903     void resetTextAutosizingBeforeLayoutIfNeeded(const WebCore::FloatSize& oldSize, const WebCore::FloatSize& newSize);
904     WebCore::VisiblePosition visiblePositionInFocusedNodeForPoint(WebCore::Frame&, const WebCore::IntPoint&);
905 #endif
906 #if !PLATFORM(COCOA)
907     static const char* interpretKeyEvent(const WebCore::KeyboardEvent*);
908 #endif
909     bool performDefaultBehaviorForKeyEvent(const WebKeyboardEvent&);
910
911 #if PLATFORM(MAC)
912     bool executeKeypressCommandsInternal(const Vector<WebCore::KeypressCommand>&, WebCore::KeyboardEvent*);
913 #endif
914
915     String sourceForFrame(WebFrame*);
916
917     void loadDataImpl(uint64_t navigationID, PassRefPtr<WebCore::SharedBuffer>, const String& MIMEType, const String& encodingName, const WebCore::URL& baseURL, const WebCore::URL& failingURL, const UserData&);
918     void loadString(uint64_t navigationID, const String&, const String& MIMEType, const WebCore::URL& baseURL, const WebCore::URL& failingURL, const UserData&);
919
920     bool platformHasLocalDataForURL(const WebCore::URL&);
921
922     // Actions
923     void tryClose();
924     void loadRequest(uint64_t navigationID, const WebCore::ResourceRequest&, const SandboxExtension::Handle&, const UserData&);
925     void loadData(const IPC::DataReference&, const String& MIMEType, const String& encodingName, const String& baseURL, const UserData&);
926     void loadHTMLString(uint64_t navigationID, const String& htmlString, const String& baseURL, const UserData&);
927     void loadAlternateHTMLString(const String& htmlString, const String& baseURL, const String& unreachableURL, const UserData&);
928     void loadPlainTextString(const String&, const UserData&);
929     void loadWebArchiveData(const IPC::DataReference&, const UserData&);
930     void navigateToURLWithSimulatedClick(const String& url, WebCore::IntPoint documentPoint, WebCore::IntPoint screenPoint);
931     void reload(uint64_t navigationID, bool reloadFromOrigin, const SandboxExtension::Handle&);
932     void goForward(uint64_t navigationID, uint64_t);
933     void goBack(uint64_t navigationID, uint64_t);
934     void goToBackForwardItem(uint64_t navigationID, uint64_t);
935     void tryRestoreScrollPosition();
936     void setInitialFocus(bool forward, bool isKeyboardEventValid, const WebKeyboardEvent&, uint64_t callbackID);
937     void setWindowResizerSize(const WebCore::IntSize&);
938     void updateIsInWindow(bool isInitialState = false);
939     void setViewState(WebCore::ViewState::Flags, bool wantsDidUpdateViewState, const Vector<uint64_t>& callbackIDs);
940     void validateCommand(const String&, uint64_t);
941     void executeEditCommand(const String&);
942     void setEditable(bool);
943
944     void updateUserActivity();
945
946     void mouseEvent(const WebMouseEvent&);
947     void mouseEventSyncForTesting(const WebMouseEvent&, bool&);
948     void wheelEventSyncForTesting(const WebWheelEvent&, bool&);
949     void keyEvent(const WebKeyboardEvent&);
950     void keyEventSyncForTesting(const WebKeyboardEvent&, bool&);
951 #if ENABLE(IOS_TOUCH_EVENTS)
952     void touchEventSync(const WebTouchEvent&, bool& handled);
953 #elif ENABLE(TOUCH_EVENTS)
954     void touchEvent(const WebTouchEvent&);
955     void touchEventSyncForTesting(const WebTouchEvent&, bool& handled);
956 #endif
957 #if ENABLE(CONTEXT_MENUS)
958     void contextMenuHidden() { m_isShowingContextMenu = false; }
959 #endif
960
961     static bool scroll(WebCore::Page*, WebCore::ScrollDirection, WebCore::ScrollGranularity);
962     static bool logicalScroll(WebCore::Page*, WebCore::ScrollLogicalDirection, WebCore::ScrollGranularity);
963
964     void loadURLInFrame(const String&, uint64_t frameID);
965
966     void restoreSession(const Vector<BackForwardListItemState>&);
967     void didRemoveBackForwardItem(uint64_t);
968
969 #if ENABLE(REMOTE_INSPECTOR)
970     void setAllowsRemoteInspection(bool);
971 #endif
972
973     void setDrawsBackground(bool);
974     void setDrawsTransparentBackground(bool);
975
976     void setTopContentInset(float);
977
978     void viewWillStartLiveResize();
979     void viewWillEndLiveResize();
980
981     void getContentsAsString(uint64_t callbackID);
982 #if ENABLE(MHTML)
983     void getContentsAsMHTMLData(uint64_t callbackID, bool useBinaryEncoding);
984 #endif
985     void getMainResourceDataOfFrame(uint64_t frameID, uint64_t callbackID);
986     void getResourceDataFromFrame(uint64_t frameID, const String& resourceURL, uint64_t callbackID);
987     void getRenderTreeExternalRepresentation(uint64_t callbackID);
988     void getSelectionOrContentsAsString(uint64_t callbackID);
989     void getSelectionAsWebArchiveData(uint64_t callbackID);
990     void getSourceForFrame(uint64_t frameID, uint64_t callbackID);
991     void getWebArchiveOfFrame(uint64_t frameID, uint64_t callbackID);
992     void runJavaScriptInMainFrame(const String&, uint64_t callbackID);
993     void forceRepaint(uint64_t callbackID);
994     void takeSnapshot(WebCore::IntRect snapshotRect, WebCore::IntSize bitmapSize, uint32_t options, uint64_t callbackID);
995
996     void preferencesDidChange(const WebPreferencesStore&);
997     void platformPreferencesDidChange(const WebPreferencesStore&);
998     void updatePreferences(const WebPreferencesStore&);
999
1000     void didReceivePolicyDecision(uint64_t frameID, uint64_t listenerID, uint32_t policyAction, uint64_t navigationID, uint64_t downloadID);
1001     void setUserAgent(const String&);
1002     void setCustomTextEncodingName(const String&);
1003     void suspendActiveDOMObjectsAndAnimations();
1004     void resumeActiveDOMObjectsAndAnimations();
1005
1006 #if PLATFORM(COCOA)
1007     void performDictionaryLookupAtLocation(const WebCore::FloatPoint&);
1008     void performDictionaryLookupOfCurrentSelection();
1009     void performDictionaryLookupForRange(WebCore::Frame*, WebCore::Range&, NSDictionary *options, WebCore::TextIndicatorPresentationTransition);
1010     DictionaryPopupInfo dictionaryPopupInfoForRange(WebCore::Frame* frame, WebCore::Range& range, NSDictionary **options, WebCore::TextIndicatorPresentationTransition presentationTransition);
1011
1012     void windowAndViewFramesChanged(const WebCore::FloatRect& windowFrameInScreenCoordinates, const WebCore::FloatRect& windowFrameInUnflippedScreenCoordinates, const WebCore::FloatRect& viewFrameInWindowCoordinates, const WebCore::FloatPoint& accessibilityViewCoordinates);
1013
1014     RetainPtr<PDFDocument> pdfDocumentForPrintingFrame(WebCore::Frame*);
1015     void computePagesForPrintingPDFDocument(uint64_t frameID, const PrintInfo&, Vector<WebCore::IntRect>& resultPageRects);
1016     void drawPDFDocument(CGContextRef, PDFDocument *, const PrintInfo&, const WebCore::IntRect&);
1017     void drawPagesToPDFFromPDFDocument(CGContextRef, PDFDocument *, const PrintInfo&, uint32_t first, uint32_t count);
1018 #endif
1019
1020     void setMainFrameIsScrollable(bool);
1021
1022     void unapplyEditCommand(uint64_t commandID);
1023     void reapplyEditCommand(uint64_t commandID);
1024     void didRemoveEditCommand(uint64_t commandID);
1025
1026     void findString(const String&, uint32_t findOptions, uint32_t maxMatchCount);
1027     void findStringMatches(const String&, uint32_t findOptions, uint32_t maxMatchCount);
1028     void getImageForFindMatch(uint32_t matchIndex);
1029     void selectFindMatch(uint32_t matchIndex);
1030     void hideFindUI();
1031     void countStringMatches(const String&, uint32_t findOptions, uint32_t maxMatchCount);
1032
1033 #if USE(COORDINATED_GRAPHICS_MULTIPROCESS)
1034     void findZoomableAreaForPoint(const WebCore::IntPoint&, const WebCore::IntSize& area);
1035 #endif
1036
1037     void didChangeSelectedIndexForActivePopupMenu(int32_t newIndex);
1038     void setTextForActivePopupMenu(int32_t index);
1039
1040 #if PLATFORM(GTK)
1041     void failedToShowPopupMenu();
1042 #endif
1043
1044 #if PLATFORM(IOS)
1045     void didChooseFilesForOpenPanelWithDisplayStringAndIcon(const Vector<String>&, const String& displayString, const IPC::DataReference& iconData);
1046 #endif
1047     void didChooseFilesForOpenPanel(const Vector<String>&);
1048     void didCancelForOpenPanel();
1049 #if ENABLE(SANDBOX_EXTENSIONS)
1050     void extendSandboxForFileFromOpenPanel(const SandboxExtension::Handle&);
1051 #endif
1052
1053     void didReceiveGeolocationPermissionDecision(uint64_t geolocationID, bool allowed);
1054
1055     void didReceiveNotificationPermissionDecision(uint64_t notificationID, bool allowed);
1056
1057 #if ENABLE(MEDIA_STREAM)
1058     void didReceiveUserMediaPermissionDecision(uint64_t userMediaID, bool allowed);
1059 #endif
1060
1061     void advanceToNextMisspelling(bool startBeforeSelection);
1062     void changeSpellingToWord(const String& word);
1063 #if USE(APPKIT)
1064     void uppercaseWord();
1065     void lowercaseWord();
1066     void capitalizeWord();
1067 #endif
1068
1069 #if ENABLE(CONTEXT_MENUS)
1070     void didSelectItemFromActiveContextMenu(const WebContextMenuItemData&);
1071 #endif
1072
1073     void changeSelectedIndex(int32_t index);
1074     void setCanStartMediaTimerFired();
1075
1076     bool canHandleUserEvents() const;
1077
1078     static bool platformCanHandleRequest(const WebCore::ResourceRequest&);
1079
1080     static PluginView* focusedPluginViewForFrame(WebCore::Frame&);
1081     static PluginView* pluginViewForFrame(WebCore::Frame*);
1082
1083     static PassRefPtr<WebCore::Range> rangeFromEditingRange(WebCore::Frame&, const EditingRange&);
1084
1085     void reportUsedFeatures();
1086
1087 #if PLATFORM(MAC)
1088     void performActionMenuHitTestAtLocation(WebCore::FloatPoint, bool forImmediateAction);
1089     PassRefPtr<WebCore::Range> lookupTextAtLocation(WebCore::FloatPoint, NSDictionary **options);
1090     void selectLastActionMenuRange();
1091     void focusAndSelectLastActionMenuHitTestResult();
1092     void inputDeviceForceDidChange(float force, int stage);
1093     void immediateActionDidUpdate();
1094     void immediateActionDidCancel();
1095     void immediateActionDidComplete();
1096     void setFont(const String& fontFamily, double fontSize, uint64_t fontTraits);
1097
1098     void dataDetectorsDidPresentUI(WebCore::PageOverlay::PageOverlayID);
1099     void dataDetectorsDidChangeUI(WebCore::PageOverlay::PageOverlayID);
1100     void dataDetectorsDidHideUI(WebCore::PageOverlay::PageOverlayID);
1101 #endif
1102
1103     void setShouldDispatchFakeMouseMoveEvents(bool dispatch) { m_shouldDispatchFakeMouseMoveEvents = dispatch; }
1104
1105 #if ENABLE(WIRELESS_PLAYBACK_TARGET) && !PLATFORM(IOS)
1106     void playbackTargetSelected(const WebCore::MediaPlaybackTarget& outputDevice) const;
1107     void playbackTargetAvailabilityDidChange(bool);
1108 #endif
1109
1110     uint64_t m_pageID;
1111
1112     std::unique_ptr<WebCore::Page> m_page;
1113     RefPtr<WebFrame> m_mainFrame;
1114     RefPtr<InjectedBundleBackForwardList> m_backForwardList;
1115
1116     RefPtr<WebPageGroupProxy> m_pageGroup;
1117
1118     String m_userAgent;
1119
1120     WebCore::IntSize m_viewSize;
1121     std::unique_ptr<DrawingArea> m_drawingArea;
1122
1123     HashSet<PluginView*> m_pluginViews;
1124     bool m_hasSeenPlugin;
1125
1126     HashMap<uint64_t, RefPtr<WebCore::TextCheckingRequest>> m_pendingTextCheckingRequestMap;
1127
1128     bool m_useFixedLayout;
1129
1130     bool m_drawsBackground;
1131     bool m_drawsTransparentBackground;
1132
1133     WebCore::Color m_underlayColor;
1134
1135     bool m_isInRedo;
1136     bool m_isClosed;
1137
1138     bool m_tabToLinks;
1139     
1140     bool m_asynchronousPluginInitializationEnabled;
1141     bool m_asynchronousPluginInitializationEnabledForAllPlugins;
1142     bool m_artificialPluginInitializationDelayEnabled;
1143
1144     bool m_scrollingPerformanceLoggingEnabled;
1145
1146     bool m_mainFrameIsScrollable;
1147
1148 #if ENABLE(PRIMARY_SNAPSHOTTED_PLUGIN_HEURISTIC)
1149     bool m_readyToFindPrimarySnapshottedPlugin;
1150     bool m_didFindPrimarySnapshottedPlugin;
1151     unsigned m_numberOfPrimarySnapshotDetectionAttempts;
1152     String m_primaryPlugInPageOrigin;
1153     String m_primaryPlugInOrigin;
1154     String m_primaryPlugInMimeType;
1155     RunLoop::Timer<WebPage> m_determinePrimarySnapshottedPlugInTimer;
1156 #endif
1157
1158     // The layer hosting mode.
1159     LayerHostingMode m_layerHostingMode;
1160
1161 #if PLATFORM(COCOA)
1162     bool m_pdfPluginEnabled;
1163
1164     bool m_hasCachedWindowFrame;
1165
1166     // The frame of the containing window in screen coordinates.
1167     WebCore::FloatRect m_windowFrameInScreenCoordinates;
1168
1169     // The frame of the containing window in unflipped screen coordinates.
1170     WebCore::FloatRect m_windowFrameInUnflippedScreenCoordinates;
1171
1172     // The frame of the view in window coordinates.
1173     WebCore::FloatRect m_viewFrameInWindowCoordinates;
1174
1175     // The accessibility position of the view.
1176     WebCore::FloatPoint m_accessibilityPosition;
1177     
1178     RetainPtr<WKAccessibilityWebPageObject> m_mockAccessibilityElement;
1179
1180     ViewGestureGeometryCollector m_viewGestureGeometryCollector;
1181
1182 #elif HAVE(ACCESSIBILITY) && (PLATFORM(GTK) || PLATFORM(EFL))
1183     GRefPtr<WebPageAccessibilityObject> m_accessibilityObject;
1184 #endif
1185
1186 #if PLATFORM(GTK) && USE(TEXTURE_MAPPER_GL)
1187     // Our view's window in the UI process.
1188     uint64_t m_nativeWindowHandle;
1189 #endif
1190
1191 #if !PLATFORM(IOS)
1192     RefPtr<PageBanner> m_headerBanner;
1193     RefPtr<PageBanner> m_footerBanner;
1194 #endif // !PLATFORM(IOS)
1195
1196     RunLoop::Timer<WebPage> m_setCanStartMediaTimer;
1197     bool m_mayStartMediaWhenInWindow;
1198
1199     HashMap<uint64_t, RefPtr<WebUndoStep>> m_undoStepMap;
1200
1201     WebCore::IntSize m_windowResizerSize;
1202
1203 #if ENABLE(CONTEXT_MENUS)
1204     std::unique_ptr<API::InjectedBundle::PageContextMenuClient> m_contextMenuClient;
1205 #endif
1206     InjectedBundlePageEditorClient m_editorClient;
1207     std::unique_ptr<API::InjectedBundle::FormClient> m_formClient;
1208     InjectedBundlePageLoaderClient m_loaderClient;
1209     InjectedBundlePagePolicyClient m_policyClient;
1210     InjectedBundlePageResourceLoadClient m_resourceLoadClient;
1211     std::unique_ptr<API::InjectedBundle::PageUIClient> m_uiClient;
1212 #if ENABLE(FULLSCREEN_API)
1213     InjectedBundlePageFullScreenClient m_fullScreenClient;
1214 #endif
1215     InjectedBundlePageDiagnosticLoggingClient m_logDiagnosticMessageClient;
1216
1217     FindController m_findController;
1218
1219     RefPtr<WebInspector> m_inspector;
1220     RefPtr<WebInspectorUI> m_inspectorUI;
1221 #if PLATFORM(IOS)
1222     RefPtr<WebVideoFullscreenManager> m_videoFullscreenManager;
1223 #endif
1224 #if ENABLE(FULLSCREEN_API)
1225     RefPtr<WebFullScreenManager> m_fullScreenManager;
1226 #endif
1227     RefPtr<WebPopupMenu> m_activePopupMenu;
1228 #if ENABLE(CONTEXT_MENUS)
1229     RefPtr<WebContextMenu> m_contextMenu;
1230 #endif
1231 #if ENABLE(INPUT_TYPE_COLOR)
1232     WebColorChooser* m_activeColorChooser;
1233 #endif
1234     RefPtr<WebOpenPanelResultListener> m_activeOpenPanelResultListener;
1235     RefPtr<NotificationPermissionRequestManager> m_notificationPermissionRequestManager;
1236
1237     RefPtr<WebUserContentController> m_userContentController;
1238
1239 #if ENABLE(GEOLOCATION)
1240     GeolocationPermissionRequestManager m_geolocationPermissionRequestManager;
1241 #endif
1242
1243 #if ENABLE(MEDIA_STREAM)
1244     UserMediaPermissionRequestManager m_userMediaPermissionRequestManager;
1245 #endif
1246
1247     std::unique_ptr<WebCore::PrintContext> m_printContext;
1248 #if PLATFORM(GTK)
1249     RefPtr<WebPrintOperationGtk> m_printOperation;
1250 #endif
1251
1252     SandboxExtensionTracker m_sandboxExtensionTracker;
1253
1254     RefPtr<SandboxExtension> m_pendingDropSandboxExtension;
1255     Vector<RefPtr<SandboxExtension>> m_pendingDropExtensionsForFileUpload;
1256
1257     bool m_canRunBeforeUnloadConfirmPanel;
1258
1259     bool m_canRunModal;
1260     bool m_isRunningModal;
1261
1262 #if ENABLE(DRAG_SUPPORT)
1263     bool m_isStartingDrag;
1264 #endif
1265
1266     bool m_cachedMainFrameIsPinnedToLeftSide;
1267     bool m_cachedMainFrameIsPinnedToRightSide;
1268     bool m_cachedMainFrameIsPinnedToTopSide;
1269     bool m_cachedMainFrameIsPinnedToBottomSide;
1270     bool m_canShortCircuitHorizontalWheelEvents;
1271     bool m_hasWheelEventHandlers;
1272
1273     unsigned m_cachedPageCount;
1274
1275     HashSet<unsigned long> m_trackedNetworkResourceRequestIdentifiers;
1276
1277     WebCore::IntSize m_minimumLayoutSize;
1278     bool m_autoSizingShouldExpandToViewHeight;
1279
1280 #if ENABLE(CONTEXT_MENUS)
1281     bool m_isShowingContextMenu;
1282 #endif
1283     
1284 #if PLATFORM(IOS)
1285     RefPtr<WebCore::Node> m_assistedNode;
1286     RefPtr<WebCore::Range> m_currentWordRange;
1287     RefPtr<WebCore::Node> m_interactionNode;
1288     WebCore::IntPoint m_lastInteractionLocation;
1289     
1290     enum SelectionAnchor {
1291         Start,
1292         End
1293     };
1294     SelectionAnchor m_selectionAnchor;
1295
1296     RefPtr<WebCore::Node> m_potentialTapNode;
1297     WebCore::FloatPoint m_potentialTapLocation;
1298
1299     WebCore::ViewportConfiguration m_viewportConfiguration;
1300     uint64_t m_firstLayerTreeTransactionIDAfterDidCommitLoad;
1301     bool m_hasReceivedVisibleContentRectsAfterDidCommitLoad;
1302     bool m_scaleWasSetByUIProcess;
1303     bool m_userHasChangedPageScaleFactor;
1304     bool m_hasStablePageScaleFactor;
1305     bool m_userIsInteracting;
1306     bool m_hasPendingBlurNotification;
1307     bool m_useTestingViewportConfiguration;
1308     bool m_isInStableState;
1309     std::chrono::milliseconds m_oldestNonStableUpdateVisibleContentRectsTimestamp;
1310     std::chrono::milliseconds m_estimatedLatency;
1311     WebCore::FloatSize m_screenSize;
1312     WebCore::FloatSize m_availableScreenSize;
1313     RefPtr<WebCore::Range> m_currentBlockSelection;
1314     WebCore::IntSize m_blockSelectionDesiredSize;
1315     WebCore::FloatSize m_maximumUnobscuredSize;
1316     int32_t m_deviceOrientation;
1317     bool m_inDynamicSizeUpdate;
1318     HashMap<std::pair<WebCore::IntSize, double>, WebCore::IntPoint> m_dynamicSizeUpdateHistory;
1319     RefPtr<WebCore::Node> m_pendingSyntheticClickNode;
1320     WebCore::FloatPoint m_pendingSyntheticClickLocation;
1321 #endif
1322
1323     WebInspectorClient* m_inspectorClient;
1324
1325     HashSet<String, CaseFoldingHash> m_mimeTypesWithCustomContentProviders;
1326     WebCore::Color m_backgroundColor;
1327
1328     HashSet<unsigned> m_activeRenderingSuppressionTokens;
1329     unsigned m_maximumRenderingSuppressionToken;
1330     
1331     WebCore::ScrollPinningBehavior m_scrollPinningBehavior;
1332
1333     bool m_useAsyncScrolling;
1334
1335     WebCore::ViewState::Flags m_viewState;
1336     WebCore::PageActivityState::Flags m_activityState;
1337
1338     bool m_processSuppressionEnabled;
1339     UserActivity m_userActivity;
1340
1341     uint64_t m_pendingNavigationID;
1342
1343 #if ENABLE(WEBGL)
1344     WebCore::WebGLLoadPolicy m_systemWebGLPolicy;
1345 #endif
1346
1347 #if PLATFORM(MAC)
1348     RefPtr<WebCore::Range> m_lastActionMenuRangeForSelection;
1349     WebCore::HitTestResult m_lastActionMenuHitTestResult;
1350     RefPtr<WebPageOverlay> m_lastActionMenuHitPageOverlay;
1351     bool m_lastActionMenuHitTestPreventsDefault;
1352     int m_lastForceStage { 0 };
1353 #endif
1354
1355     bool m_mainFrameProgressCompleted;
1356     bool m_shouldDispatchFakeMouseMoveEvents;
1357 };
1358
1359 } // namespace WebKit
1360
1361 #endif // WebPage_h