WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Patch
bug-226458-20211021161249.patch (text/plain), 20.62 KB, created by
Rob Buis
on 2021-10-21 07:12:51 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Rob Buis
Created:
2021-10-21 07:12:51 PDT
Size:
20.62 KB
patch
obsolete
>Subversion Revision: 284601 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 0a8b63093c73b80220e6efd8eed3c0230454113e..92cfe8d285172ed5f74fb4a8ff493481e8f56053 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,39 @@ >+2021-10-21 Rob Buis <rbuis@igalia.com> >+ >+ [css-contain] Support contain:style for counters >+ https://bugs.webkit.org/show_bug.cgi?id=226458 >+ >+ Reviewed by Antti Koivisto. >+ >+ Parse contain: style and use it (if set) to scope >+ counter-increment to the element's sub-tree [1]. >+ >+ Tests: imported/w3c/web-platform-tests/css/css-contain/contain-style-counters-001.html >+ imported/w3c/web-platform-tests/css/css-contain/contain-style-counters-002.html >+ imported/w3c/web-platform-tests/css/css-contain/contain-style-counters-003.html >+ imported/w3c/web-platform-tests/css/css-contain/contain-style-counters-004.html >+ >+ [1] https://drafts.csswg.org/css-contain-2/#containment-style >+ >+ * css/CSSComputedStyleDeclaration.cpp: >+ (WebCore::ComputedStyleExtractor::valueForPropertyInStyle): >+ * css/parser/CSSPropertyParser.cpp: >+ (WebCore::consumeContain): >+ * rendering/RenderCounter.cpp: >+ (WebCore::ancestorStyleContainmentObject): >+ (WebCore::previousInPreOrder): >+ (WebCore::previousSiblingOrParentElement): >+ (WebCore::makeCounterNode): >+ (WebCore::RenderCounter::rendererSubtreeAttached): >+ * rendering/RenderObject.cpp: >+ (WebCore::shouldApplyStyleContainment): >+ * rendering/RenderObject.h: >+ * rendering/style/RenderStyle.h: >+ (WebCore::RenderStyle::containsStyle const): >+ * rendering/style/RenderStyleConstants.h: >+ * style/StyleBuilderCustom.h: >+ (WebCore::Style::BuilderCustom::applyValueContain): >+ > 2021-10-21 Antoine Quint <graouts@webkit.org> > > Pass CompositeOperation to CSSPropertyAnimation::blendProperties and through more blending functions >diff --git a/Source/WebCore/css/CSSComputedStyleDeclaration.cpp b/Source/WebCore/css/CSSComputedStyleDeclaration.cpp >index 0570d9ed85f21a775561c22311abb8c1e8239e07..eea6f7bad4cdb85bcdb6763a28bad5f029259ff0 100644 >--- a/Source/WebCore/css/CSSComputedStyleDeclaration.cpp >+++ b/Source/WebCore/css/CSSComputedStyleDeclaration.cpp >@@ -3572,6 +3572,8 @@ RefPtr<CSSValue> ComputedStyleExtractor::valueForPropertyInStyle(const RenderSty > list->append(cssValuePool.createIdentifierValue(CSSValueSize)); > if (containment & Containment::Layout) > list->append(cssValuePool.createIdentifierValue(CSSValueLayout)); >+ if (containment & Containment::Style) >+ list->append(cssValuePool.createIdentifierValue(CSSValueStyle)); > if (containment & Containment::Paint) > list->append(cssValuePool.createIdentifierValue(CSSValuePaint)); > return list; >diff --git a/Source/WebCore/css/parser/CSSPropertyParser.cpp b/Source/WebCore/css/parser/CSSPropertyParser.cpp >index 9264f87f69c66f734c6eb5c509aeb5909055e951..85918e5a7cfc5bc55101d291db3941e6318fdb71 100644 >--- a/Source/WebCore/css/parser/CSSPropertyParser.cpp >+++ b/Source/WebCore/css/parser/CSSPropertyParser.cpp >@@ -3867,7 +3867,7 @@ static RefPtr<CSSValue> consumeContain(CSSParserTokenRange& range) > if (auto singleValue = consumeIdent<CSSValueNone, CSSValueStrict, CSSValueContent>(range)) > return singleValue; > auto list = CSSValueList::createSpaceSeparated(); >- RefPtr<CSSPrimitiveValue> size, layout, paint; >+ RefPtr<CSSPrimitiveValue> size, layout, paint, style; > while (!range.atEnd()) { > switch (range.peek().id()) { > case CSSValueSize: >@@ -3885,6 +3885,11 @@ static RefPtr<CSSValue> consumeContain(CSSParserTokenRange& range) > return nullptr; > paint = consumeIdent(range); > break; >+ case CSSValueStyle: >+ if (style) >+ return nullptr; >+ style = consumeIdent(range); >+ break; > default: > return nullptr; > } >@@ -3893,6 +3898,8 @@ static RefPtr<CSSValue> consumeContain(CSSParserTokenRange& range) > list->append(size.releaseNonNull()); > if (layout) > list->append(layout.releaseNonNull()); >+ if (style) >+ list->append(style.releaseNonNull()); > if (paint) > list->append(paint.releaseNonNull()); > if (!list->length()) >diff --git a/Source/WebCore/rendering/RenderCounter.cpp b/Source/WebCore/rendering/RenderCounter.cpp >index 631fc1d45e4158e89013b0234825656c241acb62..1b76793a269814e66f7ca06e6f9f41aed14d197a 100644 >--- a/Source/WebCore/rendering/RenderCounter.cpp >+++ b/Source/WebCore/rendering/RenderCounter.cpp >@@ -57,15 +57,40 @@ static CounterMaps& counterMaps() > return staticCounterMaps; > } > >+static Element* ancestorStyleContainmentObject(const Element& element) >+{ >+ Element* ancestor = is<PseudoElement>(element) ? downcast<PseudoElement>(element).hostElement() : element.parentElement(); >+ while (ancestor) { >+ if (auto* style = ancestor->existingComputedStyle()) { >+ if (style->containsStyle()) >+ break; >+ } >+ // FIXME: this should use parentInComposedTree but for now matches the rest of RenderCounter. >+ ancestor = ancestor->parentElement(); >+ } >+ return ancestor; >+} >+ > // This function processes the renderer tree in the order of the DOM tree > // including pseudo elements as defined in CSS 2.1. > static RenderElement* previousInPreOrder(const RenderElement& renderer) > { > ASSERT(renderer.element()); > Element* previous = ElementTraversal::previousIncludingPseudo(*renderer.element()); >- while (previous && !previous->renderer()) >- previous = ElementTraversal::previousIncludingPseudo(*previous); >- return previous ? previous->renderer() : 0; >+ Element* styleContainAncestor = ancestorStyleContainmentObject(*renderer.element()); >+ >+ while (true) { >+ while (previous && !previous->renderer()) >+ previous = ElementTraversal::previousIncludingPseudo(*previous, styleContainAncestor); >+ if (!previous) >+ return nullptr; >+ Element* previousStyleContainAncestor = ancestorStyleContainmentObject(*previous); >+ if (previousStyleContainAncestor == styleContainAncestor) >+ return previous->renderer(); >+ if (!previousStyleContainAncestor) >+ return nullptr; >+ previous = previousStyleContainAncestor; >+ } > } > > static inline Element* parentOrPseudoHostElement(const RenderElement& renderer) >@@ -96,6 +121,8 @@ static Element* previousSiblingOrParentElement(const Element& element) > auto* parent = element.parentElement(); > if (parent && !parent->renderer()) > parent = previousSiblingOrParentElement(*parent); >+ if (parent && parent->renderer() && parent->renderer()->style().containsStyle()) >+ return nullptr; > return parent; > } > >@@ -335,7 +362,7 @@ static CounterNode* makeCounterNode(RenderElement& renderer, const AtomString& i > maps.add(&renderer, makeUnique<CounterMap>()).iterator->value->add(identifier, newNode.copyRef()); > renderer.setHasCounterNodeMap(true); > >- if (newNode->parent()) >+ if (newNode->parent() || shouldApplyStyleContainment(renderer)) > return newNode.ptr(); > > // Check if some nodes that were previously root nodes should become children of this node now. >@@ -343,7 +370,7 @@ static CounterNode* makeCounterNode(RenderElement& renderer, const AtomString& i > auto* stayWithin = parentOrPseudoHostElement(renderer); > bool skipDescendants = false; > while ((currentRenderer = nextInPreOrder(*currentRenderer, stayWithin, skipDescendants))) { >- skipDescendants = false; >+ skipDescendants = shouldApplyStyleContainment(*currentRenderer); > if (!currentRenderer->hasCounterNodeMap()) > continue; > auto* currentCounter = maps.find(currentRenderer)->value->get(identifier); >@@ -549,8 +576,10 @@ void RenderCounter::rendererSubtreeAttached(RenderElement& renderer) > element = renderer.generatingElement(); > if (element && !element->renderer()) > return; // No need to update if the parent is not attached yet >+ bool crossedStyleContainmentBoundary = false; > for (RenderObject* descendant = &renderer; descendant; descendant = descendant->nextInPreOrder(&renderer)) { >- if (is<RenderElement>(*descendant)) >+ crossedStyleContainmentBoundary = crossedStyleContainmentBoundary || shouldApplyStyleContainment(*descendant); >+ if (crossedStyleContainmentBoundary && is<RenderElement>(*descendant)) > updateCounters(downcast<RenderElement>(*descendant)); > } > } >diff --git a/Source/WebCore/rendering/RenderObject.cpp b/Source/WebCore/rendering/RenderObject.cpp >index e7dab2a9f0467b5a4ded14d13a650d3e99bf7403..fb9190ab5a57db1771f0e93d225689edb51d3a76 100644 >--- a/Source/WebCore/rendering/RenderObject.cpp >+++ b/Source/WebCore/rendering/RenderObject.cpp >@@ -2539,3 +2539,10 @@ bool WebCore::shouldApplySizeContainment(const WebCore::RenderObject& renderer) > { > return renderer.style().containsSize() && (!renderer.isInline() || renderer.isAtomicInlineLevelBox()) && !renderer.isRubyText() && (!renderer.isTablePart() || renderer.isTableCaption()) && !renderer.isTable(); > } >+ >+bool WebCore::shouldApplyStyleContainment(const WebCore::RenderObject& renderer) >+{ >+ if (!renderer.style().containsStyle()) >+ return false; >+ return (!renderer.isInline() || renderer.isAtomicInlineLevelBox()) && !renderer.isRubyText() && (!renderer.isTablePart() || renderer.isTableCaption()) && !renderer.isTable(); >+} >diff --git a/Source/WebCore/rendering/RenderObject.h b/Source/WebCore/rendering/RenderObject.h >index c534c9fdd05d58470fa7e661486a6aeaccd668d2..7d0bebdba24a35eb089cf8de335b051d944247d3 100644 >--- a/Source/WebCore/rendering/RenderObject.h >+++ b/Source/WebCore/rendering/RenderObject.h >@@ -1208,6 +1208,7 @@ void printGraphicsLayerTreeForLiveDocuments(); > > bool shouldApplyLayoutContainment(const RenderObject&); > bool shouldApplySizeContainment(const RenderObject&); >+bool shouldApplyStyleContainment(const RenderObject&); > > } // namespace WebCore > >diff --git a/Source/WebCore/rendering/style/RenderStyle.h b/Source/WebCore/rendering/style/RenderStyle.h >index 7ecb4b3d25ddaf7f72776e7ad40dd6bd658e0cc8..3bfb128e538c4d0b3c89dc27331cd7981327bd9b 100644 >--- a/Source/WebCore/rendering/style/RenderStyle.h >+++ b/Source/WebCore/rendering/style/RenderStyle.h >@@ -531,6 +531,7 @@ public: > OptionSet<Containment> contain() const { return m_rareNonInheritedData->contain; } > bool containsLayout() const { return m_rareNonInheritedData->contain.contains(Containment::Layout); } > bool containsSize() const { return m_rareNonInheritedData->contain.contains(Containment::Size); } >+ bool containsStyle() const { return m_rareNonInheritedData->contain.contains(Containment::Style); } > BoxAlignment boxAlign() const { return static_cast<BoxAlignment>(m_rareNonInheritedData->deprecatedFlexibleBox->align); } > BoxDirection boxDirection() const { return static_cast<BoxDirection>(m_inheritedFlags.boxDirection); } > float boxFlex() const { return m_rareNonInheritedData->deprecatedFlexibleBox->flex; } >diff --git a/Source/WebCore/rendering/style/RenderStyleConstants.h b/Source/WebCore/rendering/style/RenderStyleConstants.h >index 52d4aeebc71b42516ca7220ee6f3caaf6bd4523a..5d6e70ca2ada4232ec288ab73e637351b079017d 100644 >--- a/Source/WebCore/rendering/style/RenderStyleConstants.h >+++ b/Source/WebCore/rendering/style/RenderStyleConstants.h >@@ -1241,6 +1241,7 @@ enum class Containment : uint8_t { > Layout = 1 << 0, > Paint = 1 << 1, > Size = 1 << 2, >+ Style = 1 << 3, > }; > > CSSBoxType transformBoxToCSSBoxType(TransformBox); >diff --git a/Source/WebCore/style/StyleBuilderCustom.h b/Source/WebCore/style/StyleBuilderCustom.h >index 3fffe335072b850471f97ca44eb7ca35d2672f91..9ee3a42778732c5ea3db5cb5b64c03a224f9f1c9 100644 >--- a/Source/WebCore/style/StyleBuilderCustom.h >+++ b/Source/WebCore/style/StyleBuilderCustom.h >@@ -1277,6 +1277,9 @@ inline void BuilderCustom::applyValueContain(BuilderState& builderState, CSSValu > case CSSValuePaint: > containment.add(Containment::Paint); > break; >+ case CSSValueStyle: >+ containment.add(Containment::Style); >+ break; > default: > break; > }; >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index c295ab740156f3625fafad93abd8dee92af27b18..63ebcbe1bbc9326ebc939845a73cc5f30598fbae 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,14 @@ >+2021-10-21 Rob Buis <rbuis@igalia.com> >+ >+ [css-contain] Support contain:style for counters >+ https://bugs.webkit.org/show_bug.cgi?id=226458 >+ >+ Reviewed by Antti Koivisto. >+ >+ Unskip tests that now pass. >+ >+ * TestExpectations: >+ > 2021-10-21 Enrique Ocaña González <eocanha@igalia.com> > > REGRESSION(r282059) [GStreamer] Test media/media-source/media-source-stalled-holds-sleep-assertion.html timeouts >diff --git a/LayoutTests/imported/w3c/ChangeLog b/LayoutTests/imported/w3c/ChangeLog >index 38a560a3dcac329489cdd3f1225e1c67de2cb484..6d266c9dd6269a72df8007e5458be480e87aca76 100644 >--- a/LayoutTests/imported/w3c/ChangeLog >+++ b/LayoutTests/imported/w3c/ChangeLog >@@ -1,3 +1,16 @@ >+2021-10-21 Rob Buis <rbuis@igalia.com> >+ >+ [css-contain] Support contain:style for counters >+ https://bugs.webkit.org/show_bug.cgi?id=226458 >+ >+ Reviewed by Antti Koivisto. >+ >+ Update improved test results. >+ >+ * web-platform-tests/css/css-contain/content-visibility/content-visibility-026-expected.txt: >+ * web-platform-tests/css/css-contain/parsing/contain-computed-expected.txt: >+ * web-platform-tests/css/css-contain/parsing/contain-valid-expected.txt: >+ > 2021-10-20 Alex Christensen <achristensen@webkit.org> > > URLParser should reject hosts with C0 control characters or U+007F >diff --git a/LayoutTests/TestExpectations b/LayoutTests/TestExpectations >index 5780bf5df9211eb2611e1bbe5da003256cbaa0bb..2665cccc5f14e1e3cf1b393354d25e33123ac826 100644 >--- a/LayoutTests/TestExpectations >+++ b/LayoutTests/TestExpectations >@@ -4855,10 +4855,6 @@ imported/w3c/web-platform-tests/css/css-contain/contain-paint-table-002.html [ I > imported/w3c/web-platform-tests/css/css-contain/contain-strict-001.html [ ImageOnlyFailure ] > imported/w3c/web-platform-tests/css/css-contain/contain-strict-002.html [ ImageOnlyFailure ] > imported/w3c/web-platform-tests/css/css-contain/contain-strict-011.html [ ImageOnlyFailure ] >-imported/w3c/web-platform-tests/css/css-contain/contain-style-counters-001.html [ ImageOnlyFailure ] >-imported/w3c/web-platform-tests/css/css-contain/contain-style-counters-002.html [ ImageOnlyFailure ] >-imported/w3c/web-platform-tests/css/css-contain/contain-style-counters-003.html [ ImageOnlyFailure ] >-imported/w3c/web-platform-tests/css/css-contain/contain-style-counters-004.html [ ImageOnlyFailure ] > imported/w3c/web-platform-tests/css/css-contain/content-visibility/content-visibility-032.html [ ImageOnlyFailure ] > imported/w3c/web-platform-tests/css/css-contain/content-visibility/content-visibility-033.sub.https.html [ ImageOnlyFailure ] > imported/w3c/web-platform-tests/css/css-contain/content-visibility/content-visibility-034.html [ ImageOnlyFailure ] >@@ -4881,7 +4877,6 @@ imported/w3c/web-platform-tests/css/css-contain/content-visibility/element-reass > imported/w3c/web-platform-tests/css/css-contain/content-visibility/element-reassigned-to-slot-in-skipped-subtree.html [ ImageOnlyFailure ] > imported/w3c/web-platform-tests/css/css-contain/counter-scoping-001.html [ ImageOnlyFailure ] > imported/w3c/web-platform-tests/css/css-contain/counter-scoping-002.html [ ImageOnlyFailure ] >-imported/w3c/web-platform-tests/css/css-contain/counter-scoping-003.html [ ImageOnlyFailure ] > imported/w3c/web-platform-tests/css/css-contain/quote-scoping-001.html [ ImageOnlyFailure ] > imported/w3c/web-platform-tests/css/css-contain/quote-scoping-002.html [ ImageOnlyFailure ] > imported/w3c/web-platform-tests/css/css-contain/quote-scoping-003.html [ ImageOnlyFailure ] >diff --git a/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/content-visibility/content-visibility-026-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/content-visibility/content-visibility-026-expected.txt >index 01156dd88b1226715ae5a196aaba416d817d062a..65e15308496a92f2712751681fe689ea6ff30655 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/content-visibility/content-visibility-026-expected.txt >+++ b/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/content-visibility/content-visibility-026-expected.txt >@@ -1,6 +1,6 @@ > > FAIL content-visibility: hidden adds contain: size layout style; assert_equals: expected "size layout style paint" but got "none" > FAIL content-visibility: auto adds contain: size layout style paint; assert_equals: initial onscreen expected "size layout style paint" but got "none" >-FAIL content-visibility: auto adds contain: size layout style paint, can't be overridden assert_equals: expected "size layout style paint" but got "none" >+FAIL content-visibility: auto adds contain: size layout style paint, can't be overridden assert_equals: expected "size layout style paint" but got "style" > FAIL content-visibility keeps all containment even when shorthands are specified assert_equals: expected "size layout style paint" but got "paint" > >diff --git a/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/parsing/contain-computed-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/parsing/contain-computed-expected.txt >index 4a1a0e6635ff8db7c0c5955239221190eb7cda6f..5bfc9e45e3c5fe1b147894beb1dc59b3f271625b 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/parsing/contain-computed-expected.txt >+++ b/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/parsing/contain-computed-expected.txt >@@ -4,12 +4,12 @@ PASS Property contain value 'strict' > PASS Property contain value 'content' > PASS Property contain value 'size' > PASS Property contain value 'layout' >-FAIL Property contain value 'style' assert_true: 'style' is a supported value for contain. expected true got false >+PASS Property contain value 'style' > PASS Property contain value 'paint' > PASS Property contain value 'size layout' >-FAIL Property contain value 'style paint' assert_true: 'style paint' is a supported value for contain. expected true got false >-FAIL Property contain value 'layout style paint' assert_true: 'layout style paint' is a supported value for contain. expected true got false >-FAIL Property contain value 'size layout style paint' assert_true: 'size layout style paint' is a supported value for contain. expected true got false >+PASS Property contain value 'style paint' >+PASS Property contain value 'layout style paint' >+PASS Property contain value 'size layout style paint' > PASS Property contain value 'size layout paint' > PASS Property contain value 'layout paint' > >diff --git a/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/parsing/contain-valid-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/parsing/contain-valid-expected.txt >index e51550e1405ea4e18749541ab85027777264dd37..85fcfe17397b2966a096aea68388d3c7f1753af6 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/parsing/contain-valid-expected.txt >+++ b/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/parsing/contain-valid-expected.txt >@@ -4,10 +4,10 @@ PASS e.style['contain'] = "strict" should set the property value > PASS e.style['contain'] = "content" should set the property value > PASS e.style['contain'] = "size" should set the property value > PASS e.style['contain'] = "layout" should set the property value >-FAIL e.style['contain'] = "style" should set the property value assert_not_equals: property should be set got disallowed value "" >+PASS e.style['contain'] = "style" should set the property value > PASS e.style['contain'] = "paint" should set the property value > PASS e.style['contain'] = "layout size" should set the property value >-FAIL e.style['contain'] = "paint style" should set the property value assert_not_equals: property should be set got disallowed value "" >-FAIL e.style['contain'] = "layout style paint" should set the property value assert_not_equals: property should be set got disallowed value "" >-FAIL e.style['contain'] = "layout paint style size" should set the property value assert_not_equals: property should be set got disallowed value "" >+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 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 226458
:
430185
|
430187
|
430680
|
430681
|
430717
|
430721
|
430750
|
442017
|
442303