Title: [292394] trunk
Revision
292394
Author
za...@apple.com
Date
2022-04-05 08:44:42 -0700 (Tue, 05 Apr 2022)

Log Message

[CSS-Contain] Add support for contain: inline-size
https://bugs.webkit.org/show_bug.cgi?id=238787

Reviewed by Antti Koivisto.

LayoutTests/imported/w3c:

* web-platform-tests/css/css-contain/parsing/contain-computed-expected.txt:
* web-platform-tests/css/css-contain/parsing/contain-valid-expected.txt:

Source/WebCore:

* css/CSSComputedStyleDeclaration.cpp:
(WebCore::ComputedStyleExtractor::valueForPropertyInStyle):
* css/parser/CSSPropertyParser.cpp:
(WebCore::consumeContain):
* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::computeIntrinsicLogicalWidths const):
(WebCore::RenderBlock::computeBlockPreferredLogicalWidths const):
* rendering/RenderBlockFlow.cpp:
(WebCore::RenderBlockFlow::computeIntrinsicLogicalWidths const):
(WebCore::RenderBlockFlow::computeInlinePreferredLogicalWidths const):
* rendering/RenderBox.cpp:
(WebCore::RenderBox::createsNewFormattingContext const):
(WebCore::RenderBox::establishesIndependentFormattingContext const):
* rendering/RenderBox.h:
* style/StyleBuilderCustom.h:
(WebCore::Style::BuilderCustom::applyValueContain):

LayoutTests:

* TestExpectations:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (292393 => 292394)


--- trunk/LayoutTests/ChangeLog	2022-04-05 13:50:58 UTC (rev 292393)
+++ trunk/LayoutTests/ChangeLog	2022-04-05 15:44:42 UTC (rev 292394)
@@ -1,3 +1,12 @@
+2022-04-05  Alan Bujtas  <za...@apple.com>
+
+        [CSS-Contain] Add support for contain: inline-size
+        https://bugs.webkit.org/show_bug.cgi?id=238787
+
+        Reviewed by Antti Koivisto.
+
+        * TestExpectations:
+
 2022-04-05  Cameron McCormack  <hey...@apple.com>
 
         Skip editing-word-with-marker-1.html

Modified: trunk/LayoutTests/TestExpectations (292393 => 292394)


--- trunk/LayoutTests/TestExpectations	2022-04-05 13:50:58 UTC (rev 292393)
+++ trunk/LayoutTests/TestExpectations	2022-04-05 15:44:42 UTC (rev 292394)
@@ -4636,15 +4636,8 @@
 
 # CSS containment tests that fail
 imported/w3c/web-platform-tests/css/css-contain/contain-inline-size-bfc-floats-001.html [ ImageOnlyFailure ]
-imported/w3c/web-platform-tests/css/css-contain/contain-inline-size-bfc-floats-002.html [ ImageOnlyFailure ]
-imported/w3c/web-platform-tests/css/css-contain/contain-inline-size-fieldset.html [ ImageOnlyFailure ]
 imported/w3c/web-platform-tests/css/css-contain/contain-inline-size-flex.html [ ImageOnlyFailure ]
-imported/w3c/web-platform-tests/css/css-contain/contain-inline-size-flexitem.html [ ImageOnlyFailure ]
 imported/w3c/web-platform-tests/css/css-contain/contain-inline-size-grid.html [ ImageOnlyFailure ]
-imported/w3c/web-platform-tests/css/css-contain/contain-inline-size-legend.html [ ImageOnlyFailure ]
-imported/w3c/web-platform-tests/css/css-contain/contain-inline-size-multicol.html [ ImageOnlyFailure ]
-imported/w3c/web-platform-tests/css/css-contain/contain-inline-size-regular-container.html [ ImageOnlyFailure ]
-imported/w3c/web-platform-tests/css/css-contain/contain-inline-size-vertical-rl-.html [ ImageOnlyFailure ]
 # webkit-ruby-text
 imported/w3c/web-platform-tests/css/css-contain/contain-layout-017.html [ ImageOnlyFailure ]
 imported/w3c/web-platform-tests/css/css-contain/contain-paint-021.html [ ImageOnlyFailure ]

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (292393 => 292394)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2022-04-05 13:50:58 UTC (rev 292393)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2022-04-05 15:44:42 UTC (rev 292394)
@@ -1,3 +1,13 @@
+2022-04-05  Alan Bujtas  <za...@apple.com>
+
+        [CSS-Contain] Add support for contain: inline-size
+        https://bugs.webkit.org/show_bug.cgi?id=238787
+
+        Reviewed by Antti Koivisto.
+
+        * web-platform-tests/css/css-contain/parsing/contain-computed-expected.txt:
+        * web-platform-tests/css/css-contain/parsing/contain-valid-expected.txt:
+
 2022-04-05  Nikolaos Mouchtaris  <nmouchta...@apple.com>
 
         Support rendering url(), CSS basic shapes other than path(), and coord-box for offset-path

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/parsing/contain-computed-expected.txt (292393 => 292394)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/parsing/contain-computed-expected.txt	2022-04-05 13:50:58 UTC (rev 292393)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/parsing/contain-computed-expected.txt	2022-04-05 15:44:42 UTC (rev 292394)
@@ -12,6 +12,6 @@
 PASS Property contain value 'size style layout paint'
 PASS Property contain value 'size layout paint'
 PASS Property contain value 'layout paint'
-FAIL Property contain value 'inline-size' assert_true: 'inline-size' is a supported value for contain. expected true got false
-FAIL Property contain value 'inline-size layout style paint' assert_true: 'inline-size layout style paint' is a supported value for contain. expected true got false
+PASS Property contain value 'inline-size'
+FAIL Property contain value 'inline-size layout style paint' assert_equals: expected "inline-size layout style paint" but got "layout style paint inline-size"
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/parsing/contain-valid-expected.txt (292393 => 292394)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/parsing/contain-valid-expected.txt	2022-04-05 13:50:58 UTC (rev 292393)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/parsing/contain-valid-expected.txt	2022-04-05 15:44:42 UTC (rev 292394)
@@ -10,6 +10,6 @@
 PASS e.style['contain'] = "paint style" should set the property value
 PASS e.style['contain'] = "layout style paint" should set the property value
 PASS e.style['contain'] = "layout paint style size" should set the property value
-FAIL e.style['contain'] = "inline-size" should set the property value assert_not_equals: property should be set got disallowed value ""
-FAIL e.style['contain'] = "layout inline-size" should set the property value assert_not_equals: property should be set got disallowed value ""
+PASS e.style['contain'] = "inline-size" should set the property value
+PASS e.style['contain'] = "layout inline-size" should set the property value
 

Modified: trunk/Source/WebCore/ChangeLog (292393 => 292394)


--- trunk/Source/WebCore/ChangeLog	2022-04-05 13:50:58 UTC (rev 292393)
+++ trunk/Source/WebCore/ChangeLog	2022-04-05 15:44:42 UTC (rev 292394)
@@ -1,3 +1,27 @@
+2022-04-05  Alan Bujtas  <za...@apple.com>
+
+        [CSS-Contain] Add support for contain: inline-size
+        https://bugs.webkit.org/show_bug.cgi?id=238787
+
+        Reviewed by Antti Koivisto.
+
+        * css/CSSComputedStyleDeclaration.cpp:
+        (WebCore::ComputedStyleExtractor::valueForPropertyInStyle):
+        * css/parser/CSSPropertyParser.cpp:
+        (WebCore::consumeContain):
+        * rendering/RenderBlock.cpp:
+        (WebCore::RenderBlock::computeIntrinsicLogicalWidths const):
+        (WebCore::RenderBlock::computeBlockPreferredLogicalWidths const):
+        * rendering/RenderBlockFlow.cpp:
+        (WebCore::RenderBlockFlow::computeIntrinsicLogicalWidths const):
+        (WebCore::RenderBlockFlow::computeInlinePreferredLogicalWidths const):
+        * rendering/RenderBox.cpp:
+        (WebCore::RenderBox::createsNewFormattingContext const):
+        (WebCore::RenderBox::establishesIndependentFormattingContext const):
+        * rendering/RenderBox.h:
+        * style/StyleBuilderCustom.h:
+        (WebCore::Style::BuilderCustom::applyValueContain):
+
 2022-04-05  Carlos Garcia Campos  <cgar...@igalia.com>
 
         [GStreamer] GstCapsForeachFunc returns a gboolean

Modified: trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp (292393 => 292394)


--- trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp	2022-04-05 13:50:58 UTC (rev 292393)
+++ trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp	2022-04-05 15:44:42 UTC (rev 292394)
@@ -3732,6 +3732,8 @@
                 list->append(cssValuePool.createIdentifierValue(CSSValueStyle));
             if (containment & Containment::Paint)
                 list->append(cssValuePool.createIdentifierValue(CSSValuePaint));
+            if (containment & Containment::InlineSize)
+                list->append(cssValuePool.createIdentifierValue(CSSValueInlineSize));
             return list;
         }
         case CSSPropertyContainer: {

Modified: trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp (292393 => 292394)


--- trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp	2022-04-05 13:50:58 UTC (rev 292393)
+++ trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp	2022-04-05 15:44:42 UTC (rev 292394)
@@ -4032,7 +4032,7 @@
     if (auto singleValue = consumeIdent<CSSValueNone, CSSValueStrict, CSSValueContent>(range))
         return singleValue;
     auto list = CSSValueList::createSpaceSeparated();
-    RefPtr<CSSPrimitiveValue> size, layout, paint, style;
+    RefPtr<CSSPrimitiveValue> size, inlineSize, layout, paint, style;
     while (!range.atEnd()) {
         switch (range.peek().id()) {
         case CSSValueSize:
@@ -4040,6 +4040,11 @@
                 return nullptr;
             size = consumeIdent(range);
             break;
+        case CSSValueInlineSize:
+            if (inlineSize || size)
+                return nullptr;
+            inlineSize = consumeIdent(range);
+            break;
         case CSSValueLayout:
             if (layout)
                 return nullptr;
@@ -4061,6 +4066,8 @@
     }
     if (size)
         list->append(size.releaseNonNull());
+    if (inlineSize)
+        list->append(inlineSize.releaseNonNull());
     if (layout)
         list->append(layout.releaseNonNull());
     if (style)

Modified: trunk/Source/WebCore/rendering/RenderBlock.cpp (292393 => 292394)


--- trunk/Source/WebCore/rendering/RenderBlock.cpp	2022-04-05 13:50:58 UTC (rev 292393)
+++ trunk/Source/WebCore/rendering/RenderBlock.cpp	2022-04-05 15:44:42 UTC (rev 292394)
@@ -2242,7 +2242,8 @@
 void RenderBlock::computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, LayoutUnit& maxLogicalWidth) const
 {
     ASSERT(!childrenInline());
-    if (!shouldApplySizeContainment(*this))
+    auto shouldIgnoreDescendantContentForLogicalWidth = shouldApplySizeContainment(*this) || shouldApplyInlineSizeContainment(*this);
+    if (!shouldIgnoreDescendantContentForLogicalWidth)
         computeBlockPreferredLogicalWidths(minLogicalWidth, maxLogicalWidth);
 
     maxLogicalWidth = std::max(minLogicalWidth, maxLogicalWidth);
@@ -2276,6 +2277,8 @@
 
 void RenderBlock::computeBlockPreferredLogicalWidths(LayoutUnit& minLogicalWidth, LayoutUnit& maxLogicalWidth) const
 {
+    ASSERT(!shouldApplyInlineSizeContainment(*this));
+
     const RenderStyle& styleToUse = style();
     bool nowrap = styleToUse.whiteSpace() == WhiteSpace::NoWrap;
 

Modified: trunk/Source/WebCore/rendering/RenderBlockFlow.cpp (292393 => 292394)


--- trunk/Source/WebCore/rendering/RenderBlockFlow.cpp	2022-04-05 13:50:58 UTC (rev 292393)
+++ trunk/Source/WebCore/rendering/RenderBlockFlow.cpp	2022-04-05 15:44:42 UTC (rev 292394)
@@ -345,7 +345,8 @@
 
 void RenderBlockFlow::computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, LayoutUnit& maxLogicalWidth) const
 {
-    if (!shouldApplySizeContainment(*this)) {
+    auto shouldIgnoreDescendantContentForLogicalWidth = shouldApplySizeContainment(*this) || shouldApplyInlineSizeContainment(*this);
+    if (!shouldIgnoreDescendantContentForLogicalWidth) {
         if (childrenInline())
             computeInlinePreferredLogicalWidths(minLogicalWidth, maxLogicalWidth);
         else
@@ -4118,10 +4119,7 @@
 
 void RenderBlockFlow::computeInlinePreferredLogicalWidths(LayoutUnit& minLogicalWidth, LayoutUnit& maxLogicalWidth) const
 {
-    // "The inline-axis intrinsic sizes of the principal box are determined as if the element had no content."
-    // https://drafts.csswg.org/css-contain-3/#containment-inline-size
-    if (shouldApplyInlineSizeContainment(*this))
-        return;
+    ASSERT(!shouldApplyInlineSizeContainment(*this));
 
 #if ENABLE(LAYOUT_FORMATTING_CONTEXT)
     if (const_cast<RenderBlockFlow&>(*this).tryComputePreferredWidthsUsingModernPath(minLogicalWidth, maxLogicalWidth))

Modified: trunk/Source/WebCore/style/StyleBuilderCustom.h (292393 => 292394)


--- trunk/Source/WebCore/style/StyleBuilderCustom.h	2022-04-05 13:50:58 UTC (rev 292393)
+++ trunk/Source/WebCore/style/StyleBuilderCustom.h	2022-04-05 15:44:42 UTC (rev 292394)
@@ -1299,6 +1299,9 @@
         case CSSValueSize:
             containment.add(Containment::Size);
             break;
+        case CSSValueInlineSize:
+            containment.add(Containment::InlineSize);
+            break;
         case CSSValueLayout:
             containment.add(Containment::Layout);
             break;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to