[iOS WK2] flickery scrolling with overflow-scrolling:touch
authorsimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 28 Apr 2014 17:28:11 +0000 (17:28 +0000)
committersimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 28 Apr 2014 17:28:11 +0000 (17:28 +0000)
https://bugs.webkit.org/show_bug.cgi?id=132150

Source/WebCore:

Reviewed by Tim Horton.

Fix typo in a comment.

* page/scrolling/AsyncScrollingCoordinator.cpp:
(WebCore::AsyncScrollingCoordinator::scheduleUpdateScrollPositionAfterAsyncScroll):

Source/WebKit2:
<rdar://problem/16683006>

Reviewed by Tim Horton.

Maintain a flag that tells us if the user is interacting
with the UIScrollView, and while set, don't clobber the contentOffset
via scrolling tree updates.

* UIProcess/Scrolling/ios/ScrollingTreeOverflowScrollingNodeIOS.mm:
(-[WKOverflowScrollViewDelegate initWithScrollingTreeNode:WebKit::]):
(-[WKOverflowScrollViewDelegate scrollViewWillBeginDragging:]):
(-[WKOverflowScrollViewDelegate scrollViewDidEndDragging:willDecelerate:]):
(-[WKOverflowScrollViewDelegate scrollViewDidEndDecelerating:]): We need this one,
not scrollViewDidEndScrollingAnimation:, to detect the end of decleration.
(WebKit::ScrollingTreeOverflowScrollingNodeIOS::updateAfterChildren):
(-[WKOverflowScrollViewDelegate scrollViewDidEndScrollingAnimation:]): Deleted.

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

Source/WebCore/ChangeLog
Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp
Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/Scrolling/ios/ScrollingTreeOverflowScrollingNodeIOS.mm

index 9397dca..60b5949 100644 (file)
@@ -1,3 +1,15 @@
+2014-04-24  Simon Fraser  <simon.fraser@apple.com>
+
+        [iOS WK2] flickery scrolling with overflow-scrolling:touch
+        https://bugs.webkit.org/show_bug.cgi?id=132150
+
+        Reviewed by Tim Horton.
+
+        Fix typo in a comment.
+
+        * page/scrolling/AsyncScrollingCoordinator.cpp:
+        (WebCore::AsyncScrollingCoordinator::scheduleUpdateScrollPositionAfterAsyncScroll):
+
 2014-04-28  Martin Robinson  <mrobinson@igalia.com>
 
         [GTK] Builtin cursors do not properly handle transparency
index 9e7a9c9..fc4964c 100644 (file)
@@ -167,7 +167,7 @@ void AsyncScrollingCoordinator::scheduleUpdateScrollPositionAfterAsyncScroll(Scr
             return;
         }
     
-        // If the parameters don't match what was previosly scheduled, dispatch immediately.
+        // If the parameters don't match what was previously scheduled, dispatch immediately.
         m_updateNodeScrollPositionTimer.stop();
         updateScrollPositionAfterAsyncScroll(m_scheduledScrollUpdate.nodeID, m_scheduledScrollUpdate.scrollPosition, m_scheduledScrollUpdate.isProgrammaticScroll, m_scheduledScrollUpdate.updateLayerPositionAction);
         updateScrollPositionAfterAsyncScroll(nodeID, scrollPosition, programmaticScroll, scrollingLayerPositionAction);
index 00c9b0b..9db7836 100644 (file)
@@ -1,3 +1,24 @@
+2014-04-24  Simon Fraser  <simon.fraser@apple.com>
+
+        [iOS WK2] flickery scrolling with overflow-scrolling:touch
+        https://bugs.webkit.org/show_bug.cgi?id=132150
+        <rdar://problem/16683006>
+
+        Reviewed by Tim Horton.
+        
+        Maintain a flag that tells us if the user is interacting
+        with the UIScrollView, and while set, don't clobber the contentOffset
+        via scrolling tree updates.
+
+        * UIProcess/Scrolling/ios/ScrollingTreeOverflowScrollingNodeIOS.mm:
+        (-[WKOverflowScrollViewDelegate initWithScrollingTreeNode:WebKit::]):
+        (-[WKOverflowScrollViewDelegate scrollViewWillBeginDragging:]):
+        (-[WKOverflowScrollViewDelegate scrollViewDidEndDragging:willDecelerate:]):
+        (-[WKOverflowScrollViewDelegate scrollViewDidEndDecelerating:]): We need this one,
+        not scrollViewDidEndScrollingAnimation:, to detect the end of decleration.
+        (WebKit::ScrollingTreeOverflowScrollingNodeIOS::updateAfterChildren):
+        (-[WKOverflowScrollViewDelegate scrollViewDidEndScrollingAnimation:]): Deleted.
+
 2014-04-28  Krzysztof Wolanski  <k.wolanski@samsung.com>
 
         [X11] Add missing case for mime type application/x-webkit-test-netscape
index 42a4a7b..9049a3e 100644 (file)
@@ -39,18 +39,20 @@ using namespace WebCore;
 @interface WKOverflowScrollViewDelegate : NSObject <UIScrollViewDelegate> {
     WebKit::ScrollingTreeOverflowScrollingNodeIOS* _scrollingTreeNode;
 }
+
+@property (nonatomic, getter=_isInUserInteraction) BOOL inUserInteraction;
+
 - (instancetype)initWithScrollingTreeNode:(WebKit::ScrollingTreeOverflowScrollingNodeIOS*)node;
 
 @end
 
-
 @implementation WKOverflowScrollViewDelegate
 
 - (instancetype)initWithScrollingTreeNode:(WebKit::ScrollingTreeOverflowScrollingNodeIOS*)node
 {
-    if ((self = [super init])) {
+    if ((self = [super init]))
         _scrollingTreeNode = node;
-    }
+
     return self;
 }
 
@@ -61,14 +63,18 @@ using namespace WebCore;
 
 - (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView
 {
+    _inUserInteraction = YES;
 }
 
-- (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate
+- (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)willDecelerate
 {
+    if (!willDecelerate)
+        _inUserInteraction = NO;
 }
 
-- (void)scrollViewDidEndScrollingAnimation:(UIScrollView *)scrollView
+- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView
 {
+    _inUserInteraction = NO;
 }
 
 @end
@@ -132,7 +138,7 @@ void ScrollingTreeOverflowScrollingNodeIOS::updateAfterChildren(const ScrollingS
         if (scrollingStateNode.hasChangedProperty(ScrollingStateScrollingNode::TotalContentsSize))
             scrollView.contentSize = scrollingStateNode.totalContentsSize();
 
-        if (scrollingStateNode.hasChangedProperty(ScrollingStateScrollingNode::ScrollPosition))
+        if (scrollingStateNode.hasChangedProperty(ScrollingStateScrollingNode::ScrollPosition) && ![m_scrollViewDelegate _isInUserInteraction])
             scrollView.contentOffset = scrollingStateNode.scrollPosition();
 
         END_BLOCK_OBJC_EXCEPTIONS