Changeset 175827 in webkit


Ignore:
Timestamp:
Nov 10, 2014, 1:39:02 PM (11 years ago)
Author:
Simon Fraser
Message:

[iOS WK2] Scroll deceleration rate is wrong
https://bugs.webkit.org/show_bug.cgi?id=138574
rdar://problem/18715303

Reviewed by Benjamin Poulain.

The CSS Snap Points code incorrectly set the WKScrollView's deceleration rate,
overriding the custom value that UIWebScrollView sets.

Fix by having WKScrollView store the custom rate at init time, and
using that value in -scrollViewWillBeginDragging:.

  • UIProcess/API/Cocoa/WKWebView.mm:

(-[WKWebView scrollViewWillBeginDragging:]):

  • UIProcess/ios/WKScrollView.h:
  • UIProcess/ios/WKScrollView.mm:

(-[WKScrollView initWithFrame:]):

Location:
trunk/Source/WebKit2
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified trunk/Source/WebKit2/ChangeLog

    r175822 r175827  
     12014-11-10  Simon Fraser  <simon.fraser@apple.com>
     2
     3        [iOS WK2] Scroll deceleration rate is wrong
     4        https://bugs.webkit.org/show_bug.cgi?id=138574
     5        rdar://problem/18715303
     6
     7        Reviewed by Benjamin Poulain.
     8       
     9        The CSS Snap Points code incorrectly set the WKScrollView's deceleration rate,
     10        overriding the custom value that UIWebScrollView sets.
     11       
     12        Fix by having WKScrollView store the custom rate at init time, and
     13        using that value in -scrollViewWillBeginDragging:.
     14
     15        * UIProcess/API/Cocoa/WKWebView.mm:
     16        (-[WKWebView scrollViewWillBeginDragging:]):
     17        * UIProcess/ios/WKScrollView.h:
     18        * UIProcess/ios/WKScrollView.mm:
     19        (-[WKScrollView initWithFrame:]):
     20
    1212014-11-09  Ada Chan  <adachan@apple.com>
    222
  • TabularUnified trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm

    r175796 r175827  
    13081308    if (scrollView.panGestureRecognizer.state == UIGestureRecognizerStateBegan)
    13091309        [_contentView scrollViewWillStartPanOrPinchGesture];
     1310
    13101311    [_contentView willStartZoomOrScroll];
    13111312#if ENABLE(CSS_SCROLL_SNAP) && ENABLE(ASYNC_SCROLLING)
    13121313    // FIXME: We will want to detect whether snapping will occur before beginning to drag. See WebPageProxy::didCommitLayerTree.
    13131314    WebKit::RemoteScrollingCoordinatorProxy* coordinator = _page->scrollingCoordinatorProxy();
    1314     scrollView.decelerationRate = (coordinator && coordinator->shouldSetScrollViewDecelerationRateFast()) ? UIScrollViewDecelerationRateFast : UIScrollViewDecelerationRateNormal;
     1315    ASSERT(scrollView == _scrollView.get());
     1316    scrollView.decelerationRate = (coordinator && coordinator->shouldSetScrollViewDecelerationRateFast()) ? UIScrollViewDecelerationRateFast : [_scrollView preferredScrollDecelerationFactor];;
    13151317#endif
    13161318}
  • TabularUnified trunk/Source/WebKit2/UIProcess/ios/WKScrollView.h

    r170463 r175827  
    3333
    3434@property (nonatomic, assign) WKWebView <UIScrollViewDelegate> *internalDelegate;
     35@property (nonatomic, readonly) CGFloat preferredScrollDecelerationFactor;
    3536
    3637- (void)_setContentSizePreservingContentOffsetDuringRubberband:(CGSize)contentSize;
  • TabularUnified trunk/Source/WebKit2/UIProcess/ios/WKScrollView.mm

    r173710 r175827  
    112112}
    113113
     114- (id)initWithFrame:(CGRect)frame
     115{
     116    if (self = [super initWithFrame:frame]) {
     117        ASSERT([self verticalScrollDecelerationFactor] == [self horizontalScrollDecelerationFactor]);
     118        // FIXME: use UIWebPreferredScrollDecelerationFactor() from UIKit: rdar://problem/18931007.
     119        _preferredScrollDecelerationFactor = [self verticalScrollDecelerationFactor];
     120    }
     121   
     122    return self;
     123}
     124
    114125- (void)setInternalDelegate:(WKWebView <UIScrollViewDelegate> *)internalDelegate
    115126{
Note: See TracChangeset for help on using the changeset viewer.