WebPage_p.h 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677
  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. #ifndef WebPage_p_h
  19. #define WebPage_p_h
  20. #include "ChromeClient.h"
  21. #include "HitTestResult.h"
  22. #include "InRegionScroller.h"
  23. #include "InspectorClientBlackBerry.h"
  24. #include "InspectorOverlay.h"
  25. #if USE(ACCELERATED_COMPOSITING)
  26. #include "GLES2Context.h"
  27. #include "GraphicsLayerClient.h"
  28. #include "LayerRenderer.h"
  29. #include <EGL/egl.h>
  30. #endif
  31. #include "KURL.h"
  32. #if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
  33. #include "NotificationManager.h"
  34. #endif
  35. #include "PageClientBlackBerry.h"
  36. #include "PlatformMouseEvent.h"
  37. #include "ProximityDetector.h"
  38. #include "ScriptSourceCode.h"
  39. #include "SelectionOverlay.h"
  40. #include "Timer.h"
  41. #include "ViewportArguments.h"
  42. #include "WebPage.h"
  43. #include "WebSettings.h"
  44. #include "WebTapHighlight.h"
  45. #include <BlackBerryPlatformMessage.h>
  46. #define DEFAULT_MAX_LAYOUT_WIDTH 1024
  47. #define DEFAULT_MAX_LAYOUT_HEIGHT 768
  48. namespace WebCore {
  49. class AuthenticationChallengeClient;
  50. class AutofillManager;
  51. class DOMWrapperWorld;
  52. class Document;
  53. class Element;
  54. class Frame;
  55. class GeolocationClientBlackBerry;
  56. class GraphicsLayerBlackBerry;
  57. class LayerWebKitThread;
  58. class NavigatorContentUtilsClientBlackBerry;
  59. class Node;
  60. class Page;
  61. class PluginView;
  62. class RenderLayer;
  63. class RenderObject;
  64. class ScrollView;
  65. class TransformationMatrix;
  66. template<typename T> class Timer;
  67. }
  68. namespace BlackBerry {
  69. namespace WebKit {
  70. class BackingStore;
  71. class BackingStoreClient;
  72. class DumpRenderTreeClient;
  73. class InPageSearchManager;
  74. class InputHandler;
  75. class PagePopup;
  76. class PagePopupClient;
  77. class SelectionHandler;
  78. class TouchEventHandler;
  79. class WebCookieJar;
  80. class WebPageClient;
  81. class WebKitThreadViewportAccessor;
  82. #if USE(ACCELERATED_COMPOSITING)
  83. class FrameLayers;
  84. class WebPageCompositorPrivate;
  85. #endif
  86. // In the client code, there is screen size and viewport.
  87. // In WebPagePrivate, the screen size is called the transformedViewportSize,
  88. // the viewport position is called the transformedScrollPosition,
  89. // and the viewport size is called the transformedActualVisibleSize.
  90. class WebPagePrivate : public PageClientBlackBerry
  91. , public WebSettingsDelegate
  92. #if USE(ACCELERATED_COMPOSITING)
  93. , public WebCore::GraphicsLayerClient
  94. #endif
  95. #if ENABLE(REQUEST_ANIMATION_FRAME) && !USE(REQUEST_ANIMATION_FRAME_TIMER)
  96. , public BlackBerry::Platform::AnimationFrameRateClient
  97. #endif
  98. , public Platform::GuardedPointerBase {
  99. public:
  100. enum ViewMode { Desktop, FixedDesktop };
  101. enum LoadState { None /* on instantiation of page */, Provisional, Committed, Finished, Failed };
  102. WebPagePrivate(WebPage*, WebPageClient*, const WebCore::IntRect&);
  103. static WebCore::Page* core(const WebPage*);
  104. WebPageClient* client() const { return m_client; }
  105. void init(const BlackBerry::Platform::String& pageGroupName);
  106. bool handleMouseEvent(WebCore::PlatformMouseEvent&);
  107. bool handleWheelEvent(WebCore::PlatformWheelEvent&);
  108. void load(const Platform::NetworkRequest& platformRequest, bool needReferer = false);
  109. void loadString(const BlackBerry::Platform::String&, const BlackBerry::Platform::String& baseURL, const BlackBerry::Platform::String& mimeType, const BlackBerry::Platform::String& failingURL);
  110. bool executeJavaScript(const BlackBerry::Platform::String& script, JavaScriptDataType& returnType, BlackBerry::Platform::String& returnValue);
  111. bool executeJavaScriptInIsolatedWorld(const WebCore::ScriptSourceCode&, JavaScriptDataType& returnType, BlackBerry::Platform::String& returnValue);
  112. void stopCurrentLoad();
  113. void prepareToDestroy();
  114. void enableCrossSiteXHR();
  115. void addOriginAccessWhitelistEntry(const BlackBerry::Platform::String& sourceOrigin, const BlackBerry::Platform::String& destinationOrigin, bool allowDestinationSubdomains);
  116. void removeOriginAccessWhitelistEntry(const BlackBerry::Platform::String& sourceOrigin, const BlackBerry::Platform::String& destinationOrigin, bool allowDestinationSubdomains);
  117. LoadState loadState() const { return m_loadState; }
  118. bool isLoading() const { return m_loadState == WebPagePrivate::Provisional || m_loadState == WebPagePrivate::Committed; }
  119. // Called from within WebKit via FrameLoaderClientBlackBerry.
  120. void setLoadState(LoadState);
  121. // Clamp the scale.
  122. double clampedScale(double scale) const;
  123. // Determine if we should zoom, clamping the scale parameter if required.
  124. bool shouldZoomAboutPoint(double scale, const WebCore::FloatPoint& anchor, bool enforeScaleClamping, double* clampedScale);
  125. // Scale the page to the given scale and anchor about the point which is specified in untransformed content coordinates.
  126. bool zoomAboutPoint(double scale, const WebCore::FloatPoint& anchor, bool enforceScaleClamping = true, bool forceRendering = false, bool isRestoringZoomLevel = false);
  127. WebCore::IntPoint calculateReflowedScrollPosition(const WebCore::FloatPoint& anchorOffset, double inverseScale);
  128. void setTextReflowAnchorPoint(const Platform::IntPoint& focalPoint);
  129. void restoreHistoryViewState(const WebCore::IntPoint& scrollPosition, double scale, bool shouldReflowBlock);
  130. // Perform actual zoom for after zoom animation.
  131. void zoomAnimationFinished(double finalScale, const WebCore::FloatPoint& finalDocumentScrollPosition, bool shouldConstrainScrollingToContentEdge);
  132. // Called by the backing store as well as the method below.
  133. void updateLayoutAndStyleIfNeededRecursive() const;
  134. void layoutIfNeeded() const;
  135. void setNeedsLayout();
  136. WebCore::IntPoint scrollPosition() const;
  137. WebCore::IntPoint maximumScrollPosition() const;
  138. void setScrollPosition(const WebCore::IntPoint&);
  139. void notifyInRegionScrollStopped();
  140. void setScrollOriginPoint(const Platform::IntPoint&);
  141. void setHasInRegionScrollableAreas(bool);
  142. // The actual visible size as reported by the client, but in WebKit coordinates.
  143. WebCore::IntSize actualVisibleSize() const;
  144. // The viewport size is the same as the client's window size, but in webkit coordinates.
  145. WebCore::IntSize viewportSize() const;
  146. // Modifies the zoomToFit algorithm logic to construct a scale such that the viewportSize above is equal to this size.
  147. bool hasVirtualViewport() const;
  148. bool isUserScalable() const
  149. {
  150. if (!respectViewport())
  151. return true;
  152. return m_userScalable;
  153. }
  154. void setUserScalable(bool userScalable) { m_userScalable = userScalable; }
  155. // Sets default layout size without doing layout or marking as needing layout.
  156. void setDefaultLayoutSize(const WebCore::IntSize&);
  157. // Updates WebCore when the viewportSize() or actualVisibleSize() change.
  158. void updateViewportSize(bool setFixedReportedSize = true, bool sendResizeEvent = true);
  159. WebCore::FloatPoint centerOfVisibleContentsRect() const;
  160. WebCore::IntRect visibleContentsRect() const;
  161. WebCore::IntSize contentsSize() const;
  162. WebCore::IntSize absoluteVisibleOverflowSize() const;
  163. // Virtual functions inherited from PageClientBlackBerry.
  164. virtual int playerID() const;
  165. virtual void setCursor(WebCore::PlatformCursor);
  166. virtual Platform::NetworkStreamFactory* networkStreamFactory();
  167. virtual Platform::Graphics::Window* platformWindow() const;
  168. virtual void setPreventsScreenDimming(bool preventDimming);
  169. virtual void showVirtualKeyboard(bool showKeyboard);
  170. virtual void ensureContentVisible(bool centerInView = true);
  171. virtual void zoomToContentRect(const WebCore::IntRect&);
  172. virtual void registerPlugin(WebCore::PluginView*, bool);
  173. virtual void notifyPageOnLoad();
  174. virtual bool shouldPluginEnterFullScreen(WebCore::PluginView*, const char*);
  175. virtual void didPluginEnterFullScreen(WebCore::PluginView*, const char*);
  176. virtual void didPluginExitFullScreen(WebCore::PluginView*, const char*);
  177. virtual void onPluginStartBackgroundPlay(WebCore::PluginView*, const char*);
  178. virtual void onPluginStopBackgroundPlay(WebCore::PluginView*, const char*);
  179. virtual bool lockOrientation(bool landscape);
  180. virtual void unlockOrientation();
  181. virtual int orientation() const;
  182. virtual double currentZoomFactor() const;
  183. virtual int showAlertDialog(WebPageClient::AlertType atype);
  184. virtual bool isActive() const;
  185. virtual bool isVisible() const { return m_visible; }
  186. virtual void authenticationChallenge(const WebCore::KURL&, const WebCore::ProtectionSpace&, const WebCore::Credential&);
  187. virtual SaveCredentialType notifyShouldSaveCredential(bool);
  188. virtual void syncProxyCredential(const WebCore::Credential&);
  189. // Called from within WebKit via ChromeClientBlackBerry.
  190. void enterFullscreenForNode(WebCore::Node*);
  191. void exitFullscreenForNode(WebCore::Node*);
  192. #if ENABLE(FULLSCREEN_API)
  193. void enterFullScreenForElement(WebCore::Element*);
  194. void exitFullScreenForElement(WebCore::Element*);
  195. void adjustFullScreenElementDimensionsIfNeeded();
  196. #endif
  197. void contentsSizeChanged(const WebCore::IntSize&);
  198. void overflowExceedsContentsSize();
  199. void layoutFinished();
  200. void setNeedTouchEvents(bool);
  201. void notifyPopupAutofillDialog(const Vector<String>&);
  202. void notifyDismissAutofillDialog();
  203. bool shouldZoomToInitialScaleOnLoad() const { return loadState() == Committed || m_shouldZoomToInitialScaleAfterLoadFinished; }
  204. void setShouldZoomToInitialScaleAfterLoadFinished(bool shouldZoomToInitialScaleAfterLoadFinished)
  205. {
  206. m_shouldZoomToInitialScaleAfterLoadFinished = shouldZoomToInitialScaleAfterLoadFinished;
  207. }
  208. // Called according to our heuristic or from setLoadState depending on whether we have a virtual viewport.
  209. void zoomToInitialScaleOnLoad();
  210. // Various scale factors.
  211. double currentScale() const { return m_transformationMatrix->m11(); }
  212. double zoomToFitScale() const;
  213. bool respectViewport() const;
  214. double initialScale() const;
  215. void setInitialScale(double scale) { m_initialScale = scale; }
  216. double minimumScale() const
  217. {
  218. return (m_minimumScale > zoomToFitScale() && m_minimumScale <= maximumScale() && respectViewport()) ? m_minimumScale : zoomToFitScale();
  219. }
  220. void setMinimumScale(double scale) { m_minimumScale = scale; }
  221. double maximumScale() const;
  222. void setMaximumScale(double scale) { m_maximumScale = scale; }
  223. void resetScales();
  224. // Note: to make this reflow width transform invariant just use
  225. // transformedActualVisibleSize() here instead!
  226. int reflowWidth() const { return actualVisibleSize().width(); }
  227. // These methods give the real geometry of the device given the currently set transform.
  228. WebCore::IntPoint transformedScrollPosition() const;
  229. WebCore::IntPoint transformedMaximumScrollPosition() const;
  230. WebCore::IntSize transformedActualVisibleSize() const;
  231. WebCore::IntSize transformedViewportSize() const;
  232. // Notification methods that deliver changes to the real geometry of the device as specified above.
  233. void notifyTransformChanged();
  234. void notifyTransformedContentsSizeChanged();
  235. void notifyTransformedScrollChanged();
  236. void assignFocus(Platform::FocusDirection);
  237. Platform::IntRect focusNodeRect();
  238. WebCore::IntRect getRecursiveVisibleWindowRect(WebCore::ScrollView*, bool noClipOfMainFrame = false);
  239. WebCore::IntPoint frameOffset(const WebCore::Frame*) const;
  240. WebCore::Node* bestNodeForZoomUnderPoint(const WebCore::IntPoint&);
  241. WebCore::Node* bestChildNodeForClickRect(WebCore::Node* parentNode, const WebCore::IntRect& clickRect);
  242. WebCore::Node* nodeForZoomUnderPoint(const WebCore::IntPoint&);
  243. WebCore::Node* adjustedBlockZoomNodeForZoomAndExpandingRatioLimits(WebCore::Node*);
  244. WebCore::IntRect rectForNode(WebCore::Node*);
  245. WebCore::IntRect blockZoomRectForNode(WebCore::Node*);
  246. WebCore::IntRect adjustRectOffsetForFrameOffset(const WebCore::IntRect&, const WebCore::Node*);
  247. bool compareNodesForBlockZoom(WebCore::Node* n1, WebCore::Node* n2);
  248. double newScaleForBlockZoomRect(const WebCore::IntRect&, double oldScale, double margin);
  249. double maxBlockZoomScale() const;
  250. // Context Methods.
  251. Platform::WebContext webContext(TargetDetectionStrategy);
  252. PassRefPtr<WebCore::Node> contextNode(TargetDetectionStrategy);
  253. #if ENABLE(VIEWPORT_REFLOW)
  254. void toggleTextReflowIfEnabledForBlockZoomOnly(bool shouldEnableTextReflow = false);
  255. #endif
  256. void selectionChanged(WebCore::Frame*);
  257. void setOverlayExpansionPixelHeight(int);
  258. void updateSelectionScrollView(const WebCore::Node*);
  259. void updateDelegatedOverlays(bool dispatched = false);
  260. void updateCursor();
  261. ViewMode viewMode() const { return m_viewMode; }
  262. bool setViewMode(ViewMode); // Returns true if the change requires re-layout.
  263. void setShouldUseFixedDesktopMode(bool b) { m_shouldUseFixedDesktopMode = b; }
  264. bool useFixedLayout() const;
  265. WebCore::IntSize fixedLayoutSize(bool snapToIncrement = false) const;
  266. // ZoomToFitOnLoad can lead to a large recursion depth in FrameView::layout() as we attempt
  267. // to determine the zoom scale factor so as to have the content of the page fit within the
  268. // area of the frame. From observation, we can bail out after a recursion depth of 10 and
  269. // still have reasonable results.
  270. bool didLayoutExceedMaximumIterations() const { return m_nestedLayoutFinishedCount > 10; }
  271. void clearFocusNode();
  272. WebCore::Frame* focusedOrMainFrame() const;
  273. WebCore::Frame* mainFrame() const { return m_mainFrame; }
  274. #if ENABLE(EVENT_MODE_METATAGS)
  275. void didReceiveCursorEventMode(WebCore::CursorEventMode);
  276. void didReceiveTouchEventMode(WebCore::TouchEventMode);
  277. #endif
  278. void dispatchViewportPropertiesDidChange(const WebCore::ViewportArguments&);
  279. Platform::IntSize recomputeVirtualViewportFromViewportArguments();
  280. void resetBlockZoom();
  281. void zoomAboutPointTimerFired(WebCore::Timer<WebPagePrivate>*);
  282. bool shouldSendResizeEvent();
  283. void scrollEventTimerFired(WebCore::Timer<WebPagePrivate>*);
  284. void resizeEventTimerFired(WebCore::Timer<WebPagePrivate>*);
  285. // If this url should be handled as a pattern, returns the pattern
  286. // otherwise, returns an empty string.
  287. String findPatternStringForUrl(const WebCore::KURL&) const;
  288. void suspendBackingStore();
  289. void resumeBackingStore();
  290. void setShouldResetTilesWhenShown(bool flag) { m_shouldResetTilesWhenShown = flag; }
  291. bool shouldResetTilesWhenShown() const { return m_shouldResetTilesWhenShown; }
  292. void setScreenOrientation(int);
  293. // Scroll and/or zoom so that the WebPage fits the new actual visible size, a.k.a. visual viewport.
  294. // Also sets the default layout size, a.k.a. the layout viewport.
  295. bool setViewportSize(const WebCore::IntSize& transformedActualVisibleSize, const WebCore::IntSize& defaultLayoutSize, bool ensureFocusElementVisible);
  296. void scheduleDeferrableTimer(WebCore::Timer<WebPagePrivate>*, double timeOut);
  297. void unscheduleAllDeferrableTimers();
  298. void willDeferLoading();
  299. void didResumeLoading();
  300. WebCore::TransformationMatrix* transformationMatrix() const
  301. {
  302. return m_transformationMatrix;
  303. }
  304. bool compositorDrawsRootLayer() const; // Thread safe
  305. void setCompositorDrawsRootLayer(bool); // WebKit thread only
  306. #if USE(ACCELERATED_COMPOSITING)
  307. // WebKit thread.
  308. bool needsOneShotDrawingSynchronization();
  309. void rootLayerCommitTimerFired(WebCore::Timer<WebPagePrivate>*);
  310. bool commitRootLayerIfNeeded();
  311. WebCore::LayerRenderingResults lastCompositingResults() const;
  312. WebCore::GraphicsLayer* overlayLayer();
  313. // Fallback GraphicsLayerClient implementation, used for various overlay layers.
  314. virtual void notifyAnimationStarted(const WebCore::GraphicsLayer*, double) { }
  315. virtual void notifyFlushRequired(const WebCore::GraphicsLayer*);
  316. virtual void paintContents(const WebCore::GraphicsLayer*, WebCore::GraphicsContext&, WebCore::GraphicsLayerPaintingPhase, const WebCore::IntRect&) { }
  317. // WebKit thread, plumbed through from ChromeClientBlackBerry.
  318. void setRootLayerWebKitThread(WebCore::Frame*, WebCore::LayerWebKitThread*);
  319. void setNeedsOneShotDrawingSynchronization();
  320. void scheduleRootLayerCommit();
  321. // Compositing thread.
  322. void setRootLayerCompositingThread(WebCore::LayerCompositingThread*);
  323. void commitRootLayer(const WebCore::IntRect& layoutRect, const WebCore::IntRect& documentRect, bool);
  324. bool isAcceleratedCompositingActive() const { return m_compositor; }
  325. WebPageCompositorPrivate* compositor() const { return m_compositor.get(); }
  326. void setCompositor(PassRefPtr<WebPageCompositorPrivate>);
  327. void setCompositorHelper(PassRefPtr<WebPageCompositorPrivate>);
  328. void setCompositorBackgroundColor(const WebCore::Color&);
  329. bool createCompositor();
  330. void destroyCompositor();
  331. void syncDestroyCompositorOnCompositingThread();
  332. void releaseLayerResources();
  333. void releaseLayerResourcesCompositingThread();
  334. void suspendRootLayerCommit();
  335. void resumeRootLayerCommit();
  336. void scheduleCompositingRun();
  337. #endif
  338. bool dispatchTouchEventToFullScreenPlugin(WebCore::PluginView*, const Platform::TouchEvent&);
  339. bool dispatchTouchPointAsMouseEventToFullScreenPlugin(WebCore::PluginView*, const Platform::TouchPoint&);
  340. bool dispatchMouseEventToFullScreenPlugin(WebCore::PluginView*, const Platform::MouseEvent&);
  341. BackingStoreClient* backingStoreClient() const;
  342. bool openPagePopup(PagePopupClient*, const WebCore::IntRect& originBoundsInRootView);
  343. void closePagePopup();
  344. bool hasOpenedPopup() const;
  345. // Clean up any document related data we might be holding.
  346. void clearDocumentData(const WebCore::Document*);
  347. void frameUnloaded(const WebCore::Frame*);
  348. static WebCore::RenderLayer* enclosingPositionedAncestorOrSelfIfPositioned(WebCore::RenderLayer*);
  349. static WebCore::RenderLayer* enclosingFixedPositionedAncestorOrSelfIfFixedPositioned(WebCore::RenderLayer*);
  350. static const BlackBerry::Platform::String& defaultUserAgent();
  351. void setVisible(bool);
  352. #if ENABLE(PAGE_VISIBILITY_API)
  353. void setPageVisibilityState();
  354. #endif
  355. void notifyAppActivationStateChange(ActivationStateType);
  356. void deferredTasksTimerFired(WebCore::Timer<WebPagePrivate>*);
  357. void setInspectorOverlayClient(InspectorOverlay::InspectorOverlayClient*);
  358. void applySizeOverride(int overrideWidth, int overrideHeight);
  359. void setTextZoomFactor(float);
  360. void postponeDocumentStyleRecalc();
  361. void resumeDocumentStyleRecalc();
  362. const WebCore::HitTestResult& hitTestResult(const WebCore::IntPoint& contentPos);
  363. void clearCachedHitTestResult();
  364. WebCore::IntSize screenSize() const;
  365. void willComposite();
  366. void didComposite();
  367. #if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
  368. NotificationManager& notificationManager() { return m_notificationManager; };
  369. #endif
  370. void animateToScaleAndDocumentScrollPosition(double destinationZoomScale, const WebCore::FloatPoint& destinationScrollPosition, bool shouldConstrainScrollingToContentEdge = true);
  371. void updateBackgroundColor(const WebCore::Color& backgroundColor);
  372. WebCore::Color documentBackgroundColor() const;
  373. #if ENABLE(REQUEST_ANIMATION_FRAME) && !USE(REQUEST_ANIMATION_FRAME_TIMER)
  374. // BlackBerry::Platform::AnimationFrameRateClient.
  375. virtual void animationFrameChanged();
  376. void scheduleAnimation();
  377. void startRefreshAnimationClient();
  378. void stopRefreshAnimationClient();
  379. void serviceAnimations();
  380. static void handleServiceScriptedAnimationsOnMainThread(void*);
  381. #endif
  382. WebPage* m_webPage;
  383. WebPageClient* m_client;
  384. WebCore::InspectorClientBlackBerry* m_inspectorClient;
  385. WebCore::Page* m_page;
  386. WebCore::Frame* m_mainFrame;
  387. RefPtr<WebCore::Node> m_currentContextNode;
  388. WebSettings* m_webSettings;
  389. WebCookieJar* m_cookieJar;
  390. OwnPtr<WebTapHighlight> m_tapHighlight;
  391. OwnPtr<WebTapHighlight> m_selectionHighlight;
  392. OwnPtr<SelectionOverlay> m_selectionOverlay;
  393. #if ENABLE(NAVIGATOR_CONTENT_UTILS)
  394. OwnPtr<WebCore::NavigatorContentUtilsClientBlackBerry> m_navigatorContentUtilsClient;
  395. #endif
  396. bool m_visible;
  397. ActivationStateType m_activationState;
  398. bool m_shouldResetTilesWhenShown;
  399. bool m_shouldZoomToInitialScaleAfterLoadFinished;
  400. bool m_userScalable;
  401. bool m_userPerformedManualZoom;
  402. bool m_userPerformedManualScroll;
  403. bool m_contentsSizeChanged;
  404. bool m_overflowExceedsContentsSize;
  405. bool m_resetVirtualViewportOnCommitted;
  406. bool m_shouldUseFixedDesktopMode;
  407. bool m_inspectorEnabled;
  408. int m_preventIdleDimmingCount;
  409. #if ENABLE(TOUCH_EVENTS)
  410. bool m_preventDefaultOnTouchStart;
  411. #endif
  412. unsigned m_nestedLayoutFinishedCount;
  413. WebCore::IntSize m_previousContentsSize;
  414. int m_actualVisibleWidth;
  415. int m_actualVisibleHeight;
  416. WebCore::IntSize m_virtualViewportSize;
  417. WebCore::IntSize m_defaultLayoutSize;
  418. WebCore::ViewportArguments m_viewportArguments; // We keep this around since we may need to re-evaluate the arguments on rotation.
  419. WebCore::ViewportArguments m_userViewportArguments; // A fallback set of Viewport Arguments supplied by the WebPageClient
  420. bool m_didRestoreFromPageCache;
  421. ViewMode m_viewMode;
  422. LoadState m_loadState;
  423. WebCore::TransformationMatrix* m_transformationMatrix;
  424. BackingStore* m_backingStore;
  425. BackingStoreClient* m_backingStoreClient;
  426. WebKitThreadViewportAccessor* m_webkitThreadViewportAccessor;
  427. InPageSearchManager* m_inPageSearchManager;
  428. InputHandler* m_inputHandler;
  429. SelectionHandler* m_selectionHandler;
  430. TouchEventHandler* m_touchEventHandler;
  431. ProximityDetector* m_proximityDetector;
  432. #if ENABLE(EVENT_MODE_METATAGS)
  433. WebCore::CursorEventMode m_cursorEventMode;
  434. WebCore::TouchEventMode m_touchEventMode;
  435. #endif
  436. #if ENABLE(FULLSCREEN_API)
  437. #if ENABLE(VIDEO)
  438. double m_scaleBeforeFullScreen;
  439. WebCore::IntPoint m_scrollPositionBeforeFullScreen;
  440. int m_orientationBeforeFullScreen;
  441. #endif
  442. #endif
  443. Platform::BlackBerryCursor m_currentCursor;
  444. DumpRenderTreeClient* m_dumpRenderTree;
  445. double m_initialScale;
  446. double m_minimumScale;
  447. double m_maximumScale;
  448. bool m_forceRespectViewportArguments;
  449. // Block zoom & zoom/scroll animation data.
  450. WebCore::FloatPoint m_finalAnimationDocumentScrollPositionReflowOffset;
  451. RefPtr<WebCore::Node> m_currentPinchZoomNode;
  452. WebCore::FloatPoint m_anchorInNodeRectRatio;
  453. RefPtr<WebCore::Node> m_currentBlockZoomNode;
  454. RefPtr<WebCore::Node> m_currentBlockZoomAdjustedNode;
  455. bool m_shouldReflowBlock;
  456. double m_lastUserEventTimestamp; // Used to detect user scrolling.
  457. WebCore::PlatformMouseEvent m_lastMouseEvent;
  458. bool m_pluginMouseButtonPressed; // Used to track mouse button for full screen plugins.
  459. bool m_pluginMayOpenNewTab;
  460. WebCore::GeolocationControllerClientBlackBerry* m_geolocationClient;
  461. HashSet<WebCore::PluginView*> m_pluginViews;
  462. OwnPtr<InRegionScroller> m_inRegionScroller;
  463. #if USE(ACCELERATED_COMPOSITING)
  464. bool m_isAcceleratedCompositingActive;
  465. OwnPtr<FrameLayers> m_frameLayers; // WebKit thread only.
  466. OwnPtr<WebCore::GraphicsLayer> m_overlayLayer;
  467. // Compositing thread only, used only when the WebKit layer created the context.
  468. // If the API client created the context, this will be null.
  469. OwnPtr<GLES2Context> m_ownedContext;
  470. RefPtr<WebPageCompositorPrivate> m_compositor; // Compositing thread only.
  471. OwnPtr<WebCore::Timer<WebPagePrivate> > m_rootLayerCommitTimer;
  472. bool m_needsOneShotDrawingSynchronization;
  473. bool m_needsCommit;
  474. bool m_suspendRootLayerCommit;
  475. #endif
  476. int m_pendingOrientation;
  477. RefPtr<WebCore::Node> m_fullscreenNode;
  478. RefPtr<WebCore::PluginView> m_fullScreenPluginView;
  479. typedef HashMap<const WebCore::Frame*, BackingStoreClient*> BackingStoreClientForFrameMap;
  480. BackingStoreClientForFrameMap m_backingStoreClientForFrameMap;
  481. // WebSettingsDelegate methods.
  482. virtual void didChangeSettings(WebSettings*);
  483. RefPtr<WebCore::DOMWrapperWorld> m_isolatedWorld;
  484. bool m_hasInRegionScrollableAreas;
  485. bool m_updateDelegatedOverlaysDispatched;
  486. OwnPtr<InspectorOverlay> m_inspectorOverlay;
  487. // There is no need to initialize the following members in WebPagePrivate's constructor,
  488. // because they are only used by WebPageTasks and the tasks will initialize them when
  489. // being constructed.
  490. bool m_wouldPopupListSelectMultiple;
  491. bool m_wouldPopupListSelectSingle;
  492. bool m_wouldSetDateTimeInput;
  493. bool m_wouldSetColorInput;
  494. bool m_wouldCancelSelection;
  495. bool m_wouldLoadManualScript;
  496. bool m_wouldSetFocused;
  497. bool m_wouldSetPageVisibilityState;
  498. bool m_cachedFocused;
  499. Vector<bool> m_cachedPopupListSelecteds;
  500. int m_cachedPopupListSelectedIndex;
  501. BlackBerry::Platform::String m_cachedDateTimeInput;
  502. BlackBerry::Platform::String m_cachedColorInput;
  503. WebCore::KURL m_cachedManualScript;
  504. class DeferredTaskBase {
  505. public:
  506. void perform(WebPagePrivate* webPagePrivate)
  507. {
  508. if (!(webPagePrivate->*m_isActive))
  509. return;
  510. performInternal(webPagePrivate);
  511. }
  512. protected:
  513. DeferredTaskBase(WebPagePrivate* webPagePrivate, bool WebPagePrivate::*isActive)
  514. : m_isActive(isActive)
  515. {
  516. webPagePrivate->*m_isActive = true;
  517. }
  518. virtual void performInternal(WebPagePrivate*) = 0;
  519. bool WebPagePrivate::*m_isActive;
  520. };
  521. Vector<OwnPtr<DeferredTaskBase> > m_deferredTasks;
  522. WebCore::Timer<WebPagePrivate> m_deferredTasksTimer;
  523. // The popup that opened in this webpage
  524. RefPtr<PagePopup> m_pagePopup;
  525. RefPtr<WebCore::AutofillManager> m_autofillManager;
  526. bool m_documentStyleRecalcPostponed;
  527. bool m_documentChildNeedsStyleRecalc;
  528. WebCore::IntPoint m_cachedHitTestContentPos;
  529. WebCore::HitTestResult m_cachedHitTestResult;
  530. typedef HashMap<RefPtr<WebCore::Document>, ListHashSet<RefPtr<WebCore::Node> > > CachedRectHitTestResults;
  531. CachedRectHitTestResults m_cachedRectHitTestResults;
  532. #if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
  533. NotificationManager m_notificationManager;
  534. #endif
  535. bool m_didStartAnimations;
  536. double m_animationStartTime;
  537. #if ENABLE(REQUEST_ANIMATION_FRAME) && !USE(REQUEST_ANIMATION_FRAME_TIMER)
  538. Mutex m_animationMutex;
  539. bool m_isRunningRefreshAnimationClient;
  540. bool m_animationScheduled;
  541. bool m_previousFrameDone;
  542. double m_monotonicAnimationStartTime;
  543. #endif
  544. protected:
  545. virtual ~WebPagePrivate();
  546. };
  547. }
  548. }
  549. #endif // WebPage_p_h