0bd71c6327ee8d4d5e8e32fc6b93c3e7145b711e
[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 Page;
130 class PrintContext;
131 class Range;
132 class ResourceResponse;
133 class ResourceRequest;
134 class SharedBuffer;
135 class SubstituteData;
136 class TextCheckingRequest;
137 class URL;
138 class VisibleSelection;
139 struct Highlight;
140 struct KeypressCommand;
141 struct TextCheckingResult;
142 }
143
144 namespace WebKit {
145
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(uint64_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 #if !USE(ASYNC_NSTEXTINPUTCLIENT)
626     void insertText(const String& text, const EditingRange& replacementRange, bool& handled, EditorState& newState);
627     void setComposition(const String& text, Vector<WebCore::CompositionUnderline> underlines, const EditingRange& selectionRange, const EditingRange& replacementRange, EditorState& newState);
628     void confirmComposition(EditorState& newState);
629     void insertDictatedText(const String& text, const EditingRange& replacementRange, const Vector<WebCore::DictationAlternative>& dictationAlternativeLocations, bool& handled, EditorState& newState);
630     void getAttributedSubstringFromRange(const EditingRange&, AttributedString&);
631     void getMarkedRange(EditingRange&);
632     void getSelectedRange(EditingRange&);
633     void characterIndexForPoint(const WebCore::IntPoint point, uint64_t& result);
634     void firstRectForCharacterRange(const EditingRange&, WebCore::IntRect& resultRect);
635     void executeKeypressCommands(const Vector<WebCore::KeypressCommand>&, bool& handled, EditorState& newState);
636     void cancelComposition(EditorState& newState);
637 #endif
638 #endif
639
640     void readSelectionFromPasteboard(const WTF::String& pasteboardName, bool& result);
641     void getStringSelectionForPasteboard(WTF::String& stringValue);
642     void getDataSelectionForPasteboard(const WTF::String pasteboardType, SharedMemory::Handle& handle, uint64_t& size);
643     void shouldDelayWindowOrderingEvent(const WebKit::WebMouseEvent&, bool& result);
644     void acceptsFirstMouse(int eventNumber, const WebKit::WebMouseEvent&, bool& result);
645     bool performNonEditingBehaviorForSelector(const String&, WebCore::KeyboardEvent*);
646
647 #if ENABLE(SERVICE_CONTROLS)
648     void replaceSelectionWithPasteboardData(const Vector<String>& types, const IPC::DataReference&);
649 #endif
650
651 #elif PLATFORM(EFL)
652     void confirmComposition(const String& compositionString);
653     void setComposition(const WTF::String& compositionString, const WTF::Vector<WebCore::CompositionUnderline>& underlines, uint64_t cursorPosition);
654     void cancelComposition();
655 #endif
656
657 #if HAVE(ACCESSIBILITY) && (PLATFORM(GTK) || PLATFORM(EFL))
658     void updateAccessibilityTree();
659 #endif
660
661     void setCompositionForTesting(const String& compositionString, uint64_t from, uint64_t length);
662     bool hasCompositionForTesting();
663     void confirmCompositionForTesting(const String& compositionString);
664
665     // FIXME: This a dummy message, to avoid breaking the build for platforms that don't require
666     // any synchronous messages, and should be removed when <rdar://problem/8775115> is fixed.
667     void dummy(bool&);
668
669 #if PLATFORM(COCOA)
670     bool isSpeaking();
671     void speak(const String&);
672     void stopSpeaking();
673
674     void performDictionaryLookupForSelection(WebCore::Frame*, const WebCore::VisibleSelection&, WebCore::TextIndicatorPresentationTransition);
675 #endif
676
677     bool isSmartInsertDeleteEnabled();
678     void setSmartInsertDeleteEnabled(bool);
679
680     bool isSelectTrailingWhitespaceEnabled();
681     void setSelectTrailingWhitespaceEnabled(bool);
682
683     void replaceSelectionWithText(WebCore::Frame*, const String&);
684     void clearSelection();
685
686 #if ENABLE(DRAG_SUPPORT)
687 #if PLATFORM(GTK)
688     void performDragControllerAction(uint64_t action, WebCore::DragData);
689 #else
690     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&);
691 #endif
692     void dragEnded(WebCore::IntPoint clientPosition, WebCore::IntPoint globalPosition, uint64_t operation);
693
694     void willPerformLoadDragDestinationAction();
695     void mayPerformUploadDragDestinationAction();
696
697     void willStartDrag() { ASSERT(!m_isStartingDrag); m_isStartingDrag = true; }
698     void didStartDrag() { ASSERT(m_isStartingDrag); m_isStartingDrag = false; }
699 #endif // ENABLE(DRAG_SUPPORT)
700
701     void beginPrinting(uint64_t frameID, const PrintInfo&);
702     void endPrinting();
703     void computePagesForPrinting(uint64_t frameID, const PrintInfo&, uint64_t callbackID);
704     void computePagesForPrintingImpl(uint64_t frameID, const PrintInfo&, Vector<WebCore::IntRect>& pageRects, double& totalScaleFactor);
705 #if PLATFORM(COCOA)
706     void drawRectToImage(uint64_t frameID, const PrintInfo&, const WebCore::IntRect&, const WebCore::IntSize&, uint64_t callbackID);
707     void drawPagesToPDF(uint64_t frameID, const PrintInfo&, uint32_t first, uint32_t count, uint64_t callbackID);
708     void drawPagesToPDFImpl(uint64_t frameID, const PrintInfo&, uint32_t first, uint32_t count, RetainPtr<CFMutableDataRef>& pdfPageData);
709 #if PLATFORM(IOS)
710     void computePagesForPrintingAndStartDrawingToPDF(uint64_t frameID, const PrintInfo&, uint32_t firstPage, PassRefPtr<Messages::WebPage::ComputePagesForPrintingAndStartDrawingToPDF::DelayedReply>);
711 #endif
712 #elif PLATFORM(GTK)
713     void drawPagesForPrinting(uint64_t frameID, const PrintInfo&, uint64_t callbackID);
714     void didFinishPrintOperation(const WebCore::ResourceError&, uint64_t callbackID);
715 #endif
716
717     void addResourceRequest(unsigned long, const WebCore::ResourceRequest&);
718     void removeResourceRequest(unsigned long);
719
720     void setMediaVolume(float);
721     void setMuted(bool);
722     void setMayStartMediaWhenInWindow(bool);
723
724     void updateMainFrameScrollOffsetPinning();
725
726     bool mainFrameHasCustomContentProvider() const;
727     void addMIMETypeWithCustomContentProvider(const String&);
728
729     void mainFrameDidLayout();
730
731     bool canRunBeforeUnloadConfirmPanel() const { return m_canRunBeforeUnloadConfirmPanel; }
732     void setCanRunBeforeUnloadConfirmPanel(bool canRunBeforeUnloadConfirmPanel) { m_canRunBeforeUnloadConfirmPanel = canRunBeforeUnloadConfirmPanel; }
733
734     bool canRunModal() const { return m_canRunModal; }
735     void setCanRunModal(bool canRunModal) { m_canRunModal = canRunModal; }
736
737     void runModal();
738
739     void setDeviceScaleFactor(float);
740     float deviceScaleFactor() const;
741
742     void forceRepaintWithoutCallback();
743
744     void unmarkAllMisspellings();
745     void unmarkAllBadGrammar();
746 #if PLATFORM(COCOA)
747     void handleAlternativeTextUIResult(const String&);
748 #endif
749
750     // For testing purpose.
751     void simulateMouseDown(int button, WebCore::IntPoint, int clickCount, WKEventModifiers, double time);
752     void simulateMouseUp(int button, WebCore::IntPoint, int clickCount, WKEventModifiers, double time);
753     void simulateMouseMotion(WebCore::IntPoint, double time);
754
755 #if ENABLE(CONTEXT_MENUS)
756     void contextMenuShowing() { m_isShowingContextMenu = true; }
757 #endif
758
759     void wheelEvent(const WebWheelEvent&);
760
761     void numWheelEventHandlersChanged(unsigned);
762     void recomputeShortCircuitHorizontalWheelEventsState();
763
764     void updateVisibilityState(bool isInitialState = false);
765
766 #if PLATFORM(IOS)
767     void setViewportConfigurationMinimumLayoutSize(const WebCore::FloatSize&);
768     void setMaximumUnobscuredSize(const WebCore::FloatSize&);
769     void setDeviceOrientation(int32_t);
770     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);
771     void synchronizeDynamicViewportUpdate(double& newTargetScale, WebCore::FloatPoint& newScrollPosition, uint64_t& nextValidLayerTreeTransactionID);
772     void updateVisibleContentRects(const VisibleContentRectUpdateInfo&, double oldestTimestamp);
773     bool scaleWasSetByUIProcess() const { return m_scaleWasSetByUIProcess; }
774     void willStartUserTriggeredZooming();
775     void applicationWillResignActive();
776     void applicationWillEnterForeground();
777     void applicationDidBecomeActive();
778     void zoomToRect(WebCore::FloatRect, double minimumScale, double maximumScale);
779     void completePendingSyntheticClickForContentChangeObserver();
780 #endif
781
782 #if ENABLE(IOS_TOUCH_EVENTS)
783     void dispatchTouchEvent(const WebTouchEvent&, bool& handled);
784 #endif
785
786 #if PLATFORM(GTK) && USE(TEXTURE_MAPPER_GL)
787     uint64_t nativeWindowHandle() { return m_nativeWindowHandle; }
788 #endif
789
790     bool shouldUseCustomContentProviderForResponse(const WebCore::ResourceResponse&);
791     bool canPluginHandleResponse(const WebCore::ResourceResponse& response);
792
793     bool asynchronousPluginInitializationEnabled() const { return m_asynchronousPluginInitializationEnabled; }
794     void setAsynchronousPluginInitializationEnabled(bool enabled) { m_asynchronousPluginInitializationEnabled = enabled; }
795     bool asynchronousPluginInitializationEnabledForAllPlugins() const { return m_asynchronousPluginInitializationEnabledForAllPlugins; }
796     void setAsynchronousPluginInitializationEnabledForAllPlugins(bool enabled) { m_asynchronousPluginInitializationEnabledForAllPlugins = enabled; }
797     bool artificialPluginInitializationDelayEnabled() const { return m_artificialPluginInitializationDelayEnabled; }
798     void setArtificialPluginInitializationDelayEnabled(bool enabled) { m_artificialPluginInitializationDelayEnabled = enabled; }
799     void setTabToLinksEnabled(bool enabled) { m_tabToLinks = enabled; }
800     bool tabToLinksEnabled() const { return m_tabToLinks; }
801
802     bool scrollingPerformanceLoggingEnabled() const { return m_scrollingPerformanceLoggingEnabled; }
803     void setScrollingPerformanceLoggingEnabled(bool);
804
805 #if PLATFORM(COCOA)
806     bool shouldUsePDFPlugin() const;
807     bool pdfPluginEnabled() const { return m_pdfPluginEnabled; }
808     void setPDFPluginEnabled(bool enabled) { m_pdfPluginEnabled = enabled; }
809 #endif
810
811     void savePDFToFileInDownloadsFolder(const String& suggestedFilename, const String& originatingURLString, const uint8_t* data, unsigned long size);
812 #if PLATFORM(COCOA)
813     void savePDFToTemporaryFolderAndOpenWithNativeApplication(const String& suggestedFilename, const String& originatingURLString, const uint8_t* data, unsigned long size, const String& pdfUUID);
814 #endif
815
816     bool mainFrameIsScrollable() const { return m_mainFrameIsScrollable; }
817
818     void setMinimumLayoutSize(const WebCore::IntSize&);
819     WebCore::IntSize minimumLayoutSize() const { return m_minimumLayoutSize; }
820
821     void setAutoSizingShouldExpandToViewHeight(bool shouldExpand);
822     bool autoSizingShouldExpandToViewHeight() { return m_autoSizingShouldExpandToViewHeight; }
823
824     bool canShowMIMEType(const String& MIMEType) const;
825
826     void addTextCheckingRequest(uint64_t requestID, PassRefPtr<WebCore::TextCheckingRequest>);
827     void didFinishCheckingText(uint64_t requestID, const Vector<WebCore::TextCheckingResult>&);
828     void didCancelCheckingText(uint64_t requestID);
829
830 #if ENABLE(PRIMARY_SNAPSHOTTED_PLUGIN_HEURISTIC)
831     void determinePrimarySnapshottedPlugIn();
832     void determinePrimarySnapshottedPlugInTimerFired();
833     void resetPrimarySnapshottedPlugIn();
834     bool matchesPrimaryPlugIn(const String& pageOrigin, const String& pluginOrigin, const String& mimeType) const;
835     bool plugInIntersectsSearchRect(WebCore::HTMLPlugInImageElement& pluginImageElement);
836     bool plugInIsPrimarySize(WebCore::HTMLPlugInImageElement& pluginImageElement, unsigned &pluginArea);
837 #endif
838
839     unsigned extendIncrementalRenderingSuppression();
840     void stopExtendingIncrementalRenderingSuppression(unsigned token);
841     bool shouldExtendIncrementalRenderingSuppression() { return !m_activeRenderingSuppressionTokens.isEmpty(); }
842
843     WebCore::ScrollPinningBehavior scrollPinningBehavior() { return m_scrollPinningBehavior; }
844     void setScrollPinningBehavior(uint32_t /* WebCore::ScrollPinningBehavior */ pinning);
845
846     PassRefPtr<WebCore::DocumentLoader> createDocumentLoader(WebCore::Frame&, const WebCore::ResourceRequest&, const WebCore::SubstituteData&);
847
848     void getBytecodeProfile(uint64_t callbackID);
849     
850     // Some platforms require accessibility-enabled processes to spin the run loop so that the WebProcess doesn't hang.
851     // While this is not ideal, it does not have to be applied to every platform at the moment.
852     static bool synchronousMessagesShouldSpinRunLoop();
853
854 #if ENABLE(SERVICE_CONTROLS) || ENABLE(TELEPHONE_NUMBER_DETECTION)
855     void handleTelephoneNumberClick(const String& number, const WebCore::IntPoint&);
856     void handleSelectionServiceClick(WebCore::FrameSelection&, const Vector<String>& telephoneNumbers, const WebCore::IntPoint&);
857 #endif
858
859     void didChangeScrollOffsetForFrame(WebCore::Frame*);
860
861     void setMainFrameProgressCompleted(bool completed) { m_mainFrameProgressCompleted = completed; }
862     bool shouldDispatchFakeMouseMoveEvents() const { return m_shouldDispatchFakeMouseMoveEvents; }
863
864     void setPageActivityState(WebCore::PageActivityState::Flags);
865
866 private:
867     WebPage(uint64_t pageID, const WebPageCreationParameters&);
868
869     // IPC::MessageSender
870     virtual IPC::Connection* messageSenderConnection() override;
871     virtual uint64_t messageSenderDestinationID() override;
872
873     void platformInitialize();
874     void platformDetach();
875
876     void didReceiveWebPageMessage(IPC::Connection&, IPC::MessageDecoder&);
877     void didReceiveSyncWebPageMessage(IPC::Connection&, IPC::MessageDecoder&, std::unique_ptr<IPC::MessageEncoder>&);
878
879 #if PLATFORM(IOS)
880     void resetViewportDefaultConfiguration(WebFrame* mainFrame);
881     void viewportConfigurationChanged();
882     void updateViewportSizeForCSSViewportUnits();
883
884     static void convertSelectionRectsToRootView(WebCore::FrameView*, Vector<WebCore::SelectionRect>&);
885     PassRefPtr<WebCore::Range> rangeForWebSelectionAtPosition(const WebCore::IntPoint&, const WebCore::VisiblePosition&, SelectionFlags&);
886     PassRefPtr<WebCore::Range> rangeForBlockAtPoint(const WebCore::IntPoint&);
887     void computeExpandAndShrinkThresholdsForHandle(const WebCore::IntPoint&, SelectionHandlePosition, float& growThreshold, float& shrinkThreshold);
888     PassRefPtr<WebCore::Range> changeBlockSelection(const WebCore::IntPoint&, SelectionHandlePosition, float& growThreshold, float& shrinkThreshold, SelectionFlags&);
889     PassRefPtr<WebCore::Range> expandedRangeFromHandle(WebCore::Range*, SelectionHandlePosition);
890     PassRefPtr<WebCore::Range> contractedRangeFromHandle(WebCore::Range* currentRange, SelectionHandlePosition, SelectionFlags&);
891     void getAssistedNodeInformation(AssistedNodeInformation&);
892     void platformInitializeAccessibility();
893     void handleSyntheticClick(WebCore::Node* nodeRespondingToClick, const WebCore::FloatPoint& location);
894     void completeSyntheticClick(WebCore::Node* nodeRespondingToClick, const WebCore::FloatPoint& location);
895     void sendTapHighlightForNodeIfNecessary(uint64_t requestID, WebCore::Node*);
896     void resetTextAutosizingBeforeLayoutIfNeeded(const WebCore::FloatSize& oldSize, const WebCore::FloatSize& newSize);
897     WebCore::VisiblePosition visiblePositionInFocusedNodeForPoint(WebCore::Frame&, const WebCore::IntPoint&);
898 #endif
899 #if !PLATFORM(COCOA)
900     static const char* interpretKeyEvent(const WebCore::KeyboardEvent*);
901 #endif
902     bool performDefaultBehaviorForKeyEvent(const WebKeyboardEvent&);
903
904 #if PLATFORM(MAC)
905     bool executeKeypressCommandsInternal(const Vector<WebCore::KeypressCommand>&, WebCore::KeyboardEvent*);
906 #endif
907
908     String sourceForFrame(WebFrame*);
909
910     void loadDataImpl(uint64_t navigationID, PassRefPtr<WebCore::SharedBuffer>, const String& MIMEType, const String& encodingName, const WebCore::URL& baseURL, const WebCore::URL& failingURL, const UserData&);
911     void loadString(uint64_t navigationID, const String&, const String& MIMEType, const WebCore::URL& baseURL, const WebCore::URL& failingURL, const UserData&);
912
913     bool platformHasLocalDataForURL(const WebCore::URL&);
914
915     // Actions
916     void tryClose();
917     void loadRequest(uint64_t navigationID, const WebCore::ResourceRequest&, const SandboxExtension::Handle&, const UserData&);
918     void loadData(const IPC::DataReference&, const String& MIMEType, const String& encodingName, const String& baseURL, const UserData&);
919     void loadHTMLString(uint64_t navigationID, const String& htmlString, const String& baseURL, const UserData&);
920     void loadAlternateHTMLString(const String& htmlString, const String& baseURL, const String& unreachableURL, const UserData&);
921     void loadPlainTextString(const String&, const UserData&);
922     void loadWebArchiveData(const IPC::DataReference&, const UserData&);
923     void navigateToURLWithSimulatedClick(const String& url, WebCore::IntPoint documentPoint, WebCore::IntPoint screenPoint);
924     void reload(uint64_t navigationID, bool reloadFromOrigin, const SandboxExtension::Handle&);
925     void goForward(uint64_t navigationID, uint64_t);
926     void goBack(uint64_t navigationID, uint64_t);
927     void goToBackForwardItem(uint64_t navigationID, uint64_t);
928     void tryRestoreScrollPosition();
929     void setInitialFocus(bool forward, bool isKeyboardEventValid, const WebKeyboardEvent&);
930     void setWindowResizerSize(const WebCore::IntSize&);
931     void updateIsInWindow(bool isInitialState = false);
932     void setViewState(WebCore::ViewState::Flags, bool wantsDidUpdateViewState, const Vector<uint64_t>& callbackIDs);
933     void validateCommand(const String&, uint64_t);
934     void executeEditCommand(const String&);
935     void setEditable(bool);
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_MULTIPROCESS)
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     std::unique_ptr<API::InjectedBundle::PageContextMenuClient> 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     RefPtr<WebInspector> m_inspector;
1203     RefPtr<WebInspectorUI> m_inspectorUI;
1204 #if PLATFORM(IOS)
1205     RefPtr<WebVideoFullscreenManager> m_videoFullscreenManager;
1206 #endif
1207 #if ENABLE(FULLSCREEN_API)
1208     RefPtr<WebFullScreenManager> m_fullScreenManager;
1209 #endif
1210     RefPtr<WebPopupMenu> m_activePopupMenu;
1211 #if ENABLE(CONTEXT_MENUS)
1212     RefPtr<WebContextMenu> m_contextMenu;
1213 #endif
1214 #if ENABLE(INPUT_TYPE_COLOR)
1215     WebColorChooser* m_activeColorChooser;
1216 #endif
1217     RefPtr<WebOpenPanelResultListener> m_activeOpenPanelResultListener;
1218     RefPtr<NotificationPermissionRequestManager> m_notificationPermissionRequestManager;
1219
1220     RefPtr<WebUserContentController> m_userContentController;
1221
1222 #if ENABLE(GEOLOCATION)
1223     GeolocationPermissionRequestManager m_geolocationPermissionRequestManager;
1224 #endif
1225
1226 #if ENABLE(MEDIA_STREAM)
1227     UserMediaPermissionRequestManager m_userMediaPermissionRequestManager;
1228 #endif
1229
1230     std::unique_ptr<WebCore::PrintContext> m_printContext;
1231 #if PLATFORM(GTK)
1232     RefPtr<WebPrintOperationGtk> m_printOperation;
1233 #endif
1234
1235     SandboxExtensionTracker m_sandboxExtensionTracker;
1236
1237     RefPtr<SandboxExtension> m_pendingDropSandboxExtension;
1238     Vector<RefPtr<SandboxExtension>> m_pendingDropExtensionsForFileUpload;
1239
1240     bool m_canRunBeforeUnloadConfirmPanel;
1241
1242     bool m_canRunModal;
1243     bool m_isRunningModal;
1244
1245 #if ENABLE(DRAG_SUPPORT)
1246     bool m_isStartingDrag;
1247 #endif
1248
1249     bool m_cachedMainFrameIsPinnedToLeftSide;
1250     bool m_cachedMainFrameIsPinnedToRightSide;
1251     bool m_cachedMainFrameIsPinnedToTopSide;
1252     bool m_cachedMainFrameIsPinnedToBottomSide;
1253     bool m_canShortCircuitHorizontalWheelEvents;
1254     unsigned m_numWheelEventHandlers;
1255
1256     unsigned m_cachedPageCount;
1257
1258     HashSet<unsigned long> m_trackedNetworkResourceRequestIdentifiers;
1259
1260     WebCore::IntSize m_minimumLayoutSize;
1261     bool m_autoSizingShouldExpandToViewHeight;
1262
1263 #if ENABLE(CONTEXT_MENUS)
1264     bool m_isShowingContextMenu;
1265 #endif
1266     
1267 #if PLATFORM(IOS)
1268     RefPtr<WebCore::Node> m_assistedNode;
1269     RefPtr<WebCore::Range> m_currentWordRange;
1270     RefPtr<WebCore::Node> m_interactionNode;
1271     WebCore::IntPoint m_lastInteractionLocation;
1272     
1273     enum SelectionAnchor {
1274         Start,
1275         End
1276     };
1277     SelectionAnchor m_selectionAnchor;
1278
1279     RefPtr<WebCore::Node> m_potentialTapNode;
1280     WebCore::FloatPoint m_potentialTapLocation;
1281
1282     WebCore::ViewportConfiguration m_viewportConfiguration;
1283     uint64_t m_firstLayerTreeTransactionIDAfterDidCommitLoad;
1284     bool m_hasReceivedVisibleContentRectsAfterDidCommitLoad;
1285     bool m_scaleWasSetByUIProcess;
1286     bool m_userHasChangedPageScaleFactor;
1287     bool m_hasStablePageScaleFactor;
1288     bool m_userIsInteracting;
1289     bool m_hasPendingBlurNotification;
1290     bool m_useTestingViewportConfiguration;
1291     bool m_isInStableState;
1292     std::chrono::milliseconds m_oldestNonStableUpdateVisibleContentRectsTimestamp;
1293     std::chrono::milliseconds m_estimatedLatency;
1294     WebCore::FloatSize m_screenSize;
1295     WebCore::FloatSize m_availableScreenSize;
1296     RefPtr<WebCore::Range> m_currentBlockSelection;
1297     WebCore::IntSize m_blockSelectionDesiredSize;
1298     WebCore::FloatSize m_maximumUnobscuredSize;
1299     int32_t m_deviceOrientation;
1300     bool m_inDynamicSizeUpdate;
1301     HashMap<std::pair<WebCore::IntSize, double>, WebCore::IntPoint> m_dynamicSizeUpdateHistory;
1302     RefPtr<WebCore::Node> m_pendingSyntheticClickNode;
1303     WebCore::FloatPoint m_pendingSyntheticClickLocation;
1304 #endif
1305
1306     WebInspectorClient* m_inspectorClient;
1307
1308     HashSet<String, CaseFoldingHash> m_mimeTypesWithCustomContentProviders;
1309     WebCore::Color m_backgroundColor;
1310
1311     HashSet<unsigned> m_activeRenderingSuppressionTokens;
1312     unsigned m_maximumRenderingSuppressionToken;
1313     
1314     WebCore::ScrollPinningBehavior m_scrollPinningBehavior;
1315
1316     bool m_useAsyncScrolling;
1317
1318     WebCore::ViewState::Flags m_viewState;
1319     WebCore::PageActivityState::Flags m_activityState;
1320
1321     bool m_processSuppressionEnabled;
1322     UserActivity m_userActivity;
1323
1324     uint64_t m_pendingNavigationID;
1325
1326 #if ENABLE(WEBGL)
1327     WebCore::WebGLLoadPolicy m_systemWebGLPolicy;
1328 #endif
1329
1330 #if PLATFORM(MAC)
1331     RefPtr<WebCore::Range> m_lastActionMenuRangeForSelection;
1332     WebCore::HitTestResult m_lastActionMenuHitTestResult;
1333     RefPtr<WebPageOverlay> m_lastActionMenuHitPageOverlay;
1334 #endif
1335
1336     bool m_mainFrameProgressCompleted;
1337     bool m_shouldDispatchFakeMouseMoveEvents;
1338 };
1339
1340 } // namespace WebKit
1341
1342 #endif // WebPage_h