Title: [128383] trunk
Revision
128383
Author
[email protected]
Date
2012-09-12 16:48:43 -0700 (Wed, 12 Sep 2012)

Log Message

flex item sized incorrectly in a column flexbox with height set via top/bottom
https://bugs.webkit.org/show_bug.cgi?id=94855

Reviewed by Ojan Vafai.

Source/WebCore:

Stop using computeContentLogicalHeight() to get the height of the flexbox and
use computeLogicalHeight directly.  This properly takes into account out of flow
positioning.

We can actually refactor some of this into common code, but I want to do that as
a separate pass.

Test: css3/flexbox/columns-height-set-via-top-bottom.html

* rendering/RenderFlexibleBox.cpp:
(WebCore::RenderFlexibleBox::repositionLogicalHeightDependentFlexItems): Fix out of date comment.
(WebCore::RenderFlexibleBox::mainAxisContentExtent): Use computeLogicalHeight instead of computeContentLogicalHeight.
This code actually never gets used-- I'll try to remove in a follow up.
(WebCore::RenderFlexibleBox::computeAvailableFreeSpace): Use computeLogicalHeight instead of computeContentLogicalHeight.
(WebCore::RenderFlexibleBox::lineBreakLength): Use computeLogicalHeight instead of computeContentLogicalHeight.

LayoutTests:

Test where the height of a column flexbox is set via top and bottom.

* css3/flexbox/columns-height-set-via-top-bottom-expected.txt: Added.
* css3/flexbox/columns-height-set-via-top-bottom.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (128382 => 128383)


--- trunk/LayoutTests/ChangeLog	2012-09-12 23:44:33 UTC (rev 128382)
+++ trunk/LayoutTests/ChangeLog	2012-09-12 23:48:43 UTC (rev 128383)
@@ -1,3 +1,15 @@
+2012-09-12  Tony Chang  <[email protected]>
+
+        flex item sized incorrectly in a column flexbox with height set via top/bottom
+        https://bugs.webkit.org/show_bug.cgi?id=94855
+
+        Reviewed by Ojan Vafai.
+
+        Test where the height of a column flexbox is set via top and bottom.
+
+        * css3/flexbox/columns-height-set-via-top-bottom-expected.txt: Added.
+        * css3/flexbox/columns-height-set-via-top-bottom.html: Added.
+
 2012-09-12  Alexandru Chiculita  <[email protected]>
 
         [CSS Shaders] Implement transform parameter animations for CSS Custom Filters

Added: trunk/LayoutTests/css3/flexbox/columns-height-set-via-top-bottom-expected.txt (0 => 128383)


--- trunk/LayoutTests/css3/flexbox/columns-height-set-via-top-bottom-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/css3/flexbox/columns-height-set-via-top-bottom-expected.txt	2012-09-12 23:48:43 UTC (rev 128383)
@@ -0,0 +1,2 @@
+PASS
+PASS

Added: trunk/LayoutTests/css3/flexbox/columns-height-set-via-top-bottom.html (0 => 128383)


--- trunk/LayoutTests/css3/flexbox/columns-height-set-via-top-bottom.html	                        (rev 0)
+++ trunk/LayoutTests/css3/flexbox/columns-height-set-via-top-bottom.html	2012-09-12 23:48:43 UTC (rev 128383)
@@ -0,0 +1,48 @@
+<!DOCTYPE html>
+<html>
+<style>
+.container {
+    position: relative;
+    height: 100px;
+    width: 100px;
+    border: 2px solid orange;
+}
+.flexbox {
+    display: -webkit-flex;
+    -webkit-flex-flow: column;
+    position: absolute;
+    top: 0;
+    right: 0;
+    bottom: 0;
+    left: 0;
+    padding: 10px;
+}
+.flexbox > :nth-child(1) {
+    background-color: lightblue;
+}
+.flexbox > :nth-child(2) {
+    background-color: lightgreen;
+}
+</style>
+<script>
+if (window.testRunner)
+    testRunner.dumpAsText();
+</script>
+<script src=""
+<body _onload_="checkLayout('.flexbox')">
+
+<div class="container">
+    <div data-expected-height=100 class="flexbox">
+        <div data-expected-height=30 data-expected-width=80 style="height: 30px"></div>
+        <div data-expected-height=50 data-expected-width=80 style="-webkit-flex: 1"></div>
+    </div>
+</div>
+
+<div class="container">
+    <div style="-webkit-flex-wrap: wrap" class="flexbox">
+        <div data-expected-height=50 data-expected-width=40 style="height: 50px"></div>
+        <div data-expected-height=80 data-expected-width=40 style="-webkit-flex: 1 50px"></div>
+    </div>
+</div>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (128382 => 128383)


--- trunk/Source/WebCore/ChangeLog	2012-09-12 23:44:33 UTC (rev 128382)
+++ trunk/Source/WebCore/ChangeLog	2012-09-12 23:48:43 UTC (rev 128383)
@@ -1,3 +1,26 @@
+2012-09-12  Tony Chang  <[email protected]>
+
+        flex item sized incorrectly in a column flexbox with height set via top/bottom
+        https://bugs.webkit.org/show_bug.cgi?id=94855
+
+        Reviewed by Ojan Vafai.
+
+        Stop using computeContentLogicalHeight() to get the height of the flexbox and
+        use computeLogicalHeight directly.  This properly takes into account out of flow
+        positioning.
+
+        We can actually refactor some of this into common code, but I want to do that as
+        a separate pass.
+
+        Test: css3/flexbox/columns-height-set-via-top-bottom.html
+
+        * rendering/RenderFlexibleBox.cpp:
+        (WebCore::RenderFlexibleBox::repositionLogicalHeightDependentFlexItems): Fix out of date comment.
+        (WebCore::RenderFlexibleBox::mainAxisContentExtent): Use computeLogicalHeight instead of computeContentLogicalHeight.
+        This code actually never gets used-- I'll try to remove in a follow up.
+        (WebCore::RenderFlexibleBox::computeAvailableFreeSpace): Use computeLogicalHeight instead of computeContentLogicalHeight.
+        (WebCore::RenderFlexibleBox::lineBreakLength): Use computeLogicalHeight instead of computeContentLogicalHeight.
+
 2012-09-12  Adam Barth  <[email protected]>
 
         [V8] V8DOMWrapper::perContextData has no callers and can be removed

Modified: trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp (128382 => 128383)


--- trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp	2012-09-12 23:44:33 UTC (rev 128382)
+++ trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp	2012-09-12 23:48:43 UTC (rev 128383)
@@ -307,7 +307,7 @@
     alignFlexLines(iterator, lineContexts);
 
     // If we have a single line flexbox, the line height is all the available space.
-    // For flex-direction: row, this means we need to use the height, so we do this after calling computeLogicalHeight.
+    // For flex-direction: row, this means we need to use the height, so we do this after calling updateLogicalHeight.
     if (!isMultiline() && lineContexts.size() == 1)
         lineContexts[0].crossAxisExtent = crossAxisContentExtent();
     alignChildren(iterator, lineContexts);
@@ -395,8 +395,11 @@
 
 LayoutUnit RenderFlexibleBox::mainAxisContentExtent()
 {
-    if (isColumnFlow())
-        return std::max(LayoutUnit(0), computeContentLogicalHeight(MainOrPreferredSize, style()->logicalHeight()));
+    if (isColumnFlow()) {
+        LogicalExtentComputedValues computedValues;
+        computeLogicalHeight(logicalHeight(), logicalTop(), computedValues);
+        return std::max(LayoutUnit(0), computedValues.m_extent - borderAndPaddingLogicalHeight() - scrollbarLogicalHeight());
+    }
     return contentLogicalWidth();
 }
 
@@ -613,19 +616,11 @@
     LayoutUnit contentExtent = 0;
     if (!isColumnFlow())
         contentExtent = mainAxisContentExtent();
-    else if (hasOverrideHeight())
-        contentExtent = overrideLogicalContentHeight();
     else {
-        LayoutUnit heightResult = computeContentLogicalHeight(MainOrPreferredSize, style()->logicalHeight());
-        if (heightResult == -1)
-            heightResult = preferredMainAxisExtent;
-        LayoutUnit minHeight = computeContentLogicalHeight(MinSize, style()->logicalMinHeight()); // Leave as -1 if unset.
-        LayoutUnit maxHeight = style()->logicalMaxHeight().isUndefined() ? heightResult : computeContentLogicalHeight(MaxSize, style()->logicalMaxHeight());
-        if (maxHeight == -1)
-            maxHeight = heightResult;
-        heightResult = std::min(maxHeight, heightResult);
-        heightResult = std::max(minHeight, heightResult);
-        contentExtent = heightResult;
+        // FIXME: Refactor to avoid similar code in mainAxisContentExtent().
+        LogicalExtentComputedValues computedValues;
+        computeLogicalHeight(preferredMainAxisExtent, logicalTop(), computedValues);
+        contentExtent = computedValues.m_extent - borderAndPaddingLogicalHeight() - scrollbarLogicalHeight();
     }
 
     return contentExtent - preferredMainAxisExtent;
@@ -801,13 +796,10 @@
     if (!isColumnFlow())
         return mainAxisContentExtent();
 
-    LayoutUnit height = computeContentLogicalHeight(MainOrPreferredSize, style()->logicalHeight());
-    if (height == -1)
-        height = MAX_LAYOUT_UNIT;
-    LayoutUnit maxHeight = computeContentLogicalHeight(MaxSize, style()->logicalMaxHeight());
-    if (maxHeight != -1)
-        height = std::min(height, maxHeight);
-    return height;
+    // FIXME: Refactor to avoid similar code in mainAxisContentExtent().
+    LogicalExtentComputedValues computedValues;
+    computeLogicalHeight(MAX_LAYOUT_UNIT, logicalTop(), computedValues);
+    return computedValues.m_extent - borderAndPaddingLogicalHeight() - scrollbarLogicalHeight();
 }
 
 LayoutUnit RenderFlexibleBox::adjustChildSizeForMinAndMax(RenderBox* child, LayoutUnit childSize, LayoutUnit flexboxAvailableContentExtent)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to