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-20210531095015.patch (text/plain), 15.35 KB, created by
Rob Buis
on 2021-05-31 00:50:18 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Rob Buis
Created:
2021-05-31 00:50:18 PDT
Size:
15.35 KB
patch
obsolete
>Subversion Revision: 278193 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 8a4c0b706b57f203cdcd3e32b58f16d44b3ae376..2b7acc754b40a13b51030bb84fe9dafcb4610827 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,31 @@ >+2021-05-31 Rob Buis <rbuis@igalia.com> >+ >+ [css-contain] Support contain:style >+ https://bugs.webkit.org/show_bug.cgi?id=226458 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ WIP. >+ >+ * 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-05-28 Martin Robinson <mrobinson@webkit.org> > > More readily layout when scroll-snap properties change >diff --git a/Source/WebCore/css/CSSComputedStyleDeclaration.cpp b/Source/WebCore/css/CSSComputedStyleDeclaration.cpp >index a6d543bcedf5935833aa2ca79749bb00555a3157..a470cb8a250a90ddd90767b41f3526a29579f1d7 100644 >--- a/Source/WebCore/css/CSSComputedStyleDeclaration.cpp >+++ b/Source/WebCore/css/CSSComputedStyleDeclaration.cpp >@@ -3488,6 +3488,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 fd51061973e250c9f5dd126d81c8a783335c7af3..961b53dfd7916c59ae5ace00e016373aa346014a 100644 >--- a/Source/WebCore/css/parser/CSSPropertyParser.cpp >+++ b/Source/WebCore/css/parser/CSSPropertyParser.cpp >@@ -3850,7 +3850,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: >@@ -3868,6 +3868,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; > } >@@ -3876,6 +3881,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 d3ac0c361e0cf5e058d784cf2102cc69b6f4e58c..5f13b2d8951834d0585432810ef9a7ddfa4e41b0 100644 >--- a/Source/WebCore/rendering/RenderCounter.cpp >+++ b/Source/WebCore/rendering/RenderCounter.cpp >@@ -57,15 +57,34 @@ static CounterMaps& counterMaps() > return staticCounterMaps; > } > >+static Element* ancestorStyleContainmentObject(const Element& element) >+{ >+ for (Element* ancestor = element.parentElement(); ancestor; ancestor = ancestor->parentElement()) { >+ if (ancestor->renderer() && ancestor->renderer()->style().containsStyle()) >+ return ancestor; >+ } >+ return nullptr; >+} >+ > // 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); >+ 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 +115,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 +356,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 +364,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 +570,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 crossedBoundary = false; > for (RenderObject* descendant = &renderer; descendant; descendant = descendant->nextInPreOrder(&renderer)) { >- if (is<RenderElement>(*descendant)) >+ crossedBoundary |= shouldApplyStyleContainment(*descendant); >+ if (crossedBoundary && is<RenderElement>(*descendant)) > updateCounters(downcast<RenderElement>(*descendant)); > } > } >diff --git a/Source/WebCore/rendering/RenderObject.cpp b/Source/WebCore/rendering/RenderObject.cpp >index 42e0edf3c5b3368020b1b052461c7ab5bc0746ea..51c70cf1c1946eb3f4528eda176d9937b99f1ed7 100644 >--- a/Source/WebCore/rendering/RenderObject.cpp >+++ b/Source/WebCore/rendering/RenderObject.cpp >@@ -2514,3 +2514,8 @@ 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) >+{ >+ return renderer.style().containsStyle() && (!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 bfa848c623f1032b8888de37dcbb7c55cfd00b1f..6a30036599a4bae093deba6a35e93a55638fd505 100644 >--- a/Source/WebCore/rendering/RenderObject.h >+++ b/Source/WebCore/rendering/RenderObject.h >@@ -1197,6 +1197,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 1a7563d061ceeb9fa36db75a85d38fb2983c402f..dc0b9da78a4748769b4a1c9b1ec3969903d8e464 100644 >--- a/Source/WebCore/rendering/style/RenderStyle.h >+++ b/Source/WebCore/rendering/style/RenderStyle.h >@@ -528,6 +528,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 49904a6f21ee6d261b8929c673cb441c2c974785..b52e9bc3911cd6f5e0ddd9cc880fa7c6b6d457eb 100644 >--- a/Source/WebCore/rendering/style/RenderStyleConstants.h >+++ b/Source/WebCore/rendering/style/RenderStyleConstants.h >@@ -1223,6 +1223,7 @@ enum class Containment : uint8_t { > Layout = 1 << 0, > Paint = 1 << 1, > Size = 1 << 2, >+ Style = 1 << 3, > }; > > extern const float defaultMiterLimit; >diff --git a/Source/WebCore/style/StyleBuilderCustom.h b/Source/WebCore/style/StyleBuilderCustom.h >index 7f01f9cba509c3c7d9a8e4c79176740143e8d588..bf776b5e5abb8dd0b328d18d90822a469b7cfae0 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/imported/w3c/ChangeLog b/LayoutTests/imported/w3c/ChangeLog >index ce3a922f903e40bd32db70ccbe78cdc024f4b490..069b2bc0c296944e9c26d17bb3a888e83c49d405 100644 >--- a/LayoutTests/imported/w3c/ChangeLog >+++ b/LayoutTests/imported/w3c/ChangeLog >@@ -1,3 +1,13 @@ >+2021-05-31 Rob Buis <rbuis@igalia.com> >+ >+ [css-contain] Support contain:style >+ https://bugs.webkit.org/show_bug.cgi?id=226458 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * web-platform-tests/css/css-contain/parsing/contain-computed-expected.txt: >+ * web-platform-tests/css/css-contain/parsing/contain-valid-expected.txt: >+ > 2021-05-28 Martin Robinson <mrobinson@webkit.org> > > More readily layout when scroll-snap properties change >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