[BlackBerry] Remove Mobile mode from WebPage.cpp and WebPage_p.h
[WebKit-https.git] / Source / WebKit / blackberry / Api / WebPage_p.h
1 /*
2  * Copyright (C) 2009, 2010, 2011, 2012 Research In Motion Limited. All rights reserved.
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
17  */
18
19 #ifndef WebPage_p_h
20 #define WebPage_p_h
21
22 #include "ChromeClient.h"
23 #include "InRegionScroller.h"
24 #include "InspectorClientBlackBerry.h"
25 #include "InspectorOverlay.h"
26 #if USE(ACCELERATED_COMPOSITING)
27 #include "GLES2Context.h"
28 #include "GraphicsLayerClient.h"
29 #include "LayerRenderer.h"
30 #include <EGL/egl.h>
31 #endif
32 #include "KURL.h"
33 #include "PageClientBlackBerry.h"
34 #include "PlatformMouseEvent.h"
35 #include "ScriptSourceCode.h"
36 #include "Timer.h"
37 #include "ViewportArguments.h"
38 #include "WebPage.h"
39 #include "WebSettings.h"
40 #include "WebTapHighlight.h"
41
42 #include <BlackBerryPlatformMessage.h>
43
44 namespace WebCore {
45 class AutofillManager;
46 class DOMWrapperWorld;
47 class Document;
48 class Element;
49 class Frame;
50 class GeolocationControllerClientBlackBerry;
51 class GraphicsLayerBlackBerry;
52 class JavaScriptDebuggerBlackBerry;
53 class LayerWebKitThread;
54 class Node;
55 class Page;
56 class PluginView;
57 class RenderLayer;
58 class RenderObject;
59 class ScrollView;
60 class TransformationMatrix;
61 class PagePopupBlackBerry;
62 template<typename T> class Timer;
63 }
64
65 namespace BlackBerry {
66 namespace WebKit {
67
68 class BackingStore;
69 class BackingStoreClient;
70 class BackingStoreTile;
71 class DumpRenderTreeClient;
72 class InPageSearchManager;
73 class InputHandler;
74 class SelectionHandler;
75 class TouchEventHandler;
76 class WebPageClient;
77
78 #if USE(ACCELERATED_COMPOSITING)
79 class FrameLayers;
80 class WebPageCompositorPrivate;
81 #endif
82
83 // In the client code, there is screen size and viewport.
84 // In WebPagePrivate, the screen size is called the transformedViewportSize,
85 // the viewport position is called the transformedScrollPosition,
86 // and the viewport size is called the transformedActualVisibleSize.
87 class WebPagePrivate : public PageClientBlackBerry
88                      , public WebSettingsDelegate
89 #if USE(ACCELERATED_COMPOSITING)
90                      , public WebCore::GraphicsLayerClient
91 #endif
92                      , public Platform::GuardedPointerBase {
93 public:
94     enum ViewMode { Desktop, FixedDesktop };
95     enum LoadState { None /* on instantiation of page */, Provisional, Committed, Finished, Failed };
96
97     WebPagePrivate(WebPage*, WebPageClient*, const WebCore::IntRect&);
98
99     static WebCore::Page* core(const WebPage*);
100
101     WebPageClient* client() const { return m_client; }
102
103     void init(const WebString& pageGroupName);
104     bool handleMouseEvent(WebCore::PlatformMouseEvent&);
105     bool handleWheelEvent(WebCore::PlatformWheelEvent&);
106
107     void load(const char* url, const char* networkToken, const char* method, Platform::NetworkRequest::CachePolicy, const char* data, size_t dataLength, const char* const* headers, size_t headersLength, bool isInitial, bool mustHandleInternally = false, bool forceDownload = false, const char* overrideContentType = "", const char* suggestedSaveName = "");
108     void loadString(const char* string, const char* baseURL, const char* mimeType, const char* failingURL = 0);
109     bool executeJavaScript(const char* script, JavaScriptDataType& returnType, WebString& returnValue);
110     bool executeJavaScriptInIsolatedWorld(const WebCore::ScriptSourceCode&, JavaScriptDataType& returnType, WebString& returnValue);
111
112     void stopCurrentLoad();
113     void prepareToDestroy();
114
115     void enableCrossSiteXHR();
116     void addOriginAccessWhitelistEntry(const char* sourceOrigin, const char* destinationOrigin, bool allowDestinationSubdomains);
117     void removeOriginAccessWhitelistEntry(const char* sourceOrigin, const char* destinationOrigin, bool allowDestinationSubdomains);
118
119     LoadState loadState() const { return m_loadState; }
120     bool isLoading() const { return m_loadState == WebPagePrivate::Provisional || m_loadState == WebPagePrivate::Committed; }
121
122     // Called from within WebKit via FrameLoaderClientBlackBerry.
123     void setLoadState(LoadState);
124
125     // Clamp the scale.
126     double clampedScale(double scale) const;
127
128     // Determine if we should zoom, clamping the scale parameter if required.
129     bool shouldZoomAboutPoint(double scale, const WebCore::FloatPoint& anchor, bool enforeScaleClamping, double* clampedScale);
130
131     // Scale the page to the given scale and anchor about the point which is specified in untransformed content coordinates.
132     bool zoomAboutPoint(double scale, const WebCore::FloatPoint& anchor, bool enforceScaleClamping = true, bool forceRendering = false, bool isRestoringZoomLevel = false);
133     bool scheduleZoomAboutPoint(double scale, const WebCore::FloatPoint& anchor, bool enforceScaleClamping = true, bool forceRendering = false);
134     void unscheduleZoomAboutPoint();
135     WebCore::IntPoint calculateReflowedScrollPosition(const WebCore::FloatPoint& anchorOffset, double inverseScale);
136     void setTextReflowAnchorPoint(const Platform::IntPoint& focalPoint);
137
138     void restoreHistoryViewState(Platform::IntSize contentsSize, Platform::IntPoint scrollPosition, double scale, bool shouldReflowBlock);
139
140     // Perform actual zoom for block zoom.
141     void zoomBlock();
142
143     // Called by the backing store as well as the method below.
144     void requestLayoutIfNeeded() const;
145     void setNeedsLayout();
146
147     WebCore::IntPoint scrollPosition() const;
148     WebCore::IntPoint maximumScrollPosition() const;
149     void setScrollPosition(const WebCore::IntPoint&);
150     bool scrollBy(int deltaX, int deltaY, bool scrollMainFrame = true);
151
152     void enqueueRenderingOfClippedContentOfScrollableNodeAfterInRegionScrolling(WebCore::Node*);
153     void notifyInRegionScrollStatusChanged(bool status);
154     void setScrollOriginPoint(const Platform::IntPoint&);
155     void setHasInRegionScrollableAreas(bool);
156
157     // The actual visible size as reported by the client, but in WebKit coordinates.
158     WebCore::IntSize actualVisibleSize() const;
159
160     // The viewport size is the same as the client's window size, but in webkit coordinates.
161     WebCore::IntSize viewportSize() const;
162
163     // Modifies the zoomToFit algorithm logic to construct a scale such that the viewportSize above is equal to this size.
164     bool hasVirtualViewport() const;
165     bool isUserScalable() const { return m_userScalable; }
166     void setUserScalable(bool userScalable) { m_userScalable = userScalable; }
167
168     // Sets default layout size without doing layout or marking as needing layout.
169     void setDefaultLayoutSize(const WebCore::IntSize&);
170
171     // Updates WebCore when the viewportSize() or actualVisibleSize() change.
172     void updateViewportSize(bool setFixedReportedSize = true, bool sendResizeEvent = true);
173
174     WebCore::FloatPoint centerOfVisibleContentsRect() const;
175     WebCore::IntRect visibleContentsRect() const;
176     WebCore::IntSize contentsSize() const;
177     WebCore::IntSize absoluteVisibleOverflowSize() const;
178
179     // Virtual functions inherited from PageClientBlackBerry.
180     virtual void setCursor(WebCore::PlatformCursor);
181     virtual Platform::NetworkStreamFactory* networkStreamFactory();
182     virtual Platform::Graphics::Window* platformWindow() const;
183     virtual void setPreventsScreenDimming(bool preventDimming);
184     virtual void showVirtualKeyboard(bool showKeyboard);
185     virtual void ensureContentVisible(bool centerInView = true);
186     virtual void zoomToContentRect(const WebCore::IntRect&);
187     virtual void registerPlugin(WebCore::PluginView*, bool);
188     virtual void notifyPageOnLoad();
189     virtual bool shouldPluginEnterFullScreen(WebCore::PluginView*, const char*);
190     virtual void didPluginEnterFullScreen(WebCore::PluginView*, const char*);
191     virtual void didPluginExitFullScreen(WebCore::PluginView*, const char*);
192     virtual void onPluginStartBackgroundPlay(WebCore::PluginView*, const char*);
193     virtual void onPluginStopBackgroundPlay(WebCore::PluginView*, const char*);
194     virtual bool lockOrientation(bool landscape);
195     virtual void unlockOrientation();
196     virtual int orientation() const;
197     virtual double currentZoomFactor() const;
198     virtual int showAlertDialog(WebPageClient::AlertType atype);
199     virtual bool isActive() const;
200     virtual bool isVisible() const { return m_visible; }
201     virtual bool authenticationChallenge(const WebCore::KURL&, const WebCore::ProtectionSpace&, WebCore::Credential&);
202     virtual SaveCredentialType notifyShouldSaveCredential(bool);
203     virtual void syncProxyCredential(const WebCore::Credential&);
204
205     // Called from within WebKit via ChromeClientBlackBerry.
206     void enterFullscreenForNode(WebCore::Node*);
207     void exitFullscreenForNode(WebCore::Node*);
208 #if ENABLE(FULLSCREEN_API)
209     void enterFullScreenForElement(WebCore::Element*);
210     void exitFullScreenForElement(WebCore::Element*);
211 #endif
212     void contentsSizeChanged(const WebCore::IntSize&);
213     void overflowExceedsContentsSize() { m_overflowExceedsContentsSize = true; }
214     void layoutFinished();
215     void setNeedTouchEvents(bool);
216     void notifyPopupAutofillDialog(const Vector<String>&, const WebCore::IntRect&);
217     void notifyDismissAutofillDialog();
218
219     bool shouldZoomToInitialScaleOnLoad() const { return loadState() == Committed || m_shouldZoomToInitialScaleAfterLoadFinished; }
220     void setShouldZoomToInitialScaleAfterLoadFinished(bool shouldZoomToInitialScaleAfterLoadFinished)
221     {
222         m_shouldZoomToInitialScaleAfterLoadFinished = shouldZoomToInitialScaleAfterLoadFinished;
223     }
224
225     // Called according to our heuristic or from setLoadState depending on whether we have a virtual viewport.
226     void zoomToInitialScaleOnLoad();
227
228     // Various scale factors.
229     double currentScale() const { return m_transformationMatrix->m11(); }
230     double zoomToFitScale() const;
231     double initialScale() const;
232     void setInitialScale(double scale) { m_initialScale = scale; }
233     double minimumScale() const
234     {
235         return (m_minimumScale > zoomToFitScale() && m_minimumScale <= maximumScale()) ? m_minimumScale : zoomToFitScale();
236     }
237
238     void setMinimumScale(double scale) { m_minimumScale = scale; }
239     double maximumScale() const;
240     void setMaximumScale(double scale) { m_maximumScale = scale; }
241     void resetScales();
242
243     // Note: to make this reflow width transform invariant just use
244     // transformedActualVisibleSize() here instead!
245     int reflowWidth() const { return actualVisibleSize().width(); }
246
247     // These methods give the real geometry of the device given the currently set transform.
248     WebCore::IntPoint transformedScrollPosition() const;
249     WebCore::IntPoint transformedMaximumScrollPosition() const;
250     WebCore::IntSize transformedActualVisibleSize() const;
251     WebCore::IntSize transformedViewportSize() const;
252     WebCore::IntRect transformedVisibleContentsRect() const;
253     WebCore::IntSize transformedContentsSize() const;
254
255     // Generic conversions of points, rects, relative to and from contents and viewport.
256     WebCore::IntPoint mapFromContentsToViewport(const WebCore::IntPoint&) const;
257     WebCore::IntPoint mapFromViewportToContents(const WebCore::IntPoint&) const;
258     WebCore::IntRect mapFromContentsToViewport(const WebCore::IntRect&) const;
259     WebCore::IntRect mapFromViewportToContents(const WebCore::IntRect&) const;
260
261     // Generic conversions of points, rects, relative to and from transformed contents and transformed viewport.
262     WebCore::IntPoint mapFromTransformedContentsToTransformedViewport(const WebCore::IntPoint&) const;
263     WebCore::IntPoint mapFromTransformedViewportToTransformedContents(const WebCore::IntPoint&) const;
264     WebCore::IntRect mapFromTransformedContentsToTransformedViewport(const WebCore::IntRect&) const;
265     WebCore::IntRect mapFromTransformedViewportToTransformedContents(const WebCore::IntRect&) const;
266
267     // Generic conversions of points, rects, and sizes to and from transformed coordinates.
268     WebCore::IntPoint mapToTransformed(const WebCore::IntPoint&) const;
269     WebCore::FloatPoint mapToTransformedFloatPoint(const WebCore::FloatPoint&) const;
270     WebCore::IntPoint mapFromTransformed(const WebCore::IntPoint&) const;
271     WebCore::FloatPoint mapFromTransformedFloatPoint(const WebCore::FloatPoint&) const;
272     WebCore::FloatRect mapFromTransformedFloatRect(const WebCore::FloatRect&) const;
273     WebCore::IntSize mapToTransformed(const WebCore::IntSize&) const;
274     WebCore::IntSize mapFromTransformed(const WebCore::IntSize&) const;
275     WebCore::IntRect mapToTransformed(const WebCore::IntRect&) const;
276     void clipToTransformedContentsRect(WebCore::IntRect&) const;
277     WebCore::IntRect mapFromTransformed(const WebCore::IntRect&) const;
278     bool transformedPointEqualsUntransformedPoint(const WebCore::IntPoint& transformedPoint, const WebCore::IntPoint& untransformedPoint);
279
280     // Notification methods that deliver changes to the real geometry of the device as specified above.
281     void notifyTransformChanged();
282     void notifyTransformedContentsSizeChanged();
283     void notifyTransformedScrollChanged();
284
285     void assignFocus(Platform::FocusDirection);
286     Platform::IntRect focusNodeRect();
287     WebCore::IntRect getRecursiveVisibleWindowRect(WebCore::ScrollView*, bool noClipOfMainFrame = false);
288
289     WebCore::IntPoint frameOffset(const WebCore::Frame*) const;
290
291     WebCore::Node* bestNodeForZoomUnderPoint(const WebCore::IntPoint&);
292     WebCore::Node* bestChildNodeForClickRect(WebCore::Node* parentNode, const WebCore::IntRect& clickRect);
293     WebCore::Node* nodeForZoomUnderPoint(const WebCore::IntPoint&);
294     WebCore::Node* adjustedBlockZoomNodeForZoomAndExpandingRatioLimits(WebCore::Node*);
295     WebCore::IntRect rectForNode(WebCore::Node*);
296     WebCore::IntRect blockZoomRectForNode(WebCore::Node*);
297     WebCore::IntRect adjustRectOffsetForFrameOffset(const WebCore::IntRect&, const WebCore::Node*);
298     bool compareNodesForBlockZoom(WebCore::Node* n1, WebCore::Node* n2);
299     double newScaleForBlockZoomRect(const WebCore::IntRect&, double oldScale, double margin);
300     double maxBlockZoomScale() const;
301
302     // Plugin Methods.
303     void notifyPluginRectChanged(int id, const WebCore::IntRect& rectChanged);
304
305     // Context Methods.
306     Platform::WebContext webContext(TargetDetectionStrategy);
307     PassRefPtr<WebCore::Node> contextNode(TargetDetectionStrategy);
308
309 #if ENABLE(VIEWPORT_REFLOW)
310     void toggleTextReflowIfEnabledForBlockZoomOnly(bool shouldEnableTextReflow = false);
311 #endif
312
313     void selectionChanged(WebCore::Frame*);
314
315     void updateDelegatedOverlays(bool dispatched = false);
316
317     void updateCursor();
318
319     void onInputLocaleChanged(bool isRTL);
320
321     ViewMode viewMode() const { return m_viewMode; }
322     bool setViewMode(ViewMode); // Returns true if the change requires re-layout.
323
324     void setShouldUseFixedDesktopMode(bool b) { m_shouldUseFixedDesktopMode = b; }
325
326     bool useFixedLayout() const;
327     WebCore::IntSize fixedLayoutSize(bool snapToIncrement = false) const;
328
329     // ZoomToFitOnLoad can lead to a large recursion depth in FrameView::layout() as we attempt
330     // to determine the zoom scale factor so as to have the content of the page fit within the
331     // area of the frame. From observation, we can bail out after a recursion depth of 10 and
332     // still have reasonable results.
333     bool didLayoutExceedMaximumIterations() const { return m_nestedLayoutFinishedCount > 10; }
334
335     void clearFocusNode();
336     WebCore::Frame* focusedOrMainFrame() const;
337     WebCore::Frame* mainFrame() const { return m_mainFrame; }
338
339 #if ENABLE(EVENT_MODE_METATAGS)
340     void didReceiveCursorEventMode(WebCore::CursorEventMode);
341     void didReceiveTouchEventMode(WebCore::TouchEventMode);
342 #endif
343
344     void dispatchViewportPropertiesDidChange(const WebCore::ViewportArguments&);
345     WebCore::IntSize recomputeVirtualViewportFromViewportArguments();
346
347     void resetBlockZoom();
348
349     void zoomAboutPointTimerFired(WebCore::Timer<WebPagePrivate>*);
350     bool shouldSendResizeEvent();
351     void scrollEventTimerFired(WebCore::Timer<WebPagePrivate>*);
352     void resizeEventTimerFired(WebCore::Timer<WebPagePrivate>*);
353
354     // If this url should be handled as a pattern, returns the pattern
355     // otherwise, returns an empty string.
356     String findPatternStringForUrl(const WebCore::KURL&) const;
357
358     void suspendBackingStore();
359     void resumeBackingStore();
360
361     void setShouldResetTilesWhenShown(bool flag) { m_shouldResetTilesWhenShown = flag; }
362     bool shouldResetTilesWhenShown() const { return m_shouldResetTilesWhenShown; }
363
364     void setScreenOrientation(int);
365
366     // Scroll and/or zoom so that the WebPage fits the new actual
367     // visible size.
368     void setViewportSize(const WebCore::IntSize& transformedActualVisibleSize, bool ensureFocusElementVisible);
369     void resizeSurfaceIfNeeded(); // Helper method for setViewportSize().
370
371     void scheduleDeferrableTimer(WebCore::Timer<WebPagePrivate>*, double timeOut);
372     void unscheduleAllDeferrableTimers();
373     void willDeferLoading();
374     void didResumeLoading();
375
376     // Returns true if the escape key handler should zoom.
377     bool shouldZoomOnEscape() const;
378
379     WebCore::TransformationMatrix* transformationMatrix() const
380     {
381         return m_transformationMatrix;
382     }
383
384     bool compositorDrawsRootLayer() const; // Thread safe
385     void setCompositorDrawsRootLayer(bool); // WebKit thread only
386
387 #if USE(ACCELERATED_COMPOSITING)
388     // WebKit thread.
389     bool needsOneShotDrawingSynchronization();
390     void rootLayerCommitTimerFired(WebCore::Timer<WebPagePrivate>*);
391     bool commitRootLayerIfNeeded();
392     WebCore::LayerRenderingResults lastCompositingResults() const;
393     WebCore::GraphicsLayer* overlayLayer();
394
395     // Fallback GraphicsLayerClient implementation, used for various overlay layers.
396     virtual void notifyAnimationStarted(const WebCore::GraphicsLayer*, double time) { }
397     virtual void notifySyncRequired(const WebCore::GraphicsLayer*);
398     virtual void paintContents(const WebCore::GraphicsLayer*, WebCore::GraphicsContext&, WebCore::GraphicsLayerPaintingPhase, const WebCore::IntRect& inClip) { }
399     virtual bool showDebugBorders(const WebCore::GraphicsLayer*) const;
400     virtual bool showRepaintCounter(const WebCore::GraphicsLayer*) const;
401
402     // WebKit thread, plumbed through from ChromeClientBlackBerry.
403     void setRootLayerWebKitThread(WebCore::Frame*, WebCore::LayerWebKitThread*);
404     void setNeedsOneShotDrawingSynchronization();
405     void scheduleRootLayerCommit();
406
407     // Thread safe.
408     void resetCompositingSurface();
409     void drawLayersOnCommit(); // Including backing store blit.
410
411     // Compositing thread.
412     void setRootLayerCompositingThread(WebCore::LayerCompositingThread*);
413     void commitRootLayer(const WebCore::IntRect&, const WebCore::IntSize&, bool);
414     bool isAcceleratedCompositingActive() const { return m_compositor; }
415     WebPageCompositorPrivate* compositor() const { return m_compositor.get(); }
416     void setCompositor(PassRefPtr<WebPageCompositorPrivate>);
417     void setCompositorHelper(PassRefPtr<WebPageCompositorPrivate>);
418     void setCompositorBackgroundColor(const WebCore::Color&);
419     bool createCompositor();
420     void destroyCompositor();
421     void syncDestroyCompositorOnCompositingThread();
422     void releaseLayerResources();
423     void releaseLayerResourcesCompositingThread();
424     void suspendRootLayerCommit();
425     void resumeRootLayerCommit();
426     void blitVisibleContents();
427
428     void scheduleCompositingRun();
429 #endif
430
431     bool dispatchTouchEventToFullScreenPlugin(WebCore::PluginView*, const Platform::TouchEvent&);
432     bool dispatchTouchPointAsMouseEventToFullScreenPlugin(WebCore::PluginView*, const Platform::TouchPoint&);
433     bool dispatchMouseEventToFullScreenPlugin(WebCore::PluginView*, const Platform::MouseEvent&);
434
435     BackingStoreClient* backingStoreClientForFrame(const WebCore::Frame*) const;
436     void addBackingStoreClientForFrame(const WebCore::Frame*, BackingStoreClient*);
437     void removeBackingStoreClientForFrame(const WebCore::Frame*);
438
439     void setParentPopup(WebCore::PagePopupBlackBerry* webPopup);
440
441     // Clean up any document related data we might be holding.
442     void clearDocumentData(const WebCore::Document*);
443
444     void frameUnloaded(const WebCore::Frame*);
445
446     static WebCore::RenderLayer* enclosingPositionedAncestorOrSelfIfPositioned(WebCore::RenderLayer*);
447     static WebCore::RenderLayer* enclosingFixedPositionedAncestorOrSelfIfFixedPositioned(WebCore::RenderLayer*);
448
449     static WebCore::IntSize defaultMaxLayoutSize();
450     static const String& defaultUserAgent();
451
452     void setVisible(bool);
453 #if ENABLE(PAGE_VISIBILITY_API)
454     void setPageVisibilityState();
455 #endif
456     void notifyAppActivationStateChange(ActivationStateType);
457
458     void deferredTasksTimerFired(WebCore::Timer<WebPagePrivate>*);
459
460     void setInspectorOverlayClient(InspectorOverlay::InspectorOverlayClient*);
461
462     void applySizeOverride(int overrideWidth, int overrideHeight);
463     void setTextZoomFactor(float);
464
465     WebPage* m_webPage;
466     WebPageClient* m_client;
467     WebCore::InspectorClientBlackBerry* m_inspectorClient;
468     WebCore::Page* m_page;
469     WebCore::Frame* m_mainFrame;
470     RefPtr<WebCore::Node> m_currentContextNode;
471     WebSettings* m_webSettings;
472     OwnPtr<WebTapHighlight> m_tapHighlight;
473     WebSelectionOverlay* m_selectionOverlay;
474
475 #if ENABLE(JAVASCRIPT_DEBUGGER)
476     OwnPtr<WebCore::JavaScriptDebuggerBlackBerry> m_scriptDebugger;
477 #endif
478
479     bool m_visible;
480     ActivationStateType m_activationState;
481     bool m_shouldResetTilesWhenShown;
482     bool m_shouldZoomToInitialScaleAfterLoadFinished;
483     bool m_userScalable;
484     bool m_userPerformedManualZoom;
485     bool m_userPerformedManualScroll;
486     bool m_contentsSizeChanged;
487     bool m_overflowExceedsContentsSize;
488     bool m_resetVirtualViewportOnCommitted;
489     bool m_shouldUseFixedDesktopMode;
490     bool m_needTouchEvents;
491     int m_preventIdleDimmingCount;
492
493 #if ENABLE(TOUCH_EVENTS)
494     bool m_preventDefaultOnTouchStart;
495 #endif
496     unsigned m_nestedLayoutFinishedCount;
497     WebCore::IntSize m_previousContentsSize;
498     int m_actualVisibleWidth;
499     int m_actualVisibleHeight;
500     int m_virtualViewportWidth;
501     int m_virtualViewportHeight;
502     WebCore::IntSize m_defaultLayoutSize;
503     WebCore::ViewportArguments m_viewportArguments; // We keep this around since we may need to re-evaluate the arguments on rotation.
504     WebCore::ViewportArguments m_userViewportArguments; // A fallback set of Viewport Arguments supplied by the WebPageClient
505     bool m_didRestoreFromPageCache;
506     ViewMode m_viewMode;
507     LoadState m_loadState;
508     WebCore::TransformationMatrix* m_transformationMatrix;
509     BackingStore* m_backingStore;
510     BackingStoreClient* m_backingStoreClient;
511     InPageSearchManager* m_inPageSearchManager;
512     InputHandler* m_inputHandler;
513     SelectionHandler* m_selectionHandler;
514     TouchEventHandler* m_touchEventHandler;
515
516 #if ENABLE(EVENT_MODE_METATAGS)
517     WebCore::CursorEventMode m_cursorEventMode;
518     WebCore::TouchEventMode m_touchEventMode;
519 #endif
520
521 #if ENABLE(FULLSCREEN_API)
522 #if ENABLE(VIDEO)
523     double m_scaleBeforeFullScreen;
524     int m_xScrollOffsetBeforeFullScreen;
525 #endif
526 #endif
527
528     Platform::BlackBerryCursor m_currentCursor;
529
530     DumpRenderTreeClient* m_dumpRenderTree;
531
532     double m_initialScale;
533     double m_minimumScale;
534     double m_maximumScale;
535
536     // Block zoom animation data.
537     WebCore::FloatPoint m_finalBlockPoint;
538     WebCore::FloatPoint m_finalBlockPointReflowOffset;
539     double m_blockZoomFinalScale;
540     RefPtr<WebCore::Node> m_currentPinchZoomNode;
541     WebCore::FloatPoint m_anchorInNodeRectRatio;
542     RefPtr<WebCore::Node> m_currentBlockZoomNode;
543     RefPtr<WebCore::Node> m_currentBlockZoomAdjustedNode;
544     bool m_shouldReflowBlock;
545
546     // Delayed zoomAboutPoint.
547     OwnPtr<WebCore::Timer<WebPagePrivate> > m_delayedZoomTimer;
548     struct {
549         double scale;
550         WebCore::FloatPoint anchor;
551         bool enforceScaleClamping;
552         bool forceRendering;
553     } m_delayedZoomArguments;
554
555     double m_lastUserEventTimestamp; // Used to detect user scrolling.
556
557     WebCore::PlatformMouseEvent m_lastMouseEvent;
558     bool m_pluginMouseButtonPressed; // Used to track mouse button for full screen plugins.
559     bool m_pluginMayOpenNewTab;
560
561     WebCore::GeolocationControllerClientBlackBerry* m_geolocationClient;
562
563     HashSet<WebCore::PluginView*> m_pluginViews;
564
565     OwnPtr<InRegionScroller> m_inRegionScroller;
566
567 #if USE(ACCELERATED_COMPOSITING)
568     bool m_isAcceleratedCompositingActive;
569     OwnPtr<FrameLayers> m_frameLayers; // WebKit thread only.
570     OwnPtr<WebCore::GraphicsLayer> m_overlayLayer;
571
572     // Compositing thread only, used only when the WebKit layer created the context.
573     // If the API client created the context, this will be null.
574     OwnPtr<GLES2Context> m_ownedContext;
575
576     RefPtr<WebPageCompositorPrivate> m_compositor; // Compositing thread only.
577     OwnPtr<WebCore::Timer<WebPagePrivate> > m_rootLayerCommitTimer;
578     bool m_needsOneShotDrawingSynchronization;
579     bool m_needsCommit;
580     bool m_suspendRootLayerCommit;
581 #endif
582
583     bool m_hasPendingSurfaceSizeChange;
584     int m_pendingOrientation;
585
586     RefPtr<WebCore::Node> m_fullscreenVideoNode;
587     RefPtr<WebCore::PluginView> m_fullScreenPluginView;
588
589     typedef HashMap<const WebCore::Frame*, BackingStoreClient*> BackingStoreClientForFrameMap;
590     BackingStoreClientForFrameMap m_backingStoreClientForFrameMap;
591
592     // WebSettingsDelegate methods.
593     virtual void didChangeSettings(WebSettings*);
594
595     RefPtr<WebCore::DOMWrapperWorld> m_isolatedWorld;
596     bool m_hasInRegionScrollableAreas;
597     bool m_updateDelegatedOverlaysDispatched;
598     OwnPtr<InspectorOverlay> m_inspectorOverlay;
599
600     // There is no need to initialize the following members in WebPagePrivate's constructor,
601     // because they are only used by WebPageTasks and the tasks will initialize them when
602     // being constructed.
603     bool m_wouldPopupListSelectMultiple;
604     bool m_wouldPopupListSelectSingle;
605     bool m_wouldSetDateTimeInput;
606     bool m_wouldSetColorInput;
607     bool m_wouldCancelSelection;
608     bool m_wouldLoadManualScript;
609     bool m_wouldSetFocused;
610     bool m_wouldSetPageVisibilityState;
611     Vector<bool> m_cachedPopupListSelecteds;
612     int m_cachedPopupListSelectedIndex;
613     WebString m_cachedDateTimeInput;
614     WebString m_cachedColorInput;
615     WebCore::KURL m_cachedManualScript;
616     bool m_cachedFocused;
617
618     class DeferredTaskBase {
619     public:
620         void perform(WebPagePrivate* webPagePrivate)
621         {
622             if (!(webPagePrivate->*m_isActive))
623                 return;
624             performInternal(webPagePrivate);
625         }
626     protected:
627         DeferredTaskBase(WebPagePrivate* webPagePrivate, bool WebPagePrivate::*isActive)
628             : m_isActive(isActive)
629         {
630             webPagePrivate->*m_isActive = true;
631         }
632
633         virtual void performInternal(WebPagePrivate*) = 0;
634
635         bool WebPagePrivate::*m_isActive;
636     };
637
638     Vector<OwnPtr<DeferredTaskBase> > m_deferredTasks;
639     WebCore::Timer<WebPagePrivate> m_deferredTasksTimer;
640
641     // The popup that opened in this webpage
642     WebCore::PagePopupBlackBerry* m_selectPopup;
643
644     RefPtr<WebCore::AutofillManager> m_autofillManager;
645 protected:
646     virtual ~WebPagePrivate();
647 };
648 }
649 }
650
651 #endif // WebPage_p_h