Title: [90568] trunk
Revision
90568
Author
jchaffr...@webkit.org
Date
2011-07-07 10:05:25 -0700 (Thu, 07 Jul 2011)

Log Message

Patch by Julien Chaffraix <jchaffr...@webkit.org> on 2011-07-07
Reviewed by David Hyatt.

Partial layout when a flex-box has visibility: collapse
https://bugs.webkit.org/show_bug.cgi?id=63776

Source/WebCore:

Tests: fast/flexbox/crash-button-input-autofocus.html
       fast/flexbox/crash-button-keygen.html
       fast/flexbox/crash-button-relayout.html

The issue is that FlexBoxIterator would skip any child if it has visibility: collapsed.
However if one of the child is anonymous, it may wrap some other child that would be skipped.
Now FlexBoxIterator is called during the layout phase and thus some nodes would not relayouted
as expected.

* rendering/RenderDeprecatedFlexibleBox.cpp:
(WebCore::FlexBoxIterator::next): When iterating, don't skip anonymous content as there may
be real content hiding below.

LayoutTests:

Those tests checks some variation of the same underlying issue.

* fast/flexbox/crash-button-input-autofocus-expected.txt: Added.
* fast/flexbox/crash-button-input-autofocus.html: Added.
* fast/flexbox/crash-button-keygen-expected.txt: Added.
* fast/flexbox/crash-button-keygen.html: Added.
* fast/flexbox/crash-button-relayout-expected.txt: Added.
* fast/flexbox/crash-button-relayout.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (90567 => 90568)


--- trunk/LayoutTests/ChangeLog	2011-07-07 16:53:51 UTC (rev 90567)
+++ trunk/LayoutTests/ChangeLog	2011-07-07 17:05:25 UTC (rev 90568)
@@ -1,3 +1,19 @@
+2011-07-07  Julien Chaffraix  <jchaffr...@webkit.org>
+
+        Reviewed by David Hyatt.
+
+        Partial layout when a flex-box has visibility: collapse
+        https://bugs.webkit.org/show_bug.cgi?id=63776
+
+        Those tests checks some variation of the same underlying issue.
+
+        * fast/flexbox/crash-button-input-autofocus-expected.txt: Added.
+        * fast/flexbox/crash-button-input-autofocus.html: Added.
+        * fast/flexbox/crash-button-keygen-expected.txt: Added.
+        * fast/flexbox/crash-button-keygen.html: Added.
+        * fast/flexbox/crash-button-relayout-expected.txt: Added.
+        * fast/flexbox/crash-button-relayout.html: Added.
+
 2011-07-07  Vsevolod Vlasov  <vse...@chromium.org>
 
         Web Inspector: URL links in styles open new tab instead of showing resources panel.

Added: trunk/LayoutTests/fast/flexbox/crash-button-input-autofocus-expected.txt (0 => 90568)


--- trunk/LayoutTests/fast/flexbox/crash-button-input-autofocus-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/flexbox/crash-button-input-autofocus-expected.txt	2011-07-07 17:05:25 UTC (rev 90568)
@@ -0,0 +1,3 @@
+Test for bug 63776: Partial layout when a flex-box has visibility: collapse
+
+This test PASSES if it does not CRASH.

Added: trunk/LayoutTests/fast/flexbox/crash-button-input-autofocus.html (0 => 90568)


--- trunk/LayoutTests/fast/flexbox/crash-button-input-autofocus.html	                        (rev 0)
+++ trunk/LayoutTests/fast/flexbox/crash-button-input-autofocus.html	2011-07-07 17:05:25 UTC (rev 90568)
@@ -0,0 +1,14 @@
+<html>
+<body>
+<p style="visibility: collapse;"><button><input autofocus><input id="test"></input></button></p>
+<script>
+if (window.layoutTestController)
+    layoutTestController.dumpAsText();
+document.body.offsetTop;
+document.getElementById('test').parentNode.removeChild(document.getElementById('test'));
+document.body.offsetTop;
+</script>
+<p>Test for bug <a href="" Partial layout when a flex-box has visibility: collapse</p>
+<p>This test PASSES if it does not CRASH.</p>
+</body>
+</html>
Property changes on: trunk/LayoutTests/fast/flexbox/crash-button-input-autofocus.html
___________________________________________________________________

Added: svn:executable

Added: trunk/LayoutTests/fast/flexbox/crash-button-keygen-expected.txt (0 => 90568)


--- trunk/LayoutTests/fast/flexbox/crash-button-keygen-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/flexbox/crash-button-keygen-expected.txt	2011-07-07 17:05:25 UTC (rev 90568)
@@ -0,0 +1,3 @@
+Test for bug 63776: Partial layout when a flex-box has visibility: collapse
+
+This test PASSES if it does not CRASH.

Added: trunk/LayoutTests/fast/flexbox/crash-button-keygen.html (0 => 90568)


--- trunk/LayoutTests/fast/flexbox/crash-button-keygen.html	                        (rev 0)
+++ trunk/LayoutTests/fast/flexbox/crash-button-keygen.html	2011-07-07 17:05:25 UTC (rev 90568)
@@ -0,0 +1,14 @@
+<html>
+<body>
+<p style="visibility: collapse;"><button><keygen autofocus><input id="test"></keygen></button></p>
+<script>
+if (window.layoutTestController)
+    layoutTestController.dumpAsText();
+document.body.offsetTop;
+document.getElementById('test').parentNode.removeChild(document.getElementById('test'));
+document.body.offsetTop;
+</script>
+<p>Test for bug <a href="" Partial layout when a flex-box has visibility: collapse</p>
+<p>This test PASSES if it does not CRASH.</p>
+</body>
+</html>
Property changes on: trunk/LayoutTests/fast/flexbox/crash-button-keygen.html
___________________________________________________________________

Added: svn:executable

Added: trunk/LayoutTests/fast/flexbox/crash-button-relayout-expected.txt (0 => 90568)


--- trunk/LayoutTests/fast/flexbox/crash-button-relayout-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/flexbox/crash-button-relayout-expected.txt	2011-07-07 17:05:25 UTC (rev 90568)
@@ -0,0 +1,3 @@
+Test for bug 63776: Partial layout when a flex-box has visibility: collapse
+
+This test PASSES if it does not CRASH.

Added: trunk/LayoutTests/fast/flexbox/crash-button-relayout.html (0 => 90568)


--- trunk/LayoutTests/fast/flexbox/crash-button-relayout.html	                        (rev 0)
+++ trunk/LayoutTests/fast/flexbox/crash-button-relayout.html	2011-07-07 17:05:25 UTC (rev 90568)
@@ -0,0 +1,14 @@
+<html>
+<body>
+<p style="visibility: collapse;"><button><input><script>document.getElementsByTagName('input')[0].offsetTop;</script><input id="test"></input></button></p>
+<script>
+if (window.layoutTestController)
+    layoutTestController.dumpAsText();
+document.body.offsetTop;
+document.getElementById('test').parentNode.removeChild(document.getElementById('test'));
+document.body.offsetTop;
+</script>
+<p>Test for bug <a href="" Partial layout when a flex-box has visibility: collapse</p>
+<p>This test PASSES if it does not CRASH.</p>
+</body>
+</html>
Property changes on: trunk/LayoutTests/fast/flexbox/crash-button-relayout.html
___________________________________________________________________

Added: svn:executable

Modified: trunk/Source/WebCore/ChangeLog (90567 => 90568)


--- trunk/Source/WebCore/ChangeLog	2011-07-07 16:53:51 UTC (rev 90567)
+++ trunk/Source/WebCore/ChangeLog	2011-07-07 17:05:25 UTC (rev 90568)
@@ -1,3 +1,23 @@
+2011-07-07  Julien Chaffraix  <jchaffr...@webkit.org>
+
+        Reviewed by David Hyatt.
+
+        Partial layout when a flex-box has visibility: collapse
+        https://bugs.webkit.org/show_bug.cgi?id=63776
+
+        Tests: fast/flexbox/crash-button-input-autofocus.html
+               fast/flexbox/crash-button-keygen.html
+               fast/flexbox/crash-button-relayout.html
+
+        The issue is that FlexBoxIterator would skip any child if it has visibility: collapsed.
+        However if one of the child is anonymous, it may wrap some other child that would be skipped.
+        Now FlexBoxIterator is called during the layout phase and thus some nodes would not relayouted
+        as expected.
+
+        * rendering/RenderDeprecatedFlexibleBox.cpp:
+        (WebCore::FlexBoxIterator::next): When iterating, don't skip anonymous content as there may
+        be real content hiding below.
+
 2011-07-07  Vsevolod Vlasov  <vse...@chromium.org>
 
         Web Inspector: URL links in styles open new tab instead of showing resources panel.

Modified: trunk/Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp (90567 => 90568)


--- trunk/Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp	2011-07-07 16:53:51 UTC (rev 90567)
+++ trunk/Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp	2011-07-07 17:05:25 UTC (rev 90568)
@@ -89,8 +89,8 @@
                 m_currentChild = m_forward ? m_currentChild->nextSiblingBox() : m_currentChild->previousSiblingBox();
             if (m_currentChild && m_currentChild->style()->boxOrdinalGroup() > m_lastOrdinal)
                 m_lastOrdinal = m_currentChild->style()->boxOrdinalGroup();
-        } while (!m_currentChild || m_currentChild->style()->boxOrdinalGroup() != m_currentOrdinal
-                 || m_currentChild->style()->visibility() == COLLAPSE);
+        } while (!m_currentChild || (!m_currentChild->isAnonymous()
+                 && (m_currentChild->style()->boxOrdinalGroup() != m_currentOrdinal || m_currentChild->style()->visibility() == COLLAPSE)));
         return m_currentChild;
     }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to