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