Title: [189773] trunk/Source/WebKit2
Revision
189773
Author
wenson_hs...@apple.com
Date
2015-09-14 19:42:39 -0700 (Mon, 14 Sep 2015)

Log Message

WKWebView scroll deceleration rate is not being set properly
https://bugs.webkit.org/show_bug.cgi?id=149145
<rdar://problem/22064071>

Reviewed by Simon Fraser.

We are not currently setting the web view's deceleration rate to the correct preferred value because we
are setting the decelerationRate property of the scrollView, which snaps input values to the closer of
two predefined UIKit constants, UIScrollViewDecelerationRateFast and UIScrollViewDecelerationRateNormal.
To fix this, we directly set the horizontal and vertical scroll deceleration factors to the preferred
value.

* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView scrollViewWillBeginDragging:]): Directly set the scroll view's deceleration factor without
        going through the decelerationRate property.

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (189772 => 189773)


--- trunk/Source/WebKit2/ChangeLog	2015-09-15 02:28:29 UTC (rev 189772)
+++ trunk/Source/WebKit2/ChangeLog	2015-09-15 02:42:39 UTC (rev 189773)
@@ -1,3 +1,21 @@
+2015-09-14  Wenson Hsieh  <wenson_hs...@apple.com>
+
+        WKWebView scroll deceleration rate is not being set properly
+        https://bugs.webkit.org/show_bug.cgi?id=149145
+        <rdar://problem/22064071>
+
+        Reviewed by Simon Fraser.
+
+        We are not currently setting the web view's deceleration rate to the correct preferred value because we
+        are setting the decelerationRate property of the scrollView, which snaps input values to the closer of
+        two predefined UIKit constants, UIScrollViewDecelerationRateFast and UIScrollViewDecelerationRateNormal.
+        To fix this, we directly set the horizontal and vertical scroll deceleration factors to the preferred
+        value.
+
+        * UIProcess/API/Cocoa/WKWebView.mm: 
+        (-[WKWebView scrollViewWillBeginDragging:]): Directly set the scroll view's deceleration factor without
+                going through the decelerationRate property.
+
 2015-09-14  Dan Bernstein  <m...@apple.com>
 
         Consolidate touch event code dealing with force.

Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm (189772 => 189773)


--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm	2015-09-15 02:28:29 UTC (rev 189772)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm	2015-09-15 02:42:39 UTC (rev 189773)
@@ -1480,7 +1480,9 @@
     // FIXME: We will want to detect whether snapping will occur before beginning to drag. See WebPageProxy::didCommitLayerTree.
     WebKit::RemoteScrollingCoordinatorProxy* coordinator = _page->scrollingCoordinatorProxy();
     ASSERT(scrollView == _scrollView.get());
-    scrollView.decelerationRate = (coordinator && coordinator->shouldSetScrollViewDecelerationRateFast()) ? UIScrollViewDecelerationRateFast : [_scrollView preferredScrollDecelerationFactor];
+    CGFloat scrollDecelerationFactor = (coordinator && coordinator->shouldSetScrollViewDecelerationRateFast()) ? UIScrollViewDecelerationRateFast : [_scrollView preferredScrollDecelerationFactor];
+    scrollView.horizontalScrollDecelerationFactor = scrollDecelerationFactor;
+    scrollView.verticalScrollDecelerationFactor = scrollDecelerationFactor;
 #endif
 }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to