diff options
author | Simon Hausmann <simon.hausmann@digia.com> | 2012-11-07 11:22:47 +0100 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@digia.com> | 2012-11-07 11:22:47 +0100 |
commit | cfd86b747d32ac22246a1aa908eaa720c63a88c1 (patch) | |
tree | 24d68c6f61c464ecba1e05670b80390ea3b0e50c /Source/WebKit2/UIProcess/PageViewportController.cpp | |
parent | 69d7c744c9de19d152dbe2d8e46eb7dfd4511d1a (diff) | |
download | qtwebkit-cfd86b747d32ac22246a1aa908eaa720c63a88c1.tar.gz |
Imported WebKit commit 20271caf2e2c016d5cef40184cddeefeac4f1876 (http://svn.webkit.org/repository/webkit/trunk@133733)
New snapshot that contains all previous fixes as well as build fix for latest QtMultimedia API changes.
Diffstat (limited to 'Source/WebKit2/UIProcess/PageViewportController.cpp')
-rw-r--r-- | Source/WebKit2/UIProcess/PageViewportController.cpp | 35 |
1 files changed, 13 insertions, 22 deletions
diff --git a/Source/WebKit2/UIProcess/PageViewportController.cpp b/Source/WebKit2/UIProcess/PageViewportController.cpp index 88d52ba62..92091632f 100644 --- a/Source/WebKit2/UIProcess/PageViewportController.cpp +++ b/Source/WebKit2/UIProcess/PageViewportController.cpp @@ -22,6 +22,8 @@ #include "config.h" #include "PageViewportController.h" +#if USE(TILED_BACKING_STORE) + #include "PageViewportControllerClient.h" #include "WebPageProxy.h" #include <WebCore/FloatRect.h> @@ -37,34 +39,16 @@ bool fuzzyCompare(float a, float b, float epsilon) return std::abs(a - b) < epsilon; } -ViewportUpdateDeferrer::ViewportUpdateDeferrer(PageViewportController* PageViewportController, SuspendContentFlag suspendContentFlag) - : m_controller(PageViewportController) -{ - m_controller->m_activeDeferrerCount++; - - // There is no need to suspend content for immediate updates - // only during animations or longer gestures. - if (suspendContentFlag == DeferUpdateAndSuspendContent) - m_controller->suspendContent(); -} - -ViewportUpdateDeferrer::~ViewportUpdateDeferrer() -{ - if (--(m_controller->m_activeDeferrerCount)) - return; - - m_controller->resumeContent(); -} - PageViewportController::PageViewportController(WebKit::WebPageProxy* proxy, PageViewportControllerClient* client) : m_webPageProxy(proxy) , m_client(client) , m_allowsUserScaling(false) , m_minimumScaleToFit(1) - , m_activeDeferrerCount(0) , m_hasSuspendedContent(false) , m_hadUserInteraction(false) , m_effectiveScale(1) + , m_viewportPosIsLocked(false) + , m_effectiveScaleIsLocked(false) { // Initializing Viewport Raw Attributes to avoid random negative or infinity scale factors // if there is a race condition between the first layout and setting the viewport attributes for the first time. @@ -72,6 +56,7 @@ PageViewportController::PageViewportController(WebKit::WebPageProxy* proxy, Page m_rawAttributes.minimumScale = 1; m_rawAttributes.maximumScale = 1; m_rawAttributes.userScalable = m_allowsUserScaling; + m_rawAttributes.initiallyFitToViewport = true; ASSERT(m_client); m_client->setController(this); @@ -111,6 +96,9 @@ void PageViewportController::didCommitLoad() // Do not count the previous committed page contents as covered. m_lastFrameCoveredRect = FloatRect(); + // Do not continue to use the content size of the previous page. + m_contentsSize = IntSize(); + // Reset the position to the top, page/history scroll requests may override this before we re-enable rendering. applyPositionAfterRenderingContents(FloatPoint()); } @@ -157,7 +145,8 @@ void PageViewportController::pageTransitionViewportReady() { if (!m_rawAttributes.layoutSize.isEmpty()) { m_hadUserInteraction = false; - applyScaleAfterRenderingContents(innerBoundedViewportScale(toViewportScale(m_rawAttributes.initialScale))); + float initialScale = m_rawAttributes.initiallyFitToViewport ? m_minimumScaleToFit : m_rawAttributes.initialScale; + applyScaleAfterRenderingContents(innerBoundedViewportScale(toViewportScale(initialScale))); } // At this point we should already have received the first viewport arguments and the requested scroll @@ -170,7 +159,7 @@ void PageViewportController::pageTransitionViewportReady() void PageViewportController::pageDidRequestScroll(const IntPoint& cssPosition) { // Ignore the request if suspended. Can only happen due to delay in event delivery. - if (m_activeDeferrerCount) + if (m_hasSuspendedContent) return; FloatRect endVisibleContentRect(clampViewportToContents(cssPosition, m_effectiveScale), viewportSizeInContentsCoordinates()); @@ -289,3 +278,5 @@ void PageViewportController::updateMinimumScaleToFit() } } // namespace WebKit + +#endif |