Title: [116038] trunk
Revision
116038
Author
t...@chromium.org
Date
2012-05-03 16:21:44 -0700 (Thu, 03 May 2012)

Log Message

Height overflow when nesting multiple new Flexbox'es.
https://bugs.webkit.org/show_bug.cgi?id=83572

Reviewed by Ojan Vafai.

Source/WebCore:

Test: css3/flexbox/nested-stretch.html

* rendering/RenderFlexibleBox.cpp:
(WebCore::RenderFlexibleBox::computeAvailableFreeSpace):

LayoutTests:

* css3/flexbox/nested-stretch-expected.txt: Added.
* css3/flexbox/nested-stretch.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (116037 => 116038)


--- trunk/LayoutTests/ChangeLog	2012-05-03 23:10:26 UTC (rev 116037)
+++ trunk/LayoutTests/ChangeLog	2012-05-03 23:21:44 UTC (rev 116038)
@@ -1,3 +1,13 @@
+2012-05-03  Tony Chang  <t...@chromium.org>
+
+        Height overflow when nesting multiple new Flexbox'es.
+        https://bugs.webkit.org/show_bug.cgi?id=83572
+
+        Reviewed by Ojan Vafai.
+
+        * css3/flexbox/nested-stretch-expected.txt: Added.
+        * css3/flexbox/nested-stretch.html: Added.
+
 2012-05-03  Tom Zakrajsek  <t...@codeaurora.org>
 
         Unreviewed gardening

Added: trunk/LayoutTests/css3/flexbox/nested-stretch-expected.txt (0 => 116038)


--- trunk/LayoutTests/css3/flexbox/nested-stretch-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/css3/flexbox/nested-stretch-expected.txt	2012-05-03 23:21:44 UTC (rev 116038)
@@ -0,0 +1,4 @@
+There should be two boxes of equal height on the left and 3 boxes of equal height on the right.
+PASS
+None of the boxes should overflow and the inner most boxes should be end aligned.
+PASS

Added: trunk/LayoutTests/css3/flexbox/nested-stretch.html (0 => 116038)


--- trunk/LayoutTests/css3/flexbox/nested-stretch.html	                        (rev 0)
+++ trunk/LayoutTests/css3/flexbox/nested-stretch.html	2012-05-03 23:21:44 UTC (rev 116038)
@@ -0,0 +1,61 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+div {
+  outline: 1px solid black;
+  background: hsla(210,100%,90%, .8);
+  padding: 5px;
+  margin: 5px; 
+}
+
+.flexbox {
+  display: -webkit-flexbox; 
+}
+
+.row {
+  -webkit-flex-direction: row;
+}
+
+.column {
+  display: -webkit-flexbox; 
+  -webkit-flex-direction: column;
+}
+
+.flex {
+  -webkit-flex: 1 0 auto;
+}
+</style>
+<script>
+if (window.layoutTestController)
+    layoutTestController.dumpAsText();
+</script>
+<script src=""
+</head>
+<body _onload_="checkFlexBoxen()">
+There should be two boxes of equal height on the left and 3 boxes of equal
+height on the right.
+<div class="flexbox row" style="width: 600px">
+  <div data-expected-width=290 data-expected-height=220 class="column flex">
+    <div data-expected-width=270 data-expected-height=95 class="flex"></div>
+    <div data-expected-width=270 data-expected-height=95 class="flex"></div>
+  </div>
+  <div data-expected-width=290 data-expected-height=220 class="column flex">
+    <div data-expected-width=270 data-expected-height=60 class="flex" style="height: 50px;"></div>
+    <div data-expected-width=270 data-expected-height=60 class="flex" style="height: 50px;"></div>
+    <div data-expected-width=270 data-expected-height=60 class="flex" style="height: 50px;"></div>
+  </div>
+</div>
+
+None of the boxes should overflow and the inner most boxes should be end aligned.
+<div class="flexbox column" style="width: 600px; height: 300px; position: relative;">
+  <div data-expected-width=590 data-expected-height=250 class="column flex" style="-webkit-flex-pack: end">
+    <div data-offset-y="180" data-expected-width=570 data-expected-height=30 style="height: 20px"></div>
+    <div data-offset-y="220" data-expected-width=570 data-expected-height=30 style="height: 20px"></div>
+  </div>
+  <div data-expected-width=590 data-expected-height=30 style="height: 20px"></div>
+</div>
+
+
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (116037 => 116038)


--- trunk/Source/WebCore/ChangeLog	2012-05-03 23:10:26 UTC (rev 116037)
+++ trunk/Source/WebCore/ChangeLog	2012-05-03 23:21:44 UTC (rev 116038)
@@ -1,3 +1,15 @@
+2012-05-03  Tony Chang  <t...@chromium.org>
+
+        Height overflow when nesting multiple new Flexbox'es.
+        https://bugs.webkit.org/show_bug.cgi?id=83572
+
+        Reviewed by Ojan Vafai.
+
+        Test: css3/flexbox/nested-stretch.html
+
+        * rendering/RenderFlexibleBox.cpp:
+        (WebCore::RenderFlexibleBox::computeAvailableFreeSpace):
+
 2012-05-03  Julien Chaffraix  <jchaffr...@webkit.org>
 
         ASSERT(!m_zOrderListsDirty) is triggering in Safari

Modified: trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp (116037 => 116038)


--- trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp	2012-05-03 23:10:26 UTC (rev 116037)
+++ trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp	2012-05-03 23:21:44 UTC (rev 116038)
@@ -598,23 +598,25 @@
 
 LayoutUnit RenderFlexibleBox::computeAvailableFreeSpace(LayoutUnit preferredMainAxisExtent)
 {
+    LayoutUnit contentExtent = 0;
     if (!isColumnFlow())
-        return mainAxisContentExtent() - preferredMainAxisExtent;
+        contentExtent = mainAxisContentExtent();
+    else if (hasOverrideHeight())
+        contentExtent = overrideHeight() - (logicalHeight() - contentLogicalHeight());
+    else {
+        LayoutUnit heightResult = computeContentLogicalHeightUsing(style()->logicalHeight());
+        if (heightResult == -1)
+            heightResult = preferredMainAxisExtent;
+        LayoutUnit minHeight = computeContentLogicalHeightUsing(style()->logicalMinHeight()); // Leave as -1 if unset.
+        LayoutUnit maxHeight = style()->logicalMaxHeight().isUndefined() ? heightResult : computeContentLogicalHeightUsing(style()->logicalMaxHeight());
+        if (maxHeight == -1)
+            maxHeight = heightResult;
+        heightResult = std::min(maxHeight, heightResult);
+        heightResult = std::max(minHeight, heightResult);
+        contentExtent = heightResult;
+    }
 
-    if (hasOverrideHeight())
-        return overrideHeight();
-
-    LayoutUnit heightResult = computeContentLogicalHeightUsing(style()->logicalHeight());
-    if (heightResult == -1)
-        heightResult = preferredMainAxisExtent;
-    LayoutUnit minHeight = computeContentLogicalHeightUsing(style()->logicalMinHeight()); // Leave as -1 if unset.
-    LayoutUnit maxHeight = style()->logicalMaxHeight().isUndefined() ? heightResult : computeContentLogicalHeightUsing(style()->logicalMaxHeight());
-    if (maxHeight == -1)
-        maxHeight = heightResult;
-    heightResult = std::min(maxHeight, heightResult);
-    heightResult = std::max(minHeight, heightResult);
-
-    return heightResult - preferredMainAxisExtent;
+    return contentExtent - preferredMainAxisExtent;
 }
 
 void RenderFlexibleBox::layoutFlexItems(FlexOrderIterator& iterator, WTF::Vector<LineContext>& lineContexts)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to