Changeset 292394 in webkit


Ignore:
Timestamp:
Apr 5, 2022 8:44:42 AM (2 years ago)
Author:
Alan Bujtas
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:

Location:
trunk
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r292386 r292394  
     12022-04-05  Alan Bujtas  <zalan@apple.com>
     2
     3        [CSS-Contain] Add support for contain: inline-size
     4        https://bugs.webkit.org/show_bug.cgi?id=238787
     5
     6        Reviewed by Antti Koivisto.
     7
     8        * TestExpectations:
     9
    1102022-04-05  Cameron McCormack  <heycam@apple.com>
    211
  • trunk/LayoutTests/TestExpectations

    r292386 r292394  
    46374637# CSS containment tests that fail
    46384638imported/w3c/web-platform-tests/css/css-contain/contain-inline-size-bfc-floats-001.html [ ImageOnlyFailure ]
    4639 imported/w3c/web-platform-tests/css/css-contain/contain-inline-size-bfc-floats-002.html [ ImageOnlyFailure ]
    4640 imported/w3c/web-platform-tests/css/css-contain/contain-inline-size-fieldset.html [ ImageOnlyFailure ]
    46414639imported/w3c/web-platform-tests/css/css-contain/contain-inline-size-flex.html [ ImageOnlyFailure ]
    4642 imported/w3c/web-platform-tests/css/css-contain/contain-inline-size-flexitem.html [ ImageOnlyFailure ]
    46434640imported/w3c/web-platform-tests/css/css-contain/contain-inline-size-grid.html [ ImageOnlyFailure ]
    4644 imported/w3c/web-platform-tests/css/css-contain/contain-inline-size-legend.html [ ImageOnlyFailure ]
    4645 imported/w3c/web-platform-tests/css/css-contain/contain-inline-size-multicol.html [ ImageOnlyFailure ]
    4646 imported/w3c/web-platform-tests/css/css-contain/contain-inline-size-regular-container.html [ ImageOnlyFailure ]
    4647 imported/w3c/web-platform-tests/css/css-contain/contain-inline-size-vertical-rl-.html [ ImageOnlyFailure ]
    46484641# webkit-ruby-text
    46494642imported/w3c/web-platform-tests/css/css-contain/contain-layout-017.html [ ImageOnlyFailure ]
  • trunk/LayoutTests/imported/w3c/ChangeLog

    r292382 r292394  
     12022-04-05  Alan Bujtas  <zalan@apple.com>
     2
     3        [CSS-Contain] Add support for contain: inline-size
     4        https://bugs.webkit.org/show_bug.cgi?id=238787
     5
     6        Reviewed by Antti Koivisto.
     7
     8        * web-platform-tests/css/css-contain/parsing/contain-computed-expected.txt:
     9        * web-platform-tests/css/css-contain/parsing/contain-valid-expected.txt:
     10
    1112022-04-05  Nikolaos Mouchtaris  <nmouchtaris@apple.com>
    212
  • trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/parsing/contain-computed-expected.txt

    r287882 r292394  
    1313PASS Property contain value 'size layout paint'
    1414PASS Property contain value 'layout paint'
    15 FAIL Property contain value 'inline-size' assert_true: 'inline-size' is a supported value for contain. expected true got false
    16 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
     15PASS Property contain value 'inline-size'
     16FAIL Property contain value 'inline-size layout style paint' assert_equals: expected "inline-size layout style paint" but got "layout style paint inline-size"
    1717
  • trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/parsing/contain-valid-expected.txt

    r287882 r292394  
    1111PASS e.style['contain'] = "layout style paint" should set the property value
    1212PASS e.style['contain'] = "layout paint style size" should set the property value
    13 FAIL e.style['contain'] = "inline-size" should set the property value assert_not_equals: property should be set got disallowed value ""
    14 FAIL e.style['contain'] = "layout inline-size" should set the property value assert_not_equals: property should be set got disallowed value ""
     13PASS e.style['contain'] = "inline-size" should set the property value
     14PASS e.style['contain'] = "layout inline-size" should set the property value
    1515
  • trunk/Source/WebCore/ChangeLog

    r292393 r292394  
     12022-04-05  Alan Bujtas  <zalan@apple.com>
     2
     3        [CSS-Contain] Add support for contain: inline-size
     4        https://bugs.webkit.org/show_bug.cgi?id=238787
     5
     6        Reviewed by Antti Koivisto.
     7
     8        * css/CSSComputedStyleDeclaration.cpp:
     9        (WebCore::ComputedStyleExtractor::valueForPropertyInStyle):
     10        * css/parser/CSSPropertyParser.cpp:
     11        (WebCore::consumeContain):
     12        * rendering/RenderBlock.cpp:
     13        (WebCore::RenderBlock::computeIntrinsicLogicalWidths const):
     14        (WebCore::RenderBlock::computeBlockPreferredLogicalWidths const):
     15        * rendering/RenderBlockFlow.cpp:
     16        (WebCore::RenderBlockFlow::computeIntrinsicLogicalWidths const):
     17        (WebCore::RenderBlockFlow::computeInlinePreferredLogicalWidths const):
     18        * rendering/RenderBox.cpp:
     19        (WebCore::RenderBox::createsNewFormattingContext const):
     20        (WebCore::RenderBox::establishesIndependentFormattingContext const):
     21        * rendering/RenderBox.h:
     22        * style/StyleBuilderCustom.h:
     23        (WebCore::Style::BuilderCustom::applyValueContain):
     24
    1252022-04-05  Carlos Garcia Campos  <cgarcia@igalia.com>
    226
  • trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp

    r292210 r292394  
    37333733            if (containment & Containment::Paint)
    37343734                list->append(cssValuePool.createIdentifierValue(CSSValuePaint));
     3735            if (containment & Containment::InlineSize)
     3736                list->append(cssValuePool.createIdentifierValue(CSSValueInlineSize));
    37353737            return list;
    37363738        }
  • trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp

    r291244 r292394  
    40334033        return singleValue;
    40344034    auto list = CSSValueList::createSpaceSeparated();
    4035     RefPtr<CSSPrimitiveValue> size, layout, paint, style;
     4035    RefPtr<CSSPrimitiveValue> size, inlineSize, layout, paint, style;
    40364036    while (!range.atEnd()) {
    40374037        switch (range.peek().id()) {
     
    40404040                return nullptr;
    40414041            size = consumeIdent(range);
     4042            break;
     4043        case CSSValueInlineSize:
     4044            if (inlineSize || size)
     4045                return nullptr;
     4046            inlineSize = consumeIdent(range);
    40424047            break;
    40434048        case CSSValueLayout:
     
    40624067    if (size)
    40634068        list->append(size.releaseNonNull());
     4069    if (inlineSize)
     4070        list->append(inlineSize.releaseNonNull());
    40644071    if (layout)
    40654072        list->append(layout.releaseNonNull());
  • trunk/Source/WebCore/rendering/RenderBlock.cpp

    r291992 r292394  
    22432243{
    22442244    ASSERT(!childrenInline());
    2245     if (!shouldApplySizeContainment(*this))
     2245    auto shouldIgnoreDescendantContentForLogicalWidth = shouldApplySizeContainment(*this) || shouldApplyInlineSizeContainment(*this);
     2246    if (!shouldIgnoreDescendantContentForLogicalWidth)
    22462247        computeBlockPreferredLogicalWidths(minLogicalWidth, maxLogicalWidth);
    22472248
     
    22772278void RenderBlock::computeBlockPreferredLogicalWidths(LayoutUnit& minLogicalWidth, LayoutUnit& maxLogicalWidth) const
    22782279{
     2280    ASSERT(!shouldApplyInlineSizeContainment(*this));
     2281
    22792282    const RenderStyle& styleToUse = style();
    22802283    bool nowrap = styleToUse.whiteSpace() == WhiteSpace::NoWrap;
  • trunk/Source/WebCore/rendering/RenderBlockFlow.cpp

    r291946 r292394  
    346346void RenderBlockFlow::computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, LayoutUnit& maxLogicalWidth) const
    347347{
    348     if (!shouldApplySizeContainment(*this)) {
     348    auto shouldIgnoreDescendantContentForLogicalWidth = shouldApplySizeContainment(*this) || shouldApplyInlineSizeContainment(*this);
     349    if (!shouldIgnoreDescendantContentForLogicalWidth) {
    349350        if (childrenInline())
    350351            computeInlinePreferredLogicalWidths(minLogicalWidth, maxLogicalWidth);
     
    41194120void RenderBlockFlow::computeInlinePreferredLogicalWidths(LayoutUnit& minLogicalWidth, LayoutUnit& maxLogicalWidth) const
    41204121{
    4121     // "The inline-axis intrinsic sizes of the principal box are determined as if the element had no content."
    4122     // https://drafts.csswg.org/css-contain-3/#containment-inline-size
    4123     if (shouldApplyInlineSizeContainment(*this))
    4124         return;
     4122    ASSERT(!shouldApplyInlineSizeContainment(*this));
    41254123
    41264124#if ENABLE(LAYOUT_FORMATTING_CONTEXT)
  • trunk/Source/WebCore/style/StyleBuilderCustom.h

    r291956 r292394  
    12991299        case CSSValueSize:
    13001300            containment.add(Containment::Size);
     1301            break;
     1302        case CSSValueInlineSize:
     1303            containment.add(Containment::InlineSize);
    13011304            break;
    13021305        case CSSValueLayout:
Note: See TracChangeset for help on using the changeset viewer.