Title: [290706] trunk
Revision
290706
Author
za...@apple.com
Date
2022-03-01 15:59:50 -0800 (Tue, 01 Mar 2022)

Log Message

REGRESSION(r285232) https://alvaromontoro.github.io/almond.css/demo/ looks wrong in Safari, ok in Chrome and Firefox
https://bugs.webkit.org/show_bug.cgi?id=237276
<rdar://problem/89566459>

Reviewed by Simon Fraser.

Source/WebCore:

r285232 introduced the isFixed() check as a resolvable preferred width type, but percent values are also resolvable as
block layout gets the horizontal constraint from the containing block chain (unlike the height percent values) -i.e. 'width: 50%' can be resolved during preferred width computation.

Test: fast/css-grid-layout/ascpect-ratio-with-percent-width.html

* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::availableLogicalHeightForPercentageComputation const):

LayoutTests:

* fast/css-grid-layout/ascpect-ratio-with-percent-width-expected.html: Added.
* fast/css-grid-layout/ascpect-ratio-with-percent-width.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (290705 => 290706)


--- trunk/LayoutTests/ChangeLog	2022-03-01 23:51:26 UTC (rev 290705)
+++ trunk/LayoutTests/ChangeLog	2022-03-01 23:59:50 UTC (rev 290706)
@@ -1,3 +1,14 @@
+2022-03-01  Alan Bujtas  <za...@apple.com>
+
+        REGRESSION(r285232) https://alvaromontoro.github.io/almond.css/demo/ looks wrong in Safari, ok in Chrome and Firefox
+        https://bugs.webkit.org/show_bug.cgi?id=237276
+        <rdar://problem/89566459>
+
+        Reviewed by Simon Fraser.
+
+        * fast/css-grid-layout/ascpect-ratio-with-percent-width-expected.html: Added.
+        * fast/css-grid-layout/ascpect-ratio-with-percent-width.html: Added.
+
 2022-03-01  Said Abou-Hallawa  <s...@apple.com>
 
         [macOS][REGRESSION] (rr289518): Form controls are scaled twice on Retina display

Added: trunk/LayoutTests/fast/css-grid-layout/ascpect-ratio-with-percent-width-expected.html (0 => 290706)


--- trunk/LayoutTests/fast/css-grid-layout/ascpect-ratio-with-percent-width-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/css-grid-layout/ascpect-ratio-with-percent-width-expected.html	2022-03-01 23:59:50 UTC (rev 290706)
@@ -0,0 +1,17 @@
+<style>
+div {
+  display: grid;
+  place-items: center;
+
+  width: 200px;
+  height: 200px;
+
+  border: solid;
+  background-color: cyan;
+  
+  font-family: Ahem;
+  font-size: 20px;
+}
+</style>
+<!-- PASS if the text content is centered both horizontally and vertically -->
+<div>centered</div>
\ No newline at end of file

Added: trunk/LayoutTests/fast/css-grid-layout/ascpect-ratio-with-percent-width.html (0 => 290706)


--- trunk/LayoutTests/fast/css-grid-layout/ascpect-ratio-with-percent-width.html	                        (rev 0)
+++ trunk/LayoutTests/fast/css-grid-layout/ascpect-ratio-with-percent-width.html	2022-03-01 23:59:50 UTC (rev 290706)
@@ -0,0 +1,21 @@
+<style>
+.container {
+  width: 200px;
+  border: solid;
+}
+
+.grid {
+  display: grid;
+  place-items: center;
+
+  width: 100%;
+  aspect-ratio: 1;
+
+  background-color: cyan;
+  
+  font-family: Ahem;
+  font-size: 20px;
+}
+</style>
+<!-- PASS if the text content is centered both horizontally and vertically -->
+<div class=container><div class=grid>centered</div></div>
\ No newline at end of file

Modified: trunk/Source/WebCore/ChangeLog (290705 => 290706)


--- trunk/Source/WebCore/ChangeLog	2022-03-01 23:51:26 UTC (rev 290705)
+++ trunk/Source/WebCore/ChangeLog	2022-03-01 23:59:50 UTC (rev 290706)
@@ -1,3 +1,19 @@
+2022-03-01  Alan Bujtas  <za...@apple.com>
+
+        REGRESSION(r285232) https://alvaromontoro.github.io/almond.css/demo/ looks wrong in Safari, ok in Chrome and Firefox
+        https://bugs.webkit.org/show_bug.cgi?id=237276
+        <rdar://problem/89566459>
+
+        Reviewed by Simon Fraser.
+
+        r285232 introduced the isFixed() check as a resolvable preferred width type, but percent values are also resolvable as
+        block layout gets the horizontal constraint from the containing block chain (unlike the height percent values) -i.e. 'width: 50%' can be resolved during preferred width computation.
+
+        Test: fast/css-grid-layout/ascpect-ratio-with-percent-width.html
+
+        * rendering/RenderBlock.cpp:
+        (WebCore::RenderBlock::availableLogicalHeightForPercentageComputation const):
+
 2022-03-01  Michael Catanzaro  <mcatanz...@gnome.org>
 
         Misc compiler warnings, late Feb 2022 edition

Modified: trunk/Source/WebCore/rendering/RenderBlock.cpp (290705 => 290706)


--- trunk/Source/WebCore/rendering/RenderBlock.cpp	2022-03-01 23:51:26 UTC (rev 290705)
+++ trunk/Source/WebCore/rendering/RenderBlock.cpp	2022-03-01 23:59:50 UTC (rev 290706)
@@ -3184,7 +3184,7 @@
         availableHeight = std::max(0_lu, constrainContentBoxLogicalHeightByMinMax(contentBoxHeight - scrollbarLogicalHeight(), std::nullopt));
     } else if (shouldComputeLogicalHeightFromAspectRatio()) {
         // Only grid is expected to be in a state where it is calculating pref width and having unknown logical width.
-        if (isRenderGrid() && preferredLogicalWidthsDirty() && !style().logicalWidth().isFixed())
+        if (isRenderGrid() && preferredLogicalWidthsDirty() && !style().logicalWidth().isSpecified())
             return availableHeight;
         availableHeight = blockSizeFromAspectRatio(horizontalBorderAndPaddingExtent(), verticalBorderAndPaddingExtent(), LayoutUnit(style().logicalAspectRatio()), style().boxSizingForAspectRatio(), logicalWidth());
     } else if (isOutOfFlowPositionedWithSpecifiedHeight) {
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to