Title: [289995] trunk
Revision
289995
Author
za...@apple.com
Date
2022-02-16 20:23:29 -0800 (Wed, 16 Feb 2022)

Log Message

REGRESSION(r285885) Unable to exit Trip Details in Amtrak app
https://bugs.webkit.org/show_bug.cgi?id=236732
<rdar://87462825>

Reviewed by Simon Fraser.

Source/WebCore:

Starting from r285885 an (effective)”overflow: clip” value is set on any block box with “contain: paint”.
It is supposed to ensure we don’t paint outside of the box’s border box (note that "contain: paint", as the name implies, should only affect painting).

However this effective value trickles in to layout affecting certain layout constraints.
In case of flex, it makes the flex layout think that the box is really a clipped box and it starts flexing it accordingly producing incorrect size.
What it means is that the minimum preferred size ends up being 0px because now with "let's clip all the overflow content"
0px is indeed the smallest size a box could take that does not produce overflow (while with the initial, “overflow: visible” value,
its minimum width would likely be > 0px -provided it has some content. Also note that setting “overflow: clip” on the box in the markup
(so it becomes an explicit clip value and not just an “effective” implicit clip through “contain: paint”) produces
the exact same rendering meaning that this effective property value does affect layout).

This is a partial revert of r285885 (focusing on where the flex algorithm consults with the flex items' overflow values).

Test: fast/flexbox/incorrect-min-size-with-paint-contain.html

* rendering/RenderFlexibleBox.cpp:
(WebCore::RenderFlexibleBox::mainAxisOverflowForChild const):
(WebCore::RenderFlexibleBox::crossAxisOverflowForChild const):

LayoutTests:

* fast/flexbox/incorrect-min-size-with-paint-contain-expected.html: Added.
* fast/flexbox/incorrect-min-size-with-paint-contain.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (289994 => 289995)


--- trunk/LayoutTests/ChangeLog	2022-02-17 03:46:45 UTC (rev 289994)
+++ trunk/LayoutTests/ChangeLog	2022-02-17 04:23:29 UTC (rev 289995)
@@ -1,3 +1,14 @@
+2022-02-16  Alan Bujtas  <za...@apple.com>
+
+        REGRESSION(r285885) Unable to exit Trip Details in Amtrak app
+        https://bugs.webkit.org/show_bug.cgi?id=236732
+        <rdar://87462825>
+
+        Reviewed by Simon Fraser.
+
+        * fast/flexbox/incorrect-min-size-with-paint-contain-expected.html: Added.
+        * fast/flexbox/incorrect-min-size-with-paint-contain.html: Added.
+
 2022-02-16  Matt Woodrow  <mattwood...@apple.com>
 
         Implement getComputedStyle for subgrids

Added: trunk/LayoutTests/fast/flexbox/incorrect-min-size-with-paint-contain-expected.html (0 => 289995)


--- trunk/LayoutTests/fast/flexbox/incorrect-min-size-with-paint-contain-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/flexbox/incorrect-min-size-with-paint-contain-expected.html	2022-02-17 04:23:29 UTC (rev 289995)
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<style>
+div {
+  height: 100px;
+  width: 100px;
+  background-color: green;
+}
+</style>
+<div></div>
\ No newline at end of file

Added: trunk/LayoutTests/fast/flexbox/incorrect-min-size-with-paint-contain.html (0 => 289995)


--- trunk/LayoutTests/fast/flexbox/incorrect-min-size-with-paint-contain.html	                        (rev 0)
+++ trunk/LayoutTests/fast/flexbox/incorrect-min-size-with-paint-contain.html	2022-02-17 04:23:29 UTC (rev 289995)
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<style>
+div {
+  height: 100px;
+  width: 100px;
+}
+.container {
+  display: flex;
+}
+.paintcontain {
+  contain: paint;
+}
+</style>
+<!-- PASS if the green box is visible -->
+<div class=container>
+  <div class=paintcontain><div style="background-color: green;"></div></div>
+  <div><div></div></div>
+</div>
\ No newline at end of file

Modified: trunk/Source/WebCore/ChangeLog (289994 => 289995)


--- trunk/Source/WebCore/ChangeLog	2022-02-17 03:46:45 UTC (rev 289994)
+++ trunk/Source/WebCore/ChangeLog	2022-02-17 04:23:29 UTC (rev 289995)
@@ -1,3 +1,30 @@
+2022-02-16  Alan Bujtas  <za...@apple.com>
+
+        REGRESSION(r285885) Unable to exit Trip Details in Amtrak app
+        https://bugs.webkit.org/show_bug.cgi?id=236732
+        <rdar://87462825>
+
+        Reviewed by Simon Fraser.
+
+        Starting from r285885 an (effective)”overflow: clip” value is set on any block box with “contain: paint”.
+        It is supposed to ensure we don’t paint outside of the box’s border box (note that "contain: paint", as the name implies, should only affect painting).
+
+        However this effective value trickles in to layout affecting certain layout constraints.
+        In case of flex, it makes the flex layout think that the box is really a clipped box and it starts flexing it accordingly producing incorrect size.
+        What it means is that the minimum preferred size ends up being 0px because now with "let's clip all the overflow content"
+        0px is indeed the smallest size a box could take that does not produce overflow (while with the initial, “overflow: visible” value,
+        its minimum width would likely be > 0px -provided it has some content. Also note that setting “overflow: clip” on the box in the markup
+        (so it becomes an explicit clip value and not just an “effective” implicit clip through “contain: paint”) produces
+        the exact same rendering meaning that this effective property value does affect layout).
+
+        This is a partial revert of r285885 (focusing on where the flex algorithm consults with the flex items' overflow values).
+
+        Test: fast/flexbox/incorrect-min-size-with-paint-contain.html
+
+        * rendering/RenderFlexibleBox.cpp:
+        (WebCore::RenderFlexibleBox::mainAxisOverflowForChild const):
+        (WebCore::RenderFlexibleBox::crossAxisOverflowForChild const):
+
 2022-02-16  Per Arne Vollan  <pvol...@apple.com>
 
         Send icons to the WebContent process for rendering of the attachment element

Modified: trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp (289994 => 289995)


--- trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp	2022-02-17 03:46:45 UTC (rev 289994)
+++ trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp	2022-02-17 04:23:29 UTC (rev 289995)
@@ -1916,15 +1916,15 @@
 Overflow RenderFlexibleBox::mainAxisOverflowForChild(const RenderBox& child) const
 {
     if (isHorizontalFlow())
-        return child.effectiveOverflowX();
-    return child.effectiveOverflowY();
+        return child.style().overflowX();
+    return child.style().overflowY();
 }
 
 Overflow RenderFlexibleBox::crossAxisOverflowForChild(const RenderBox& child) const
 {
     if (isHorizontalFlow())
-        return child.effectiveOverflowY();
-    return child.effectiveOverflowX();
+        return child.style().overflowY();
+    return child.style().overflowX();
 }
 
 bool RenderFlexibleBox::childHasPercentHeightDescendants(const RenderBox& renderer) const
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to