Title: [272309] trunk
Revision
272309
Author
[email protected]
Date
2021-02-03 06:04:58 -0800 (Wed, 03 Feb 2021)

Log Message

[css-grid] max-height percentages are wrongly resolved for replaced grid items
https://bugs.webkit.org/show_bug.cgi?id=220733

Patch by Ziran Sun <[email protected]> on 2021-02-03
Reviewed by Manuel Rego Casasnovas.

LayoutTests/imported/w3c:

The following tests are imported from WPT.
* web-platform-tests/css/css-grid/grid-items/grid-img-item-percent-max-height-001-expected.html: Added.
* web-platform-tests/css/css-grid/grid-items/grid-img-item-percent-max-height-001.html: Added.

Source/WebCore:

Make replacedMinMaxLogicalHeightComputesAsNone check the override cb height. If the
override height is indefinite, this function should return true. Otherwise returns false.

This is an import of Chromium changes at
https://chromium-review.googlesource.com/c/chromium/src/+/2100771
and
https://chromium-review.googlesource.com/c/chromium/src/+/2287370.
The Chromium code checks on Quirks mode. In WebKit, this check doesn't seem making any
impact.
Test percentage-max-height-001.html already works in WebKit without this change. Test
percentage-max-height-002.html is not ported as it still doesn't work even with this
change. This change intends to fix the grid bug raised.

Test grid-img-item-percent-max-height-001.html was ported to WPT at
https://github.com/web-platform-tests/wpt/commit/4816b3d70f98777afd1757995af84c3adc67d433

Test: imported/w3c/web-platform-tests/css/css-grid/grid-items/grid-img-item-percent-max-height-001.html

* rendering/RenderBox.cpp:
(WebCore::RenderBox::replacedMinMaxLogicalHeightComputesAsNone const):

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (272308 => 272309)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2021-02-03 14:03:54 UTC (rev 272308)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2021-02-03 14:04:58 UTC (rev 272309)
@@ -1,5 +1,16 @@
 2021-02-03  Ziran Sun  <[email protected]>
 
+        [css-grid] max-height percentages are wrongly resolved for replaced grid items
+        https://bugs.webkit.org/show_bug.cgi?id=220733
+
+        Reviewed by Manuel Rego Casasnovas.
+
+        The following tests are imported from WPT.
+        * web-platform-tests/css/css-grid/grid-items/grid-img-item-percent-max-height-001-expected.html: Added.
+        * web-platform-tests/css/css-grid/grid-items/grid-img-item-percent-max-height-001.html: Added.
+
+2021-02-03  Ziran Sun  <[email protected]>
+
         [css-grid] WPT test css/css-grid/grid-model/grid-box-sizing-001.html fails
         https://bugs.webkit.org/show_bug.cgi?id=204578
 

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/grid-items/grid-img-item-percent-max-height-001-expected.html (0 => 272309)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/grid-items/grid-img-item-percent-max-height-001-expected.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/grid-items/grid-img-item-percent-max-height-001-expected.html	2021-02-03 14:04:58 UTC (rev 272309)
@@ -0,0 +1,4 @@
+<!DOCTYPE html>
+<link rel="author" title="Morten Stenshorne" href=""
+<p>Test passes if there is a filled green square.</p>
+<div style="width:100px; height:100px; background:green;"></div>

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/grid-items/grid-img-item-percent-max-height-001.html (0 => 272309)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/grid-items/grid-img-item-percent-max-height-001.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/grid-items/grid-img-item-percent-max-height-001.html	2021-02-03 14:04:58 UTC (rev 272309)
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Grid Layout Test: % max height of grid items</title>
+<link rel="author" title="David Grogan" href=""
+<link rel="help" href=""
+<link rel="match" href=""
+<meta name="assert" content="% max-height of replaced grid items is respected">
+
+<p>Test passes if there is a filled green square.</p>
+
+<div style="display: grid; grid-template-rows: 200px;">
+  <img src="" style="max-height: 50%;">
+</div>

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/grid-items/w3c-import.log (272308 => 272309)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/grid-items/w3c-import.log	2021-02-03 14:03:54 UTC (rev 272308)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/grid-items/w3c-import.log	2021-02-03 14:04:58 UTC (rev 272309)
@@ -19,6 +19,7 @@
 /LayoutTests/imported/w3c/web-platform-tests/css/css-grid/grid-items/explicitly-sized-grid-item-as-table-expected.html
 /LayoutTests/imported/w3c/web-platform-tests/css/css-grid/grid-items/explicitly-sized-grid-item-as-table.html
 /LayoutTests/imported/w3c/web-platform-tests/css/css-grid/grid-items/grid-automatic-minimum-intrinsic-aspect-ratio-001.html
+/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/grid-items/grid-img-item-percent-max-height-001.html
 /LayoutTests/imported/w3c/web-platform-tests/css/css-grid/grid-items/grid-inline-items-001-expected.xht
 /LayoutTests/imported/w3c/web-platform-tests/css/css-grid/grid-items/grid-inline-items-001.html
 /LayoutTests/imported/w3c/web-platform-tests/css/css-grid/grid-items/grid-inline-items-002-expected.xht

Modified: trunk/Source/WebCore/ChangeLog (272308 => 272309)


--- trunk/Source/WebCore/ChangeLog	2021-02-03 14:03:54 UTC (rev 272308)
+++ trunk/Source/WebCore/ChangeLog	2021-02-03 14:04:58 UTC (rev 272309)
@@ -1,5 +1,33 @@
 2021-02-03  Ziran Sun  <[email protected]>
 
+        [css-grid] max-height percentages are wrongly resolved for replaced grid items
+        https://bugs.webkit.org/show_bug.cgi?id=220733
+
+        Reviewed by Manuel Rego Casasnovas.
+
+        Make replacedMinMaxLogicalHeightComputesAsNone check the override cb height. If the
+        override height is indefinite, this function should return true. Otherwise returns false.
+
+        This is an import of Chromium changes at
+        https://chromium-review.googlesource.com/c/chromium/src/+/2100771
+        and
+        https://chromium-review.googlesource.com/c/chromium/src/+/2287370.
+        The Chromium code checks on Quirks mode. In WebKit, this check doesn't seem making any
+        impact.
+        Test percentage-max-height-001.html already works in WebKit without this change. Test
+        percentage-max-height-002.html is not ported as it still doesn't work even with this 
+        change. This change intends to fix the grid bug raised.
+
+        Test grid-img-item-percent-max-height-001.html was ported to WPT at
+        https://github.com/web-platform-tests/wpt/commit/4816b3d70f98777afd1757995af84c3adc67d433
+
+        Test: imported/w3c/web-platform-tests/css/css-grid/grid-items/grid-img-item-percent-max-height-001.html
+
+        * rendering/RenderBox.cpp:
+        (WebCore::RenderBox::replacedMinMaxLogicalHeightComputesAsNone const):
+
+2021-02-03  Ziran Sun  <[email protected]>
+
         [css-grid][css-flex] <table> grid item should fill the grid area for 'stretch'/'normal' self alignment
         https://bugs.webkit.org/show_bug.cgi?id=191463
 

Modified: trunk/Source/WebCore/rendering/RenderBox.cpp (272308 => 272309)


--- trunk/Source/WebCore/rendering/RenderBox.cpp	2021-02-03 14:03:54 UTC (rev 272308)
+++ trunk/Source/WebCore/rendering/RenderBox.cpp	2021-02-03 14:04:58 UTC (rev 272309)
@@ -3247,6 +3247,9 @@
     if (logicalHeight == initialLogicalHeight)
         return true;
     
+    if (logicalHeight.isPercentOrCalculated() && hasOverridingContainingBlockContentLogicalHeight())
+        return overridingContainingBlockContentLogicalHeight() == LayoutUnit(-1);
+
     // Make sure % min-height and % max-height resolve to none if the containing block has auto height.
     // Note that the "height" case for replaced elements was handled by hasReplacedLogicalHeight, which is why
     // min and max-height are the only ones handled here.
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to