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-20210606133317.patch (text/plain), 17.91 KB, created by
Rob Buis
on 2021-06-06 04:33:19 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Rob Buis
Created:
2021-06-06 04:33:19 PDT
Size:
17.91 KB
patch
obsolete
>Subversion Revision: 278533 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 859457e38743a6db22ec6db115634b94feeefadf..192a2eaa8a81f60cb76e785b3968acada41a42df 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,31 @@ >+2021-06-06 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-06-05 Chris Dumez <cdumez@apple.com> > > Fix repeated call to String::utf8() in SQLiteFileSystem::computeHashForFileName() >diff --git a/Source/WebCore/css/CSSComputedStyleDeclaration.cpp b/Source/WebCore/css/CSSComputedStyleDeclaration.cpp >index a50edfe2cecc2fe994501a7037b6d02a6e273fe4..c9c49f7295769ad62eeacc7b50f31edd361c435b 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 d74f94e10562aa845aaf7797e66a3dc2907cad6c..3469e139fa5518961e51bfa69c36d5f7c36976b7 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 631fc1d45e4158e89013b0234825656c241acb62..a10a2ff38135e4216e97b40cc28486006d38f7b4 100644 >--- a/Source/WebCore/rendering/RenderCounter.cpp >+++ b/Source/WebCore/rendering/RenderCounter.cpp >@@ -57,15 +57,38 @@ static CounterMaps& counterMaps() > return staticCounterMaps; > } > >+static Element* ancestorStyleContainmentObject(const Element& element) >+{ >+ while (Element* ancestor = is<PseudoElement>(element) ? downcast<PseudoElement>(element).hostElement() : element.parentElement()) { >+ if (auto* style = ancestor->existingComputedStyle()) { >+ if (style->containsStyle()) >+ return ancestor; >+ } >+ ancestor = ancestor->parentElement(); >+ } >+ 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->hasDisplayContents()) >+ 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) >@@ -78,7 +101,7 @@ static inline Element* parentOrPseudoHostElement(const RenderElement& renderer) > static Element* previousSiblingOrParentElement(const Element& element) > { > if (auto* previous = ElementTraversal::pseudoAwarePreviousSibling(element)) { >- while (previous && !previous->renderer()) >+ while (previous && !previous->renderer() && !previous->hasDisplayContents()) > previous = ElementTraversal::pseudoAwarePreviousSibling(*previous); > > if (previous) >@@ -92,10 +115,11 @@ static Element* previousSiblingOrParentElement(const Element& element) > return hostElement; > return previousSiblingOrParentElement(*hostElement); > } >- > auto* parent = element.parentElement(); > if (parent && !parent->renderer()) > parent = previousSiblingOrParentElement(*parent); >+ if (parent && parent->renderer() && parent->renderer()->style().containsStyle()) >+ return nullptr; > return parent; > } > >@@ -223,6 +247,7 @@ static CounterInsertionPoint findPlaceForCounter(RenderElement& counterOwner, co > // towards the begining of the document for counters with the same identifier as the one > // we are trying to find a place for. This is the next renderer to be checked. > RenderElement* currentRenderer = previousInPreOrder(counterOwner); >+ > RefPtr<CounterNode> previousSibling; > > while (currentRenderer) { >@@ -335,7 +360,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 +368,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 +574,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 0dcfbcf601d378e286c8182c4fdc86a02da39900..bb3161b111da442859cec4e8270da2ed2cc2e4e0 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 f20f7595d5e04c5b325d47a8de056cc9f1843c07..8f431e9a6f7fd2704f1b84f6feffd6458f32c2fc 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 93d9571e6de5557a76cd0495d425590b6a0fea71..d83715a01b875d50e0643617ef843159c4cf3eec 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 f6e6f7a827079d64f73e81606c1c67d8364f9df0..5d6cca67cd4a862a994c4203698593864aaa6222 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 9e7849f811c7d4b09d80f4959713418231ff5e9a..cb21b4a29cbd65e5601d0f251ccd09f9556391f9 100644 >--- a/LayoutTests/imported/w3c/ChangeLog >+++ b/LayoutTests/imported/w3c/ChangeLog >@@ -1,3 +1,13 @@ >+2021-06-06 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-06-04 Chris Dumez <cdumez@apple.com> > > Worker.constructor throws an exception when the url param is an empty string >diff --git a/LayoutTests/TestExpectations b/LayoutTests/TestExpectations >index ff7cf8f7cb8967d898ea706fbf3c0319a28a5957..843cbb4095e415c801936eac47c70289e568a35f 100644 >--- a/LayoutTests/TestExpectations >+++ b/LayoutTests/TestExpectations >@@ -4676,10 +4676,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 ] >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
Flags:
ews-feeder
:
commit-queue-
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 226458
:
430185
|
430187
|
430680
|
430681
|
430717
|
430721
|
430750
|
442017
|
442303