Title: [145937] trunk
Revision
145937
Author
o...@chromium.org
Date
2013-03-15 14:13:46 -0700 (Fri, 15 Mar 2013)

Log Message

Auto height column flexboxes with border and padding are too short
https://bugs.webkit.org/show_bug.cgi?id=112398

Reviewed by Tony Chang.

Source/WebCore:

Test: css3/flexbox/auto-height-column-with-border-and-padding.html

* rendering/RenderFlexibleBox.cpp:
(WebCore::RenderFlexibleBox::mainAxisContentExtent):
computeLogicalHeight expects that you pass in the border-box logicalHeight, not
the contentLogicalHeight. Since we subtract the border, padding and scrollbar height from
the returned m_extent, if we pass in the contentLogicalHeight and the flexbox is auto-sized
then we end up incorrectly subtracting border, padding and scrollbar height from the
contentLogicalHeight.

LayoutTests:

* css3/flexbox/auto-height-column-with-border-and-padding-expected.html: Added.
* css3/flexbox/auto-height-column-with-border-and-padding.html: Added.
* css3/flexbox/resources/flexbox.css:
(.flex-one-one-auto):

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (145936 => 145937)


--- trunk/LayoutTests/ChangeLog	2013-03-15 21:06:25 UTC (rev 145936)
+++ trunk/LayoutTests/ChangeLog	2013-03-15 21:13:46 UTC (rev 145937)
@@ -1,3 +1,15 @@
+2013-03-14  Ojan Vafai  <o...@chromium.org>
+
+        Auto height column flexboxes with border and padding are too short
+        https://bugs.webkit.org/show_bug.cgi?id=112398
+
+        Reviewed by Tony Chang.
+
+        * css3/flexbox/auto-height-column-with-border-and-padding-expected.html: Added.
+        * css3/flexbox/auto-height-column-with-border-and-padding.html: Added.
+        * css3/flexbox/resources/flexbox.css:
+        (.flex-one-one-auto):
+
 2013-03-15  Hajime Morrita  <morr...@google.com>
 
         [Custom Elements] Any HTMLElement subclass should become a superclass of custom element

Added: trunk/LayoutTests/css3/flexbox/auto-height-column-with-border-and-padding-expected.html (0 => 145937)


--- trunk/LayoutTests/css3/flexbox/auto-height-column-with-border-and-padding-expected.html	                        (rev 0)
+++ trunk/LayoutTests/css3/flexbox/auto-height-column-with-border-and-padding-expected.html	2013-03-15 21:13:46 UTC (rev 145937)
@@ -0,0 +1,7 @@
+<!DOCTYPE html>
+Tests that auto-height column flexboxes with border and padding correctly size their height to their content.
+<div style="border: 5px solid salmon; padding: 5px; overflow: scroll">
+    <div>
+        <div style="height: 50px; background-color: pink">
+    <div>
+</div>

Added: trunk/LayoutTests/css3/flexbox/auto-height-column-with-border-and-padding.html (0 => 145937)


--- trunk/LayoutTests/css3/flexbox/auto-height-column-with-border-and-padding.html	                        (rev 0)
+++ trunk/LayoutTests/css3/flexbox/auto-height-column-with-border-and-padding.html	2013-03-15 21:13:46 UTC (rev 145937)
@@ -0,0 +1,8 @@
+<!DOCTYPE html>
+<link href="" rel="stylesheet">
+Tests that auto-height column flexboxes with border and padding correctly size their height to their content.
+<div class="flexbox column" style="border: 5px solid salmon; padding: 5px; overflow: scroll">
+    <div class="flex-one-one-auto" style="min-height: 0">
+        <div style="height: 50px; background-color: pink">
+    <div>
+</div>

Modified: trunk/LayoutTests/css3/flexbox/resources/flexbox.css (145936 => 145937)


--- trunk/LayoutTests/css3/flexbox/resources/flexbox.css	2013-03-15 21:06:25 UTC (rev 145936)
+++ trunk/LayoutTests/css3/flexbox/resources/flexbox.css	2013-03-15 21:13:46 UTC (rev 145937)
@@ -19,6 +19,10 @@
     -webkit-flex: 1;
     flex: 1;
 }
+.flex-one-one-auto {
+    -webkit-flex: 1 1 auto;
+    flex: 1 1 auto;
+}
 
 .row {
     -webkit-flex-direction: row;

Modified: trunk/Source/WebCore/ChangeLog (145936 => 145937)


--- trunk/Source/WebCore/ChangeLog	2013-03-15 21:06:25 UTC (rev 145936)
+++ trunk/Source/WebCore/ChangeLog	2013-03-15 21:13:46 UTC (rev 145937)
@@ -1,3 +1,20 @@
+2013-03-14  Ojan Vafai  <o...@chromium.org>
+
+        Auto height column flexboxes with border and padding are too short
+        https://bugs.webkit.org/show_bug.cgi?id=112398
+
+        Reviewed by Tony Chang.
+
+        Test: css3/flexbox/auto-height-column-with-border-and-padding.html
+
+        * rendering/RenderFlexibleBox.cpp:
+        (WebCore::RenderFlexibleBox::mainAxisContentExtent):
+        computeLogicalHeight expects that you pass in the border-box logicalHeight, not
+        the contentLogicalHeight. Since we subtract the border, padding and scrollbar height from 
+        the returned m_extent, if we pass in the contentLogicalHeight and the flexbox is auto-sized
+        then we end up incorrectly subtracting border, padding and scrollbar height from the
+        contentLogicalHeight.
+
 2013-03-15  Tim Horton  <timothy_hor...@apple.com>
 
         RenderSnapshottedPlugIn can't be a RenderBlock (what if it's display: inline?)

Modified: trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp (145936 => 145937)


--- trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp	2013-03-15 21:06:25 UTC (rev 145936)
+++ trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp	2013-03-15 21:13:46 UTC (rev 145937)
@@ -521,8 +521,11 @@
 {
     if (isColumnFlow()) {
         LogicalExtentComputedValues computedValues;
-        computeLogicalHeight(contentLogicalHeight, logicalTop(), computedValues);
-        return std::max(LayoutUnit(0), computedValues.m_extent - borderAndPaddingLogicalHeight() - scrollbarLogicalHeight());
+        LayoutUnit borderPaddingAndScrollbar = borderAndPaddingLogicalHeight() + scrollbarLogicalHeight();
+        // FIXME: Remove this std:max once we enable saturated layout arithmetic. It's just here to handle overflow.
+        LayoutUnit borderBoxLogicalHeight = std::max(contentLogicalHeight, contentLogicalHeight + borderPaddingAndScrollbar);
+        computeLogicalHeight(borderBoxLogicalHeight, logicalTop(), computedValues);
+        return std::max(LayoutUnit(0), computedValues.m_extent - borderPaddingAndScrollbar);
     }
     return contentLogicalWidth();
 }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to