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