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-20210607174913.patch (text/plain), 19.53 KB, created by
Rob Buis
on 2021-06-07 08:49:16 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Rob Buis
Created:
2021-06-07 08:49:16 PDT
Size:
19.53 KB
patch
obsolete
>Subversion Revision: 278559 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index cf38a350d97e8349bfdc5aec281ab8bac645a54e..9390b2480dc11123c3c2a7c7c76cbe2d5fd01d4d 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,40 @@ >+2021-06-07 Rob Buis <rbuis@igalia.com> >+ >+ [css-contain] Support contain:style >+ https://bugs.webkit.org/show_bug.cgi?id=226458 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ 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::findPlaceForCounter): >+ (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-07 Alicia Boya GarcÃa <aboya@igalia.com> > > [GStreamer] Add clang TSA annotations: MainThreadNotifier >diff --git a/Source/WebCore/css/CSSComputedStyleDeclaration.cpp b/Source/WebCore/css/CSSComputedStyleDeclaration.cpp >index cd567d90ea2eb2f70ab806b0ec2dcc82646dd781..d7b71bea44f402df39f680087efc54a318c8559f 100644 >--- a/Source/WebCore/css/CSSComputedStyleDeclaration.cpp >+++ b/Source/WebCore/css/CSSComputedStyleDeclaration.cpp >@@ -3493,6 +3493,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 6845237869326086cbcae0ed94dbc3a56deb52f5..d04bc86a682f45e992bb4842adb7adc2daa4686a 100644 >--- a/Source/WebCore/css/parser/CSSPropertyParser.cpp >+++ b/Source/WebCore/css/parser/CSSPropertyParser.cpp >@@ -3837,7 +3837,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: >@@ -3855,6 +3855,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; > } >@@ -3863,6 +3868,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..50f655056838a89cb17ccc9e5bf5e122d6e728d5 100644 >--- a/Source/WebCore/rendering/RenderCounter.cpp >+++ b/Source/WebCore/rendering/RenderCounter.cpp >@@ -57,15 +57,39 @@ 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; >+ } >+ 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); >+ 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 +120,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 +361,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 +369,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 +575,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/ChangeLog b/LayoutTests/ChangeLog >index 7c7b83790cf3bfac579105c6c9833a78f1a6a340..9befe963ca1812375a47308355d40929238e21b7 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,14 @@ >+2021-06-07 Rob Buis <rbuis@igalia.com> >+ >+ [css-contain] Support contain:style >+ https://bugs.webkit.org/show_bug.cgi?id=226458 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Unskip tests that now pass. >+ >+ * TestExpectations: >+ > 2021-06-07 Aditya Keerthi <akeerthi@apple.com> > > [iOS] Unexpected scrolling when switching focus from a text input to a select element >diff --git a/LayoutTests/imported/w3c/ChangeLog b/LayoutTests/imported/w3c/ChangeLog >index ac2f54c19bb4fcec2a57900cedc45269d7b2ef57..de422dc53ff0375641a1bfa94a8de9bd249d841f 100644 >--- a/LayoutTests/imported/w3c/ChangeLog >+++ b/LayoutTests/imported/w3c/ChangeLog >@@ -1,3 +1,16 @@ >+2021-06-07 Rob Buis <rbuis@igalia.com> >+ >+ [css-contain] Support contain:style >+ https://bugs.webkit.org/show_bug.cgi?id=226458 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ 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-06-06 Darin Adler <darin@apple.com> > > Handle custom identifiers and strings separately, so we can quote strings correctly consistently >diff --git a/LayoutTests/TestExpectations b/LayoutTests/TestExpectations >index 977482b240de91343acc7b883bb43c4f5117b800..ef54a494a0a11612872fe6ade7861abe702cff7e 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/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