Title: [280530] trunk
Revision
280530
Author
za...@apple.com
Date
2021-08-02 08:38:53 -0700 (Mon, 02 Aug 2021)

Log Message

REGRESSION (r273072): Images do not layout correctly on walmart.com/grocery
https://bugs.webkit.org/show_bug.cgi?id=228656
<rdar://80418083>

Reviewed by Sergio Villar Senin.

Source/WebCore:

Take the min/max values into account when computing the definite size (https://drafts.csswg.org/css-sizing-3/#definite)
for the flex child.

Test: fast/flexbox/flex-with-min-max-height.html

* rendering/RenderFlexibleBox.cpp:
(WebCore::RenderFlexibleBox::computeCrossSizeForChildUsingContainerCrossSize const):

LayoutTests:

* fast/flexbox/flex-with-min-max-height-expected.html: Added.
* fast/flexbox/flex-with-min-max-height.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (280529 => 280530)


--- trunk/LayoutTests/ChangeLog	2021-08-02 14:43:14 UTC (rev 280529)
+++ trunk/LayoutTests/ChangeLog	2021-08-02 15:38:53 UTC (rev 280530)
@@ -1,3 +1,14 @@
+2021-08-02  Alan Bujtas  <za...@apple.com>
+
+        REGRESSION (r273072): Images do not layout correctly on walmart.com/grocery
+        https://bugs.webkit.org/show_bug.cgi?id=228656
+        <rdar://80418083>
+
+        Reviewed by Sergio Villar Senin.
+
+        * fast/flexbox/flex-with-min-max-height-expected.html: Added.
+        * fast/flexbox/flex-with-min-max-height.html: Added.
+
 2021-08-02  Andres Gonzalez  <andresg...@apple.com>
 
         Fix for [WebAccessibilityObjectWrapper lineRectsAndText] to properly handle replacement nodes and SVG text.

Added: trunk/LayoutTests/fast/flexbox/flex-with-min-max-height-expected.html (0 => 280530)


--- trunk/LayoutTests/fast/flexbox/flex-with-min-max-height-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/flexbox/flex-with-min-max-height-expected.html	2021-08-02 15:38:53 UTC (rev 280530)
@@ -0,0 +1,8 @@
+<style>
+img {
+  height: 50px;
+}
+</style>
+<div><img src=""
+<div><img src=""
+<div><img src=""

Added: trunk/LayoutTests/fast/flexbox/flex-with-min-max-height.html (0 => 280530)


--- trunk/LayoutTests/fast/flexbox/flex-with-min-max-height.html	                        (rev 0)
+++ trunk/LayoutTests/fast/flexbox/flex-with-min-max-height.html	2021-08-02 15:38:53 UTC (rev 280530)
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<style>
+div {
+  display: flex;
+  height: 0px;
+}
+</style>
+<div style="min-height: 50px"><img src=""
+<div style="min-height: 50px; max-height: 10px"><img src=""
+<div style="min-height: 50px; max-height: 100px"><img src=""
+<div style="max-height: 10px"><img src=""

Modified: trunk/LayoutTests/platform/ios/TestExpectations (280529 => 280530)


--- trunk/LayoutTests/platform/ios/TestExpectations	2021-08-02 14:43:14 UTC (rev 280529)
+++ trunk/LayoutTests/platform/ios/TestExpectations	2021-08-02 15:38:53 UTC (rev 280530)
@@ -2488,6 +2488,7 @@
 webkit.org/b/211891 imported/w3c/web-platform-tests/css/css-flexbox/flexbox-align-self-vert-004.xhtml [ ImageOnlyFailure ]
 webkit.org/b/211891 imported/w3c/web-platform-tests/css/css-flexbox/flexbox-align-self-vert-rtl-001.xhtml [ ImageOnlyFailure ]
 webkit.org/b/211891 imported/w3c/web-platform-tests/css/css-flexbox/flexbox-align-self-vert-rtl-002.xhtml [ ImageOnlyFailure ]
+webkit.org/b/211891 fast/flexbox/flex-with-min-max-height.html [ ImageOnlyFailure ]
 
 # min-width: auto issues.
 webkit.org/b/221600 imported/w3c/web-platform-tests/css/css-flexbox/flexbox-min-width-auto-003.html [ ImageOnlyFailure ]

Modified: trunk/Source/WebCore/ChangeLog (280529 => 280530)


--- trunk/Source/WebCore/ChangeLog	2021-08-02 14:43:14 UTC (rev 280529)
+++ trunk/Source/WebCore/ChangeLog	2021-08-02 15:38:53 UTC (rev 280530)
@@ -1,3 +1,19 @@
+2021-08-02  Alan Bujtas  <za...@apple.com>
+
+        REGRESSION (r273072): Images do not layout correctly on walmart.com/grocery
+        https://bugs.webkit.org/show_bug.cgi?id=228656
+        <rdar://80418083>
+
+        Reviewed by Sergio Villar Senin.
+
+        Take the min/max values into account when computing the definite size (https://drafts.csswg.org/css-sizing-3/#definite)
+        for the flex child.
+
+        Test: fast/flexbox/flex-with-min-max-height.html
+
+        * rendering/RenderFlexibleBox.cpp:
+        (WebCore::RenderFlexibleBox::computeCrossSizeForChildUsingContainerCrossSize const):
+
 2021-08-02  Andres Gonzalez  <andresg...@apple.com>
 
         Fix for [WebAccessibilityObjectWrapper lineRectsAndText] to properly handle replacement nodes and SVG text.

Modified: trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp (280529 => 280530)


--- trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp	2021-08-02 14:43:14 UTC (rev 280529)
+++ trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp	2021-08-02 15:38:53 UTC (rev 280530)
@@ -1630,10 +1630,25 @@
 // This refers to https://drafts.csswg.org/css-flexbox-1/#definite-sizes, section 1).
 LayoutUnit RenderFlexibleBox::computeCrossSizeForChildUsingContainerCrossSize(const RenderBox& child) const
 {
-    auto containerCrossSizeLength = isHorizontalFlow() ? style().height() : style().width();
     // Keep this sync'ed with childCrossSizeShouldUseContainerCrossSize().
-    ASSERT(containerCrossSizeLength.isFixed());
-    return std::max(0_lu, valueForLength(containerCrossSizeLength, -1_lu) - crossAxisMarginExtentForChild(child));
+    auto definiteSizeValue = [&] {
+        // Let's compute the definite size value for the flex item (value that we can resolve without running layout).
+        auto isHorizontal = isHorizontalFlow();
+        auto size = isHorizontal ? style().height() : style().width();
+        ASSERT(size.isFixed());
+        auto definiteValue = LayoutUnit { size.value() };
+
+        auto maximumSize = isHorizontal ? style().maxHeight() : style().maxWidth();
+        if (maximumSize.isFixed())
+            definiteValue = std::min(definiteValue, LayoutUnit { maximumSize.value() });
+
+        auto minimumSize = isHorizontal ? style().minHeight() : style().minWidth();
+        if (minimumSize.isFixed())
+            definiteValue = std::max(definiteValue, LayoutUnit { minimumSize.value() });
+
+        return definiteValue;
+    };
+    return std::max(0_lu, definiteSizeValue() - crossAxisMarginExtentForChild(child));
 }
 
 void RenderFlexibleBox::prepareChildForPositionedLayout(RenderBox& child)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to