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