Cannot change WKWebView scrollView deceleration rate
authorwenson_hsieh@apple.com <wenson_hsieh@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 17 Aug 2015 20:39:04 +0000 (20:39 +0000)
committerwenson_hsieh@apple.com <wenson_hsieh@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 17 Aug 2015 20:39:04 +0000 (20:39 +0000)
https://bugs.webkit.org/show_bug.cgi?id=148086
<rdar://problem/21893685>

Reviewed by Simon Fraser.

Updates the preferred scroll deceleration factor when the scrollView's decelerationRate is explicitly set by the
user, so when snap scrolling is inactive and [WKWebView scrollViewWillBeginDragging] sets its scrollView's
decelerationRate to the preferred decelerationRate, it will be set to the updated value.

* UIProcess/ios/WKScrollView.mm:
(-[WKScrollView setDecelerationRate:]): Overrides setDecelerationRate to update _preferredScrollDecelerationFactor.

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

Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/ios/WKScrollView.mm

index 57c2b358074438ff3c9f8885ba1e11ebec0bf57c..c4acc7f389d48348110ad516cc0f25be28d0c32d 100644 (file)
@@ -1,3 +1,18 @@
+2015-08-17  Wenson Hsieh  <wenson_hsieh@apple.com>
+
+        Cannot change WKWebView scrollView deceleration rate
+        https://bugs.webkit.org/show_bug.cgi?id=148086
+        <rdar://problem/21893685>
+
+        Reviewed by Simon Fraser.
+
+        Updates the preferred scroll deceleration factor when the scrollView's decelerationRate is explicitly set by the
+        user, so when snap scrolling is inactive and [WKWebView scrollViewWillBeginDragging] sets its scrollView's
+        decelerationRate to the preferred decelerationRate, it will be set to the updated value.
+
+        * UIProcess/ios/WKScrollView.mm:
+        (-[WKScrollView setDecelerationRate:]): Overrides setDecelerationRate to update _preferredScrollDecelerationFactor.
+
 2015-08-17  Timothy Horton  <timothy_horton@apple.com>
 
         Adopt shrink-wrapping for TextIndicators on Mac
 2015-08-17  Timothy Horton  <timothy_horton@apple.com>
 
         Adopt shrink-wrapping for TextIndicators on Mac
index 639894b25c1d15f8f3bdaa768577a93bac03c561..6598bd1a09258e4b7154181f78ced67ae11e8817 100644 (file)
@@ -267,6 +267,12 @@ static inline bool valuesAreWithinOnePixel(CGFloat a, CGFloat b)
         [self _restoreContentOffsetWithRubberbandAmount:rubberbandAmount];
 }
 
         [self _restoreContentOffsetWithRubberbandAmount:rubberbandAmount];
 }
 
+- (void)setDecelerationRate:(CGFloat)decelerationRate
+{
+    [super setDecelerationRate:decelerationRate];
+    _preferredScrollDecelerationFactor = decelerationRate;
+}
+
 @end
 
 #endif // PLATFORM(IOS)
 @end
 
 #endif // PLATFORM(IOS)