Title: [183840] trunk/Source/WebCore
Revision
183840
Author
[email protected]
Date
2015-05-05 16:35:41 -0700 (Tue, 05 May 2015)

Log Message

iOS] Scroll snap points trigger reentrant layout
https://bugs.webkit.org/show_bug.cgi?id=144644
<rdar://problem/20366547>

Reviewed by Simon Fraser.

Covered by scroll-snap-mandatory.html test.

We had an iOS code path in 'appendChildSnapOffsets' that used offsetLeft and offsetTop. This code
was sometimes called during layout, which triggered a reentrant layout call, resulting in a debug
assertion.

* page/scrolling/AxisScrollSnapOffsets.cpp:
(WebCore::appendChildSnapOffsets): Remove iOS codepath.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (183839 => 183840)


--- trunk/Source/WebCore/ChangeLog	2015-05-05 23:22:39 UTC (rev 183839)
+++ trunk/Source/WebCore/ChangeLog	2015-05-05 23:35:41 UTC (rev 183840)
@@ -1,3 +1,20 @@
+2015-05-05  Brent Fulgham  <[email protected]>
+
+        iOS] Scroll snap points trigger reentrant layout
+        https://bugs.webkit.org/show_bug.cgi?id=144644
+        <rdar://problem/20366547>
+
+        Reviewed by Simon Fraser.
+
+        Covered by scroll-snap-mandatory.html test.
+
+        We had an iOS code path in 'appendChildSnapOffsets' that used offsetLeft and offsetTop. This code
+        was sometimes called during layout, which triggered a reentrant layout call, resulting in a debug
+        assertion.
+
+        * page/scrolling/AxisScrollSnapOffsets.cpp:
+        (WebCore::appendChildSnapOffsets): Remove iOS codepath.
+
 2015-05-05  Roger Fong  <[email protected]>
 
         Blurry media control icons on non retina displays.

Modified: trunk/Source/WebCore/page/scrolling/AxisScrollSnapOffsets.cpp (183839 => 183840)


--- trunk/Source/WebCore/page/scrolling/AxisScrollSnapOffsets.cpp	2015-05-05 23:22:39 UTC (rev 183839)
+++ trunk/Source/WebCore/page/scrolling/AxisScrollSnapOffsets.cpp	2015-05-05 23:35:41 UTC (rev 183840)
@@ -45,23 +45,15 @@
         if (RenderBox* box = child.renderBox()) {
             LayoutUnit viewWidth = box->width();
             LayoutUnit viewHeight = box->height();
-#if PLATFORM(IOS)
-            // FIXME: Dangerous to call offsetLeft and offsetTop because they call updateLayoutIgnorePendingStylesheets, which can invalidate the RenderBox pointer we are holding.
-            // FIXME: Investigate why using localToContainerPoint gives the wrong offsets for iOS main frame. Also, these offsets won't take transforms into account (make sure to test this!).
-            float left = child.offsetLeft();
-            float top = child.offsetTop();
-#else
-            // FIXME: Check that localToContainerPoint works with CSS rotations.
             FloatPoint position = box->localToContainerPoint(FloatPoint(), parent.renderBox());
-            float left = position.x();
-            float top = position.y();
-#endif
+            LayoutUnit left = position.x();
+            LayoutUnit top = position.y();
             for (auto& coordinate : box->style().scrollSnapCoordinates()) {
-                LayoutUnit lastPotentialSnapPositionX = LayoutUnit(left) + valueForLength(coordinate.width(), viewWidth);
+                LayoutUnit lastPotentialSnapPositionX = left + valueForLength(coordinate.width(), viewWidth);
                 if (shouldAddHorizontalChildOffsets && lastPotentialSnapPositionX > 0)
                     horizontalSnapOffsetSubsequence.append(lastPotentialSnapPositionX);
 
-                LayoutUnit lastPotentialSnapPositionY = LayoutUnit(top) + valueForLength(coordinate.height(), viewHeight);
+                LayoutUnit lastPotentialSnapPositionY = top + valueForLength(coordinate.height(), viewHeight);
                 if (shouldAddVerticalChildOffsets && lastPotentialSnapPositionY > 0)
                     verticalSnapOffsetSubsequence.append(lastPotentialSnapPositionY);
             }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to