[iOS] When bouncing back from max pinch zoom scale, scaleChangeRate should be 0.
authorakling@apple.com <akling@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 30 May 2015 02:49:30 +0000 (02:49 +0000)
committerakling@apple.com <akling@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 30 May 2015 02:49:30 +0000 (02:49 +0000)
<https://webkit.org/b/145487>
<rdar://problem/20989389>

Reviewed by Benjamin Poulain.

Make sure we don't send WebCore some velocity data with non-zero scaleChangeRate
when we bounce back from being pinch-zoomed past the maximum scale.

This fixes an issue where the bounce-back animation would cause a burst of
unnecessary tile generation.

* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::adjustVelocityDataForBoundedScale):
(WebKit::WebPage::updateVisibleContentRects):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@185028 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit2/ChangeLog
Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm

index 9678eaf..5021ae3 100644 (file)
@@ -1,3 +1,21 @@
+2015-05-29  Andreas Kling  <akling@apple.com>
+
+        [iOS] When bouncing back from max pinch zoom scale, scaleChangeRate should be 0.
+        <https://webkit.org/b/145487>
+        <rdar://problem/20989389>
+
+        Reviewed by Benjamin Poulain.
+
+        Make sure we don't send WebCore some velocity data with non-zero scaleChangeRate
+        when we bounce back from being pinch-zoomed past the maximum scale.
+
+        This fixes an issue where the bounce-back animation would cause a burst of
+        unnecessary tile generation.
+
+        * WebProcess/WebPage/ios/WebPageIOS.mm:
+        (WebKit::adjustVelocityDataForBoundedScale):
+        (WebKit::WebPage::updateVisibleContentRects):
+
 2015-05-29  Jon Lee  <jonlee@apple.com>
 
         Fix preferences for wireless playback
index 8ed37db..5daa8bf 100644 (file)
@@ -2728,14 +2728,14 @@ void WebPage::applicationDidBecomeActive()
     [[NSNotificationCenter defaultCenter] postNotificationName:WebUIApplicationDidBecomeActiveNotification object:nil];
 }
 
-static inline void adjustVelocityDataForBoundedScale(double& horizontalVelocity, double& verticalVelocity, double& scaleChangeRate, double exposedRectScale, double boundedScale)
+static inline void adjustVelocityDataForBoundedScale(double& horizontalVelocity, double& verticalVelocity, double& scaleChangeRate, double exposedRectScale, double minimumScale, double maximumScale)
 {
     if (scaleChangeRate) {
         horizontalVelocity = 0;
         verticalVelocity = 0;
     }
 
-    if (exposedRectScale != boundedScale)
+    if (exposedRectScale >= maximumScale || exposedRectScale <= minimumScale)
         scaleChangeRate = 0;
 }
 
@@ -2814,7 +2814,7 @@ void WebPage::updateVisibleContentRects(const VisibleContentRectUpdateInfo& visi
     double horizontalVelocity = visibleContentRectUpdateInfo.horizontalVelocity();
     double verticalVelocity = visibleContentRectUpdateInfo.verticalVelocity();
     double scaleChangeRate = visibleContentRectUpdateInfo.scaleChangeRate();
-    adjustVelocityDataForBoundedScale(horizontalVelocity, verticalVelocity, scaleChangeRate, visibleContentRectUpdateInfo.scale(), boundedScale);
+    adjustVelocityDataForBoundedScale(horizontalVelocity, verticalVelocity, scaleChangeRate, visibleContentRectUpdateInfo.scale(), m_viewportConfiguration.minimumScale(), m_viewportConfiguration.maximumScale());
 
     frameView.setScrollVelocity(horizontalVelocity, verticalVelocity, scaleChangeRate, visibleContentRectUpdateInfo.timestamp());