Changeset 284642 in webkit
- Timestamp:
- Oct 21, 2021 1:48:28 PM (9 months ago)
- Location:
- trunk
- Files:
-
- 15 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/TestExpectations (modified) (2 diffs)
-
LayoutTests/imported/w3c/ChangeLog (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/css/css-contain/content-visibility/content-visibility-026-expected.txt (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/css/css-contain/parsing/contain-computed-expected.txt (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/css/css-contain/parsing/contain-valid-expected.txt (modified) (1 diff)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/css/CSSComputedStyleDeclaration.cpp (modified) (1 diff)
-
Source/WebCore/css/parser/CSSPropertyParser.cpp (modified) (3 diffs)
-
Source/WebCore/rendering/RenderCounter.cpp (modified) (6 diffs)
-
Source/WebCore/rendering/RenderObject.cpp (modified) (1 diff)
-
Source/WebCore/rendering/RenderObject.h (modified) (1 diff)
-
Source/WebCore/rendering/style/RenderStyle.h (modified) (1 diff)
-
Source/WebCore/rendering/style/RenderStyleConstants.h (modified) (1 diff)
-
Source/WebCore/style/StyleBuilderCustom.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r284640 r284642 1 2021-10-21 Rob Buis <rbuis@igalia.com> 2 3 [css-contain] Support contain:style for counters 4 https://bugs.webkit.org/show_bug.cgi?id=226458 5 6 Reviewed by Antti Koivisto. 7 8 Unskip tests that now pass. 9 10 * TestExpectations: 11 1 12 2021-10-21 Eric Hutchison <ehutchison@apple.com> 2 13 -
trunk/LayoutTests/TestExpectations
r284577 r284642 4856 4856 imported/w3c/web-platform-tests/css/css-contain/contain-strict-002.html [ ImageOnlyFailure ] 4857 4857 imported/w3c/web-platform-tests/css/css-contain/contain-strict-011.html [ ImageOnlyFailure ] 4858 imported/w3c/web-platform-tests/css/css-contain/contain-style-counters-001.html [ ImageOnlyFailure ]4859 imported/w3c/web-platform-tests/css/css-contain/contain-style-counters-002.html [ ImageOnlyFailure ]4860 imported/w3c/web-platform-tests/css/css-contain/contain-style-counters-003.html [ ImageOnlyFailure ]4861 imported/w3c/web-platform-tests/css/css-contain/contain-style-counters-004.html [ ImageOnlyFailure ]4862 4858 imported/w3c/web-platform-tests/css/css-contain/content-visibility/content-visibility-032.html [ ImageOnlyFailure ] 4863 4859 imported/w3c/web-platform-tests/css/css-contain/content-visibility/content-visibility-033.sub.https.html [ ImageOnlyFailure ] … … 4882 4878 imported/w3c/web-platform-tests/css/css-contain/counter-scoping-001.html [ ImageOnlyFailure ] 4883 4879 imported/w3c/web-platform-tests/css/css-contain/counter-scoping-002.html [ ImageOnlyFailure ] 4884 imported/w3c/web-platform-tests/css/css-contain/counter-scoping-003.html [ ImageOnlyFailure ]4885 4880 imported/w3c/web-platform-tests/css/css-contain/quote-scoping-001.html [ ImageOnlyFailure ] 4886 4881 imported/w3c/web-platform-tests/css/css-contain/quote-scoping-002.html [ ImageOnlyFailure ] -
trunk/LayoutTests/imported/w3c/ChangeLog
r284610 r284642 1 2021-10-21 Rob Buis <rbuis@igalia.com> 2 3 [css-contain] Support contain:style for counters 4 https://bugs.webkit.org/show_bug.cgi?id=226458 5 6 Reviewed by Antti Koivisto. 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 14 2021-10-21 Chris Dumez <cdumez@apple.com> 2 15 -
trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/content-visibility/content-visibility-026-expected.txt
r274957 r284642 2 2 FAIL content-visibility: hidden adds contain: size layout style; assert_equals: expected "size layout style paint" but got "none" 3 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 5 FAIL content-visibility keeps all containment even when shorthands are specified assert_equals: expected "size layout style paint" but got "paint" 6 6 -
trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/parsing/contain-computed-expected.txt
r274957 r284642 5 5 PASS Property contain value 'size' 6 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 8 PASS Property contain value 'paint' 9 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 11 FAIL Property contain value 'layout style paint' assert_true: 'layout style paint' is a supported value for contain. expected true got false 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 10 PASS Property contain value 'style paint' 11 PASS Property contain value 'layout style paint' 12 PASS Property contain value 'size layout style paint' 13 13 PASS Property contain value 'size layout paint' 14 14 PASS Property contain value 'layout paint' -
trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/parsing/contain-valid-expected.txt
r274957 r284642 5 5 PASS e.style['contain'] = "size" should set the property value 6 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 8 PASS e.style['contain'] = "paint" should set the property value 9 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 "" 11 FAIL e.style['contain'] = "layout style paint" should set the property value assert_not_equals: property should be set got disallowed 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 "" 10 PASS e.style['contain'] = "paint style" should set the property value 11 PASS e.style['contain'] = "layout style paint" should set the property value 12 PASS e.style['contain'] = "layout paint style size" should set the property value 13 13 -
trunk/Source/WebCore/ChangeLog
r284630 r284642 1 2021-10-21 Rob Buis <rbuis@igalia.com> 2 3 [css-contain] Support contain:style for counters 4 https://bugs.webkit.org/show_bug.cgi?id=226458 5 6 Reviewed by Antti Koivisto. 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::makeCounterNode): 27 (WebCore::RenderCounter::rendererSubtreeAttached): 28 * rendering/RenderObject.cpp: 29 (WebCore::shouldApplyStyleContainment): 30 * rendering/RenderObject.h: 31 * rendering/style/RenderStyle.h: 32 (WebCore::RenderStyle::containsStyle const): 33 * rendering/style/RenderStyleConstants.h: 34 * style/StyleBuilderCustom.h: 35 (WebCore::Style::BuilderCustom::applyValueContain): 36 1 37 2021-10-19 Darin Adler <darin@apple.com> 2 38 -
trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp
r284447 r284642 3573 3573 if (containment & Containment::Layout) 3574 3574 list->append(cssValuePool.createIdentifierValue(CSSValueLayout)); 3575 if (containment & Containment::Style) 3576 list->append(cssValuePool.createIdentifierValue(CSSValueStyle)); 3575 3577 if (containment & Containment::Paint) 3576 3578 list->append(cssValuePool.createIdentifierValue(CSSValuePaint)); -
trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp
r284440 r284642 3868 3868 return singleValue; 3869 3869 auto list = CSSValueList::createSpaceSeparated(); 3870 RefPtr<CSSPrimitiveValue> size, layout, paint ;3870 RefPtr<CSSPrimitiveValue> size, layout, paint, style; 3871 3871 while (!range.atEnd()) { 3872 3872 switch (range.peek().id()) { … … 3886 3886 paint = consumeIdent(range); 3887 3887 break; 3888 case CSSValueStyle: 3889 if (style) 3890 return nullptr; 3891 style = consumeIdent(range); 3892 break; 3888 3893 default: 3889 3894 return nullptr; … … 3894 3899 if (layout) 3895 3900 list->append(layout.releaseNonNull()); 3901 if (style) 3902 list->append(style.releaseNonNull()); 3896 3903 if (paint) 3897 3904 list->append(paint.releaseNonNull()); -
trunk/Source/WebCore/rendering/RenderCounter.cpp
r278253 r284642 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 // FIXME: this should use parentInComposedTree but for now matches the rest of RenderCounter. 69 ancestor = ancestor->parentElement(); 70 } 71 return ancestor; 72 } 73 60 74 // This function processes the renderer tree in the order of the DOM tree 61 75 // including pseudo elements as defined in CSS 2.1. … … 64 78 ASSERT(renderer.element()); 65 79 Element* previous = ElementTraversal::previousIncludingPseudo(*renderer.element()); 66 while (previous && !previous->renderer()) 67 previous = ElementTraversal::previousIncludingPseudo(*previous); 68 return previous ? previous->renderer() : 0; 80 Element* styleContainAncestor = ancestorStyleContainmentObject(*renderer.element()); 81 82 while (true) { 83 while (previous && !previous->renderer()) 84 previous = ElementTraversal::previousIncludingPseudo(*previous, styleContainAncestor); 85 if (!previous) 86 return nullptr; 87 Element* previousStyleContainAncestor = ancestorStyleContainmentObject(*previous); 88 if (previousStyleContainAncestor == styleContainAncestor) 89 return previous->renderer(); 90 if (!previousStyleContainAncestor) 91 return nullptr; 92 previous = previousStyleContainAncestor; 93 } 69 94 } 70 95 … … 97 122 if (parent && !parent->renderer()) 98 123 parent = previousSiblingOrParentElement(*parent); 124 if (parent && parent->renderer() && parent->renderer()->style().containsStyle()) 125 return nullptr; 99 126 return parent; 100 127 } … … 336 363 renderer.setHasCounterNodeMap(true); 337 364 338 if (newNode->parent() )365 if (newNode->parent() || shouldApplyStyleContainment(renderer)) 339 366 return newNode.ptr(); 340 367 … … 344 371 bool skipDescendants = false; 345 372 while ((currentRenderer = nextInPreOrder(*currentRenderer, stayWithin, skipDescendants))) { 346 skipDescendants = false;373 skipDescendants = shouldApplyStyleContainment(*currentRenderer); 347 374 if (!currentRenderer->hasCounterNodeMap()) 348 375 continue; … … 550 577 if (element && !element->renderer()) 551 578 return; // No need to update if the parent is not attached yet 579 bool crossedStyleContainmentBoundary = false; 552 580 for (RenderObject* descendant = &renderer; descendant; descendant = descendant->nextInPreOrder(&renderer)) { 553 if (is<RenderElement>(*descendant)) 581 crossedStyleContainmentBoundary = crossedStyleContainmentBoundary || shouldApplyStyleContainment(*descendant); 582 if (crossedStyleContainmentBoundary && is<RenderElement>(*descendant)) 554 583 updateCounters(downcast<RenderElement>(*descendant)); 555 584 } -
trunk/Source/WebCore/rendering/RenderObject.cpp
r284366 r284642 2540 2540 return renderer.style().containsSize() && (!renderer.isInline() || renderer.isAtomicInlineLevelBox()) && !renderer.isRubyText() && (!renderer.isTablePart() || renderer.isTableCaption()) && !renderer.isTable(); 2541 2541 } 2542 2543 bool WebCore::shouldApplyStyleContainment(const WebCore::RenderObject& renderer) 2544 { 2545 if (!renderer.style().containsStyle()) 2546 return false; 2547 return (!renderer.isInline() || renderer.isAtomicInlineLevelBox()) && !renderer.isRubyText() && (!renderer.isTablePart() || renderer.isTableCaption()) && !renderer.isTable(); 2548 } -
trunk/Source/WebCore/rendering/RenderObject.h
r284080 r284642 1209 1209 bool shouldApplyLayoutContainment(const RenderObject&); 1210 1210 bool shouldApplySizeContainment(const RenderObject&); 1211 bool shouldApplyStyleContainment(const RenderObject&); 1211 1212 1212 1213 } // namespace WebCore -
trunk/Source/WebCore/rendering/style/RenderStyle.h
r284366 r284642 532 532 bool containsLayout() const { return m_rareNonInheritedData->contain.contains(Containment::Layout); } 533 533 bool containsSize() const { return m_rareNonInheritedData->contain.contains(Containment::Size); } 534 bool containsStyle() const { return m_rareNonInheritedData->contain.contains(Containment::Style); } 534 535 BoxAlignment boxAlign() const { return static_cast<BoxAlignment>(m_rareNonInheritedData->deprecatedFlexibleBox->align); } 535 536 BoxDirection boxDirection() const { return static_cast<BoxDirection>(m_inheritedFlags.boxDirection); } -
trunk/Source/WebCore/rendering/style/RenderStyleConstants.h
r282750 r284642 1242 1242 Paint = 1 << 1, 1243 1243 Size = 1 << 2, 1244 Style = 1 << 3, 1244 1245 }; 1245 1246 -
trunk/Source/WebCore/style/StyleBuilderCustom.h
r284437 r284642 1277 1277 case CSSValuePaint: 1278 1278 containment.add(Containment::Paint); 1279 break; 1280 case CSSValueStyle: 1281 containment.add(Containment::Style); 1279 1282 break; 1280 1283 default:
Note: See TracChangeset
for help on using the changeset viewer.