Title: [98033] trunk
Revision
98033
Author
[email protected]
Date
2011-10-20 15:55:49 -0700 (Thu, 20 Oct 2011)

Log Message

RenderDeprecatedFlexibleBox does not call its children's layout method
https://bugs.webkit.org/show_bug.cgi?id=64842

Reviewed by David Hyatt.

Source/WebCore:

Tests: fast/flexbox/021-vertical.html
       fast/flexbox/crash-flexbox-no-layout-child.html

The FlexBoxIterator would skip any child with visibility: collapsed. However those child
would need layout but their layout() function would never be called.

This change refactors the way flexible box handles visibility: collapsed child and mark sure
their layout() function is called but makes sure that they don't participate in the flex box
dimensions.

* rendering/RenderDeprecatedFlexibleBox.cpp:
(WebCore::FlexBoxIterator::next): Do not skip visibility: collapsed child.
(WebCore::childDoesNotAffectWidthOrFlexing): Helper function.

(WebCore::RenderDeprecatedFlexibleBox::calcHorizontalPrefWidths):
(WebCore::RenderDeprecatedFlexibleBox::calcVerticalPrefWidths):
(WebCore::gatherFlexChildrenInfo):
(WebCore::RenderDeprecatedFlexibleBox::layoutHorizontalBox):
(WebCore::RenderDeprecatedFlexibleBox::layoutVerticalBox):
(WebCore::RenderDeprecatedFlexibleBox::applyLineClamp):
(WebCore::RenderDeprecatedFlexibleBox::allowedChildFlex):
Updated to skip the now seen visibility: collapsed child during the
iteration.

LayoutTests:

Added a test covering the vertical change as the horizontal one is covered
by 021.html. The test is failing currently as we don't properly support this
case.

* fast/flexbox/021-vertical-expected.png: Added.
* fast/flexbox/021-vertical-expected.txt: Added.
* fast/flexbox/021-vertical.html: Added.
* fast/flexbox/crash-flexbox-no-layout-child-expected.txt: Added.
* fast/flexbox/crash-flexbox-no-layout-child.html: Added.

* platform/chromium-win/fast/flexbox/021-expected.txt:
* platform/efl/fast/flexbox/021-expected.txt:
* platform/gtk/fast/flexbox/021-expected.txt:
* platform/mac/fast/flexbox/021-expected.txt:
* platform/qt/fast/flexbox/021-expected.txt:
Updated as we now layout out this flex-box. The image result should not
change as it doesn't contribute to the visible flexbox layout.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (98032 => 98033)


--- trunk/LayoutTests/ChangeLog	2011-10-20 22:52:45 UTC (rev 98032)
+++ trunk/LayoutTests/ChangeLog	2011-10-20 22:55:49 UTC (rev 98033)
@@ -1,3 +1,28 @@
+2011-10-20  Julien Chaffraix  <[email protected]>
+
+        RenderDeprecatedFlexibleBox does not call its children's layout method
+        https://bugs.webkit.org/show_bug.cgi?id=64842
+
+        Reviewed by David Hyatt.
+
+        Added a test covering the vertical change as the horizontal one is covered
+        by 021.html. The test is failing currently as we don't properly support this
+        case.
+
+        * fast/flexbox/021-vertical-expected.png: Added.
+        * fast/flexbox/021-vertical-expected.txt: Added.
+        * fast/flexbox/021-vertical.html: Added.
+        * fast/flexbox/crash-flexbox-no-layout-child-expected.txt: Added.
+        * fast/flexbox/crash-flexbox-no-layout-child.html: Added.
+
+        * platform/chromium-win/fast/flexbox/021-expected.txt:
+        * platform/efl/fast/flexbox/021-expected.txt:
+        * platform/gtk/fast/flexbox/021-expected.txt:
+        * platform/mac/fast/flexbox/021-expected.txt:
+        * platform/qt/fast/flexbox/021-expected.txt:
+        Updated as we now layout out this flex-box. The image result should not
+        change as it doesn't contribute to the visible flexbox layout.
+
 2011-10-20  Simon Fraser  <[email protected]>
 
         Fix two compositing iframes tests

Added: trunk/LayoutTests/fast/flexbox/021-vertical-expected.png (0 => 98033)


--- trunk/LayoutTests/fast/flexbox/021-vertical-expected.png	                        (rev 0)
+++ trunk/LayoutTests/fast/flexbox/021-vertical-expected.png	2011-10-20 22:55:49 UTC (rev 98033)
@@ -0,0 +1,5 @@
+\x89PNG
+
+
+IHDR X')tEXtchecksumc0fee90186c7c7a1304dce56aa9b46bc\xDB]`\x93
+\xC6IDATx\x9C\xED\xDC1\xC20EA\x8C88\x9C|\xD3R$\xC5\x96\xA2\x99\xD6\xCD/\x9F\xB6\xF0\x9A\x99\x9D\xE7\xEEw#\xB0b &\xB0b &\xB0b \xF6\xBAzX\x9F\xF5\xCF?\x9A\xF7\xEE\xA7\xFC%|q\xC1\x88	,\x80\x98\xC0\x88	,\x80\x98\xC0\x88	,\x80\x98\xC0\x88	,\x80\x98\xC0\x88	,\x80\x98\xC0\x88	,\x80\x98\xC0\x88	,\x80\x98\xC0\x88	,\x80\x98\xC0\x88	,\x80\x98\xC0\x88	,\x80\x98\xC0\x88	,\x80\x98\xC0\x88	,\x80\x98\xC0\x88	,\x80\x98\xC0\x88	,\x80\x98\xC0\x88	,\x80\x98\xC0\x88	,\x80\x98\xC0\x88	,\x80\x98\xC0\x88	,\x80\x98\xC0\x88	,\x80\x98\xC0\x88	,\x80\x98\xC0\x88	,\x80\x98\xC0\x88	,\x80\x98\xC0\x88	,\x80\x98\xC0\x88	,\x80\x98\xC0\x88	,\x80\x98\xC0\x88	,\x80\x98\xC0\x88	,\x80\x98\xC0\x88	,\x80\x98\xC0\x88	,\x80\x98\xC0\x88	,\x80\x98\xC0\x88	,\x80\x98\xC0\x88	,\x80\x98\xC0\x88	,\x80\x98\xC0\x88	,\x80\x98\xC0\x88	,\x80\x98\xC0\x88	,\x80\x98\xC0\x88	,\x80\x98\xC0\x88	,\x80\x98\xC0\x88	,\x80\x98\xC0\x88	,\x80\x98\xC0\x88	,\x80\x98\xC0\x88	,\x80\x98\xC0\x88	,\x80\x98\xC0\x88	,\x80\x98\xC0\x88	,\x80\x98\xC0\x88	,\x80\x98\xC0\x88	,\x80\x98\xC0\x88	,\x80\x98\xC0\x88	,\x80\x98\xC0\x88\xAD\x99ٽ\xE0V\\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0bgL\xAB\xA1r\xFBrIEND\xAEB`\x82
\ No newline at end of file

Added: trunk/LayoutTests/fast/flexbox/021-vertical-expected.txt (0 => 98033)


--- trunk/LayoutTests/fast/flexbox/021-vertical-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/flexbox/021-vertical-expected.txt	2011-10-20 22:55:49 UTC (rev 98033)
@@ -0,0 +1,8 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  RenderBlock {HTML} at (0,0) size 800x600
+    RenderBody {BODY} at (8,8) size 784x584
+      RenderDeprecatedFlexibleBox {DIV} at (0,0) size 100x100 [bgcolor=#FF0000]
+        RenderDeprecatedFlexibleBox {DIV} at (0,0) size 50x100
+        RenderDeprecatedFlexibleBox {DIV} at (0,0) size 50x100 [bgcolor=#008000]

Added: trunk/LayoutTests/fast/flexbox/021-vertical.html (0 => 98033)


--- trunk/LayoutTests/fast/flexbox/021-vertical.html	                        (rev 0)
+++ trunk/LayoutTests/fast/flexbox/021-vertical.html	2011-10-20 22:55:49 UTC (rev 98033)
@@ -0,0 +1,44 @@
+<html>
+<head>
+<style>
+div {
+  box-orient: vertical;
+  -moz-box-orient: vertical;
+  -webkit-box-orient: vertical;
+  display: -moz-box;
+  display: -webkit-box;
+  display: box;
+  background-color: red;
+  width: 100px;
+  height: 100px;
+}
+
+.first {
+  visibility: collapse;
+  -moz-box-flex: 1;
+  -webkit-box-flex: 1;
+  box-flex: 1;
+  width: 50px;
+  height: 100px;
+}
+
+.second {
+  background-color: green;
+  -moz-box-flex: 1;
+  -webkit-box-flex: 1;
+  box-flex: 1;
+  width: 50px;
+  height: 100px;
+}
+
+</style>
+</head>
+<body>
+<!-- You should see a 100x100 green square below.  If you see any red, the test has failed.  This test is checking
+for visibility:collapse support with vertical orientation. This test is expected to fail but not crash! -->
+<div>
+  <div class="first"></div>
+  <div class="second"></div>
+</div>
+</body>
+</html>

Added: trunk/LayoutTests/fast/flexbox/crash-flexbox-no-layout-child-expected.txt (0 => 98033)


--- trunk/LayoutTests/fast/flexbox/crash-flexbox-no-layout-child-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/flexbox/crash-flexbox-no-layout-child-expected.txt	2011-10-20 22:55:49 UTC (rev 98033)
@@ -0,0 +1,3 @@
+ 
+Bug 64842: RenderDeprecatedFlexibleBox does not call its children's layout method
+This test passes if it does not CRASH.

Added: trunk/LayoutTests/fast/flexbox/crash-flexbox-no-layout-child.html (0 => 98033)


--- trunk/LayoutTests/fast/flexbox/crash-flexbox-no-layout-child.html	                        (rev 0)
+++ trunk/LayoutTests/fast/flexbox/crash-flexbox-no-layout-child.html	2011-10-20 22:55:49 UTC (rev 98033)
@@ -0,0 +1,20 @@
+<script>
+if (window.layoutTestController)
+    layoutTestController.dumpAsText();
+
+function boom() {
+  setTimeout('document.querySelector("progress").setAttribute("style", "overflow: scroll; border-style: dotted;");', 10);
+}
+window._onload_ = boom;
+</script>
+<body>
+  <span style="display: -webkit-inline-box;">
+    <span style="position: fixed; visibility: collapse;">
+      <span style="visibility: visible;">
+        <progress></progress>
+      </span>
+    </span>
+  </span>
+  <div>Bug <a href="" RenderDeprecatedFlexibleBox does not call its children's layout method</div>
+  <div>This test passes if it does not CRASH.</div>
+</body>

Modified: trunk/LayoutTests/platform/chromium-win/fast/flexbox/021-expected.txt (98032 => 98033)


--- trunk/LayoutTests/platform/chromium-win/fast/flexbox/021-expected.txt	2011-10-20 22:52:45 UTC (rev 98032)
+++ trunk/LayoutTests/platform/chromium-win/fast/flexbox/021-expected.txt	2011-10-20 22:55:49 UTC (rev 98033)
@@ -10,5 +10,5 @@
           text run at (520,0) width 244: "This test is checking for visibility:collapse"
           text run at (0,20) width 50: "support."
       RenderDeprecatedFlexibleBox {DIV} at (0,56) size 100x100 [bgcolor=#FF0000]
-        RenderDeprecatedFlexibleBox {DIV} at (0,0) size 0x0
+        RenderDeprecatedFlexibleBox {DIV} at (0,0) size 50x100
         RenderDeprecatedFlexibleBox {DIV} at (0,0) size 100x100 [bgcolor=#008000]

Modified: trunk/LayoutTests/platform/efl/fast/flexbox/021-expected.txt (98032 => 98033)


--- trunk/LayoutTests/platform/efl/fast/flexbox/021-expected.txt	2011-10-20 22:52:45 UTC (rev 98032)
+++ trunk/LayoutTests/platform/efl/fast/flexbox/021-expected.txt	2011-10-20 22:55:49 UTC (rev 98033)
@@ -10,5 +10,5 @@
           text run at (541,0) width 150: "This test is checking for"
           text run at (0,19) width 164: "visibility:collapse support."
       RenderDeprecatedFlexibleBox {DIV} at (0,54) size 100x100 [bgcolor=#FF0000]
-        RenderDeprecatedFlexibleBox {DIV} at (0,0) size 0x0
+        RenderDeprecatedFlexibleBox {DIV} at (0,0) size 50x100
         RenderDeprecatedFlexibleBox {DIV} at (0,0) size 100x100 [bgcolor=#008000]

Modified: trunk/LayoutTests/platform/gtk/fast/flexbox/021-expected.txt (98032 => 98033)


--- trunk/LayoutTests/platform/gtk/fast/flexbox/021-expected.txt	2011-10-20 22:52:45 UTC (rev 98032)
+++ trunk/LayoutTests/platform/gtk/fast/flexbox/021-expected.txt	2011-10-20 22:55:49 UTC (rev 98033)
@@ -10,5 +10,5 @@
           text run at (541,0) width 150: "This test is checking for"
           text run at (0,19) width 164: "visibility:collapse support."
       RenderDeprecatedFlexibleBox {DIV} at (0,54) size 100x100 [bgcolor=#FF0000]
-        RenderDeprecatedFlexibleBox {DIV} at (0,0) size 0x0
+        RenderDeprecatedFlexibleBox {DIV} at (0,0) size 50x100
         RenderDeprecatedFlexibleBox {DIV} at (0,0) size 100x100 [bgcolor=#008000]

Modified: trunk/LayoutTests/platform/mac/fast/flexbox/021-expected.txt (98032 => 98033)


--- trunk/LayoutTests/platform/mac/fast/flexbox/021-expected.txt	2011-10-20 22:52:45 UTC (rev 98032)
+++ trunk/LayoutTests/platform/mac/fast/flexbox/021-expected.txt	2011-10-20 22:55:49 UTC (rev 98033)
@@ -10,5 +10,5 @@
           text run at (541,0) width 150: "This test is checking for"
           text run at (0,18) width 164: "visibility:collapse support."
       RenderDeprecatedFlexibleBox {DIV} at (0,52) size 100x100 [bgcolor=#FF0000]
-        RenderDeprecatedFlexibleBox {DIV} at (0,0) size 0x0
+        RenderDeprecatedFlexibleBox {DIV} at (0,0) size 50x100
         RenderDeprecatedFlexibleBox {DIV} at (0,0) size 100x100 [bgcolor=#008000]

Modified: trunk/LayoutTests/platform/qt/fast/flexbox/021-expected.txt (98032 => 98033)


--- trunk/LayoutTests/platform/qt/fast/flexbox/021-expected.txt	2011-10-20 22:52:45 UTC (rev 98032)
+++ trunk/LayoutTests/platform/qt/fast/flexbox/021-expected.txt	2011-10-20 22:55:49 UTC (rev 98033)
@@ -10,5 +10,5 @@
           text run at (608,0) width 166: "This test is checking for"
           text run at (0,21) width 182: "visibility:collapse support."
       RenderDeprecatedFlexibleBox {DIV} at (0,58) size 100x100 [bgcolor=#FF0000]
-        RenderDeprecatedFlexibleBox {DIV} at (0,0) size 0x0
+        RenderDeprecatedFlexibleBox {DIV} at (0,0) size 50x100
         RenderDeprecatedFlexibleBox {DIV} at (0,0) size 100x100 [bgcolor=#008000]

Modified: trunk/Source/WebCore/ChangeLog (98032 => 98033)


--- trunk/Source/WebCore/ChangeLog	2011-10-20 22:52:45 UTC (rev 98032)
+++ trunk/Source/WebCore/ChangeLog	2011-10-20 22:55:49 UTC (rev 98033)
@@ -1,3 +1,34 @@
+2011-10-20  Julien Chaffraix  <[email protected]>
+
+        RenderDeprecatedFlexibleBox does not call its children's layout method
+        https://bugs.webkit.org/show_bug.cgi?id=64842
+
+        Reviewed by David Hyatt.
+
+        Tests: fast/flexbox/021-vertical.html
+               fast/flexbox/crash-flexbox-no-layout-child.html
+
+        The FlexBoxIterator would skip any child with visibility: collapsed. However those child
+        would need layout but their layout() function would never be called.
+
+        This change refactors the way flexible box handles visibility: collapsed child and mark sure
+        their layout() function is called but makes sure that they don't participate in the flex box
+        dimensions.
+
+        * rendering/RenderDeprecatedFlexibleBox.cpp:
+        (WebCore::FlexBoxIterator::next): Do not skip visibility: collapsed child.
+        (WebCore::childDoesNotAffectWidthOrFlexing): Helper function.
+
+        (WebCore::RenderDeprecatedFlexibleBox::calcHorizontalPrefWidths):
+        (WebCore::RenderDeprecatedFlexibleBox::calcVerticalPrefWidths):
+        (WebCore::gatherFlexChildrenInfo):
+        (WebCore::RenderDeprecatedFlexibleBox::layoutHorizontalBox):
+        (WebCore::RenderDeprecatedFlexibleBox::layoutVerticalBox):
+        (WebCore::RenderDeprecatedFlexibleBox::applyLineClamp):
+        (WebCore::RenderDeprecatedFlexibleBox::allowedChildFlex):
+        Updated to skip the now seen visibility: collapsed child during the
+        iteration.
+
 2011-10-20  Raymond Toy  <[email protected]>
 
         Implement SSE denormal disabler for windows.

Modified: trunk/Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp (98032 => 98033)


--- trunk/Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp	2011-10-20 22:52:45 UTC (rev 98032)
+++ trunk/Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp	2011-10-20 22:55:49 UTC (rev 98033)
@@ -97,7 +97,7 @@
             if (m_currentChild && notFirstOrdinalValue())
                 m_ordinalValues.add(m_currentChild->style()->boxOrdinalGroup());
         } while (!m_currentChild || (!m_currentChild->isAnonymous()
-                 && (m_currentChild->style()->boxOrdinalGroup() != m_currentOrdinal || m_currentChild->style()->visibility() == COLLAPSE)));
+                 && m_currentChild->style()->boxOrdinalGroup() != m_currentOrdinal));
         return m_currentChild;
     }
 
@@ -144,11 +144,16 @@
     return margin;
 }
 
+static bool childDoesNotAffectWidthOrFlexing(RenderObject* child)
+{
+    // Positioned children and collapsed children don't affect the min/max width.
+    return child->isPositioned() || child->style()->visibility() == COLLAPSE;
+}
+
 void RenderDeprecatedFlexibleBox::calcHorizontalPrefWidths()
 {
     for (RenderBox* child = firstChildBox(); child; child = child->nextSiblingBox()) {
-        // Positioned children and collapsed children don't affect the min/max width.
-        if (child->isPositioned() || child->style()->visibility() == COLLAPSE)
+        if (childDoesNotAffectWidthOrFlexing(child))
             continue;
 
         LayoutUnit margin = marginWidthForChild(child);
@@ -160,8 +165,7 @@
 void RenderDeprecatedFlexibleBox::calcVerticalPrefWidths()
 {
     for (RenderBox* child = firstChildBox(); child; child = child->nextSiblingBox()) {
-        // Positioned children and collapsed children don't affect the min/max width.
-        if (child->isPositioned() || child->style()->visibility() == COLLAPSE)
+        if (childDoesNotAffectWidthOrFlexing(child))
             continue;
 
         LayoutUnit margin = marginWidthForChild(child);
@@ -310,7 +314,7 @@
 {
     for (RenderBox* child = iterator.first(); child; child = iterator.next()) {
         // Check to see if this child flexes.
-        if (!child->isPositioned() && child->style()->boxFlex() > 0.0f) {
+        if (!childDoesNotAffectWidthOrFlexing(child) && child->style()->boxFlex() > 0.0f) {
             // We always have to lay out flexible objects again, since the flex distribution
             // may have changed, and we need to reallocate space.
             child->clearOverrideSize();
@@ -422,8 +426,14 @@
                         child->setChildNeedsLayout(true, false);
                 }
                 continue;
+            } else if (child->style()->visibility() == COLLAPSE) {
+                // visibility: collapsed children do not participate in our positioning.
+                // But we need to lay them down.
+                child->layoutIfNeeded();
+                continue;
             }
 
+
             // We need to see if this child's height has changed, since we make block elements
             // fill the height of a containing box by default.
             // Now do a layout.
@@ -513,6 +523,9 @@
 
                     // Now distribute the space to objects.
                     for (RenderBox* child = iterator.first(); child && spaceAvailableThisPass && totalFlex; child = iterator.next()) {
+                        if (child->style()->visibility() == COLLAPSE)
+                            continue;
+
                         if (allowedChildFlex(child, expanding, i)) {
                             LayoutUnit spaceAdd = static_cast<LayoutUnit>(spaceAvailableThisPass * (child->style()->boxFlex() / totalFlex));
                             if (spaceAdd) {
@@ -562,7 +575,7 @@
             // Determine the total number of children.
             int totalChildren = 0;
             for (RenderBox* child = iterator.first(); child; child = iterator.next()) {
-                if (child->isPositioned())
+                if (childDoesNotAffectWidthOrFlexing(child))
                     continue;
                 ++totalChildren;
             }
@@ -573,7 +586,7 @@
                 --totalChildren;
                 bool firstChild = true;
                 for (RenderBox* child = iterator.first(); child; child = iterator.next()) {
-                    if (child->isPositioned())
+                    if (childDoesNotAffectWidthOrFlexing(child))
                         continue;
 
                     if (firstChild) {
@@ -594,7 +607,7 @@
             else // END for LTR, START for RTL
                 offset += remainingSpace;
             for (RenderBox* child = iterator.first(); child; child = iterator.next()) {
-                if (child->isPositioned())
+                if (childDoesNotAffectWidthOrFlexing(child))
                     continue;
 
                 placeChild(child, child->location() + LayoutSize(offset, 0));
@@ -654,6 +667,11 @@
                         child->setChildNeedsLayout(true, false);
                 }
                 continue;
+            } else if (child->style()->visibility() == COLLAPSE) {
+                // visibility: collapsed children do not participate in our positioning.
+                // But we need to lay them down.
+                child->layoutIfNeeded();
+                continue;
             }
 
             // Compute the child's vertical margins.
@@ -805,7 +823,7 @@
             // Determine the total number of children.
             int totalChildren = 0;
             for (RenderBox* child = iterator.first(); child; child = iterator.next()) {
-                if (child->isPositioned())
+                if (childDoesNotAffectWidthOrFlexing(child))
                     continue;
 
                 ++totalChildren;
@@ -817,7 +835,7 @@
                 --totalChildren;
                 bool firstChild = true;
                 for (RenderBox* child = iterator.first(); child; child = iterator.next()) {
-                    if (child->isPositioned())
+                    if (childDoesNotAffectWidthOrFlexing(child))
                         continue;
 
                     if (firstChild) {
@@ -837,7 +855,7 @@
             else // END
                 offset += remainingSpace;
             for (RenderBox* child = iterator.first(); child; child = iterator.next()) {
-                if (child->isPositioned())
+                if (childDoesNotAffectWidthOrFlexing(child))
                     continue;
                 placeChild(child, child->location() + LayoutSize(0, offset));
             }
@@ -854,7 +872,7 @@
 {
     int maxLineCount = 0;
     for (RenderBox* child = iterator.first(); child; child = iterator.next()) {
-        if (child->isPositioned())
+        if (childDoesNotAffectWidthOrFlexing(child))
             continue;
 
         if (relayoutChildren || (child->isReplaced() && (child->style()->width().isPercent() || child->style()->height().isPercent()))
@@ -880,7 +898,7 @@
         return;
 
     for (RenderBox* child = iterator.first(); child; child = iterator.next()) {
-        if (child->isPositioned() || !child->style()->height().isAuto() || !child->isBlockFlow())
+        if (childDoesNotAffectWidthOrFlexing(child) || !child->style()->height().isAuto() || !child->isBlockFlow())
             continue;
 
         RenderBlock* blockChild = toRenderBlock(child);
@@ -968,7 +986,7 @@
 
 LayoutUnit RenderDeprecatedFlexibleBox::allowedChildFlex(RenderBox* child, bool expanding, unsigned int group)
 {
-    if (child->isPositioned() || child->style()->boxFlex() == 0.0f || child->style()->boxFlexGroup() != group)
+    if (childDoesNotAffectWidthOrFlexing(child) || child->style()->boxFlex() == 0.0f || child->style()->boxFlexGroup() != group)
         return 0;
 
     if (expanding) {
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to