Title: [274419] trunk
Revision
274419
Author
[email protected]
Date
2021-03-15 06:18:25 -0700 (Mon, 15 Mar 2021)

Log Message

Treat min-intrinsic like *-content
https://bugs.webkit.org/show_bug.cgi?id=222854

Patch by Rob Buis <[email protected]> on 2021-03-15
Reviewed by Sergio Villar Senin.

Source/WebCore:

Treat min-intrinsic like *-content for intrinsic logical
content calculations.

Test: fast/flexbox/indefinite-width-crash.html

* rendering/RenderBox.cpp:
(WebCore::RenderBox::computeIntrinsicLogicalContentHeightUsing const):
(WebCore::RenderBox::computeContentAndScrollbarLogicalHeightUsing const):

LayoutTests:

Add test for this.

* fast/flexbox/indefinite-width-crash-expected.txt: Added.
* fast/flexbox/indefinite-width-crash.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (274418 => 274419)


--- trunk/LayoutTests/ChangeLog	2021-03-15 13:15:44 UTC (rev 274418)
+++ trunk/LayoutTests/ChangeLog	2021-03-15 13:18:25 UTC (rev 274419)
@@ -1,3 +1,15 @@
+2021-03-15  Rob Buis  <[email protected]>
+
+        Treat min-intrinsic like *-content
+        https://bugs.webkit.org/show_bug.cgi?id=222854
+
+        Reviewed by Sergio Villar Senin.
+
+        Add test for this.
+
+        * fast/flexbox/indefinite-width-crash-expected.txt: Added.
+        * fast/flexbox/indefinite-width-crash.html: Added.
+
 2021-03-15  Imanol Fernandez  <[email protected]>
 
         Split WebXR features into enabledFeatures, supportedFeatures and requestedFeatures

Added: trunk/LayoutTests/fast/flexbox/indefinite-width-crash-expected.txt (0 => 274419)


--- trunk/LayoutTests/fast/flexbox/indefinite-width-crash-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/flexbox/indefinite-width-crash-expected.txt	2021-03-15 13:18:25 UTC (rev 274419)
@@ -0,0 +1 @@
+This test should not crash.

Added: trunk/LayoutTests/fast/flexbox/indefinite-width-crash.html (0 => 274419)


--- trunk/LayoutTests/fast/flexbox/indefinite-width-crash.html	                        (rev 0)
+++ trunk/LayoutTests/fast/flexbox/indefinite-width-crash.html	2021-03-15 13:18:25 UTC (rev 274419)
@@ -0,0 +1,21 @@
+<!DOCTYPE html>
+<script>
+  _onload_ = () => {
+    if (window.testRunner) {
+      testRunner.dumpAsText();
+      testRunner.waitUntilDone();
+    }
+    setTimeout(function() { document.write('This test should not crash.'); testRunner.notifyDone(); }, 0);
+  };
+</script>
+<style>
+* {
+    display: flex;
+    flex-direction: column;
+    width: min-intrinsic;
+    writing-mode: vertical-lr;
+}
+</style>
+<body>
+<p>This shouldn't crash.</p>
+</body>

Modified: trunk/Source/WebCore/ChangeLog (274418 => 274419)


--- trunk/Source/WebCore/ChangeLog	2021-03-15 13:15:44 UTC (rev 274418)
+++ trunk/Source/WebCore/ChangeLog	2021-03-15 13:18:25 UTC (rev 274419)
@@ -1,3 +1,19 @@
+2021-03-15  Rob Buis  <[email protected]>
+
+        Treat min-intrinsic like *-content
+        https://bugs.webkit.org/show_bug.cgi?id=222854
+
+        Reviewed by Sergio Villar Senin.
+
+        Treat min-intrinsic like *-content for intrinsic logical
+        content calculations.
+
+        Test: fast/flexbox/indefinite-width-crash.html
+
+        * rendering/RenderBox.cpp:
+        (WebCore::RenderBox::computeIntrinsicLogicalContentHeightUsing const):
+        (WebCore::RenderBox::computeContentAndScrollbarLogicalHeightUsing const):
+
 2021-03-15  Imanol Fernandez  <[email protected]>
 
         Split WebXR features into enabledFeatures, supportedFeatures and requestedFeatures

Modified: trunk/Source/WebCore/rendering/RenderBox.cpp (274418 => 274419)


--- trunk/Source/WebCore/rendering/RenderBox.cpp	2021-03-15 13:15:44 UTC (rev 274418)
+++ trunk/Source/WebCore/rendering/RenderBox.cpp	2021-03-15 13:18:25 UTC (rev 274419)
@@ -3022,10 +3022,8 @@
 {
     // FIXME: The CSS sizing spec is considering changing what min-content/max-content should resolve to.
     // If that happens, this code will have to change.
-    if (logicalHeightLength.isMinContent() || logicalHeightLength.isMaxContent() || logicalHeightLength.isFitContent()) {
-        if (!intrinsicContentHeight)
-            return intrinsicContentHeight;
-        if (style().boxSizing() == BoxSizing::BorderBox)
+    if (logicalHeightLength.isMinContent() || logicalHeightLength.isMaxContent() || logicalHeightLength.isFitContent() || logicalHeightLength.isMinIntrinsic()) {
+        if (intrinsicContentHeight && style().boxSizing() == BoxSizing::BorderBox)
             return intrinsicContentHeight.value() + borderAndPaddingLogicalHeight();
         return intrinsicContentHeight;
     }
@@ -3041,7 +3039,7 @@
         return heightType == MinSize ? Optional<LayoutUnit>(0) : WTF::nullopt;
     // FIXME: The CSS sizing spec is considering changing what min-content/max-content should resolve to.
     // If that happens, this code will have to change.
-    if (height.isIntrinsic())
+    if (height.isIntrinsic() || height.isMinIntrinsic())
         return computeIntrinsicLogicalContentHeightUsing(height, intrinsicContentHeight, borderAndPaddingLogicalHeight());
     if (height.isFixed())
         return LayoutUnit(height.value());
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to