Title: [194030] trunk
Revision
194030
Author
[email protected]
Date
2015-12-14 02:06:08 -0800 (Mon, 14 Dec 2015)

Log Message

[css-grid] Fix height computation of grid items with borders
https://bugs.webkit.org/show_bug.cgi?id=151800

Reviewed by Darin Adler.

Source/WebCore:

When computing the logical height of grid items for the
default "min-height: auto;" case we were constraning the
min-content size using constrainLogicalHeightByMinMax()
instead of constrainContentLogicalHeightByMinMax(). The
problem of using the former is that we were adding the borders
twice.

Test: fast/css-grid-layout/grid-item-with-border-in-intrinsic.html

* rendering/RenderBox.cpp:
(WebCore::RenderBox::computeLogicalHeight):

LayoutTests:

* fast/css-grid-layout/grid-item-with-border-in-intrinsic-expected.txt: Added.
* fast/css-grid-layout/grid-item-with-border-in-intrinsic.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (194029 => 194030)


--- trunk/LayoutTests/ChangeLog	2015-12-14 07:24:01 UTC (rev 194029)
+++ trunk/LayoutTests/ChangeLog	2015-12-14 10:06:08 UTC (rev 194030)
@@ -1,3 +1,13 @@
+2015-12-14  Sergio Villar Senin  <[email protected]>
+
+        [css-grid] Fix height computation of grid items with borders
+        https://bugs.webkit.org/show_bug.cgi?id=151800
+
+        Reviewed by Darin Adler.
+
+        * fast/css-grid-layout/grid-item-with-border-in-intrinsic-expected.txt: Added.
+        * fast/css-grid-layout/grid-item-with-border-in-intrinsic.html: Added.
+
 2015-12-13  Zalan Bujtas  <[email protected]>
 
         Clean up absolute positioned map properly.

Added: trunk/LayoutTests/fast/css-grid-layout/grid-item-with-border-in-intrinsic-expected.txt (0 => 194030)


--- trunk/LayoutTests/fast/css-grid-layout/grid-item-with-border-in-intrinsic-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/css-grid-layout/grid-item-with-border-in-intrinsic-expected.txt	2015-12-14 10:06:08 UTC (rev 194030)
@@ -0,0 +1,8 @@
+X
+PASS
+X
+PASS
+X
+PASS
+X
+PASS
Property changes on: trunk/LayoutTests/fast/css-grid-layout/grid-item-with-border-in-intrinsic-expected.txt
___________________________________________________________________

Added: svn:eol-style

Added: trunk/LayoutTests/fast/css-grid-layout/grid-item-with-border-in-intrinsic.html (0 => 194030)


--- trunk/LayoutTests/fast/css-grid-layout/grid-item-with-border-in-intrinsic.html	                        (rev 0)
+++ trunk/LayoutTests/fast/css-grid-layout/grid-item-with-border-in-intrinsic.html	2015-12-14 10:06:08 UTC (rev 194030)
@@ -0,0 +1,47 @@
+<!DOCTYPE html>
+
+<style>
+.grid {
+    display: -webkit-grid;
+    font: 50px/1 Ahem;
+    border: 5px dashed magenta;
+    width: 150px;
+    height: 150px;
+}
+.item {
+    border: 50px solid rgba(0, 255, 250, 0.5);
+}
+.gridFR {
+    -webkit-grid: 1fr / 1fr;
+}
+.gridMaxContent {
+    -webkit-grid: -webkit-max-content / -webkit-max-content;
+}
+.gridMinContent {
+    -webkit-grid: -webkit-min-content / -webkit-min-content;
+}
+.gridAuto {
+    -webkit-grid: auto / auto;
+}
+</style>
+<script src=""
+
+<body _onload_="checkLayout('.grid')">
+
+<div class="grid gridFR" data-expected-width="160" data-expected-height="160" data-expected-client-width="150" data-expected-client-height="150">
+    <div class="item" data-expected-width="150" data-expected-height="150" data-expected-client-width="50" data-expected-client-height="50">X</div>
+</div>
+
+<div class="grid gridMinContent" data-expected-width="160" data-expected-height="160" data-expected-client-width="150" data-expected-client-height="150">
+    <div class="item" data-expected-width="150" data-expected-height="150" data-expected-client-width="50" data-expected-client-height="50">X</div>
+</div>
+
+<div class="grid gridMaxContent" data-expected-width="160" data-expected-height="160" data-expected-client-width="150" data-expected-client-height="150">
+    <div class="item" data-expected-width="150" data-expected-height="150" data-expected-client-width="50" data-expected-client-height="50">X</div>
+</div>
+
+<div class="grid gridAuto" data-expected-width="160" data-expected-height="160" data-expected-client-width="150" data-expected-client-height="150">
+    <div class="item" data-expected-width="150" data-expected-height="150" data-expected-client-width="50" data-expected-client-height="50">X</div>
+</div>
+
+</body>
Property changes on: trunk/LayoutTests/fast/css-grid-layout/grid-item-with-border-in-intrinsic.html
___________________________________________________________________

Added: svn:mime-type

Added: svn:eol-style

Modified: trunk/Source/WebCore/ChangeLog (194029 => 194030)


--- trunk/Source/WebCore/ChangeLog	2015-12-14 07:24:01 UTC (rev 194029)
+++ trunk/Source/WebCore/ChangeLog	2015-12-14 10:06:08 UTC (rev 194030)
@@ -1,3 +1,22 @@
+2015-12-14  Sergio Villar Senin  <[email protected]>
+
+        [css-grid] Fix height computation of grid items with borders
+        https://bugs.webkit.org/show_bug.cgi?id=151800
+
+        Reviewed by Darin Adler.
+
+        When computing the logical height of grid items for the
+        default "min-height: auto;" case we were constraning the
+        min-content size using constrainLogicalHeightByMinMax()
+        instead of constrainContentLogicalHeightByMinMax(). The
+        problem of using the former is that we were adding the borders
+        twice.
+
+        Test: fast/css-grid-layout/grid-item-with-border-in-intrinsic.html
+
+        * rendering/RenderBox.cpp:
+        (WebCore::RenderBox::computeLogicalHeight):
+
 2015-12-13  Tim Horton  <[email protected]>
 
         Adopt CGIOSurfaceContextCreateImageReference to avoid unnecessary readback

Modified: trunk/Source/WebCore/rendering/RenderBox.cpp (194029 => 194030)


--- trunk/Source/WebCore/rendering/RenderBox.cpp	2015-12-14 07:24:01 UTC (rev 194029)
+++ trunk/Source/WebCore/rendering/RenderBox.cpp	2015-12-14 10:06:08 UTC (rev 194030)
@@ -2786,7 +2786,7 @@
             if (parent()->isRenderGrid() && style().logicalHeight().isAuto() && style().logicalMinHeight().isAuto() && style().overflowX() == OVISIBLE) {
                 LayoutUnit intrinsicContentHeight = computedValues.m_extent - borderAndPaddingLogicalHeight();
                 if (auto minContentHeight = computeContentLogicalHeight(MinSize, Length(MinContent), intrinsicContentHeight))
-                    contentHeight = std::max(contentHeight, constrainLogicalHeightByMinMax(minContentHeight.value(), intrinsicContentHeight));
+                    contentHeight = std::max(contentHeight, constrainContentBoxLogicalHeightByMinMax(minContentHeight.value(), intrinsicContentHeight));
             }
 #endif
             h = Length(contentHeight, Fixed);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to