Title: [110747] trunk
Revision
110747
Author
[email protected]
Date
2012-03-14 14:10:24 -0700 (Wed, 14 Mar 2012)

Log Message

multiline column flexbox with auto height wrap too much
https://bugs.webkit.org/show_bug.cgi?id=80929

Reviewed by David Hyatt.

Source/WebCore:

Test: css3/flexbox/multiline-column-auto.html

* rendering/RenderBox.cpp:
(WebCore::RenderBox::computeLogicalHeightUsing):
(WebCore):
(WebCore::RenderBox::computeContentLogicalHeightUsing): Pull out into a separate method.
* rendering/RenderBox.h:
(RenderBox):
* rendering/RenderFlexibleBox.cpp:
(WebCore::RenderFlexibleBox::lineBreakLength): Compute the value based on height & max-height for column layout.
(WebCore):
(WebCore::RenderFlexibleBox::computeNextFlexLine):
* rendering/RenderFlexibleBox.h:
(RenderFlexibleBox):

LayoutTests:

* css3/flexbox/multiline-column-auto-expected.txt: Added.
* css3/flexbox/multiline-column-auto.html: Added.
* css3/flexbox/multiline-shrink-to-fit-expected.html:
* css3/flexbox/multiline-shrink-to-fit.html:

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (110746 => 110747)


--- trunk/LayoutTests/ChangeLog	2012-03-14 21:04:37 UTC (rev 110746)
+++ trunk/LayoutTests/ChangeLog	2012-03-14 21:10:24 UTC (rev 110747)
@@ -1,3 +1,15 @@
+2012-03-14  Tony Chang  <[email protected]>
+
+        multiline column flexbox with auto height wrap too much
+        https://bugs.webkit.org/show_bug.cgi?id=80929
+
+        Reviewed by David Hyatt.
+
+        * css3/flexbox/multiline-column-auto-expected.txt: Added.
+        * css3/flexbox/multiline-column-auto.html: Added.
+        * css3/flexbox/multiline-shrink-to-fit-expected.html:
+        * css3/flexbox/multiline-shrink-to-fit.html:
+
 2012-03-14  Jessie Berlin  <[email protected]>
 
         PeerConnection was renamed to DeprecatedPeerConnection in r110587. Update the expected

Added: trunk/LayoutTests/css3/flexbox/multiline-column-auto-expected.txt (0 => 110747)


--- trunk/LayoutTests/css3/flexbox/multiline-column-auto-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/css3/flexbox/multiline-column-auto-expected.txt	2012-03-14 21:10:24 UTC (rev 110747)
@@ -0,0 +1,6 @@
+Test to make sure that multiline columns break at the right places when auto sized.
+
+PASS
+PASS
+PASS
+PASS
Property changes on: trunk/LayoutTests/css3/flexbox/multiline-column-auto-expected.txt
___________________________________________________________________

Added: svn:eol-style

Added: trunk/LayoutTests/css3/flexbox/multiline-column-auto.html (0 => 110747)


--- trunk/LayoutTests/css3/flexbox/multiline-column-auto.html	                        (rev 0)
+++ trunk/LayoutTests/css3/flexbox/multiline-column-auto.html	2012-03-14 21:10:24 UTC (rev 110747)
@@ -0,0 +1,65 @@
+<!DOCTYPE html>
+<html>
+<style>
+.flexbox {
+    display: -webkit-flexbox;
+    background-color: #aaa;
+    position: relative;
+    -webkit-flex-flow: column wrap;
+    margin-top: 20px;
+}
+.flexbox > div {
+    border: 0;
+}
+
+.flexbox :nth-child(1) {
+    background-color: lightblue;
+}
+.flexbox :nth-child(2) {
+    background-color: lightgreen;
+}
+.flexbox :nth-child(3) {
+    background-color: pink;
+}
+.flexbox :nth-child(4) {
+    background-color: yellow;
+}
+</style>
+<script>
+if (window.layoutTestController)
+    layoutTestController.dumpAsText();
+</script>
+<script src=""
+<body _onload_="checkFlexBoxen()">
+<p>Test to make sure that multiline columns break at the right places when auto sized.</p>
+
+<div data-expected-width="200" data-expected-height="80" class="flexbox" style="width: 200px">
+  <div data-offset-x="0" data-offset-y="0" style="width: 50px; height: 20px"></div>
+  <div data-offset-x="0" data-offset-y="20" style="width: 50px; height: 20px"></div>
+  <div data-offset-x="0" data-offset-y="40" style="width: 50px; height: 20px"></div>
+  <div data-offset-x="0" data-offset-y="60" style="width: 50px; height: 20px"></div>
+</div>
+
+<div data-expected-width="200" data-expected-height="40" class="flexbox" style="width: 200px; max-height: 50px;">
+  <div data-offset-x="0" data-offset-y="0" style="width: 50px; height: 20px"></div>
+  <div data-offset-x="0" data-offset-y="20" style="width: 50px; height: 20px"></div>
+  <div data-offset-x="50" data-offset-y="0" style="width: 50px; height: 20px"></div>
+  <div data-offset-x="50" data-offset-y="20" style="width: 50px; height: 20px"></div>
+</div>
+
+<div data-expected-width="200" data-expected-height="50" class="flexbox" style="width: 200px; height: 50px;">
+  <div data-offset-x="0" data-offset-y="0" style="width: 50px; height: 20px"></div>
+  <div data-offset-x="0" data-offset-y="20" style="width: 50px; height: 20px"></div>
+  <div data-offset-x="50" data-offset-y="0" style="width: 50px; height: 20px"></div>
+  <div data-offset-x="50" data-offset-y="20" style="width: 50px; height: 20px"></div>
+</div>
+
+<div data-expected-width="200" data-expected-height="30" class="flexbox" style="width: 200px; height: 50px; max-height: 30px;">
+  <div data-offset-x="0" data-offset-y="0" style="width: 50px; height: 20px"></div>
+  <div data-offset-x="50" data-offset-y="0" style="width: 50px; height: 20px"></div>
+  <div data-offset-x="100" data-offset-y="0" style="width: 50px; height: 20px"></div>
+  <div data-offset-x="150" data-offset-y="0" style="width: 50px; height: 20px"></div>
+</div>
+
+</body>
+</html>
Property changes on: trunk/LayoutTests/css3/flexbox/multiline-column-auto.html
___________________________________________________________________

Added: svn:eol-style

Modified: trunk/LayoutTests/css3/flexbox/multiline-shrink-to-fit-expected.html (110746 => 110747)


--- trunk/LayoutTests/css3/flexbox/multiline-shrink-to-fit-expected.html	2012-03-14 21:04:37 UTC (rev 110746)
+++ trunk/LayoutTests/css3/flexbox/multiline-shrink-to-fit-expected.html	2012-03-14 21:10:24 UTC (rev 110747)
@@ -33,7 +33,6 @@
 <body>
 <p>Test to make sure that multiline column flexboxes shrink-to-fit properly.</p>
 
-<!-- FIXME: Remove the height once https://bugs.webkit.org/show_bug.cgi?id=80929 is fixed. -->
 <div class="testcase" style="height: 60px; width: 400px">
   <div style="width: 100px; height: 20px"></div>
   <div style="width: 100px; height: 10px"></div>
@@ -56,7 +55,6 @@
 </div>
 <p style="clear:left">The grey background should be 400px wide.</p>
 
-<!-- FIXME: Remove the height once https://bugs.webkit.org/show_bug.cgi?id=80929 is fixed. -->
 <div style="width: 150px">
 <div class="testcase" style="height: 60px; width: 150px">
   <div style="width: 100px; height: 20px"></div>

Modified: trunk/LayoutTests/css3/flexbox/multiline-shrink-to-fit.html (110746 => 110747)


--- trunk/LayoutTests/css3/flexbox/multiline-shrink-to-fit.html	2012-03-14 21:04:37 UTC (rev 110746)
+++ trunk/LayoutTests/css3/flexbox/multiline-shrink-to-fit.html	2012-03-14 21:10:24 UTC (rev 110747)
@@ -26,8 +26,7 @@
 <body>
 <p>Test to make sure that multiline column flexboxes shrink-to-fit properly.</p>
 
-<!-- FIXME: Remove the height once https://bugs.webkit.org/show_bug.cgi?id=80929 is fixed. -->
-<div class="flexbox" style="height: 60px">
+<div class="flexbox">
   <div style="width: 100px; height: 20px"></div>
   <div style="width: 100px; height: 10px"></div>
   <div style="width: 100px; height: 10px"></div>
@@ -43,9 +42,8 @@
 </div>
 <p style="clear:left">The grey background should be 400px wide.</p>
 
-<!-- FIXME: Remove the height once https://bugs.webkit.org/show_bug.cgi?id=80929 is fixed. -->
 <div style="width: 150px">
-<div class="flexbox" style="height: 60px">
+<div class="flexbox">
   <div style="width: 100px; height: 20px"></div>
   <div style="width: 100px; height: 10px"></div>
   <div style="width: 100px; height: 10px"></div>

Modified: trunk/Source/WebCore/ChangeLog (110746 => 110747)


--- trunk/Source/WebCore/ChangeLog	2012-03-14 21:04:37 UTC (rev 110746)
+++ trunk/Source/WebCore/ChangeLog	2012-03-14 21:10:24 UTC (rev 110747)
@@ -1,3 +1,25 @@
+2012-03-14  Tony Chang  <[email protected]>
+
+        multiline column flexbox with auto height wrap too much
+        https://bugs.webkit.org/show_bug.cgi?id=80929
+
+        Reviewed by David Hyatt.
+
+        Test: css3/flexbox/multiline-column-auto.html
+
+        * rendering/RenderBox.cpp:
+        (WebCore::RenderBox::computeLogicalHeightUsing):
+        (WebCore):
+        (WebCore::RenderBox::computeContentLogicalHeightUsing): Pull out into a separate method.
+        * rendering/RenderBox.h:
+        (RenderBox):
+        * rendering/RenderFlexibleBox.cpp:
+        (WebCore::RenderFlexibleBox::lineBreakLength): Compute the value based on height & max-height for column layout.
+        (WebCore):
+        (WebCore::RenderFlexibleBox::computeNextFlexLine):
+        * rendering/RenderFlexibleBox.h:
+        (RenderFlexibleBox):
+
 2012-03-14  Xingnan Wang  <[email protected]>
 
         Optimize the multiply-add in Biquad.cpp::process

Modified: trunk/Source/WebCore/rendering/RenderBox.cpp (110746 => 110747)


--- trunk/Source/WebCore/rendering/RenderBox.cpp	2012-03-14 21:04:37 UTC (rev 110746)
+++ trunk/Source/WebCore/rendering/RenderBox.cpp	2012-03-14 21:10:24 UTC (rev 110747)
@@ -2152,18 +2152,22 @@
     }
 }
 
-LayoutUnit RenderBox::computeLogicalHeightUsing(const Length& h)
+LayoutUnit RenderBox::computeLogicalHeightUsing(const Length& height)
 {
+    LayoutUnit logicalHeight = computeContentLogicalHeightUsing(height);
+    if (logicalHeight != -1)
+        logicalHeight = computeBorderBoxLogicalHeight(logicalHeight);
+    return logicalHeight;
+}
+
+LayoutUnit RenderBox::computeContentLogicalHeightUsing(const Length& height)
+{
     LayoutUnit logicalHeight = -1;
-    if (!h.isAuto()) {
-        if (h.isFixed())
-            logicalHeight = h.value();
-        else if (h.isPercent())
-            logicalHeight = computePercentageLogicalHeight(h);
-        if (logicalHeight != -1) {
-            logicalHeight = computeBorderBoxLogicalHeight(logicalHeight);
-            return logicalHeight;
-        }
+    if (!height.isAuto()) {
+        if (height.isFixed())
+            logicalHeight = height.value();
+        else if (height.isPercent())
+            logicalHeight = computePercentageLogicalHeight(height);
     }
     return logicalHeight;
 }

Modified: trunk/Source/WebCore/rendering/RenderBox.h (110746 => 110747)


--- trunk/Source/WebCore/rendering/RenderBox.h	2012-03-14 21:04:37 UTC (rev 110746)
+++ trunk/Source/WebCore/rendering/RenderBox.h	2012-03-14 21:10:24 UTC (rev 110747)
@@ -341,6 +341,7 @@
 
     LayoutUnit computeLogicalWidthInRegionUsing(LogicalWidthType, LayoutUnit availableLogicalWidth, const RenderBlock* containingBlock, RenderRegion*, LayoutUnit offsetFromLogicalTopOfFirstPage);
     LayoutUnit computeLogicalHeightUsing(const Length& height);
+    LayoutUnit computeContentLogicalHeightUsing(const Length& height);
     LayoutUnit computeReplacedLogicalWidthUsing(Length width) const;
     LayoutUnit computeReplacedLogicalWidthRespectingMinMaxWidth(LayoutUnit logicalWidth, bool includeMaxWidth = true) const;
     LayoutUnit computeReplacedLogicalHeightUsing(Length height) const;

Modified: trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp (110746 => 110747)


--- trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp	2012-03-14 21:04:37 UTC (rev 110746)
+++ trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp	2012-03-14 21:10:24 UTC (rev 110747)
@@ -669,6 +669,20 @@
     }
 }
 
+LayoutUnit RenderFlexibleBox::lineBreakLength()
+{
+    if (!isColumnFlow())
+        return mainAxisContentExtent();
+
+    LayoutUnit height = computeContentLogicalHeightUsing(style()->logicalHeight());
+    if (height == -1)
+        height = std::numeric_limits<LayoutUnit>::max();
+    LayoutUnit maxHeight = computeContentLogicalHeightUsing(style()->logicalMaxHeight());
+    if (maxHeight != -1)
+        height = std::min(height, maxHeight);
+    return height;
+}
+
 bool RenderFlexibleBox::computeNextFlexLine(FlexOrderIterator& iterator, OrderedFlexItemList& orderedChildren, LayoutUnit& preferredMainAxisExtent, float& totalPositiveFlexibility, float& totalNegativeFlexibility)
 {
     orderedChildren.clear();
@@ -678,6 +692,8 @@
     if (!iterator.currentChild())
         return false;
 
+    LayoutUnit lineBreak = lineBreakLength();
+
     for (RenderBox* child = iterator.currentChild(); child; child = iterator.next()) {
         if (child->isPositioned()) {
             orderedChildren.append(child);
@@ -690,10 +706,7 @@
         else
             childMainAxisExtent += child->marginHeight();
 
-        // FIXME: For auto sized column flexbox, mainAxisContentExtent (the height) hasn't been computed yet so we break
-        // after the first child. If the height is auto, we need to look at max-height to determine the line breaks.
-        // https://bugs.webkit.org/show_bug.cgi?id=80929
-        if (isMultiline() && preferredMainAxisExtent + childMainAxisExtent > mainAxisContentExtent() && orderedChildren.size() > 0)
+        if (isMultiline() && preferredMainAxisExtent + childMainAxisExtent > lineBreak && orderedChildren.size() > 0)
             break;
         orderedChildren.append(child);
         preferredMainAxisExtent += childMainAxisExtent;

Modified: trunk/Source/WebCore/rendering/RenderFlexibleBox.h (110746 => 110747)


--- trunk/Source/WebCore/rendering/RenderFlexibleBox.h	2012-03-14 21:04:37 UTC (rev 110746)
+++ trunk/Source/WebCore/rendering/RenderFlexibleBox.h	2012-03-14 21:10:24 UTC (rev 110747)
@@ -103,6 +103,7 @@
     LayoutUnit marginBoxAscentForChild(RenderBox*);
 
     void computeMainAxisPreferredSizes(bool relayoutChildren, FlexOrderHashSet&);
+    LayoutUnit lineBreakLength();
     bool computeNextFlexLine(FlexOrderIterator&, OrderedFlexItemList& orderedChildren, LayoutUnit& preferredMainAxisExtent, float& totalPositiveFlexibility, float& totalNegativeFlexibility);
     bool runFreeSpaceAllocationAlgorithm(const OrderedFlexItemList&, LayoutUnit& availableFreeSpace, float& totalPositiveFlexibility, float& totalNegativeFlexibility, InflexibleFlexItemSize&, WTF::Vector<LayoutUnit>& childSizes);
     void setLogicalOverrideSize(RenderBox* child, LayoutUnit childPreferredSize);
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to