| Differences between
and this patch
- a/Source/WebCore/ChangeLog +37 lines
Lines 1-3 a/Source/WebCore/ChangeLog_sec1
1
2021-06-07  Rob Buis  <rbuis@igalia.com>
2
3
        [css-contain] Support contain:style
4
        https://bugs.webkit.org/show_bug.cgi?id=226458
5
6
        Reviewed by NOBODY (OOPS!).
7
8
        Parse contain: style and use it (if set) to scope
9
        counter-increment to the element's sub-tree [1].
10
11
        Tests: imported/w3c/web-platform-tests/css/css-contain/contain-style-counters-001.html
12
               imported/w3c/web-platform-tests/css/css-contain/contain-style-counters-002.html
13
               imported/w3c/web-platform-tests/css/css-contain/contain-style-counters-003.html
14
               imported/w3c/web-platform-tests/css/css-contain/contain-style-counters-004.html
15
16
        [1] https://drafts.csswg.org/css-contain-2/#containment-style
17
18
        * css/CSSComputedStyleDeclaration.cpp:
19
        (WebCore::ComputedStyleExtractor::valueForPropertyInStyle):
20
        * css/parser/CSSPropertyParser.cpp:
21
        (WebCore::consumeContain):
22
        * rendering/RenderCounter.cpp:
23
        (WebCore::ancestorStyleContainmentObject):
24
        (WebCore::previousInPreOrder):
25
        (WebCore::previousSiblingOrParentElement):
26
        (WebCore::findPlaceForCounter):
27
        (WebCore::makeCounterNode):
28
        (WebCore::RenderCounter::rendererSubtreeAttached):
29
        * rendering/RenderObject.cpp:
30
        (WebCore::shouldApplyStyleContainment):
31
        * rendering/RenderObject.h:
32
        * rendering/style/RenderStyle.h:
33
        (WebCore::RenderStyle::containsStyle const):
34
        * rendering/style/RenderStyleConstants.h:
35
        * style/StyleBuilderCustom.h:
36
        (WebCore::Style::BuilderCustom::applyValueContain):
37
1
2021-06-07  Alicia Boya García  <aboya@igalia.com>
38
2021-06-07  Alicia Boya García  <aboya@igalia.com>
2
39
3
        [GStreamer] Add clang TSA annotations: MainThreadNotifier
40
        [GStreamer] Add clang TSA annotations: MainThreadNotifier
- a/Source/WebCore/css/CSSComputedStyleDeclaration.cpp +2 lines
Lines 3493-3498 RefPtr<CSSValue> ComputedStyleExtractor::valueForPropertyInStyle(const RenderSty a/Source/WebCore/css/CSSComputedStyleDeclaration.cpp_sec1
3493
                list->append(cssValuePool.createIdentifierValue(CSSValueSize));
3493
                list->append(cssValuePool.createIdentifierValue(CSSValueSize));
3494
            if (containment & Containment::Layout)
3494
            if (containment & Containment::Layout)
3495
                list->append(cssValuePool.createIdentifierValue(CSSValueLayout));
3495
                list->append(cssValuePool.createIdentifierValue(CSSValueLayout));
3496
            if (containment & Containment::Style)
3497
                list->append(cssValuePool.createIdentifierValue(CSSValueStyle));
3496
            if (containment & Containment::Paint)
3498
            if (containment & Containment::Paint)
3497
                list->append(cssValuePool.createIdentifierValue(CSSValuePaint));
3499
                list->append(cssValuePool.createIdentifierValue(CSSValuePaint));
3498
            return list;
3500
            return list;
- a/Source/WebCore/css/parser/CSSPropertyParser.cpp -1 / +8 lines
Lines 3837-3843 static RefPtr<CSSValue> consumeContain(CSSParserTokenRange& range) a/Source/WebCore/css/parser/CSSPropertyParser.cpp_sec1
3837
    if (auto singleValue = consumeIdent<CSSValueNone, CSSValueStrict, CSSValueContent>(range))
3837
    if (auto singleValue = consumeIdent<CSSValueNone, CSSValueStrict, CSSValueContent>(range))
3838
        return singleValue;
3838
        return singleValue;
3839
    auto list = CSSValueList::createSpaceSeparated();
3839
    auto list = CSSValueList::createSpaceSeparated();
3840
    RefPtr<CSSPrimitiveValue> size, layout, paint;
3840
    RefPtr<CSSPrimitiveValue> size, layout, paint, style;
3841
    while (!range.atEnd()) {
3841
    while (!range.atEnd()) {
3842
        switch (range.peek().id()) {
3842
        switch (range.peek().id()) {
3843
        case CSSValueSize:
3843
        case CSSValueSize:
Lines 3855-3860 static RefPtr<CSSValue> consumeContain(CSSParserTokenRange& range) a/Source/WebCore/css/parser/CSSPropertyParser.cpp_sec2
3855
                return nullptr;
3855
                return nullptr;
3856
            paint = consumeIdent(range);
3856
            paint = consumeIdent(range);
3857
            break;
3857
            break;
3858
        case CSSValueStyle:
3859
            if (style)
3860
                return nullptr;
3861
            style = consumeIdent(range);
3862
            break;
3858
        default:
3863
        default:
3859
            return nullptr;
3864
            return nullptr;
3860
        }
3865
        }
Lines 3863-3868 static RefPtr<CSSValue> consumeContain(CSSParserTokenRange& range) a/Source/WebCore/css/parser/CSSPropertyParser.cpp_sec3
3863
        list->append(size.releaseNonNull());
3868
        list->append(size.releaseNonNull());
3864
    if (layout)
3869
    if (layout)
3865
        list->append(layout.releaseNonNull());
3870
        list->append(layout.releaseNonNull());
3871
    if (style)
3872
        list->append(style.releaseNonNull());
3866
    if (paint)
3873
    if (paint)
3867
        list->append(paint.releaseNonNull());
3874
        list->append(paint.releaseNonNull());
3868
    if (!list->length())
3875
    if (!list->length())
- a/Source/WebCore/rendering/RenderCounter.cpp -6 / +34 lines
Lines 57-71 static CounterMaps& counterMaps() a/Source/WebCore/rendering/RenderCounter.cpp_sec1
57
    return staticCounterMaps;
57
    return staticCounterMaps;
58
}
58
}
59
59
60
static Element* ancestorStyleContainmentObject(const Element& element)
61
{
62
    Element* ancestor = is<PseudoElement>(element) ? downcast<PseudoElement>(element).hostElement() : element.parentElement();
63
    while (ancestor) {
64
        if (auto* style = ancestor->existingComputedStyle()) {
65
            if (style->containsStyle())
66
                break;
67
        }
68
        ancestor = ancestor->parentElement();
69
    }
70
    return ancestor;
71
}
72
60
// This function processes the renderer tree in the order of the DOM tree
73
// This function processes the renderer tree in the order of the DOM tree
61
// including pseudo elements as defined in CSS 2.1.
74
// including pseudo elements as defined in CSS 2.1.
62
static RenderElement* previousInPreOrder(const RenderElement& renderer)
75
static RenderElement* previousInPreOrder(const RenderElement& renderer)
63
{
76
{
64
    ASSERT(renderer.element());
77
    ASSERT(renderer.element());
65
    Element* previous = ElementTraversal::previousIncludingPseudo(*renderer.element());
78
    Element* previous = ElementTraversal::previousIncludingPseudo(*renderer.element());
66
    while (previous && !previous->renderer())
79
    Element* styleContainAncestor = ancestorStyleContainmentObject(*renderer.element());
67
        previous = ElementTraversal::previousIncludingPseudo(*previous);
80
68
    return previous ? previous->renderer() : 0;
81
    while (true) {
82
        while (previous && !previous->renderer())
83
            previous = ElementTraversal::previousIncludingPseudo(*previous);
84
        if (!previous)
85
            return nullptr;
86
        Element* previousStyleContainAncestor = ancestorStyleContainmentObject(*previous);
87
        if (previousStyleContainAncestor == styleContainAncestor)
88
            return previous->renderer();
89
        if (!previousStyleContainAncestor)
90
            return nullptr;
91
        previous = previousStyleContainAncestor;
92
    }
69
}
93
}
70
94
71
static inline Element* parentOrPseudoHostElement(const RenderElement& renderer)
95
static inline Element* parentOrPseudoHostElement(const RenderElement& renderer)
Lines 96-101 static Element* previousSiblingOrParentElement(const Element& element) a/Source/WebCore/rendering/RenderCounter.cpp_sec2
96
    auto* parent = element.parentElement();
120
    auto* parent = element.parentElement();
97
    if (parent && !parent->renderer())
121
    if (parent && !parent->renderer())
98
        parent = previousSiblingOrParentElement(*parent);
122
        parent = previousSiblingOrParentElement(*parent);
123
    if (parent && parent->renderer() && parent->renderer()->style().containsStyle())
124
        return nullptr;
99
    return parent;
125
    return parent;
100
}
126
}
101
127
Lines 335-341 static CounterNode* makeCounterNode(RenderElement& renderer, const AtomString& i a/Source/WebCore/rendering/RenderCounter.cpp_sec3
335
    maps.add(&renderer, makeUnique<CounterMap>()).iterator->value->add(identifier, newNode.copyRef());
361
    maps.add(&renderer, makeUnique<CounterMap>()).iterator->value->add(identifier, newNode.copyRef());
336
    renderer.setHasCounterNodeMap(true);
362
    renderer.setHasCounterNodeMap(true);
337
363
338
    if (newNode->parent())
364
    if (newNode->parent() || shouldApplyStyleContainment(renderer))
339
        return newNode.ptr();
365
        return newNode.ptr();
340
366
341
    // Check if some nodes that were previously root nodes should become children of this node now.
367
    // Check if some nodes that were previously root nodes should become children of this node now.
Lines 343-349 static CounterNode* makeCounterNode(RenderElement& renderer, const AtomString& i a/Source/WebCore/rendering/RenderCounter.cpp_sec4
343
    auto* stayWithin = parentOrPseudoHostElement(renderer);
369
    auto* stayWithin = parentOrPseudoHostElement(renderer);
344
    bool skipDescendants = false;
370
    bool skipDescendants = false;
345
    while ((currentRenderer = nextInPreOrder(*currentRenderer, stayWithin, skipDescendants))) {
371
    while ((currentRenderer = nextInPreOrder(*currentRenderer, stayWithin, skipDescendants))) {
346
        skipDescendants = false;
372
        skipDescendants = shouldApplyStyleContainment(*currentRenderer);
347
        if (!currentRenderer->hasCounterNodeMap())
373
        if (!currentRenderer->hasCounterNodeMap())
348
            continue;
374
            continue;
349
        auto* currentCounter = maps.find(currentRenderer)->value->get(identifier);
375
        auto* currentCounter = maps.find(currentRenderer)->value->get(identifier);
Lines 549-556 void RenderCounter::rendererSubtreeAttached(RenderElement& renderer) a/Source/WebCore/rendering/RenderCounter.cpp_sec5
549
        element = renderer.generatingElement();
575
        element = renderer.generatingElement();
550
    if (element && !element->renderer())
576
    if (element && !element->renderer())
551
        return; // No need to update if the parent is not attached yet
577
        return; // No need to update if the parent is not attached yet
578
    bool crossedBoundary = false;
552
    for (RenderObject* descendant = &renderer; descendant; descendant = descendant->nextInPreOrder(&renderer)) {
579
    for (RenderObject* descendant = &renderer; descendant; descendant = descendant->nextInPreOrder(&renderer)) {
553
        if (is<RenderElement>(*descendant))
580
        crossedBoundary |= shouldApplyStyleContainment(*descendant);
581
        if (crossedBoundary && is<RenderElement>(*descendant))
554
            updateCounters(downcast<RenderElement>(*descendant));
582
            updateCounters(downcast<RenderElement>(*descendant));
555
    }
583
    }
556
}
584
}
- a/Source/WebCore/rendering/RenderObject.cpp +5 lines
Lines 2514-2516 bool WebCore::shouldApplySizeContainment(const WebCore::RenderObject& renderer) a/Source/WebCore/rendering/RenderObject.cpp_sec1
2514
{
2514
{
2515
    return renderer.style().containsSize() && (!renderer.isInline() || renderer.isAtomicInlineLevelBox()) && !renderer.isRubyText() && (!renderer.isTablePart() || renderer.isTableCaption()) && !renderer.isTable();
2515
    return renderer.style().containsSize() && (!renderer.isInline() || renderer.isAtomicInlineLevelBox()) && !renderer.isRubyText() && (!renderer.isTablePart() || renderer.isTableCaption()) && !renderer.isTable();
2516
}
2516
}
2517
2518
bool WebCore::shouldApplyStyleContainment(const WebCore::RenderObject& renderer)
2519
{
2520
    return renderer.style().containsStyle() && (!renderer.isInline() || renderer.isAtomicInlineLevelBox()) && !renderer.isRubyText() && (!renderer.isTablePart() || renderer.isTableCaption()) && !renderer.isTable();
2521
}
- a/Source/WebCore/rendering/RenderObject.h +1 lines
Lines 1197-1202 void printGraphicsLayerTreeForLiveDocuments(); a/Source/WebCore/rendering/RenderObject.h_sec1
1197
1197
1198
bool shouldApplyLayoutContainment(const RenderObject&);
1198
bool shouldApplyLayoutContainment(const RenderObject&);
1199
bool shouldApplySizeContainment(const RenderObject&);
1199
bool shouldApplySizeContainment(const RenderObject&);
1200
bool shouldApplyStyleContainment(const RenderObject&);
1200
1201
1201
} // namespace WebCore
1202
} // namespace WebCore
1202
1203
- a/Source/WebCore/rendering/style/RenderStyle.h +1 lines
Lines 528-533 public: a/Source/WebCore/rendering/style/RenderStyle.h_sec1
528
    OptionSet<Containment> contain() const { return m_rareNonInheritedData->contain; }
528
    OptionSet<Containment> contain() const { return m_rareNonInheritedData->contain; }
529
    bool containsLayout() const { return m_rareNonInheritedData->contain.contains(Containment::Layout); }
529
    bool containsLayout() const { return m_rareNonInheritedData->contain.contains(Containment::Layout); }
530
    bool containsSize() const { return m_rareNonInheritedData->contain.contains(Containment::Size); }
530
    bool containsSize() const { return m_rareNonInheritedData->contain.contains(Containment::Size); }
531
    bool containsStyle() const { return m_rareNonInheritedData->contain.contains(Containment::Style); }
531
    BoxAlignment boxAlign() const { return static_cast<BoxAlignment>(m_rareNonInheritedData->deprecatedFlexibleBox->align); }
532
    BoxAlignment boxAlign() const { return static_cast<BoxAlignment>(m_rareNonInheritedData->deprecatedFlexibleBox->align); }
532
    BoxDirection boxDirection() const { return static_cast<BoxDirection>(m_inheritedFlags.boxDirection); }
533
    BoxDirection boxDirection() const { return static_cast<BoxDirection>(m_inheritedFlags.boxDirection); }
533
    float boxFlex() const { return m_rareNonInheritedData->deprecatedFlexibleBox->flex; }
534
    float boxFlex() const { return m_rareNonInheritedData->deprecatedFlexibleBox->flex; }
- a/Source/WebCore/rendering/style/RenderStyleConstants.h +1 lines
Lines 1223-1228 enum class Containment : uint8_t { a/Source/WebCore/rendering/style/RenderStyleConstants.h_sec1
1223
    Layout   = 1 << 0,
1223
    Layout   = 1 << 0,
1224
    Paint    = 1 << 1,
1224
    Paint    = 1 << 1,
1225
    Size     = 1 << 2,
1225
    Size     = 1 << 2,
1226
    Style    = 1 << 3,
1226
};
1227
};
1227
1228
1228
extern const float defaultMiterLimit;
1229
extern const float defaultMiterLimit;
- a/Source/WebCore/style/StyleBuilderCustom.h +3 lines
Lines 1277-1282 inline void BuilderCustom::applyValueContain(BuilderState& builderState, CSSValu a/Source/WebCore/style/StyleBuilderCustom.h_sec1
1277
        case CSSValuePaint:
1277
        case CSSValuePaint:
1278
            containment.add(Containment::Paint);
1278
            containment.add(Containment::Paint);
1279
            break;
1279
            break;
1280
        case CSSValueStyle:
1281
            containment.add(Containment::Style);
1282
            break;
1280
        default:
1283
        default:
1281
            break;
1284
            break;
1282
        };
1285
        };
- a/LayoutTests/ChangeLog +11 lines
Lines 1-3 a/LayoutTests/ChangeLog_sec1
1
2021-06-07  Rob Buis  <rbuis@igalia.com>
2
3
        [css-contain] Support contain:style
4
        https://bugs.webkit.org/show_bug.cgi?id=226458
5
6
        Reviewed by NOBODY (OOPS!).
7
8
        Unskip tests that now pass.
9
10
        * TestExpectations:
11
1
2021-06-07  Aditya Keerthi  <akeerthi@apple.com>
12
2021-06-07  Aditya Keerthi  <akeerthi@apple.com>
2
13
3
        [iOS] Unexpected scrolling when switching focus from a text input to a select element
14
        [iOS] Unexpected scrolling when switching focus from a text input to a select element
- a/LayoutTests/imported/w3c/ChangeLog +13 lines
Lines 1-3 a/LayoutTests/imported/w3c/ChangeLog_sec1
1
2021-06-07  Rob Buis  <rbuis@igalia.com>
2
3
        [css-contain] Support contain:style
4
        https://bugs.webkit.org/show_bug.cgi?id=226458
5
6
        Reviewed by NOBODY (OOPS!).
7
8
        Update improved test results.
9
10
        * web-platform-tests/css/css-contain/content-visibility/content-visibility-026-expected.txt:
11
        * web-platform-tests/css/css-contain/parsing/contain-computed-expected.txt:
12
        * web-platform-tests/css/css-contain/parsing/contain-valid-expected.txt:
13
1
2021-06-06  Darin Adler  <darin@apple.com>
14
2021-06-06  Darin Adler  <darin@apple.com>
2
15
3
        Handle custom identifiers and strings separately, so we can quote strings correctly consistently
16
        Handle custom identifiers and strings separately, so we can quote strings correctly consistently
- a/LayoutTests/TestExpectations -4 lines
Lines 4676-4685 imported/w3c/web-platform-tests/css/css-contain/contain-paint-table-002.html [ I a/LayoutTests/TestExpectations_sec1
4676
imported/w3c/web-platform-tests/css/css-contain/contain-strict-001.html [ ImageOnlyFailure ]
4676
imported/w3c/web-platform-tests/css/css-contain/contain-strict-001.html [ ImageOnlyFailure ]
4677
imported/w3c/web-platform-tests/css/css-contain/contain-strict-002.html [ ImageOnlyFailure ]
4677
imported/w3c/web-platform-tests/css/css-contain/contain-strict-002.html [ ImageOnlyFailure ]
4678
imported/w3c/web-platform-tests/css/css-contain/contain-strict-011.html [ ImageOnlyFailure ]
4678
imported/w3c/web-platform-tests/css/css-contain/contain-strict-011.html [ ImageOnlyFailure ]
4679
imported/w3c/web-platform-tests/css/css-contain/contain-style-counters-001.html [ ImageOnlyFailure ]
4680
imported/w3c/web-platform-tests/css/css-contain/contain-style-counters-002.html [ ImageOnlyFailure ]
4681
imported/w3c/web-platform-tests/css/css-contain/contain-style-counters-003.html [ ImageOnlyFailure ]
4682
imported/w3c/web-platform-tests/css/css-contain/contain-style-counters-004.html [ ImageOnlyFailure ]
4683
imported/w3c/web-platform-tests/css/css-contain/content-visibility/content-visibility-032.html [ ImageOnlyFailure ]
4679
imported/w3c/web-platform-tests/css/css-contain/content-visibility/content-visibility-032.html [ ImageOnlyFailure ]
4684
imported/w3c/web-platform-tests/css/css-contain/content-visibility/content-visibility-033.sub.https.html [ ImageOnlyFailure ]
4680
imported/w3c/web-platform-tests/css/css-contain/content-visibility/content-visibility-033.sub.https.html [ ImageOnlyFailure ]
4685
imported/w3c/web-platform-tests/css/css-contain/content-visibility/content-visibility-034.html [ ImageOnlyFailure ]
4681
imported/w3c/web-platform-tests/css/css-contain/content-visibility/content-visibility-034.html [ ImageOnlyFailure ]
- a/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/content-visibility/content-visibility-026-expected.txt -1 / +1 lines
Lines 1-6 a/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/content-visibility/content-visibility-026-expected.txt_sec1
1
1
2
FAIL content-visibility: hidden adds contain: size layout style; assert_equals: expected "size layout style paint" but got "none"
2
FAIL content-visibility: hidden adds contain: size layout style; assert_equals: expected "size layout style paint" but got "none"
3
FAIL content-visibility: auto adds contain: size layout style paint; assert_equals: initial onscreen expected "size layout style paint" but got "none"
3
FAIL content-visibility: auto adds contain: size layout style paint; assert_equals: initial onscreen expected "size layout style paint" but got "none"
4
FAIL content-visibility: auto adds contain: size layout style paint, can't be overridden assert_equals: expected "size layout style paint" but got "none"
4
FAIL content-visibility: auto adds contain: size layout style paint, can't be overridden assert_equals: expected "size layout style paint" but got "style"
5
FAIL content-visibility keeps all containment even when shorthands are specified assert_equals: expected "size layout style paint" but got "paint"
5
FAIL content-visibility keeps all containment even when shorthands are specified assert_equals: expected "size layout style paint" but got "paint"
6
6
- a/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/parsing/contain-computed-expected.txt -4 / +4 lines
Lines 4-15 PASS Property contain value 'strict' a/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/parsing/contain-computed-expected.txt_sec1
4
PASS Property contain value 'content'
4
PASS Property contain value 'content'
5
PASS Property contain value 'size'
5
PASS Property contain value 'size'
6
PASS Property contain value 'layout'
6
PASS Property contain value 'layout'
7
FAIL Property contain value 'style' assert_true: 'style' is a supported value for contain. expected true got false
7
PASS Property contain value 'style'
8
PASS Property contain value 'paint'
8
PASS Property contain value 'paint'
9
PASS Property contain value 'size layout'
9
PASS Property contain value 'size layout'
10
FAIL Property contain value 'style paint' assert_true: 'style paint' is a supported value for contain. expected true got false
10
PASS Property contain value 'style paint'
11
FAIL Property contain value 'layout style paint' assert_true: 'layout style paint' is a supported value for contain. expected true got false
11
PASS Property contain value 'layout style paint'
12
FAIL Property contain value 'size layout style paint' assert_true: 'size layout style paint' is a supported value for contain. expected true got false
12
PASS Property contain value 'size layout style paint'
13
PASS Property contain value 'size layout paint'
13
PASS Property contain value 'size layout paint'
14
PASS Property contain value 'layout paint'
14
PASS Property contain value 'layout paint'
15
15
- a/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/parsing/contain-valid-expected.txt -4 / +4 lines
Lines 4-13 PASS e.style['contain'] = "strict" should set the property value a/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/parsing/contain-valid-expected.txt_sec1
4
PASS e.style['contain'] = "content" should set the property value
4
PASS e.style['contain'] = "content" should set the property value
5
PASS e.style['contain'] = "size" should set the property value
5
PASS e.style['contain'] = "size" should set the property value
6
PASS e.style['contain'] = "layout" should set the property value
6
PASS e.style['contain'] = "layout" should set the property value
7
FAIL e.style['contain'] = "style" should set the property value assert_not_equals: property should be set got disallowed value ""
7
PASS e.style['contain'] = "style" should set the property value
8
PASS e.style['contain'] = "paint" should set the property value
8
PASS e.style['contain'] = "paint" should set the property value
9
PASS e.style['contain'] = "layout size" should set the property value
9
PASS e.style['contain'] = "layout size" should set the property value
10
FAIL e.style['contain'] = "paint style" should set the property value assert_not_equals: property should be set got disallowed value ""
10
PASS e.style['contain'] = "paint style" should set the property value
11
FAIL e.style['contain'] = "layout style paint" should set the property value assert_not_equals: property should be set got disallowed value ""
11
PASS e.style['contain'] = "layout style paint" should set the property value
12
FAIL e.style['contain'] = "layout paint style size" should set the property value assert_not_equals: property should be set got disallowed value ""
12
PASS e.style['contain'] = "layout paint style size" should set the property value
13
13

Return to Bug 226458