Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(300)

Unified Diff: Source/WebKit/chromium/src/WebViewImpl.cpp

Issue 12330082: Merge 143355 (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1410/
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/WebKit/chromium/src/WebViewImpl.h ('k') | Source/WebKit/chromium/tests/WebFrameTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/WebKit/chromium/src/WebViewImpl.cpp
===================================================================
--- Source/WebKit/chromium/src/WebViewImpl.cpp (revision 143777)
+++ Source/WebKit/chromium/src/WebViewImpl.cpp (working copy)
@@ -400,8 +400,11 @@
, m_ignoreViewportTagMaximumScale(false)
, m_pageScaleFactorIsSet(false)
, m_savedPageScaleFactor(0)
- , m_doubleTapZoomInEffect(false)
- , m_shouldUseDoubleTapTimeZero(false)
+ , m_doubleTapZoomPageScaleFactor(0)
+ , m_doubleTapZoomPending(false)
+ , m_enableFakeDoubleTapAnimationForTesting(false)
+ , m_fakeDoubleTapPageScaleFactor(0)
+ , m_fakeDoubleTapUseAnchor(false)
, m_contextMenuAllowed(false)
, m_doingDragAndDrop(false)
, m_ignoreInputEvents(false)
@@ -857,20 +860,35 @@
scheduleAnimation();
}
-void WebViewImpl::startPageScaleAnimation(const IntPoint& targetPosition, bool useAnchor, float newScale, double durationInSeconds)
+bool WebViewImpl::startPageScaleAnimation(const IntPoint& targetPosition, bool useAnchor, float newScale, double durationInSeconds)
{
WebPoint clampedPoint = targetPosition;
- if (!useAnchor)
+ if (!useAnchor) {
clampedPoint = clampOffsetAtScale(targetPosition, newScale);
- if ((!durationInSeconds && !useAnchor) || m_shouldUseDoubleTapTimeZero) {
- setPageScaleFactor(newScale, clampedPoint);
- return;
+ if (!durationInSeconds) {
+ setPageScaleFactor(newScale, clampedPoint);
+ return false;
+ }
}
- if (!m_layerTreeView)
- return;
+ if (useAnchor && newScale == pageScaleFactor())
+ return false;
- m_layerTreeView->startPageScaleAnimation(targetPosition, useAnchor, newScale, durationInSeconds);
+ if (m_enableFakeDoubleTapAnimationForTesting) {
+ m_fakeDoubleTapTargetPosition = targetPosition;
+ m_fakeDoubleTapUseAnchor = useAnchor;
+ m_fakeDoubleTapPageScaleFactor = newScale;
+ } else {
+ if (!m_layerTreeView)
+ return false;
+ m_layerTreeView->startPageScaleAnimation(targetPosition, useAnchor, newScale, durationInSeconds);
+ }
+ return true;
}
+
+void WebViewImpl::enableFakeDoubleTapAnimationForTesting(bool enable)
+{
+ m_enableFakeDoubleTapAnimationForTesting = enable;
+}
#endif
WebViewBenchmarkSupport* WebViewImpl::benchmarkSupport()
@@ -1154,11 +1172,6 @@
return WebRect(newX, source.y, newWidth, source.height);
}
-void WebViewImpl::shouldUseAnimateDoubleTapTimeZeroForTesting(bool setToZero)
-{
- m_shouldUseDoubleTapTimeZero = setToZero;
-}
-
void WebViewImpl::computeScaleAndScrollForHitRect(const WebRect& hitRect, AutoZoomType zoomType, float& scale, WebPoint& scroll, bool& isAnchor)
{
scale = pageScaleFactor();
@@ -1216,17 +1229,15 @@
scaleUnchanged = fabs(pageScaleFactor() - scale) < minScaleDifference;
}
- if (zoomType == DoubleTap && (rect.isEmpty() || scaleUnchanged || m_doubleTapZoomInEffect)) {
+ bool stillAtPreviousDoubleTapScale = (pageScaleFactor() == m_doubleTapZoomPageScaleFactor
+ && m_doubleTapZoomPageScaleFactor != m_minimumPageScaleFactor)
+ || m_doubleTapZoomPending;
+ if (zoomType == DoubleTap && (rect.isEmpty() || scaleUnchanged || stillAtPreviousDoubleTapScale)) {
// Zoom out to minimum scale.
scale = m_minimumPageScaleFactor;
scroll = WebPoint(hitRect.x, hitRect.y);
isAnchor = true;
- m_doubleTapZoomInEffect = false;
} else {
- if (zoomType == DoubleTap && scale != m_minimumPageScaleFactor)
- m_doubleTapZoomInEffect = true;
- else
- m_doubleTapZoomInEffect = false;
// FIXME: If this is being called for auto zoom during find in page,
// then if the user manually zooms in it'd be nice to preserve the
// relative increase in zoom they caused (if they zoom out then it's ok
@@ -1345,8 +1356,13 @@
computeScaleAndScrollForHitRect(WebRect(webPoint.x, webPoint.y, 0, 0), zoomType, scale, scroll, isAnchor);
bool isDoubleTap = (zoomType == DoubleTap);
- double durationInSeconds = (isDoubleTap && !m_shouldUseDoubleTapTimeZero) ? doubleTapZoomAnimationDurationInSeconds : 0;
- startPageScaleAnimation(scroll, isAnchor, scale, durationInSeconds);
+ double durationInSeconds = isDoubleTap ? doubleTapZoomAnimationDurationInSeconds : 0;
+ bool isAnimating = startPageScaleAnimation(scroll, isAnchor, scale, durationInSeconds);
+
+ if (isDoubleTap && isAnimating) {
+ m_doubleTapZoomPageScaleFactor = scale;
+ m_doubleTapZoomPending = true;
+ }
#endif
}
@@ -3766,10 +3782,8 @@
m_newNavigationLoader = 0;
#endif
m_observedNewNavigation = false;
- if (*isNewNavigation && !isNavigationWithinPage) {
+ if (*isNewNavigation && !isNavigationWithinPage)
m_pageScaleFactorIsSet = false;
- m_doubleTapZoomInEffect = false;
- }
// Make sure link highlight from previous page is cleared.
m_linkHighlight.clear();
@@ -4216,7 +4230,7 @@
}
setPageScaleFactor(pageScaleFactor() * pageScaleDelta, scrollPoint);
- m_doubleTapZoomInEffect = false;
+ m_doubleTapZoomPending = false;
}
}
« no previous file with comments | « Source/WebKit/chromium/src/WebViewImpl.h ('k') | Source/WebKit/chromium/tests/WebFrameTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698