Title: [109386] trunk/Source/WebCore
Revision
109386
Author
[email protected]
Date
2012-03-01 12:04:09 -0800 (Thu, 01 Mar 2012)

Log Message

Glitchy scrolling on pages where the scroll layer needs to be updated on the main thread
https://bugs.webkit.org/show_bug.cgi?id=80038
<rdar://problem/10933831>

Reviewed by Simon Fraser.

When we need to update the scroll layer position on the main thread, we need to cache the
scroll position we sent to the main thread and assume that that's the correct scroll position.

* page/scrolling/mac/ScrollingTreeNodeMac.h:
(ScrollingTreeNodeMac):
* page/scrolling/mac/ScrollingTreeNodeMac.mm:
(WebCore::ScrollingTreeNodeMac::update):
(WebCore::ScrollingTreeNodeMac::setScrollPosition):
(WebCore::ScrollingTreeNodeMac::scrollPosition):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (109385 => 109386)


--- trunk/Source/WebCore/ChangeLog	2012-03-01 20:01:46 UTC (rev 109385)
+++ trunk/Source/WebCore/ChangeLog	2012-03-01 20:04:09 UTC (rev 109386)
@@ -1,3 +1,21 @@
+2012-03-01  Anders Carlsson  <[email protected]>
+
+        Glitchy scrolling on pages where the scroll layer needs to be updated on the main thread
+        https://bugs.webkit.org/show_bug.cgi?id=80038
+        <rdar://problem/10933831>
+
+        Reviewed by Simon Fraser.
+
+        When we need to update the scroll layer position on the main thread, we need to cache the
+        scroll position we sent to the main thread and assume that that's the correct scroll position.
+
+        * page/scrolling/mac/ScrollingTreeNodeMac.h:
+        (ScrollingTreeNodeMac):
+        * page/scrolling/mac/ScrollingTreeNodeMac.mm:
+        (WebCore::ScrollingTreeNodeMac::update):
+        (WebCore::ScrollingTreeNodeMac::setScrollPosition):
+        (WebCore::ScrollingTreeNodeMac::scrollPosition):
+
 2012-03-01  Julien Chaffraix  <[email protected]>
 
         Unreviewed, rolling out r109367.

Modified: trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeNodeMac.h (109385 => 109386)


--- trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeNodeMac.h	2012-03-01 20:01:46 UTC (rev 109385)
+++ trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeNodeMac.h	2012-03-01 20:04:09 UTC (rev 109386)
@@ -76,6 +76,7 @@
     RetainPtr<CFRunLoopTimerRef> m_snapRubberbandTimer;
 
     RetainPtr<CALayer> m_scrollLayer;
+    IntPoint m_probableMainThreadScrollPosition;
 };
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeNodeMac.mm (109385 => 109386)


--- trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeNodeMac.mm	2012-03-01 20:01:46 UTC (rev 109385)
+++ trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeNodeMac.mm	2012-03-01 20:04:09 UTC (rev 109386)
@@ -60,6 +60,13 @@
 
     if (state->changedProperties() & (ScrollingTreeState::ScrollLayer | ScrollingTreeState::ContentsSize | ScrollingTreeState::ViewportRect))
         updateMainFramePinState(scrollPosition());
+
+    if ((state->changedProperties() & ScrollingTreeState::ShouldUpdateScrollLayerPositionOnMainThread) && shouldUpdateScrollLayerPositionOnMainThread()) {
+        // We're transitioning to the slow "update scroll layer position on the main thread" mode.
+        // Initialize the probable main thread scroll position with the current scroll layer position.
+        CGPoint scrollLayerPosition = m_scrollLayer.get().position;
+        m_probableMainThreadScrollPosition = IntPoint(-scrollLayerPosition.x, -scrollLayerPosition.y);
+    }
 }
 
 void ScrollingTreeNodeMac::handleWheelEvent(const PlatformWheelEvent& wheelEvent)
@@ -73,6 +80,7 @@
     updateMainFramePinState(scrollPosition);
 
     if (shouldUpdateScrollLayerPositionOnMainThread()) {
+        m_probableMainThreadScrollPosition = scrollPosition;
         scrollingTree()->updateMainFrameScrollPositionAndScrollLayerPosition(scrollPosition);
         return;
     }
@@ -215,6 +223,9 @@
 
 IntPoint ScrollingTreeNodeMac::scrollPosition() const
 {
+    if (shouldUpdateScrollLayerPositionOnMainThread())
+        return m_probableMainThreadScrollPosition;
+
     CGPoint scrollLayerPosition = m_scrollLayer.get().position;
     return IntPoint(-scrollLayerPosition.x, -scrollLayerPosition.y);
 }
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to