579505942ae34a86ebcb9e5893804634421d8a93
[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
363     void listenForLayoutMilestones(uint32_t /* LayoutMilestones */);
364
365     void setSuppressScrollbarAnimations(bool);
366     
367     void setEnableVerticalRubberBanding(bool);
368     void setEnableHorizontalRubberBanding(bool);
369     
370     void setBackgroundExtendsBeyondPage(bool);
371
372     void setPaginationMode(uint32_t /* WebCore::Pagination::Mode */);
373     void setPaginationBehavesLikeColumns(bool);
374     void setPageLength(double);
375     void setGapBetweenPages(double);
376
377     void postInjectedBundleMessage(const String& messageName, const UserData&);
378
379     bool drawsBackground() const { return m_drawsBackground; }
380     bool drawsTransparentBackground() const { return m_drawsTransparentBackground; }
381
382     void setUnderlayColor(const WebCore::Color& color) { m_underlayColor = color; }
383     WebCore::Color underlayColor() const { return m_underlayColor; }
384
385     void stopLoading();
386     void stopLoadingFrame(uint64_t frameID);
387     bool defersLoading() const;
388     void setDefersLoading(bool deferLoading);
389
390     void enterAcceleratedCompositingMode(WebCore::GraphicsLayer*);
391     void exitAcceleratedCompositingMode();
392
393     void addPluginView(PluginView*);
394     void removePluginView(PluginView*);
395
396     bool isVisible() const { return m_viewState & WebCore::ViewState::IsVisible; }
397     bool isVisibleOrOccluded() const { return m_viewState & WebCore::ViewState::IsVisibleOrOccluded; }
398
399     LayerHostingMode layerHostingMode() const { return m_layerHostingMode; }
400     void setLayerHostingMode(unsigned);
401
402 #if PLATFORM(COCOA)
403     void updatePluginsActiveAndFocusedState();
404     const WebCore::FloatRect& windowFrameInScreenCoordinates() const { return m_windowFrameInScreenCoordinates; }
405     const WebCore::FloatRect& windowFrameInUnflippedScreenCoordinates() const { return m_windowFrameInUnflippedScreenCoordinates; }
406     const WebCore::FloatRect& viewFrameInWindowCoordinates() const { return m_viewFrameInWindowCoordinates; }
407
408     bool hasCachedWindowFrame() const { return m_hasCachedWindowFrame; }
409
410 #if !PLATFORM(IOS)
411     void setTopOverhangImage(PassRefPtr<WebImage>);
412     void setBottomOverhangImage(PassRefPtr<WebImage>);
413 #endif // !PLATFORM(IOS)
414
415     void updateHeaderAndFooterLayersForDeviceScaleChange(float scaleFactor);
416 #endif // PLATFORM(COCOA)
417
418     bool windowIsFocused() const;
419     bool windowAndWebPageAreFocused() const;
420
421 #if !PLATFORM(IOS)
422     void setHeaderPageBanner(PassRefPtr<PageBanner>);
423     PageBanner* headerPageBanner();
424     void setFooterPageBanner(PassRefPtr<PageBanner>);
425     PageBanner* footerPageBanner();
426
427     void hidePageBanners();
428     void showPageBanners();
429     
430 #endif // !PLATFORM(IOS)
431
432     WebCore::IntPoint screenToRootView(const WebCore::IntPoint&);
433     WebCore::IntRect rootViewToScreen(const WebCore::IntRect&);
434     
435 #if PLATFORM(IOS)
436     WebCore::IntPoint accessibilityScreenToRootView(const WebCore::IntPoint&);
437     WebCore::IntRect rootViewToAccessibilityScreen(const WebCore::IntRect&);
438 #endif
439     
440     PassRefPtr<WebImage> scaledSnapshotWithOptions(const WebCore::IntRect&, double additionalScaleFactor, SnapshotOptions);
441     PassRefPtr<WebImage> snapshotAtSize(const WebCore::IntRect&, const WebCore::IntSize& bitmapSize, SnapshotOptions);
442     PassRefPtr<WebImage> snapshotNode(WebCore::Node&, SnapshotOptions, unsigned maximumPixelCount = std::numeric_limits<unsigned>::max());
443
444     static const WebEvent* currentEvent();
445
446     FindController& findController() { return m_findController; }
447
448 #if ENABLE(GEOLOCATION)
449     GeolocationPermissionRequestManager& geolocationPermissionRequestManager() { return m_geolocationPermissionRequestManager; }
450 #endif
451
452 #if PLATFORM(IOS) || PLATFORM(EFL)
453     void savePageState(WebCore::HistoryItem&);
454     void restorePageState(const WebCore::HistoryItem&);
455 #endif
456
457 #if ENABLE(MEDIA_STREAM)
458     UserMediaPermissionRequestManager& userMediaPermissionRequestManager() { return m_userMediaPermissionRequestManager; }
459 #endif
460
461 #if PLATFORM(IOS)
462     WebCore::FloatSize screenSize() const;
463     WebCore::FloatSize availableScreenSize() const;
464     int32_t deviceOrientation() const { return m_deviceOrientation; }
465     void viewportPropertiesDidChange(const WebCore::ViewportArguments&);
466     void didReceiveMobileDocType(bool);
467
468     void setUseTestingViewportConfiguration(bool useTestingViewport) { m_useTestingViewportConfiguration = useTestingViewport; }
469     bool isUsingTestingViewportConfiguration() const { return m_useTestingViewportConfiguration; }
470
471     double minimumPageScaleFactor() const;
472     double maximumPageScaleFactor() const;
473     bool allowsUserScaling() const;
474     bool hasStablePageScaleFactor() const { return m_hasStablePageScaleFactor; }
475
476     void handleTap(const WebCore::IntPoint&, uint64_t lastLayerTreeTranscationId);
477     void potentialTapAtPosition(uint64_t requestID, const WebCore::FloatPoint&);
478     void commitPotentialTap(uint64_t lastLayerTreeTranscationId);
479     void commitPotentialTapFailed();
480     void cancelPotentialTap();
481     void tapHighlightAtPosition(uint64_t requestID, const WebCore::FloatPoint&);
482
483     void inspectorNodeSearchMovedToPosition(const WebCore::FloatPoint&);
484     void inspectorNodeSearchEndedAtPosition(const WebCore::FloatPoint&);
485
486     void blurAssistedNode();
487     void selectWithGesture(const WebCore::IntPoint&, uint32_t granularity, uint32_t gestureType, uint32_t gestureState, uint64_t callbackID);
488     void updateSelectionWithTouches(const WebCore::IntPoint& point, uint32_t touches, bool baseIsStart, uint64_t callbackID);
489     void updateBlockSelectionWithTouch(const WebCore::IntPoint&, uint32_t touch, uint32_t handlePosition);
490     void selectWithTwoTouches(const WebCore::IntPoint& from, const WebCore::IntPoint& to, uint32_t gestureType, uint32_t gestureState, uint64_t callbackID);
491     void extendSelection(uint32_t granularity);
492     void selectWordBackward();
493     void moveSelectionByOffset(int32_t offset, uint64_t callbackID);
494     void selectTextWithGranularityAtPoint(const WebCore::IntPoint&, uint32_t granularity, uint64_t callbackID);
495     void selectPositionAtBoundaryWithDirection(const WebCore::IntPoint&, uint32_t granularity, uint32_t direction, uint64_t callbackID);
496     void selectPositionAtPoint(const WebCore::IntPoint&, uint64_t callbackID);
497     void beginSelectionInDirection(uint32_t direction, uint64_t callbackID);
498     void updateSelectionWithExtentPoint(const WebCore::IntPoint&, uint64_t callbackID);
499
500     void elementDidFocus(WebCore::Node*);
501     void elementDidBlur(WebCore::Node*);
502     void requestDictationContext(uint64_t callbackID);
503     void replaceDictatedText(const String& oldText, const String& newText);
504     void replaceSelectedText(const String& oldText, const String& newText);
505     void requestAutocorrectionData(const String& textForAutocorrection, uint64_t callbackID);
506     void applyAutocorrection(const String& correction, const String& originalText, uint64_t callbackID);
507     void syncApplyAutocorrection(const String& correction, const String& originalText, bool& correctionApplied);
508     void requestAutocorrectionContext(uint64_t callbackID);
509     void getAutocorrectionContext(String& beforeText, String& markedText, String& selectedText, String& afterText, uint64_t& location, uint64_t& length);
510     void getPositionInformation(const WebCore::IntPoint&, InteractionInformationAtPosition&);
511     void requestPositionInformation(const WebCore::IntPoint&);
512     void startInteractionWithElementAtPosition(const WebCore::IntPoint&);
513     void stopInteraction();
514     void performActionOnElement(uint32_t action);
515     void focusNextAssistedNode(bool isForward, uint64_t callbackID);
516     void setAssistedNodeValue(const String&);
517     void setAssistedNodeValueAsNumber(double);
518     void setAssistedNodeSelectedIndex(uint32_t index, bool allowMultipleSelection);
519     void resetAssistedNodeForFrame(WebFrame*);
520     WebCore::IntRect rectForElementAtInteractionLocation();
521     void updateSelectionAppearance();
522
523 #if ENABLE(IOS_TOUCH_EVENTS)
524     void dispatchAsynchronousTouchEvents(const Vector<WebTouchEvent, 1>& queue);
525 #endif
526
527     void contentSizeCategoryDidChange(const String&);
528     void executeEditCommandWithCallback(const String&, uint64_t callbackID);
529
530     std::chrono::milliseconds eventThrottlingDelay() const;
531
532     void showInspectorHighlight(const WebCore::Highlight&);
533     void hideInspectorHighlight();
534
535     void showInspectorIndication();
536     void hideInspectorIndication();
537
538     void enableInspectorNodeSearch();
539     void disableInspectorNodeSearch();
540 #endif
541
542     NotificationPermissionRequestManager* notificationPermissionRequestManager();
543
544     void pageDidScroll();
545 #if USE(TILED_BACKING_STORE)
546     void pageDidRequestScroll(const WebCore::IntPoint&);
547     void setFixedVisibleContentRect(const WebCore::IntRect&);
548     void sendViewportAttributesChanged();
549 #endif
550
551 #if ENABLE(CONTEXT_MENUS)
552     WebContextMenu* contextMenu();
553     WebContextMenu* contextMenuAtPointInWindow(const WebCore::IntPoint&);
554 #endif
555     
556     bool hasLocalDataForURL(const WebCore::URL&);
557     String cachedResponseMIMETypeForURL(const WebCore::URL&);
558     String cachedSuggestedFilenameForURL(const WebCore::URL&);
559     PassRefPtr<WebCore::SharedBuffer> cachedResponseDataForURL(const WebCore::URL&);
560
561     static bool canHandleRequest(const WebCore::ResourceRequest&);
562
563     class SandboxExtensionTracker {
564     public:
565         ~SandboxExtensionTracker();
566
567         void invalidate();
568
569         void beginLoad(WebFrame*, const SandboxExtension::Handle& handle);
570         void willPerformLoadDragDestinationAction(PassRefPtr<SandboxExtension> pendingDropSandboxExtension);
571         void didStartProvisionalLoad(WebFrame*);
572         void didCommitProvisionalLoad(WebFrame*);
573         void didFailProvisionalLoad(WebFrame*);
574
575     private:
576         void setPendingProvisionalSandboxExtension(PassRefPtr<SandboxExtension>);
577
578         RefPtr<SandboxExtension> m_pendingProvisionalSandboxExtension;
579         RefPtr<SandboxExtension> m_provisionalSandboxExtension;
580         RefPtr<SandboxExtension> m_committedSandboxExtension;
581     };
582
583     SandboxExtensionTracker& sandboxExtensionTracker() { return m_sandboxExtensionTracker; }
584
585 #if PLATFORM(EFL)
586     void setThemePath(const String&);
587 #endif
588
589 #if USE(COORDINATED_GRAPHICS_MULTIPROCESS)
590     void commitPageTransitionViewport();
591 #endif
592
593 #if PLATFORM(GTK)
594     void setComposition(const String& text, const Vector<WebCore::CompositionUnderline>& underlines, uint64_t selectionStart, uint64_t selectionEnd, uint64_t replacementRangeStart, uint64_t replacementRangeLength);
595     void confirmComposition(const String& text, int64_t selectionStart, int64_t selectionLength);
596     void cancelComposition();
597 #endif
598
599 #if PLATFORM (GTK) && HAVE(GTK_GESTURES)
600     void getCenterForZoomGesture(const WebCore::IntPoint& centerInViewCoordinates, WebCore::IntPoint& result);
601 #endif
602
603     void didChangeSelection();
604     void discardedComposition();
605
606 #if PLATFORM(COCOA)
607     void registerUIProcessAccessibilityTokens(const IPC::DataReference& elemenToken, const IPC::DataReference& windowToken);
608     WKAccessibilityWebPageObject* accessibilityRemoteObject();
609     NSObject *accessibilityObjectForMainFramePlugin();
610     const WebCore::FloatPoint& accessibilityPosition() const { return m_accessibilityPosition; }
611     
612     void sendComplexTextInputToPlugin(uint64_t pluginComplexTextInputIdentifier, const String& textInput);
613
614     void insertTextAsync(const String& text, const EditingRange& replacementRange, bool registerUndoGroup = false);
615     void getMarkedRangeAsync(uint64_t callbackID);
616     void getSelectedRangeAsync(uint64_t callbackID);
617     void characterIndexForPointAsync(const WebCore::IntPoint&, uint64_t callbackID);
618     void firstRectForCharacterRangeAsync(const EditingRange&, uint64_t callbackID);
619     void setCompositionAsync(const String& text, Vector<WebCore::CompositionUnderline> underlines, const EditingRange& selectionRange, const EditingRange& replacementRange);
620     void confirmCompositionAsync();
621
622 #if PLATFORM(MAC)
623     void insertDictatedTextAsync(const String& text, const EditingRange& replacementRange, const Vector<WebCore::DictationAlternative>& dictationAlternativeLocations, bool registerUndoGroup = false);
624     void attributedSubstringForCharacterRangeAsync(const EditingRange&, uint64_t callbackID);
625     void fontAtSelection(uint64_t callbackID);
626 #if !USE(ASYNC_NSTEXTINPUTCLIENT)
627     void insertText(const String& text, const EditingRange& replacementRange, bool& handled, EditorState& newState);
628     void setComposition(const String& text, Vector<WebCore::CompositionUnderline> underlines, const EditingRange& selectionRange, const EditingRange& replacementRange, EditorState& newState);
629     void confirmComposition(EditorState& newState);
630     void insertDictatedText(const String& text, const EditingRange& replacementRange, const Vector<WebCore::DictationAlternative>& dictationAlternativeLocations, bool& handled, EditorState& newState);
631     void getAttributedSubstringFromRange(const EditingRange&, AttributedString&);
632     void getMarkedRange(EditingRange&);
633     void getSelectedRange(EditingRange&);
634     void characterIndexForPoint(const WebCore::IntPoint point, uint64_t& result);
635     void firstRectForCharacterRange(const EditingRange&, WebCore::IntRect& resultRect);
636     void executeKeypressCommands(const Vector<WebCore::KeypressCommand>&, bool& handled, EditorState& newState);
637     void cancelComposition(EditorState& newState);
638 #endif
639 #endif
640
641     void readSelectionFromPasteboard(const WTF::String& pasteboardName, bool& result);
642     void getStringSelectionForPasteboard(WTF::String& stringValue);
643     void getDataSelectionForPasteboard(const WTF::String pasteboardType, SharedMemory::Handle& handle, uint64_t& size);
644     void shouldDelayWindowOrderingEvent(const WebKit::WebMouseEvent&, bool& result);
645     void acceptsFirstMouse(int eventNumber, const WebKit::WebMouseEvent&, bool& result);
646     bool performNonEditingBehaviorForSelector(const String&, WebCore::KeyboardEvent*);
647
648 #if ENABLE(SERVICE_CONTROLS)
649     void replaceSelectionWithPasteboardData(const Vector<String>& types, const IPC::DataReference&);
650 #endif
651
652 #elif PLATFORM(EFL)
653     void confirmComposition(const String& compositionString);
654     void setComposition(const WTF::String& compositionString, const WTF::Vector<WebCore::CompositionUnderline>& underlines, uint64_t cursorPosition);
655     void cancelComposition();
656 #endif
657
658 #if HAVE(ACCESSIBILITY) && (PLATFORM(GTK) || PLATFORM(EFL))
659     void updateAccessibilityTree();
660 #endif
661
662     void setCompositionForTesting(const String& compositionString, uint64_t from, uint64_t length);
663     bool hasCompositionForTesting();
664     void confirmCompositionForTesting(const String& compositionString);
665
666     // FIXME: This a dummy message, to avoid breaking the build for platforms that don't require
667     // any synchronous messages, and should be removed when <rdar://problem/8775115> is fixed.
668     void dummy(bool&);
669
670 #if PLATFORM(COCOA)
671     bool isSpeaking();
672     void speak(const String&);
673     void stopSpeaking();
674
675     void performDictionaryLookupForSelection(WebCore::Frame*, const WebCore::VisibleSelection&, WebCore::TextIndicatorPresentationTransition);
676 #endif
677
678     bool isSmartInsertDeleteEnabled();
679     void setSmartInsertDeleteEnabled(bool);
680
681     bool isSelectTrailingWhitespaceEnabled();
682     void setSelectTrailingWhitespaceEnabled(bool);
683
684     void replaceSelectionWithText(WebCore::Frame*, const String&);
685     void clearSelection();
686     void restoreSelectionInFocusedEditableElement();
687
688 #if ENABLE(DRAG_SUPPORT)
689 #if PLATFORM(GTK)
690     void performDragControllerAction(uint64_t action, WebCore::DragData);
691 #else
692     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&);
693 #endif
694     void dragEnded(WebCore::IntPoint clientPosition, WebCore::IntPoint globalPosition, uint64_t operation);
695
696     void willPerformLoadDragDestinationAction();
697     void mayPerformUploadDragDestinationAction();
698
699     void willStartDrag() { ASSERT(!m_isStartingDrag); m_isStartingDrag = true; }
700     void didStartDrag() { ASSERT(m_isStartingDrag); m_isStartingDrag = false; }
701 #endif // ENABLE(DRAG_SUPPORT)
702
703     void beginPrinting(uint64_t frameID, const PrintInfo&);
704     void endPrinting();
705     void computePagesForPrinting(uint64_t frameID, const PrintInfo&, uint64_t callbackID);
706     void computePagesForPrintingImpl(uint64_t frameID, const PrintInfo&, Vector<WebCore::IntRect>& pageRects, double& totalScaleFactor);
707 #if PLATFORM(COCOA)
708     void drawRectToImage(uint64_t frameID, const PrintInfo&, const WebCore::IntRect&, const WebCore::IntSize&, uint64_t callbackID);
709     void drawPagesToPDF(uint64_t frameID, const PrintInfo&, uint32_t first, uint32_t count, uint64_t callbackID);
710     void drawPagesToPDFImpl(uint64_t frameID, const PrintInfo&, uint32_t first, uint32_t count, RetainPtr<CFMutableDataRef>& pdfPageData);
711 #if PLATFORM(IOS)
712     void computePagesForPrintingAndStartDrawingToPDF(uint64_t frameID, const PrintInfo&, uint32_t firstPage, PassRefPtr<Messages::WebPage::ComputePagesForPrintingAndStartDrawingToPDF::DelayedReply>);
713 #endif
714 #elif PLATFORM(GTK)
715     void drawPagesForPrinting(uint64_t frameID, const PrintInfo&, uint64_t callbackID);
716     void didFinishPrintOperation(const WebCore::ResourceError&, uint64_t callbackID);
717 #endif
718
719     void addResourceRequest(unsigned long, const WebCore::ResourceRequest&);
720     void removeResourceRequest(unsigned long);
721
722     void setMediaVolume(float);
723     void setMuted(bool);
724     void setMayStartMediaWhenInWindow(bool);
725
726     void updateMainFrameScrollOffsetPinning();
727
728     bool mainFrameHasCustomContentProvider() const;
729     void addMIMETypeWithCustomContentProvider(const String&);
730
731     void mainFrameDidLayout();
732
733     bool canRunBeforeUnloadConfirmPanel() const { return m_canRunBeforeUnloadConfirmPanel; }
734     void setCanRunBeforeUnloadConfirmPanel(bool canRunBeforeUnloadConfirmPanel) { m_canRunBeforeUnloadConfirmPanel = canRunBeforeUnloadConfirmPanel; }
735
736     bool canRunModal() const { return m_canRunModal; }
737     void setCanRunModal(bool canRunModal) { m_canRunModal = canRunModal; }
738
739     void runModal();
740
741     void setDeviceScaleFactor(float);
742     float deviceScaleFactor() const;
743
744     void forceRepaintWithoutCallback();
745
746     void unmarkAllMisspellings();
747     void unmarkAllBadGrammar();
748 #if PLATFORM(COCOA)
749     void handleAlternativeTextUIResult(const String&);
750 #endif
751
752     // For testing purpose.
753     void simulateMouseDown(int button, WebCore::IntPoint, int clickCount, WKEventModifiers, double time);
754     void simulateMouseUp(int button, WebCore::IntPoint, int clickCount, WKEventModifiers, double time);
755     void simulateMouseMotion(WebCore::IntPoint, double time);
756
757 #if ENABLE(CONTEXT_MENUS)
758     void contextMenuShowing() { m_isShowingContextMenu = true; }
759 #endif
760
761     void wheelEvent(const WebWheelEvent&);
762
763     void numWheelEventHandlersChanged(unsigned);
764     void recomputeShortCircuitHorizontalWheelEventsState();
765
766     void updateVisibilityState(bool isInitialState = false);
767
768 #if PLATFORM(IOS)
769     void setViewportConfigurationMinimumLayoutSize(const WebCore::FloatSize&);
770     void setMaximumUnobscuredSize(const WebCore::FloatSize&);
771     void setDeviceOrientation(int32_t);
772     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);
773     void synchronizeDynamicViewportUpdate(double& newTargetScale, WebCore::FloatPoint& newScrollPosition, uint64_t& nextValidLayerTreeTransactionID);
774     void updateVisibleContentRects(const VisibleContentRectUpdateInfo&, double oldestTimestamp);
775     bool scaleWasSetByUIProcess() const { return m_scaleWasSetByUIProcess; }
776     void willStartUserTriggeredZooming();
777     void applicationWillResignActive();
778     void applicationWillEnterForeground();
779     void applicationDidBecomeActive();
780     void zoomToRect(WebCore::FloatRect, double minimumScale, double maximumScale);
781     void completePendingSyntheticClickForContentChangeObserver();
782 #endif
783
784 #if ENABLE(IOS_TOUCH_EVENTS)
785     void dispatchTouchEvent(const WebTouchEvent&, bool& handled);
786 #endif
787
788 #if PLATFORM(GTK) && USE(TEXTURE_MAPPER_GL)
789     uint64_t nativeWindowHandle() { return m_nativeWindowHandle; }
790 #endif
791
792     bool shouldUseCustomContentProviderForResponse(const WebCore::ResourceResponse&);
793     bool canPluginHandleResponse(const WebCore::ResourceResponse& response);
794
795     bool asynchronousPluginInitializationEnabled() const { return m_asynchronousPluginInitializationEnabled; }
796     void setAsynchronousPluginInitializationEnabled(bool enabled) { m_asynchronousPluginInitializationEnabled = enabled; }
797     bool asynchronousPluginInitializationEnabledForAllPlugins() const { return m_asynchronousPluginInitializationEnabledForAllPlugins; }
798     void setAsynchronousPluginInitializationEnabledForAllPlugins(bool enabled) { m_asynchronousPluginInitializationEnabledForAllPlugins = enabled; }
799     bool artificialPluginInitializationDelayEnabled() const { return m_artificialPluginInitializationDelayEnabled; }
800     void setArtificialPluginInitializationDelayEnabled(bool enabled) { m_artificialPluginInitializationDelayEnabled = enabled; }
801     void setTabToLinksEnabled(bool enabled) { m_tabToLinks = enabled; }
802     bool tabToLinksEnabled() const { return m_tabToLinks; }
803
804     bool scrollingPerformanceLoggingEnabled() const { return m_scrollingPerformanceLoggingEnabled; }
805     void setScrollingPerformanceLoggingEnabled(bool);
806
807 #if PLATFORM(COCOA)
808     bool shouldUsePDFPlugin() const;
809     bool pdfPluginEnabled() const { return m_pdfPluginEnabled; }
810     void setPDFPluginEnabled(bool enabled) { m_pdfPluginEnabled = enabled; }
811 #endif
812
813     void savePDFToFileInDownloadsFolder(const String& suggestedFilename, const String& originatingURLString, const uint8_t* data, unsigned long size);
814 #if PLATFORM(COCOA)
815     void savePDFToTemporaryFolderAndOpenWithNativeApplication(const String& suggestedFilename, const String& originatingURLString, const uint8_t* data, unsigned long size, const String& pdfUUID);
816 #endif
817
818     bool mainFrameIsScrollable() const { return m_mainFrameIsScrollable; }
819
820     void setMinimumLayoutSize(const WebCore::IntSize&);
821     WebCore::IntSize minimumLayoutSize() const { return m_minimumLayoutSize; }
822
823     void setAutoSizingShouldExpandToViewHeight(bool shouldExpand);
824     bool autoSizingShouldExpandToViewHeight() { return m_autoSizingShouldExpandToViewHeight; }
825
826     bool canShowMIMEType(const String& MIMEType) const;
827
828     void addTextCheckingRequest(uint64_t requestID, PassRefPtr<WebCore::TextCheckingRequest>);
829     void didFinishCheckingText(uint64_t requestID, const Vector<WebCore::TextCheckingResult>&);
830     void didCancelCheckingText(uint64_t requestID);
831
832 #if ENABLE(PRIMARY_SNAPSHOTTED_PLUGIN_HEURISTIC)
833     void determinePrimarySnapshottedPlugIn();
834     void determinePrimarySnapshottedPlugInTimerFired();
835     void resetPrimarySnapshottedPlugIn();
836     bool matchesPrimaryPlugIn(const String& pageOrigin, const String& pluginOrigin, const String& mimeType) const;
837     bool plugInIntersectsSearchRect(WebCore::HTMLPlugInImageElement& pluginImageElement);
838     bool plugInIsPrimarySize(WebCore::HTMLPlugInImageElement& pluginImageElement, unsigned &pluginArea);
839 #endif
840
841     unsigned extendIncrementalRenderingSuppression();
842     void stopExtendingIncrementalRenderingSuppression(unsigned token);
843     bool shouldExtendIncrementalRenderingSuppression() { return !m_activeRenderingSuppressionTokens.isEmpty(); }
844
845     WebCore::ScrollPinningBehavior scrollPinningBehavior() { return m_scrollPinningBehavior; }
846     void setScrollPinningBehavior(uint32_t /* WebCore::ScrollPinningBehavior */ pinning);
847
848     PassRefPtr<WebCore::DocumentLoader> createDocumentLoader(WebCore::Frame&, const WebCore::ResourceRequest&, const WebCore::SubstituteData&);
849
850     void getBytecodeProfile(uint64_t callbackID);
851     
852     // Some platforms require accessibility-enabled processes to spin the run loop so that the WebProcess doesn't hang.
853     // While this is not ideal, it does not have to be applied to every platform at the moment.
854     static bool synchronousMessagesShouldSpinRunLoop();
855
856 #if ENABLE(SERVICE_CONTROLS) || ENABLE(TELEPHONE_NUMBER_DETECTION)
857     void handleTelephoneNumberClick(const String& number, const WebCore::IntPoint&);
858     void handleSelectionServiceClick(WebCore::FrameSelection&, const Vector<String>& telephoneNumbers, const WebCore::IntPoint&);
859 #endif
860
861     void didChangeScrollOffsetForFrame(WebCore::Frame*);
862
863     void setMainFrameProgressCompleted(bool completed) { m_mainFrameProgressCompleted = completed; }
864     bool shouldDispatchFakeMouseMoveEvents() const { return m_shouldDispatchFakeMouseMoveEvents; }
865
866     void setPageActivityState(WebCore::PageActivityState::Flags);
867
868 private:
869     WebPage(uint64_t pageID, const WebPageCreationParameters&);
870
871     // IPC::MessageSender
872     virtual IPC::Connection* messageSenderConnection() override;
873     virtual uint64_t messageSenderDestinationID() override;
874
875     void platformInitialize();
876     void platformDetach();
877     void platformEditorState(WebCore::Frame&, EditorState& result) const;
878
879     void didReceiveWebPageMessage(IPC::Connection&, IPC::MessageDecoder&);
880     void didReceiveSyncWebPageMessage(IPC::Connection&, IPC::MessageDecoder&, std::unique_ptr<IPC::MessageEncoder>&);
881
882 #if PLATFORM(IOS)
883     void resetViewportDefaultConfiguration(WebFrame* mainFrame);
884     void viewportConfigurationChanged();
885     void updateViewportSizeForCSSViewportUnits();
886
887     static void convertSelectionRectsToRootView(WebCore::FrameView*, Vector<WebCore::SelectionRect>&);
888     PassRefPtr<WebCore::Range> rangeForWebSelectionAtPosition(const WebCore::IntPoint&, const WebCore::VisiblePosition&, SelectionFlags&);
889     PassRefPtr<WebCore::Range> rangeForBlockAtPoint(const WebCore::IntPoint&);
890     void computeExpandAndShrinkThresholdsForHandle(const WebCore::IntPoint&, SelectionHandlePosition, float& growThreshold, float& shrinkThreshold);
891     PassRefPtr<WebCore::Range> changeBlockSelection(const WebCore::IntPoint&, SelectionHandlePosition, float& growThreshold, float& shrinkThreshold, SelectionFlags&);
892     PassRefPtr<WebCore::Range> expandedRangeFromHandle(WebCore::Range*, SelectionHandlePosition);
893     PassRefPtr<WebCore::Range> contractedRangeFromHandle(WebCore::Range* currentRange, SelectionHandlePosition, SelectionFlags&);
894     void getAssistedNodeInformation(AssistedNodeInformation&);
895     void platformInitializeAccessibility();
896     void handleSyntheticClick(WebCore::Node* nodeRespondingToClick, const WebCore::FloatPoint& location);
897     void completeSyntheticClick(WebCore::Node* nodeRespondingToClick, const WebCore::FloatPoint& location);
898     void sendTapHighlightForNodeIfNecessary(uint64_t requestID, WebCore::Node*);
899     void resetTextAutosizingBeforeLayoutIfNeeded(const WebCore::FloatSize& oldSize, const WebCore::FloatSize& newSize);
900     WebCore::VisiblePosition visiblePositionInFocusedNodeForPoint(WebCore::Frame&, const WebCore::IntPoint&);
901 #endif
902 #if !PLATFORM(COCOA)
903     static const char* interpretKeyEvent(const WebCore::KeyboardEvent*);
904 #endif
905     bool performDefaultBehaviorForKeyEvent(const WebKeyboardEvent&);
906
907 #if PLATFORM(MAC)
908     bool executeKeypressCommandsInternal(const Vector<WebCore::KeypressCommand>&, WebCore::KeyboardEvent*);
909 #endif
910
911     String sourceForFrame(WebFrame*);
912
913     void loadDataImpl(uint64_t navigationID, PassRefPtr<WebCore::SharedBuffer>, const String& MIMEType, const String& encodingName, const WebCore::URL& baseURL, const WebCore::URL& failingURL, const UserData&);
914     void loadString(uint64_t navigationID, const String&, const String& MIMEType, const WebCore::URL& baseURL, const WebCore::URL& failingURL, const UserData&);
915
916     bool platformHasLocalDataForURL(const WebCore::URL&);
917
918     // Actions
919     void tryClose();
920     void loadRequest(uint64_t navigationID, const WebCore::ResourceRequest&, const SandboxExtension::Handle&, const UserData&);
921     void loadData(const IPC::DataReference&, const String& MIMEType, const String& encodingName, const String& baseURL, const UserData&);
922     void loadHTMLString(uint64_t navigationID, const String& htmlString, const String& baseURL, const UserData&);
923     void loadAlternateHTMLString(const String& htmlString, const String& baseURL, const String& unreachableURL, const UserData&);
924     void loadPlainTextString(const String&, const UserData&);
925     void loadWebArchiveData(const IPC::DataReference&, const UserData&);
926     void navigateToURLWithSimulatedClick(const String& url, WebCore::IntPoint documentPoint, WebCore::IntPoint screenPoint);
927     void reload(uint64_t navigationID, bool reloadFromOrigin, const SandboxExtension::Handle&);
928     void goForward(uint64_t navigationID, uint64_t);
929     void goBack(uint64_t navigationID, uint64_t);
930     void goToBackForwardItem(uint64_t navigationID, uint64_t);
931     void tryRestoreScrollPosition();
932     void setInitialFocus(bool forward, bool isKeyboardEventValid, const WebKeyboardEvent&, uint64_t callbackID);
933     void setWindowResizerSize(const WebCore::IntSize&);
934     void updateIsInWindow(bool isInitialState = false);
935     void setViewState(WebCore::ViewState::Flags, bool wantsDidUpdateViewState, const Vector<uint64_t>& callbackIDs);
936     void validateCommand(const String&, uint64_t);
937     void executeEditCommand(const String&);
938     void setEditable(bool);
939
940     void updateUserActivity();
941
942     void mouseEvent(const WebMouseEvent&);
943     void mouseEventSyncForTesting(const WebMouseEvent&, bool&);
944     void wheelEventSyncForTesting(const WebWheelEvent&, bool&);
945     void keyEvent(const WebKeyboardEvent&);
946     void keyEventSyncForTesting(const WebKeyboardEvent&, bool&);
947 #if ENABLE(IOS_TOUCH_EVENTS)
948     void touchEventSync(const WebTouchEvent&, bool& handled);
949 #elif ENABLE(TOUCH_EVENTS)
950     void touchEvent(const WebTouchEvent&);
951     void touchEventSyncForTesting(const WebTouchEvent&, bool& handled);
952 #endif
953 #if ENABLE(CONTEXT_MENUS)
954     void contextMenuHidden() { m_isShowingContextMenu = false; }
955 #endif
956
957     static bool scroll(WebCore::Page*, WebCore::ScrollDirection, WebCore::ScrollGranularity);
958     static bool logicalScroll(WebCore::Page*, WebCore::ScrollLogicalDirection, WebCore::ScrollGranularity);
959
960     void loadURLInFrame(const String&, uint64_t frameID);
961
962     void restoreSession(const Vector<BackForwardListItemState>&);
963     void didRemoveBackForwardItem(uint64_t);
964
965 #if ENABLE(REMOTE_INSPECTOR)
966     void setAllowsRemoteInspection(bool);
967 #endif
968
969     void setDrawsBackground(bool);
970     void setDrawsTransparentBackground(bool);
971
972     void setTopContentInset(float);
973
974     void viewWillStartLiveResize();
975     void viewWillEndLiveResize();
976
977     void getContentsAsString(uint64_t callbackID);
978 #if ENABLE(MHTML)
979     void getContentsAsMHTMLData(uint64_t callbackID, bool useBinaryEncoding);
980 #endif
981     void getMainResourceDataOfFrame(uint64_t frameID, uint64_t callbackID);
982     void getResourceDataFromFrame(uint64_t frameID, const String& resourceURL, uint64_t callbackID);
983     void getRenderTreeExternalRepresentation(uint64_t callbackID);
984     void getSelectionOrContentsAsString(uint64_t callbackID);
985     void getSelectionAsWebArchiveData(uint64_t callbackID);
986     void getSourceForFrame(uint64_t frameID, uint64_t callbackID);
987     void getWebArchiveOfFrame(uint64_t frameID, uint64_t callbackID);
988     void runJavaScriptInMainFrame(const String&, uint64_t callbackID);
989     void forceRepaint(uint64_t callbackID);
990     void takeSnapshot(WebCore::IntRect snapshotRect, WebCore::IntSize bitmapSize, uint32_t options, uint64_t callbackID);
991
992     void preferencesDidChange(const WebPreferencesStore&);
993     void platformPreferencesDidChange(const WebPreferencesStore&);
994     void updatePreferences(const WebPreferencesStore&);
995
996     void didReceivePolicyDecision(uint64_t frameID, uint64_t listenerID, uint32_t policyAction, uint64_t navigationID, uint64_t downloadID);
997     void setUserAgent(const String&);
998     void setCustomTextEncodingName(const String&);
999     void suspendActiveDOMObjectsAndAnimations();
1000     void resumeActiveDOMObjectsAndAnimations();
1001
1002 #if PLATFORM(COCOA)
1003     void performDictionaryLookupAtLocation(const WebCore::FloatPoint&);
1004     void performDictionaryLookupOfCurrentSelection();
1005     void performDictionaryLookupForRange(WebCore::Frame*, WebCore::Range&, NSDictionary *options, WebCore::TextIndicatorPresentationTransition);
1006     DictionaryPopupInfo dictionaryPopupInfoForRange(WebCore::Frame* frame, WebCore::Range& range, NSDictionary **options, WebCore::TextIndicatorPresentationTransition presentationTransition);
1007
1008     void windowAndViewFramesChanged(const WebCore::FloatRect& windowFrameInScreenCoordinates, const WebCore::FloatRect& windowFrameInUnflippedScreenCoordinates, const WebCore::FloatRect& viewFrameInWindowCoordinates, const WebCore::FloatPoint& accessibilityViewCoordinates);
1009
1010     RetainPtr<PDFDocument> pdfDocumentForPrintingFrame(WebCore::Frame*);
1011     void computePagesForPrintingPDFDocument(uint64_t frameID, const PrintInfo&, Vector<WebCore::IntRect>& resultPageRects);
1012     void drawPDFDocument(CGContextRef, PDFDocument *, const PrintInfo&, const WebCore::IntRect&);
1013     void drawPagesToPDFFromPDFDocument(CGContextRef, PDFDocument *, const PrintInfo&, uint32_t first, uint32_t count);
1014 #endif
1015
1016     void setMainFrameIsScrollable(bool);
1017
1018     void unapplyEditCommand(uint64_t commandID);
1019     void reapplyEditCommand(uint64_t commandID);
1020     void didRemoveEditCommand(uint64_t commandID);
1021
1022     void findString(const String&, uint32_t findOptions, uint32_t maxMatchCount);
1023     void findStringMatches(const String&, uint32_t findOptions, uint32_t maxMatchCount);
1024     void getImageForFindMatch(uint32_t matchIndex);
1025     void selectFindMatch(uint32_t matchIndex);
1026     void hideFindUI();
1027     void countStringMatches(const String&, uint32_t findOptions, uint32_t maxMatchCount);
1028
1029 #if USE(COORDINATED_GRAPHICS_MULTIPROCESS)
1030     void findZoomableAreaForPoint(const WebCore::IntPoint&, const WebCore::IntSize& area);
1031 #endif
1032
1033     void didChangeSelectedIndexForActivePopupMenu(int32_t newIndex);
1034     void setTextForActivePopupMenu(int32_t index);
1035
1036 #if PLATFORM(GTK)
1037     void failedToShowPopupMenu();
1038 #endif
1039
1040 #if PLATFORM(IOS)
1041     void didChooseFilesForOpenPanelWithDisplayStringAndIcon(const Vector<String>&, const String& displayString, const IPC::DataReference& iconData);
1042 #endif
1043     void didChooseFilesForOpenPanel(const Vector<String>&);
1044     void didCancelForOpenPanel();
1045 #if ENABLE(SANDBOX_EXTENSIONS)
1046     void extendSandboxForFileFromOpenPanel(const SandboxExtension::Handle&);
1047 #endif
1048
1049     void didReceiveGeolocationPermissionDecision(uint64_t geolocationID, bool allowed);
1050
1051     void didReceiveNotificationPermissionDecision(uint64_t notificationID, bool allowed);
1052
1053 #if ENABLE(MEDIA_STREAM)
1054     void didReceiveUserMediaPermissionDecision(uint64_t userMediaID, bool allowed);
1055 #endif
1056
1057     void advanceToNextMisspelling(bool startBeforeSelection);
1058     void changeSpellingToWord(const String& word);
1059 #if USE(APPKIT)
1060     void uppercaseWord();
1061     void lowercaseWord();
1062     void capitalizeWord();
1063 #endif
1064
1065 #if ENABLE(CONTEXT_MENUS)
1066     void didSelectItemFromActiveContextMenu(const WebContextMenuItemData&);
1067 #endif
1068
1069     void changeSelectedIndex(int32_t index);
1070     void setCanStartMediaTimerFired();
1071
1072     bool canHandleUserEvents() const;
1073
1074     static bool platformCanHandleRequest(const WebCore::ResourceRequest&);
1075
1076     static PluginView* focusedPluginViewForFrame(WebCore::Frame&);
1077     static PluginView* pluginViewForFrame(WebCore::Frame*);
1078
1079     static PassRefPtr<WebCore::Range> rangeFromEditingRange(WebCore::Frame&, const EditingRange&);
1080
1081     void reportUsedFeatures();
1082
1083 #if PLATFORM(MAC)
1084     void performActionMenuHitTestAtLocation(WebCore::FloatPoint, bool forImmediateAction);
1085     PassRefPtr<WebCore::Range> lookupTextAtLocation(WebCore::FloatPoint, NSDictionary **options);
1086     void selectLastActionMenuRange();
1087     void focusAndSelectLastActionMenuHitTestResult();
1088     void immediateActionDidUpdate(float force);
1089     void immediateActionDidCancel();
1090     void immediateActionDidComplete();
1091     void setFont(const String& fontFamily, double fontSize, uint64_t fontTraits);
1092
1093     void dataDetectorsDidPresentUI(WebCore::PageOverlay::PageOverlayID);
1094     void dataDetectorsDidChangeUI(WebCore::PageOverlay::PageOverlayID);
1095     void dataDetectorsDidHideUI(WebCore::PageOverlay::PageOverlayID);
1096 #endif
1097
1098     void setShouldDispatchFakeMouseMoveEvents(bool dispatch) { m_shouldDispatchFakeMouseMoveEvents = dispatch; }
1099
1100 #if ENABLE(WIRELESS_PLAYBACK_TARGET) && !PLATFORM(IOS)
1101     void playbackTargetSelected(const WebCore::MediaPlaybackTarget& outputDevice) const;
1102     void playbackTargetAvailabilityDidChange(bool);
1103 #endif
1104
1105     uint64_t m_pageID;
1106
1107     std::unique_ptr<WebCore::Page> m_page;
1108     RefPtr<WebFrame> m_mainFrame;
1109     RefPtr<InjectedBundleBackForwardList> m_backForwardList;
1110
1111     RefPtr<WebPageGroupProxy> m_pageGroup;
1112
1113     String m_userAgent;
1114
1115     WebCore::IntSize m_viewSize;
1116     std::unique_ptr<DrawingArea> m_drawingArea;
1117
1118     HashSet<PluginView*> m_pluginViews;
1119     bool m_hasSeenPlugin;
1120
1121     HashMap<uint64_t, RefPtr<WebCore::TextCheckingRequest>> m_pendingTextCheckingRequestMap;
1122
1123     bool m_useFixedLayout;
1124
1125     bool m_drawsBackground;
1126     bool m_drawsTransparentBackground;
1127
1128     WebCore::Color m_underlayColor;
1129
1130     bool m_isInRedo;
1131     bool m_isClosed;
1132
1133     bool m_tabToLinks;
1134     
1135     bool m_asynchronousPluginInitializationEnabled;
1136     bool m_asynchronousPluginInitializationEnabledForAllPlugins;
1137     bool m_artificialPluginInitializationDelayEnabled;
1138
1139     bool m_scrollingPerformanceLoggingEnabled;
1140
1141     bool m_mainFrameIsScrollable;
1142
1143 #if ENABLE(PRIMARY_SNAPSHOTTED_PLUGIN_HEURISTIC)
1144     bool m_readyToFindPrimarySnapshottedPlugin;
1145     bool m_didFindPrimarySnapshottedPlugin;
1146     unsigned m_numberOfPrimarySnapshotDetectionAttempts;
1147     String m_primaryPlugInPageOrigin;
1148     String m_primaryPlugInOrigin;
1149     String m_primaryPlugInMimeType;
1150     RunLoop::Timer<WebPage> m_determinePrimarySnapshottedPlugInTimer;
1151 #endif
1152
1153     // The layer hosting mode.
1154     LayerHostingMode m_layerHostingMode;
1155
1156 #if PLATFORM(COCOA)
1157     bool m_pdfPluginEnabled;
1158
1159     bool m_hasCachedWindowFrame;
1160
1161     // The frame of the containing window in screen coordinates.
1162     WebCore::FloatRect m_windowFrameInScreenCoordinates;
1163
1164     // The frame of the containing window in unflipped screen coordinates.
1165     WebCore::FloatRect m_windowFrameInUnflippedScreenCoordinates;
1166
1167     // The frame of the view in window coordinates.
1168     WebCore::FloatRect m_viewFrameInWindowCoordinates;
1169
1170     // The accessibility position of the view.
1171     WebCore::FloatPoint m_accessibilityPosition;
1172     
1173     RetainPtr<WKAccessibilityWebPageObject> m_mockAccessibilityElement;
1174
1175     ViewGestureGeometryCollector m_viewGestureGeometryCollector;
1176
1177 #elif HAVE(ACCESSIBILITY) && (PLATFORM(GTK) || PLATFORM(EFL))
1178     GRefPtr<WebPageAccessibilityObject> m_accessibilityObject;
1179 #endif
1180
1181 #if PLATFORM(GTK) && USE(TEXTURE_MAPPER_GL)
1182     // Our view's window in the UI process.
1183     uint64_t m_nativeWindowHandle;
1184 #endif
1185
1186 #if !PLATFORM(IOS)
1187     RefPtr<PageBanner> m_headerBanner;
1188     RefPtr<PageBanner> m_footerBanner;
1189 #endif // !PLATFORM(IOS)
1190
1191     RunLoop::Timer<WebPage> m_setCanStartMediaTimer;
1192     bool m_mayStartMediaWhenInWindow;
1193
1194     HashMap<uint64_t, RefPtr<WebUndoStep>> m_undoStepMap;
1195
1196     WebCore::IntSize m_windowResizerSize;
1197
1198 #if ENABLE(CONTEXT_MENUS)
1199     std::unique_ptr<API::InjectedBundle::PageContextMenuClient> m_contextMenuClient;
1200 #endif
1201     InjectedBundlePageEditorClient m_editorClient;
1202     std::unique_ptr<API::InjectedBundle::FormClient> m_formClient;
1203     InjectedBundlePageLoaderClient m_loaderClient;
1204     InjectedBundlePagePolicyClient m_policyClient;
1205     InjectedBundlePageResourceLoadClient m_resourceLoadClient;
1206     std::unique_ptr<API::InjectedBundle::PageUIClient> m_uiClient;
1207 #if ENABLE(FULLSCREEN_API)
1208     InjectedBundlePageFullScreenClient m_fullScreenClient;
1209 #endif
1210     InjectedBundlePageDiagnosticLoggingClient m_logDiagnosticMessageClient;
1211
1212     FindController m_findController;
1213
1214     RefPtr<WebInspector> m_inspector;
1215     RefPtr<WebInspectorUI> m_inspectorUI;
1216 #if PLATFORM(IOS)
1217     RefPtr<WebVideoFullscreenManager> m_videoFullscreenManager;
1218 #endif
1219 #if ENABLE(FULLSCREEN_API)
1220     RefPtr<WebFullScreenManager> m_fullScreenManager;
1221 #endif
1222     RefPtr<WebPopupMenu> m_activePopupMenu;
1223 #if ENABLE(CONTEXT_MENUS)
1224     RefPtr<WebContextMenu> m_contextMenu;
1225 #endif
1226 #if ENABLE(INPUT_TYPE_COLOR)
1227     WebColorChooser* m_activeColorChooser;
1228 #endif
1229     RefPtr<WebOpenPanelResultListener> m_activeOpenPanelResultListener;
1230     RefPtr<NotificationPermissionRequestManager> m_notificationPermissionRequestManager;
1231
1232     RefPtr<WebUserContentController> m_userContentController;
1233
1234 #if ENABLE(GEOLOCATION)
1235     GeolocationPermissionRequestManager m_geolocationPermissionRequestManager;
1236 #endif
1237
1238 #if ENABLE(MEDIA_STREAM)
1239     UserMediaPermissionRequestManager m_userMediaPermissionRequestManager;
1240 #endif
1241
1242     std::unique_ptr<WebCore::PrintContext> m_printContext;
1243 #if PLATFORM(GTK)
1244     RefPtr<WebPrintOperationGtk> m_printOperation;
1245 #endif
1246
1247     SandboxExtensionTracker m_sandboxExtensionTracker;
1248
1249     RefPtr<SandboxExtension> m_pendingDropSandboxExtension;
1250     Vector<RefPtr<SandboxExtension>> m_pendingDropExtensionsForFileUpload;
1251
1252     bool m_canRunBeforeUnloadConfirmPanel;
1253
1254     bool m_canRunModal;
1255     bool m_isRunningModal;
1256
1257 #if ENABLE(DRAG_SUPPORT)
1258     bool m_isStartingDrag;
1259 #endif
1260
1261     bool m_cachedMainFrameIsPinnedToLeftSide;
1262     bool m_cachedMainFrameIsPinnedToRightSide;
1263     bool m_cachedMainFrameIsPinnedToTopSide;
1264     bool m_cachedMainFrameIsPinnedToBottomSide;
1265     bool m_canShortCircuitHorizontalWheelEvents;
1266     unsigned m_numWheelEventHandlers;
1267
1268     unsigned m_cachedPageCount;
1269
1270     HashSet<unsigned long> m_trackedNetworkResourceRequestIdentifiers;
1271
1272     WebCore::IntSize m_minimumLayoutSize;
1273     bool m_autoSizingShouldExpandToViewHeight;
1274
1275 #if ENABLE(CONTEXT_MENUS)
1276     bool m_isShowingContextMenu;
1277 #endif
1278     
1279 #if PLATFORM(IOS)
1280     RefPtr<WebCore::Node> m_assistedNode;
1281     RefPtr<WebCore::Range> m_currentWordRange;
1282     RefPtr<WebCore::Node> m_interactionNode;
1283     WebCore::IntPoint m_lastInteractionLocation;
1284     
1285     enum SelectionAnchor {
1286         Start,
1287         End
1288     };
1289     SelectionAnchor m_selectionAnchor;
1290
1291     RefPtr<WebCore::Node> m_potentialTapNode;
1292     WebCore::FloatPoint m_potentialTapLocation;
1293
1294     WebCore::ViewportConfiguration m_viewportConfiguration;
1295     uint64_t m_firstLayerTreeTransactionIDAfterDidCommitLoad;
1296     bool m_hasReceivedVisibleContentRectsAfterDidCommitLoad;
1297     bool m_scaleWasSetByUIProcess;
1298     bool m_userHasChangedPageScaleFactor;
1299     bool m_hasStablePageScaleFactor;
1300     bool m_userIsInteracting;
1301     bool m_hasPendingBlurNotification;
1302     bool m_useTestingViewportConfiguration;
1303     bool m_isInStableState;
1304     std::chrono::milliseconds m_oldestNonStableUpdateVisibleContentRectsTimestamp;
1305     std::chrono::milliseconds m_estimatedLatency;
1306     WebCore::FloatSize m_screenSize;
1307     WebCore::FloatSize m_availableScreenSize;
1308     RefPtr<WebCore::Range> m_currentBlockSelection;
1309     WebCore::IntSize m_blockSelectionDesiredSize;
1310     WebCore::FloatSize m_maximumUnobscuredSize;
1311     int32_t m_deviceOrientation;
1312     bool m_inDynamicSizeUpdate;
1313     HashMap<std::pair<WebCore::IntSize, double>, WebCore::IntPoint> m_dynamicSizeUpdateHistory;
1314     RefPtr<WebCore::Node> m_pendingSyntheticClickNode;
1315     WebCore::FloatPoint m_pendingSyntheticClickLocation;
1316 #endif
1317
1318     WebInspectorClient* m_inspectorClient;
1319
1320     HashSet<String, CaseFoldingHash> m_mimeTypesWithCustomContentProviders;
1321     WebCore::Color m_backgroundColor;
1322
1323     HashSet<unsigned> m_activeRenderingSuppressionTokens;
1324     unsigned m_maximumRenderingSuppressionToken;
1325     
1326     WebCore::ScrollPinningBehavior m_scrollPinningBehavior;
1327
1328     bool m_useAsyncScrolling;
1329
1330     WebCore::ViewState::Flags m_viewState;
1331     WebCore::PageActivityState::Flags m_activityState;
1332
1333     bool m_processSuppressionEnabled;
1334     UserActivity m_userActivity;
1335
1336     uint64_t m_pendingNavigationID;
1337
1338 #if ENABLE(WEBGL)
1339     WebCore::WebGLLoadPolicy m_systemWebGLPolicy;
1340 #endif
1341
1342 #if PLATFORM(MAC)
1343     RefPtr<WebCore::Range> m_lastActionMenuRangeForSelection;
1344     WebCore::HitTestResult m_lastActionMenuHitTestResult;
1345     RefPtr<WebPageOverlay> m_lastActionMenuHitPageOverlay;
1346     bool m_lastActionMenuHitTestPreventsDefault;
1347 #endif
1348
1349     bool m_mainFrameProgressCompleted;
1350     bool m_shouldDispatchFakeMouseMoveEvents;
1351 };
1352
1353 } // namespace WebKit
1354
1355 #endif // WebPage_h