Title: [102355] trunk/Source/WebCore
Revision
102355
Author
bda...@apple.com
Date
2011-12-08 11:19:05 -0800 (Thu, 08 Dec 2011)

Log Message

https://bugs.webkit.org/show_bug.cgi?id=73348
REGRESSION: Assertion when loading a page with a scrollable RenderLayer 
-and corresponding-
<rdar://problem/10518918>

Reviewed by Darin Adler.

The main problem here is that certain delegate calls into AppKit for overlay 
scrollbars can cause AppKit to call back into WebKit looking for more information. 
The assertion happens when WebKit tells AppKit that the scroll position has 
changed during a layout, and AppKit immediately asks WebKit to convert some 
coordinates, and WebKit asserts that you shouldn't do that while a layout is still 
happening. It's still possible for AppKit to call this delegate method while a 
layout is happening, and we should guard against that. This patch, however, does 
not do that.

This change instead addresses the reason this assertion started happening much 
more frequently recently, which is that it recently became true that 
notifyPositionChanged() can be called when the position has not changed. To fix 
the assertion AND the bug that that change was intended to fix, we can just make 
sure that either the position OR the scroll origin has changed before calling 
notifyPositionChanged(). 

* platform/mac/ScrollAnimatorMac.mm:
(WebCore::ScrollAnimatorMac::immediateScrollToPoint):

Call resetScrollOriginChanged() after the scroll instead of before so that we know 
whether or not to call notifyPositionChanged().
* platform/ScrollView.cpp:
(WebCore::ScrollView::updateScrollbars):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (102354 => 102355)


--- trunk/Source/WebCore/ChangeLog	2011-12-08 19:16:14 UTC (rev 102354)
+++ trunk/Source/WebCore/ChangeLog	2011-12-08 19:19:05 UTC (rev 102355)
@@ -1,3 +1,36 @@
+2011-12-08  Beth Dakin  <bda...@apple.com>
+
+        https://bugs.webkit.org/show_bug.cgi?id=73348
+        REGRESSION: Assertion when loading a page with a scrollable RenderLayer 
+        -and corresponding-
+        <rdar://problem/10518918>
+
+        Reviewed by Darin Adler.
+
+        The main problem here is that certain delegate calls into AppKit for overlay 
+        scrollbars can cause AppKit to call back into WebKit looking for more information. 
+        The assertion happens when WebKit tells AppKit that the scroll position has 
+        changed during a layout, and AppKit immediately asks WebKit to convert some 
+        coordinates, and WebKit asserts that you shouldn't do that while a layout is still 
+        happening. It's still possible for AppKit to call this delegate method while a 
+        layout is happening, and we should guard against that. This patch, however, does 
+        not do that.
+
+        This change instead addresses the reason this assertion started happening much 
+        more frequently recently, which is that it recently became true that 
+        notifyPositionChanged() can be called when the position has not changed. To fix 
+        the assertion AND the bug that that change was intended to fix, we can just make 
+        sure that either the position OR the scroll origin has changed before calling 
+        notifyPositionChanged(). 
+
+        * platform/mac/ScrollAnimatorMac.mm:
+        (WebCore::ScrollAnimatorMac::immediateScrollToPoint):
+
+        Call resetScrollOriginChanged() after the scroll instead of before so that we know 
+        whether or not to call notifyPositionChanged().
+        * platform/ScrollView.cpp:
+        (WebCore::ScrollView::updateScrollbars):
+
 2011-12-08  Kaustubh Atrawalkar  <kaust...@motorola.com>
 
         Fixing support for static conditional overloaded functions.

Modified: trunk/Source/WebCore/platform/ScrollView.cpp (102354 => 102355)


--- trunk/Source/WebCore/platform/ScrollView.cpp	2011-12-08 19:16:14 UTC (rev 102354)
+++ trunk/Source/WebCore/platform/ScrollView.cpp	2011-12-08 19:19:05 UTC (rev 102355)
@@ -591,8 +591,8 @@
 
     IntPoint adjustedScrollPosition = adjustScrollPositionWithinRange(IntPoint(desiredOffset));
     if (adjustedScrollPosition != scrollPosition() || scrollOriginChanged()) {
+        ScrollableArea::scrollToOffsetWithoutAnimation(adjustedScrollPosition + IntSize(scrollOrigin().x(), scrollOrigin().y()));
         resetScrollOriginChanged();
-        ScrollableArea::scrollToOffsetWithoutAnimation(adjustedScrollPosition + IntSize(scrollOrigin().x(), scrollOrigin().y()));
     }
 
     // Make sure the scrollbar offsets are up to date.

Modified: trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.mm (102354 => 102355)


--- trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.mm	2011-12-08 19:16:14 UTC (rev 102354)
+++ trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.mm	2011-12-08 19:19:05 UTC (rev 102355)
@@ -668,6 +668,10 @@
 {
     FloatPoint adjustedPosition = adjustScrollPositionIfNecessary(newPosition);
  
+    bool positionChanged = adjustedPosition.x() != m_currentPosX || adjustedPosition.y() != m_currentPosY;
+    if (!positionChanged && !scrollableArea()->scrollOriginChanged())
+        return;
+
     m_currentPosX = adjustedPosition.x();
     m_currentPosY = adjustedPosition.y();
     notifyPositionChanged();
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to