Change more of the IPC code to take connections by reference
[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 "APIInjectedBundlePageUIClient.h"
31 #include "APIObject.h"
32 #include "DictionaryPopupInfo.h"
33 #include "FindController.h"
34 #include "GeolocationPermissionRequestManager.h"
35 #include "ImageOptions.h"
36 #include "InjectedBundlePageDiagnosticLoggingClient.h"
37 #include "InjectedBundlePageEditorClient.h"
38 #include "InjectedBundlePageFullScreenClient.h"
39 #include "InjectedBundlePageLoaderClient.h"
40 #include "InjectedBundlePagePolicyClient.h"
41 #include "InjectedBundlePageResourceLoadClient.h"
42 #include "LayerTreeHost.h"
43 #include "MessageReceiver.h"
44 #include "MessageSender.h"
45 #include "Plugin.h"
46 #include "SandboxExtension.h"
47 #include "ShareableBitmap.h"
48 #include "UserData.h"
49 #include "UserMediaPermissionRequestManager.h"
50 #include <WebCore/DictationAlternative.h>
51 #include <WebCore/DragData.h>
52 #include <WebCore/Editor.h>
53 #include <WebCore/FrameLoaderTypes.h>
54 #include <WebCore/HitTestResult.h>
55 #include <WebCore/IntRect.h>
56 #include <WebCore/IntSizeHash.h>
57 #include <WebCore/Page.h>
58 #include <WebCore/PageOverlay.h>
59 #include <WebCore/PageVisibilityState.h>
60 #include <WebCore/ScrollTypes.h>
61 #include <WebCore/TextChecking.h>
62 #include <WebCore/TextIndicator.h>
63 #include <WebCore/UserActivity.h>
64 #include <WebCore/ViewState.h>
65 #include <WebCore/ViewportConfiguration.h>
66 #include <WebCore/WebCoreKeyboardUIMode.h>
67 #include <memory>
68 #include <wtf/HashMap.h>
69 #include <wtf/PassRefPtr.h>
70 #include <wtf/RefPtr.h>
71 #include <wtf/RunLoop.h>
72 #include <wtf/text/WTFString.h>
73
74 #if HAVE(ACCESSIBILITY) && (PLATFORM(GTK) || PLATFORM(EFL))
75 #include "WebPageAccessibilityObject.h"
76 #include <wtf/gobject/GRefPtr.h>
77 #endif
78
79 #if PLATFORM(GTK)
80 #include "ArgumentCodersGtk.h"
81 #include "WebPrintOperationGtk.h"
82 #endif
83
84 #if PLATFORM(IOS)
85 #include "GestureTypes.h"
86 #import "WebPageMessages.h"
87 #endif
88
89 #if ENABLE(IOS_TOUCH_EVENTS)
90 #include <WebKitAdditions/PlatformTouchEventIOS.h>
91 #elif ENABLE(TOUCH_EVENTS)
92 #include <WebCore/PlatformTouchEvent.h>
93 #endif
94
95 #if ENABLE(CONTEXT_MENUS)
96 #include "InjectedBundlePageContextMenuClient.h"
97 #endif
98
99 #if PLATFORM(COCOA)
100 #include "ViewGestureGeometryCollector.h"
101 #include <wtf/RetainPtr.h>
102 OBJC_CLASS CALayer;
103 OBJC_CLASS NSDictionary;
104 OBJC_CLASS NSObject;
105 OBJC_CLASS WKAccessibilityWebPageObject;
106
107 #define ENABLE_PRIMARY_SNAPSHOTTED_PLUGIN_HEURISTIC 1
108 #endif
109
110 namespace API {
111 class Array;
112 }
113
114 namespace IPC {
115 class ArgumentDecoder;
116 class Connection;
117 }
118
119 namespace WebCore {
120 class DocumentLoader;
121 class GraphicsContext;
122 class Frame;
123 class FrameView;
124 class HTMLPlugInElement;
125 class HTMLPlugInImageElement;
126 class IntPoint;
127 class KeyboardEvent;
128 class Page;
129 class PrintContext;
130 class Range;
131 class ResourceResponse;
132 class ResourceRequest;
133 class SharedBuffer;
134 class SubstituteData;
135 class TextCheckingRequest;
136 class URL;
137 class VisibleSelection;
138 struct Highlight;
139 struct KeypressCommand;
140 struct TextCheckingResult;
141 }
142
143 namespace WebKit {
144
145 class DrawingArea;
146 class InjectedBundleBackForwardList;
147 class NotificationPermissionRequestManager;
148 class PageBanner;
149 class PluginView;
150 class VisibleContentRectUpdateInfo;
151 class WebColorChooser;
152 class WebContextMenu;
153 class WebContextMenuItemData;
154 class WebEvent;
155 class WebFrame;
156 class WebFullScreenManager;
157 class WebImage;
158 class WebInspector;
159 class WebInspectorClient;
160 class WebInspectorUI;
161 class WebKeyboardEvent;
162 class WebMouseEvent;
163 class WebNotificationClient;
164 class WebOpenPanelResultListener;
165 class WebPageGroupProxy;
166 class WebPageOverlay;
167 class WebPopupMenu;
168 class WebUndoStep;
169 class WebUserContentController;
170 class WebVideoFullscreenManager;
171 class WebWheelEvent;
172 struct AssistedNodeInformation;
173 struct AttributedString;
174 struct BackForwardListItemState;
175 struct EditingRange;
176 struct EditorState;
177 struct InteractionInformationAtPosition;
178 struct PrintInfo;
179 struct WebPageCreationParameters;
180 struct WebPreferencesStore;
181
182 #if PLATFORM(COCOA)
183 class RemoteLayerTreeTransaction;
184 #endif
185
186 #if ENABLE(TOUCH_EVENTS)
187 class WebTouchEvent;
188 #endif
189
190 class WebPage : public API::ObjectImpl<API::Object::Type::BundlePage>, public IPC::MessageReceiver, public IPC::MessageSender {
191 public:
192     static PassRefPtr<WebPage> create(uint64_t pageID, const WebPageCreationParameters&);
193     virtual ~WebPage();
194
195     void reinitializeWebPage(const WebPageCreationParameters&);
196
197     void close();
198
199     static WebPage* fromCorePage(WebCore::Page*);
200
201     WebCore::Page* corePage() const { return m_page.get(); }
202     uint64_t pageID() const { return m_pageID; }
203     WebCore::SessionID sessionID() const { return m_page->sessionID(); }
204     bool usesEphemeralSession() const { return m_page->usesEphemeralSession(); }
205
206     void setSessionID(WebCore::SessionID);
207
208     void setSize(const WebCore::IntSize&);
209     const WebCore::IntSize& size() const { return m_viewSize; }
210     WebCore::IntRect bounds() const { return WebCore::IntRect(WebCore::IntPoint(), size()); }
211     
212     InjectedBundleBackForwardList* backForwardList();
213     DrawingArea* drawingArea() const { return m_drawingArea.get(); }
214 #if ENABLE(ASYNC_SCROLLING)
215     WebCore::ScrollingCoordinator* scrollingCoordinator() const;
216 #endif
217
218     WebPageGroupProxy* pageGroup() const { return m_pageGroup.get(); }
219
220     void scrollMainFrameIfNotAtMaxScrollPosition(const WebCore::IntSize& scrollOffset);
221
222     bool scrollBy(uint32_t scrollDirection, uint32_t scrollGranularity);
223
224     void centerSelectionInVisibleArea();
225
226 #if PLATFORM(COCOA)
227     void willCommitLayerTree(RemoteLayerTreeTransaction&);
228     void didFlushLayerTreeAtTime(std::chrono::milliseconds);
229 #endif
230
231 #if ENABLE(INSPECTOR)
232     WebInspector* inspector();
233     WebInspectorUI* inspectorUI();
234     bool isInspectorPage() { return !!m_inspectorUI; }
235 #endif
236
237 #if PLATFORM(IOS)
238     WebVideoFullscreenManager* videoFullscreenManager();
239 #endif
240
241 #if ENABLE(FULLSCREEN_API)
242     WebFullScreenManager* fullScreenManager();
243 #endif
244
245     // -- Called by the DrawingArea.
246     // FIXME: We could genericize these into a DrawingArea client interface. Would that be beneficial?
247     void drawRect(WebCore::GraphicsContext&, const WebCore::IntRect&);
248     void layoutIfNeeded();
249
250     // -- Called from WebCore clients.
251     bool handleEditingKeyboardEvent(WebCore::KeyboardEvent*);
252
253     void didStartPageTransition();
254     void didCompletePageTransition();
255     void didCommitLoad(WebFrame*);
256     void didFinishLoad(WebFrame*);
257     void show();
258     String userAgent(const WebCore::URL&) const;
259     String userAgent(WebFrame*, const WebCore::URL&) const;
260     String platformUserAgent(const WebCore::URL&) const;
261     WebCore::IntRect windowResizerRect() const;
262     WebCore::KeyboardUIMode keyboardUIMode();
263
264     WebUndoStep* webUndoStep(uint64_t);
265     void addWebUndoStep(uint64_t, WebUndoStep*);
266     void removeWebEditCommand(uint64_t);
267     bool isInRedo() const { return m_isInRedo; }
268
269     void setActivePopupMenu(WebPopupMenu*);
270
271 #if ENABLE(INPUT_TYPE_COLOR)
272     WebColorChooser* activeColorChooser() const { return m_activeColorChooser; }
273     void setActiveColorChooser(WebColorChooser*);
274     void didChooseColor(const WebCore::Color&);
275     void didEndColorPicker();
276 #endif
277
278     WebOpenPanelResultListener* activeOpenPanelResultListener() const { return m_activeOpenPanelResultListener.get(); }
279     void setActiveOpenPanelResultListener(PassRefPtr<WebOpenPanelResultListener>);
280
281     void didReceiveMessage(IPC::Connection&, IPC::MessageDecoder&) override;
282     void didReceiveSyncMessage(IPC::Connection&, IPC::MessageDecoder&, std::unique_ptr<IPC::MessageEncoder>&) override;
283
284     // -- InjectedBundle methods
285 #if ENABLE(CONTEXT_MENUS)
286     void initializeInjectedBundleContextMenuClient(WKBundlePageContextMenuClientBase*);
287 #endif
288     void initializeInjectedBundleEditorClient(WKBundlePageEditorClientBase*);
289     void setInjectedBundleFormClient(std::unique_ptr<API::InjectedBundle::FormClient>);
290     void initializeInjectedBundleLoaderClient(WKBundlePageLoaderClientBase*);
291     void initializeInjectedBundlePolicyClient(WKBundlePagePolicyClientBase*);
292     void initializeInjectedBundleResourceLoadClient(WKBundlePageResourceLoadClientBase*);
293     void setInjectedBundleUIClient(std::unique_ptr<API::InjectedBundle::PageUIClient>);
294 #if ENABLE(FULLSCREEN_API)
295     void initializeInjectedBundleFullScreenClient(WKBundlePageFullScreenClientBase*);
296 #endif
297     void initializeInjectedBundleDiagnosticLoggingClient(WKBundlePageDiagnosticLoggingClientBase*);
298
299 #if ENABLE(CONTEXT_MENUS)
300     InjectedBundlePageContextMenuClient& injectedBundleContextMenuClient() { return m_contextMenuClient; }
301 #endif
302     InjectedBundlePageEditorClient& injectedBundleEditorClient() { return m_editorClient; }
303     API::InjectedBundle::FormClient& injectedBundleFormClient() { return *m_formClient.get(); }
304     InjectedBundlePageLoaderClient& injectedBundleLoaderClient() { return m_loaderClient; }
305     InjectedBundlePagePolicyClient& injectedBundlePolicyClient() { return m_policyClient; }
306     InjectedBundlePageResourceLoadClient& injectedBundleResourceLoadClient() { return m_resourceLoadClient; }
307     API::InjectedBundle::PageUIClient& injectedBundleUIClient() { return *m_uiClient.get(); }
308     InjectedBundlePageDiagnosticLoggingClient& injectedBundleDiagnosticLoggingClient() { return m_logDiagnosticMessageClient; }
309 #if ENABLE(FULLSCREEN_API)
310     InjectedBundlePageFullScreenClient& injectedBundleFullScreenClient() { return m_fullScreenClient; }
311 #endif
312
313     bool findStringFromInjectedBundle(const String&, FindOptions);
314
315     WebFrame* mainWebFrame() const { return m_mainFrame.get(); }
316
317     WebCore::MainFrame* mainFrame() const; // May return 0.
318     WebCore::FrameView* mainFrameView() const; // May return 0.
319
320     PassRefPtr<WebCore::Range> currentSelectionAsRange();
321
322 #if ENABLE(NETSCAPE_PLUGIN_API)
323     PassRefPtr<Plugin> createPlugin(WebFrame*, WebCore::HTMLPlugInElement*, const Plugin::Parameters&, String& newMIMEType);
324 #endif
325
326 #if ENABLE(WEBGL)
327     WebCore::WebGLLoadPolicy webGLPolicyForURL(WebFrame*, const String&);
328     WebCore::WebGLLoadPolicy resolveWebGLPolicyForURL(WebFrame*, const String&);
329 #endif // ENABLE(WEBGL)
330     
331     EditorState editorState() const;
332
333     String renderTreeExternalRepresentation() const;
334     String renderTreeExternalRepresentationForPrinting() const;
335     uint64_t renderTreeSize() const;
336
337     void setTracksRepaints(bool);
338     bool isTrackingRepaints() const;
339     void resetTrackedRepaints();
340     PassRefPtr<API::Array> trackedRepaintRects();
341
342     void executeEditingCommand(const String& commandName, const String& argument);
343     bool isEditingCommandEnabled(const String& commandName);
344     void clearMainFrameName();
345     void sendClose();
346
347     void sendSetWindowFrame(const WebCore::FloatRect&);
348
349     double textZoomFactor() const;
350     void setTextZoomFactor(double);
351     double pageZoomFactor() const;
352     void setPageZoomFactor(double);
353     void setPageAndTextZoomFactors(double pageZoomFactor, double textZoomFactor);
354     void windowScreenDidChange(uint64_t);
355
356     void scalePage(double scale, const WebCore::IntPoint& origin);
357     void scalePageInViewCoordinates(double scale, WebCore::IntPoint centerInViewCoordinates);
358     double pageScaleFactor() const;
359
360     void setUseFixedLayout(bool);
361     bool useFixedLayout() const { return m_useFixedLayout; }
362     void setFixedLayoutSize(const WebCore::IntSize&);
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&);
478     void potentialTapAtPosition(uint64_t requestID, const WebCore::FloatPoint&);
479     void commitPotentialTap();
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     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 #if ENABLE(INSPECTOR)
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 #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(TILED_BACKING_STORE)
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 #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
687 #if ENABLE(DRAG_SUPPORT)
688 #if PLATFORM(GTK)
689     void performDragControllerAction(uint64_t action, WebCore::DragData);
690 #else
691     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&);
692 #endif
693     void dragEnded(WebCore::IntPoint clientPosition, WebCore::IntPoint globalPosition, uint64_t operation);
694
695     void willPerformLoadDragDestinationAction();
696     void mayPerformUploadDragDestinationAction();
697
698     void willStartDrag() { ASSERT(!m_isStartingDrag); m_isStartingDrag = true; }
699     void didStartDrag() { ASSERT(m_isStartingDrag); m_isStartingDrag = false; }
700 #endif // ENABLE(DRAG_SUPPORT)
701
702     void beginPrinting(uint64_t frameID, const PrintInfo&);
703     void endPrinting();
704     void computePagesForPrinting(uint64_t frameID, const PrintInfo&, uint64_t callbackID);
705     void computePagesForPrintingImpl(uint64_t frameID, const PrintInfo&, Vector<WebCore::IntRect>& pageRects, double& totalScaleFactor);
706 #if PLATFORM(COCOA)
707     void drawRectToImage(uint64_t frameID, const PrintInfo&, const WebCore::IntRect&, const WebCore::IntSize&, uint64_t callbackID);
708     void drawPagesToPDF(uint64_t frameID, const PrintInfo&, uint32_t first, uint32_t count, uint64_t callbackID);
709     void drawPagesToPDFImpl(uint64_t frameID, const PrintInfo&, uint32_t first, uint32_t count, RetainPtr<CFMutableDataRef>& pdfPageData);
710 #if PLATFORM(IOS)
711     void computePagesForPrintingAndStartDrawingToPDF(uint64_t frameID, const PrintInfo&, uint32_t firstPage, PassRefPtr<Messages::WebPage::ComputePagesForPrintingAndStartDrawingToPDF::DelayedReply>);
712 #endif
713 #elif PLATFORM(GTK)
714     void drawPagesForPrinting(uint64_t frameID, const PrintInfo&, uint64_t callbackID);
715     void didFinishPrintOperation(const WebCore::ResourceError&, uint64_t callbackID);
716 #endif
717
718     void addResourceRequest(unsigned long, const WebCore::ResourceRequest&);
719     void removeResourceRequest(unsigned long);
720
721     void setMediaVolume(float);
722     void setMuted(bool);
723     void setMayStartMediaWhenInWindow(bool);
724
725     void updateMainFrameScrollOffsetPinning();
726
727     bool mainFrameHasCustomContentProvider() const;
728     void addMIMETypeWithCustomContentProvider(const String&);
729
730     void mainFrameDidLayout();
731
732     bool canRunBeforeUnloadConfirmPanel() const { return m_canRunBeforeUnloadConfirmPanel; }
733     void setCanRunBeforeUnloadConfirmPanel(bool canRunBeforeUnloadConfirmPanel) { m_canRunBeforeUnloadConfirmPanel = canRunBeforeUnloadConfirmPanel; }
734
735     bool canRunModal() const { return m_canRunModal; }
736     void setCanRunModal(bool canRunModal) { m_canRunModal = canRunModal; }
737
738     void runModal();
739
740     void setDeviceScaleFactor(float);
741     float deviceScaleFactor() const;
742
743     void forceRepaintWithoutCallback();
744
745     void unmarkAllMisspellings();
746     void unmarkAllBadGrammar();
747 #if PLATFORM(COCOA)
748     void handleAlternativeTextUIResult(const String&);
749 #endif
750
751     // For testing purpose.
752     void simulateMouseDown(int button, WebCore::IntPoint, int clickCount, WKEventModifiers, double time);
753     void simulateMouseUp(int button, WebCore::IntPoint, int clickCount, WKEventModifiers, double time);
754     void simulateMouseMotion(WebCore::IntPoint, double time);
755
756 #if ENABLE(CONTEXT_MENUS)
757     void contextMenuShowing() { m_isShowingContextMenu = true; }
758 #endif
759
760     void wheelEvent(const WebWheelEvent&);
761
762     void numWheelEventHandlersChanged(unsigned);
763     void recomputeShortCircuitHorizontalWheelEventsState();
764
765     void updateVisibilityState(bool isInitialState = false);
766
767 #if PLATFORM(IOS)
768     void setViewportConfigurationMinimumLayoutSize(const WebCore::FloatSize&);
769     void setMaximumUnobscuredSize(const WebCore::FloatSize&);
770     void setDeviceOrientation(int32_t);
771     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);
772     void synchronizeDynamicViewportUpdate(double& newTargetScale, WebCore::FloatPoint& newScrollPosition, uint64_t& nextValidLayerTreeTransactionID);
773     void updateVisibleContentRects(const VisibleContentRectUpdateInfo&, double oldestTimestamp);
774     bool scaleWasSetByUIProcess() const { return m_scaleWasSetByUIProcess; }
775     void willStartUserTriggeredZooming();
776     void applicationWillResignActive();
777     void applicationWillEnterForeground();
778     void applicationDidBecomeActive();
779     void zoomToRect(WebCore::FloatRect, double minimumScale, double maximumScale);
780     void completePendingSyntheticClickForContentChangeObserver();
781 #endif
782
783 #if ENABLE(IOS_TOUCH_EVENTS)
784     void dispatchTouchEvent(const WebTouchEvent&, bool& handled);
785 #endif
786
787 #if PLATFORM(GTK) && USE(TEXTURE_MAPPER_GL)
788     uint64_t nativeWindowHandle() { return m_nativeWindowHandle; }
789 #endif
790
791     bool shouldUseCustomContentProviderForResponse(const WebCore::ResourceResponse&);
792     bool canPluginHandleResponse(const WebCore::ResourceResponse& response);
793
794     bool asynchronousPluginInitializationEnabled() const { return m_asynchronousPluginInitializationEnabled; }
795     void setAsynchronousPluginInitializationEnabled(bool enabled) { m_asynchronousPluginInitializationEnabled = enabled; }
796     bool asynchronousPluginInitializationEnabledForAllPlugins() const { return m_asynchronousPluginInitializationEnabledForAllPlugins; }
797     void setAsynchronousPluginInitializationEnabledForAllPlugins(bool enabled) { m_asynchronousPluginInitializationEnabledForAllPlugins = enabled; }
798     bool artificialPluginInitializationDelayEnabled() const { return m_artificialPluginInitializationDelayEnabled; }
799     void setArtificialPluginInitializationDelayEnabled(bool enabled) { m_artificialPluginInitializationDelayEnabled = enabled; }
800     void setTabToLinksEnabled(bool enabled) { m_tabToLinks = enabled; }
801     bool tabToLinksEnabled() const { return m_tabToLinks; }
802
803     bool scrollingPerformanceLoggingEnabled() const { return m_scrollingPerformanceLoggingEnabled; }
804     void setScrollingPerformanceLoggingEnabled(bool);
805
806 #if PLATFORM(COCOA)
807     bool shouldUsePDFPlugin() const;
808     bool pdfPluginEnabled() const { return m_pdfPluginEnabled; }
809     void setPDFPluginEnabled(bool enabled) { m_pdfPluginEnabled = enabled; }
810 #endif
811
812     void savePDFToFileInDownloadsFolder(const String& suggestedFilename, const String& originatingURLString, const uint8_t* data, unsigned long size);
813 #if PLATFORM(COCOA)
814     void savePDFToTemporaryFolderAndOpenWithNativeApplication(const String& suggestedFilename, const String& originatingURLString, const uint8_t* data, unsigned long size, const String& pdfUUID);
815 #endif
816
817     bool mainFrameIsScrollable() const { return m_mainFrameIsScrollable; }
818
819     void setMinimumLayoutSize(const WebCore::IntSize&);
820     WebCore::IntSize minimumLayoutSize() const { return m_minimumLayoutSize; }
821
822     void setAutoSizingShouldExpandToViewHeight(bool shouldExpand);
823     bool autoSizingShouldExpandToViewHeight() { return m_autoSizingShouldExpandToViewHeight; }
824
825     bool canShowMIMEType(const String& MIMEType) const;
826
827     void addTextCheckingRequest(uint64_t requestID, PassRefPtr<WebCore::TextCheckingRequest>);
828     void didFinishCheckingText(uint64_t requestID, const Vector<WebCore::TextCheckingResult>&);
829     void didCancelCheckingText(uint64_t requestID);
830
831 #if ENABLE(PRIMARY_SNAPSHOTTED_PLUGIN_HEURISTIC)
832     void determinePrimarySnapshottedPlugIn();
833     void determinePrimarySnapshottedPlugInTimerFired();
834     void resetPrimarySnapshottedPlugIn();
835     bool matchesPrimaryPlugIn(const String& pageOrigin, const String& pluginOrigin, const String& mimeType) const;
836     bool plugInIntersectsSearchRect(WebCore::HTMLPlugInImageElement& pluginImageElement);
837     bool plugInIsPrimarySize(WebCore::HTMLPlugInImageElement& pluginImageElement, unsigned &pluginArea);
838 #endif
839
840     unsigned extendIncrementalRenderingSuppression();
841     void stopExtendingIncrementalRenderingSuppression(unsigned token);
842     bool shouldExtendIncrementalRenderingSuppression() { return !m_activeRenderingSuppressionTokens.isEmpty(); }
843
844     WebCore::ScrollPinningBehavior scrollPinningBehavior() { return m_scrollPinningBehavior; }
845     void setScrollPinningBehavior(uint32_t /* WebCore::ScrollPinningBehavior */ pinning);
846
847     PassRefPtr<WebCore::DocumentLoader> createDocumentLoader(WebCore::Frame&, const WebCore::ResourceRequest&, const WebCore::SubstituteData&);
848
849     void getBytecodeProfile(uint64_t callbackID);
850     
851     // Some platforms require accessibility-enabled processes to spin the run loop so that the WebProcess doesn't hang.
852     // While this is not ideal, it does not have to be applied to every platform at the moment.
853     static bool synchronousMessagesShouldSpinRunLoop();
854
855 #if ENABLE(SERVICE_CONTROLS) || ENABLE(TELEPHONE_NUMBER_DETECTION)
856     void handleTelephoneNumberClick(const String& number, const WebCore::IntPoint&);
857     void handleSelectionServiceClick(WebCore::FrameSelection&, const Vector<String>& telephoneNumbers, const WebCore::IntPoint&);
858 #endif
859
860     void didChangeScrollOffsetForFrame(WebCore::Frame*);
861
862     void setMainFrameProgressCompleted(bool completed) { m_mainFrameProgressCompleted = completed; }
863     bool shouldDispatchFakeMouseMoveEvents() const { return m_shouldDispatchFakeMouseMoveEvents; }
864
865     void setPageActivityState(WebCore::PageActivityState::Flags);
866
867 private:
868     WebPage(uint64_t pageID, const WebPageCreationParameters&);
869
870     // IPC::MessageSender
871     virtual IPC::Connection* messageSenderConnection() override;
872     virtual uint64_t messageSenderDestinationID() override;
873
874     void platformInitialize();
875     void platformDetach();
876
877     void didReceiveWebPageMessage(IPC::Connection&, IPC::MessageDecoder&);
878     void didReceiveSyncWebPageMessage(IPC::Connection&, IPC::MessageDecoder&, std::unique_ptr<IPC::MessageEncoder>&);
879
880 #if PLATFORM(IOS)
881     void resetViewportDefaultConfiguration(WebFrame* mainFrame);
882     void viewportConfigurationChanged();
883     void updateViewportSizeForCSSViewportUnits();
884
885     static void convertSelectionRectsToRootView(WebCore::FrameView*, Vector<WebCore::SelectionRect>&);
886     PassRefPtr<WebCore::Range> rangeForWebSelectionAtPosition(const WebCore::IntPoint&, const WebCore::VisiblePosition&, SelectionFlags&);
887     PassRefPtr<WebCore::Range> rangeForBlockAtPoint(const WebCore::IntPoint&);
888     void computeExpandAndShrinkThresholdsForHandle(const WebCore::IntPoint&, SelectionHandlePosition, float& growThreshold, float& shrinkThreshold);
889     PassRefPtr<WebCore::Range> changeBlockSelection(const WebCore::IntPoint&, SelectionHandlePosition, float& growThreshold, float& shrinkThreshold, SelectionFlags&);
890     PassRefPtr<WebCore::Range> expandedRangeFromHandle(WebCore::Range*, SelectionHandlePosition);
891     PassRefPtr<WebCore::Range> contractedRangeFromHandle(WebCore::Range* currentRange, SelectionHandlePosition, SelectionFlags&);
892     void getAssistedNodeInformation(AssistedNodeInformation&);
893     void platformInitializeAccessibility();
894     void handleSyntheticClick(WebCore::Node* nodeRespondingToClick, const WebCore::FloatPoint& location);
895     void completeSyntheticClick(WebCore::Node* nodeRespondingToClick, const WebCore::FloatPoint& location);
896     void sendTapHighlightForNodeIfNecessary(uint64_t requestID, WebCore::Node*);
897     void resetTextAutosizingBeforeLayoutIfNeeded(const WebCore::FloatSize& oldSize, const WebCore::FloatSize& newSize);
898     WebCore::VisiblePosition visiblePositionInFocusedNodeForPoint(WebCore::Frame&, const WebCore::IntPoint&);
899 #endif
900 #if !PLATFORM(COCOA)
901     static const char* interpretKeyEvent(const WebCore::KeyboardEvent*);
902 #endif
903     bool performDefaultBehaviorForKeyEvent(const WebKeyboardEvent&);
904
905 #if PLATFORM(MAC)
906     bool executeKeypressCommandsInternal(const Vector<WebCore::KeypressCommand>&, WebCore::KeyboardEvent*);
907 #endif
908
909     String sourceForFrame(WebFrame*);
910
911     void loadDataImpl(uint64_t navigationID, PassRefPtr<WebCore::SharedBuffer>, const String& MIMEType, const String& encodingName, const WebCore::URL& baseURL, const WebCore::URL& failingURL, const UserData&);
912     void loadString(uint64_t navigationID, const String&, const String& MIMEType, const WebCore::URL& baseURL, const WebCore::URL& failingURL, const UserData&);
913
914     bool platformHasLocalDataForURL(const WebCore::URL&);
915
916     // Actions
917     void tryClose();
918     void loadRequest(uint64_t navigationID, const WebCore::ResourceRequest&, const SandboxExtension::Handle&, const UserData&);
919     void loadData(const IPC::DataReference&, const String& MIMEType, const String& encodingName, const String& baseURL, const UserData&);
920     void loadHTMLString(uint64_t navigationID, const String& htmlString, const String& baseURL, const UserData&);
921     void loadAlternateHTMLString(const String& htmlString, const String& baseURL, const String& unreachableURL, const UserData&);
922     void loadPlainTextString(const String&, const UserData&);
923     void loadWebArchiveData(const IPC::DataReference&, const UserData&);
924     void navigateToURLWithSimulatedClick(const String& url, WebCore::IntPoint documentPoint, WebCore::IntPoint screenPoint);
925     void reload(uint64_t navigationID, bool reloadFromOrigin, const SandboxExtension::Handle&);
926     void goForward(uint64_t navigationID, uint64_t);
927     void goBack(uint64_t navigationID, uint64_t);
928     void goToBackForwardItem(uint64_t navigationID, uint64_t);
929     void tryRestoreScrollPosition();
930     void setInitialFocus(bool forward, bool isKeyboardEventValid, const WebKeyboardEvent&);
931     void setWindowResizerSize(const WebCore::IntSize&);
932     void updateIsInWindow(bool isInitialState = false);
933     void setViewState(WebCore::ViewState::Flags, bool wantsDidUpdateViewState, const Vector<uint64_t>& callbackIDs);
934     void validateCommand(const String&, uint64_t);
935     void executeEditCommand(const String&);
936
937     void updateUserActivity();
938
939     void mouseEvent(const WebMouseEvent&);
940     void mouseEventSyncForTesting(const WebMouseEvent&, bool&);
941     void wheelEventSyncForTesting(const WebWheelEvent&, bool&);
942     void keyEvent(const WebKeyboardEvent&);
943     void keyEventSyncForTesting(const WebKeyboardEvent&, bool&);
944 #if ENABLE(IOS_TOUCH_EVENTS)
945     void touchEventSync(const WebTouchEvent&, bool& handled);
946 #elif ENABLE(TOUCH_EVENTS)
947     void touchEvent(const WebTouchEvent&);
948     void touchEventSyncForTesting(const WebTouchEvent&, bool& handled);
949 #endif
950 #if ENABLE(CONTEXT_MENUS)
951     void contextMenuHidden() { m_isShowingContextMenu = false; }
952 #endif
953
954     static bool scroll(WebCore::Page*, WebCore::ScrollDirection, WebCore::ScrollGranularity);
955     static bool logicalScroll(WebCore::Page*, WebCore::ScrollLogicalDirection, WebCore::ScrollGranularity);
956
957     void loadURLInFrame(const String&, uint64_t frameID);
958
959     void restoreSession(const Vector<BackForwardListItemState>&);
960     void didRemoveBackForwardItem(uint64_t);
961
962 #if ENABLE(REMOTE_INSPECTOR)
963     void setAllowsRemoteInspection(bool);
964 #endif
965
966     void setDrawsBackground(bool);
967     void setDrawsTransparentBackground(bool);
968
969     void setTopContentInset(float);
970
971     void viewWillStartLiveResize();
972     void viewWillEndLiveResize();
973
974     void getContentsAsString(uint64_t callbackID);
975 #if ENABLE(MHTML)
976     void getContentsAsMHTMLData(uint64_t callbackID, bool useBinaryEncoding);
977 #endif
978     void getMainResourceDataOfFrame(uint64_t frameID, uint64_t callbackID);
979     void getResourceDataFromFrame(uint64_t frameID, const String& resourceURL, uint64_t callbackID);
980     void getRenderTreeExternalRepresentation(uint64_t callbackID);
981     void getSelectionOrContentsAsString(uint64_t callbackID);
982     void getSelectionAsWebArchiveData(uint64_t callbackID);
983     void getSourceForFrame(uint64_t frameID, uint64_t callbackID);
984     void getWebArchiveOfFrame(uint64_t frameID, uint64_t callbackID);
985     void runJavaScriptInMainFrame(const String&, uint64_t callbackID);
986     void forceRepaint(uint64_t callbackID);
987     void takeSnapshot(WebCore::IntRect snapshotRect, WebCore::IntSize bitmapSize, uint32_t options, uint64_t callbackID);
988
989     void preferencesDidChange(const WebPreferencesStore&);
990     void platformPreferencesDidChange(const WebPreferencesStore&);
991     void updatePreferences(const WebPreferencesStore&);
992
993     void didReceivePolicyDecision(uint64_t frameID, uint64_t listenerID, uint32_t policyAction, uint64_t navigationID, uint64_t downloadID);
994     void setUserAgent(const String&);
995     void setCustomTextEncodingName(const String&);
996     void suspendActiveDOMObjectsAndAnimations();
997     void resumeActiveDOMObjectsAndAnimations();
998
999 #if PLATFORM(COCOA)
1000     void performDictionaryLookupAtLocation(const WebCore::FloatPoint&);
1001     void performDictionaryLookupOfCurrentSelection();
1002     void performDictionaryLookupForRange(WebCore::Frame*, WebCore::Range&, NSDictionary *options, WebCore::TextIndicatorPresentationTransition);
1003     DictionaryPopupInfo dictionaryPopupInfoForRange(WebCore::Frame* frame, WebCore::Range& range, NSDictionary **options, WebCore::TextIndicatorPresentationTransition presentationTransition);
1004
1005     void windowAndViewFramesChanged(const WebCore::FloatRect& windowFrameInScreenCoordinates, const WebCore::FloatRect& windowFrameInUnflippedScreenCoordinates, const WebCore::FloatRect& viewFrameInWindowCoordinates, const WebCore::FloatPoint& accessibilityViewCoordinates);
1006
1007     RetainPtr<PDFDocument> pdfDocumentForPrintingFrame(WebCore::Frame*);
1008     void computePagesForPrintingPDFDocument(uint64_t frameID, const PrintInfo&, Vector<WebCore::IntRect>& resultPageRects);
1009     void drawPDFDocument(CGContextRef, PDFDocument *, const PrintInfo&, const WebCore::IntRect&);
1010     void drawPagesToPDFFromPDFDocument(CGContextRef, PDFDocument *, const PrintInfo&, uint32_t first, uint32_t count);
1011 #endif
1012
1013     void setMainFrameIsScrollable(bool);
1014
1015     void unapplyEditCommand(uint64_t commandID);
1016     void reapplyEditCommand(uint64_t commandID);
1017     void didRemoveEditCommand(uint64_t commandID);
1018
1019     void findString(const String&, uint32_t findOptions, uint32_t maxMatchCount);
1020     void findStringMatches(const String&, uint32_t findOptions, uint32_t maxMatchCount);
1021     void getImageForFindMatch(uint32_t matchIndex);
1022     void selectFindMatch(uint32_t matchIndex);
1023     void hideFindUI();
1024     void countStringMatches(const String&, uint32_t findOptions, uint32_t maxMatchCount);
1025
1026 #if USE(COORDINATED_GRAPHICS)
1027     void findZoomableAreaForPoint(const WebCore::IntPoint&, const WebCore::IntSize& area);
1028 #endif
1029
1030     void didChangeSelectedIndexForActivePopupMenu(int32_t newIndex);
1031     void setTextForActivePopupMenu(int32_t index);
1032
1033 #if PLATFORM(GTK)
1034     void failedToShowPopupMenu();
1035 #endif
1036
1037 #if PLATFORM(IOS)
1038     void didChooseFilesForOpenPanelWithDisplayStringAndIcon(const Vector<String>&, const String& displayString, const IPC::DataReference& iconData);
1039 #endif
1040     void didChooseFilesForOpenPanel(const Vector<String>&);
1041     void didCancelForOpenPanel();
1042 #if ENABLE(SANDBOX_EXTENSIONS)
1043     void extendSandboxForFileFromOpenPanel(const SandboxExtension::Handle&);
1044 #endif
1045
1046     void didReceiveGeolocationPermissionDecision(uint64_t geolocationID, bool allowed);
1047
1048     void didReceiveNotificationPermissionDecision(uint64_t notificationID, bool allowed);
1049
1050 #if ENABLE(MEDIA_STREAM)
1051     void didReceiveUserMediaPermissionDecision(uint64_t userMediaID, bool allowed);
1052 #endif
1053
1054     void advanceToNextMisspelling(bool startBeforeSelection);
1055     void changeSpellingToWord(const String& word);
1056 #if USE(APPKIT)
1057     void uppercaseWord();
1058     void lowercaseWord();
1059     void capitalizeWord();
1060 #endif
1061
1062 #if ENABLE(CONTEXT_MENUS)
1063     void didSelectItemFromActiveContextMenu(const WebContextMenuItemData&);
1064 #endif
1065
1066     void changeSelectedIndex(int32_t index);
1067     void setCanStartMediaTimerFired();
1068
1069     bool canHandleUserEvents() const;
1070
1071     static bool platformCanHandleRequest(const WebCore::ResourceRequest&);
1072
1073     static PluginView* focusedPluginViewForFrame(WebCore::Frame&);
1074     static PluginView* pluginViewForFrame(WebCore::Frame*);
1075
1076     static PassRefPtr<WebCore::Range> rangeFromEditingRange(WebCore::Frame&, const EditingRange&);
1077
1078     void reportUsedFeatures();
1079
1080 #if PLATFORM(MAC)
1081     void performActionMenuHitTestAtLocation(WebCore::FloatPoint, bool forImmediateAction);
1082     PassRefPtr<WebCore::Range> lookupTextAtLocation(WebCore::FloatPoint, NSDictionary **options);
1083     void selectLastActionMenuRange();
1084     void focusAndSelectLastActionMenuHitTestResult();
1085
1086     void dataDetectorsDidPresentUI(WebCore::PageOverlay::PageOverlayID);
1087     void dataDetectorsDidChangeUI(WebCore::PageOverlay::PageOverlayID);
1088     void dataDetectorsDidHideUI(WebCore::PageOverlay::PageOverlayID);
1089 #endif
1090
1091     void setShouldDispatchFakeMouseMoveEvents(bool dispatch) { m_shouldDispatchFakeMouseMoveEvents = dispatch; }
1092
1093     uint64_t m_pageID;
1094
1095     std::unique_ptr<WebCore::Page> m_page;
1096     RefPtr<WebFrame> m_mainFrame;
1097     RefPtr<InjectedBundleBackForwardList> m_backForwardList;
1098
1099     RefPtr<WebPageGroupProxy> m_pageGroup;
1100
1101     String m_userAgent;
1102
1103     WebCore::IntSize m_viewSize;
1104     std::unique_ptr<DrawingArea> m_drawingArea;
1105
1106     HashSet<PluginView*> m_pluginViews;
1107     bool m_hasSeenPlugin;
1108
1109     HashMap<uint64_t, RefPtr<WebCore::TextCheckingRequest>> m_pendingTextCheckingRequestMap;
1110
1111     bool m_useFixedLayout;
1112
1113     bool m_drawsBackground;
1114     bool m_drawsTransparentBackground;
1115
1116     WebCore::Color m_underlayColor;
1117
1118     bool m_isInRedo;
1119     bool m_isClosed;
1120
1121     bool m_tabToLinks;
1122     
1123     bool m_asynchronousPluginInitializationEnabled;
1124     bool m_asynchronousPluginInitializationEnabledForAllPlugins;
1125     bool m_artificialPluginInitializationDelayEnabled;
1126
1127     bool m_scrollingPerformanceLoggingEnabled;
1128
1129     bool m_mainFrameIsScrollable;
1130
1131 #if ENABLE(PRIMARY_SNAPSHOTTED_PLUGIN_HEURISTIC)
1132     bool m_readyToFindPrimarySnapshottedPlugin;
1133     bool m_didFindPrimarySnapshottedPlugin;
1134     unsigned m_numberOfPrimarySnapshotDetectionAttempts;
1135     String m_primaryPlugInPageOrigin;
1136     String m_primaryPlugInOrigin;
1137     String m_primaryPlugInMimeType;
1138     RunLoop::Timer<WebPage> m_determinePrimarySnapshottedPlugInTimer;
1139 #endif
1140
1141     // The layer hosting mode.
1142     LayerHostingMode m_layerHostingMode;
1143
1144 #if PLATFORM(COCOA)
1145     bool m_pdfPluginEnabled;
1146
1147     bool m_hasCachedWindowFrame;
1148
1149     // The frame of the containing window in screen coordinates.
1150     WebCore::FloatRect m_windowFrameInScreenCoordinates;
1151
1152     // The frame of the containing window in unflipped screen coordinates.
1153     WebCore::FloatRect m_windowFrameInUnflippedScreenCoordinates;
1154
1155     // The frame of the view in window coordinates.
1156     WebCore::FloatRect m_viewFrameInWindowCoordinates;
1157
1158     // The accessibility position of the view.
1159     WebCore::FloatPoint m_accessibilityPosition;
1160     
1161     RetainPtr<WKAccessibilityWebPageObject> m_mockAccessibilityElement;
1162
1163     ViewGestureGeometryCollector m_viewGestureGeometryCollector;
1164
1165 #elif HAVE(ACCESSIBILITY) && (PLATFORM(GTK) || PLATFORM(EFL))
1166     GRefPtr<WebPageAccessibilityObject> m_accessibilityObject;
1167 #endif
1168
1169 #if PLATFORM(GTK) && USE(TEXTURE_MAPPER_GL)
1170     // Our view's window in the UI process.
1171     uint64_t m_nativeWindowHandle;
1172 #endif
1173
1174 #if !PLATFORM(IOS)
1175     RefPtr<PageBanner> m_headerBanner;
1176     RefPtr<PageBanner> m_footerBanner;
1177 #endif // !PLATFORM(IOS)
1178
1179     RunLoop::Timer<WebPage> m_setCanStartMediaTimer;
1180     bool m_mayStartMediaWhenInWindow;
1181
1182     HashMap<uint64_t, RefPtr<WebUndoStep>> m_undoStepMap;
1183
1184     WebCore::IntSize m_windowResizerSize;
1185
1186 #if ENABLE(CONTEXT_MENUS)
1187     InjectedBundlePageContextMenuClient m_contextMenuClient;
1188 #endif
1189     InjectedBundlePageEditorClient m_editorClient;
1190     std::unique_ptr<API::InjectedBundle::FormClient> m_formClient;
1191     InjectedBundlePageLoaderClient m_loaderClient;
1192     InjectedBundlePagePolicyClient m_policyClient;
1193     InjectedBundlePageResourceLoadClient m_resourceLoadClient;
1194     std::unique_ptr<API::InjectedBundle::PageUIClient> m_uiClient;
1195 #if ENABLE(FULLSCREEN_API)
1196     InjectedBundlePageFullScreenClient m_fullScreenClient;
1197 #endif
1198     InjectedBundlePageDiagnosticLoggingClient m_logDiagnosticMessageClient;
1199
1200     FindController m_findController;
1201
1202 #if ENABLE(INSPECTOR)
1203     RefPtr<WebInspector> m_inspector;
1204     RefPtr<WebInspectorUI> m_inspectorUI;
1205 #endif
1206 #if PLATFORM(IOS)
1207     RefPtr<WebVideoFullscreenManager> m_videoFullscreenManager;
1208 #endif
1209 #if ENABLE(FULLSCREEN_API)
1210     RefPtr<WebFullScreenManager> m_fullScreenManager;
1211 #endif
1212     RefPtr<WebPopupMenu> m_activePopupMenu;
1213 #if ENABLE(CONTEXT_MENUS)
1214     RefPtr<WebContextMenu> m_contextMenu;
1215 #endif
1216 #if ENABLE(INPUT_TYPE_COLOR)
1217     WebColorChooser* m_activeColorChooser;
1218 #endif
1219     RefPtr<WebOpenPanelResultListener> m_activeOpenPanelResultListener;
1220     RefPtr<NotificationPermissionRequestManager> m_notificationPermissionRequestManager;
1221
1222     RefPtr<WebUserContentController> m_userContentController;
1223
1224 #if ENABLE(GEOLOCATION)
1225     GeolocationPermissionRequestManager m_geolocationPermissionRequestManager;
1226 #endif
1227
1228 #if ENABLE(MEDIA_STREAM)
1229     UserMediaPermissionRequestManager m_userMediaPermissionRequestManager;
1230 #endif
1231
1232     std::unique_ptr<WebCore::PrintContext> m_printContext;
1233 #if PLATFORM(GTK)
1234     RefPtr<WebPrintOperationGtk> m_printOperation;
1235 #endif
1236
1237     SandboxExtensionTracker m_sandboxExtensionTracker;
1238
1239     RefPtr<SandboxExtension> m_pendingDropSandboxExtension;
1240     Vector<RefPtr<SandboxExtension>> m_pendingDropExtensionsForFileUpload;
1241
1242     bool m_canRunBeforeUnloadConfirmPanel;
1243
1244     bool m_canRunModal;
1245     bool m_isRunningModal;
1246
1247 #if ENABLE(DRAG_SUPPORT)
1248     bool m_isStartingDrag;
1249 #endif
1250
1251     bool m_cachedMainFrameIsPinnedToLeftSide;
1252     bool m_cachedMainFrameIsPinnedToRightSide;
1253     bool m_cachedMainFrameIsPinnedToTopSide;
1254     bool m_cachedMainFrameIsPinnedToBottomSide;
1255     bool m_canShortCircuitHorizontalWheelEvents;
1256     unsigned m_numWheelEventHandlers;
1257
1258     unsigned m_cachedPageCount;
1259
1260     HashSet<unsigned long> m_trackedNetworkResourceRequestIdentifiers;
1261
1262     WebCore::IntSize m_minimumLayoutSize;
1263     bool m_autoSizingShouldExpandToViewHeight;
1264
1265 #if ENABLE(CONTEXT_MENUS)
1266     bool m_isShowingContextMenu;
1267 #endif
1268     
1269 #if PLATFORM(IOS)
1270     RefPtr<WebCore::Node> m_assistedNode;
1271     RefPtr<WebCore::Range> m_currentWordRange;
1272     RefPtr<WebCore::Node> m_interactionNode;
1273     WebCore::IntPoint m_lastInteractionLocation;
1274     
1275     enum SelectionAnchor {
1276         Start,
1277         End
1278     };
1279     SelectionAnchor m_selectionAnchor;
1280
1281     RefPtr<WebCore::Node> m_potentialTapNode;
1282     WebCore::FloatPoint m_potentialTapLocation;
1283
1284     WebCore::ViewportConfiguration m_viewportConfiguration;
1285     uint64_t m_firstLayerTreeTransactionIDAfterDidCommitLoad;
1286     bool m_hasReceivedVisibleContentRectsAfterDidCommitLoad;
1287     bool m_scaleWasSetByUIProcess;
1288     bool m_userHasChangedPageScaleFactor;
1289     bool m_hasStablePageScaleFactor;
1290     bool m_userIsInteracting;
1291     bool m_hasPendingBlurNotification;
1292     bool m_useTestingViewportConfiguration;
1293     bool m_isInStableState;
1294     std::chrono::milliseconds m_oldestNonStableUpdateVisibleContentRectsTimestamp;
1295     std::chrono::milliseconds m_estimatedLatency;
1296     WebCore::FloatSize m_screenSize;
1297     WebCore::FloatSize m_availableScreenSize;
1298     RefPtr<WebCore::Range> m_currentBlockSelection;
1299     WebCore::IntSize m_blockSelectionDesiredSize;
1300     WebCore::FloatSize m_maximumUnobscuredSize;
1301     int32_t m_deviceOrientation;
1302     bool m_inDynamicSizeUpdate;
1303     HashMap<std::pair<WebCore::IntSize, double>, WebCore::IntPoint> m_dynamicSizeUpdateHistory;
1304     RefPtr<WebCore::Node> m_pendingSyntheticClickNode;
1305     WebCore::FloatPoint m_pendingSyntheticClickLocation;
1306 #endif
1307
1308     WebInspectorClient* m_inspectorClient;
1309
1310     HashSet<String, CaseFoldingHash> m_mimeTypesWithCustomContentProviders;
1311     WebCore::Color m_backgroundColor;
1312
1313     HashSet<unsigned> m_activeRenderingSuppressionTokens;
1314     unsigned m_maximumRenderingSuppressionToken;
1315     
1316     WebCore::ScrollPinningBehavior m_scrollPinningBehavior;
1317
1318     bool m_useAsyncScrolling;
1319
1320     WebCore::ViewState::Flags m_viewState;
1321     WebCore::PageActivityState::Flags m_activityState;
1322
1323     bool m_processSuppressionEnabled;
1324     UserActivity m_userActivity;
1325
1326     uint64_t m_pendingNavigationID;
1327
1328 #if ENABLE(WEBGL)
1329     WebCore::WebGLLoadPolicy m_systemWebGLPolicy;
1330 #endif
1331
1332 #if PLATFORM(MAC)
1333     RefPtr<WebCore::Range> m_lastActionMenuRangeForSelection;
1334     WebCore::HitTestResult m_lastActionMenuHitTestResult;
1335     RefPtr<WebPageOverlay> m_lastActionMenuHitPageOverlay;
1336 #endif
1337
1338     bool m_mainFrameProgressCompleted;
1339     bool m_shouldDispatchFakeMouseMoveEvents;
1340 };
1341
1342 } // namespace WebKit
1343
1344 #endif // WebPage_h