Title: [290729] trunk
Revision
290729
Author
[email protected]
Date
2022-03-02 07:23:29 -0800 (Wed, 02 Mar 2022)

Log Message

[css-cascade] Support 'revert-layer' in @keyframes
https://bugs.webkit.org/show_bug.cgi?id=237152

Reviewed by Antti Koivisto.

Source/WebCore:

In @keyframes, 'revert-layer' should roll back the cascaded value to
author origin. Resolver::styleForKeyframe already has the base style of
the element, so we only need to avoid applying properties with the
'revert-layer' value.

Test: imported/w3c/web-platform-tests/css/css-cascade/revert-layer-010.html.html

* style/StyleBuilder.cpp:
(WebCore::Style::Builder::applyProperty):
* style/StyleBuilderState.h:
(WebCore::Style::BuilderState::setIsBuildingKeyframeStyle):
* style/StyleResolver.cpp:
(WebCore::Style::Resolver::styleForKeyframe):

LayoutTests:

Expect test to pass.

* TestExpectations:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (290728 => 290729)


--- trunk/LayoutTests/ChangeLog	2022-03-02 15:06:43 UTC (rev 290728)
+++ trunk/LayoutTests/ChangeLog	2022-03-02 15:23:29 UTC (rev 290729)
@@ -1,3 +1,14 @@
+2022-03-02  Oriol Brufau  <[email protected]>
+
+        [css-cascade] Support 'revert-layer' in @keyframes
+        https://bugs.webkit.org/show_bug.cgi?id=237152
+
+        Reviewed by Antti Koivisto.
+
+        Expect test to pass.
+
+        * TestExpectations:
+
 2022-03-02  Alan Bujtas  <[email protected]>
 
         [RTL] Incorrect alt text position in right to left context

Modified: trunk/LayoutTests/TestExpectations (290728 => 290729)


--- trunk/LayoutTests/TestExpectations	2022-03-02 15:06:43 UTC (rev 290728)
+++ trunk/LayoutTests/TestExpectations	2022-03-02 15:23:29 UTC (rev 290729)
@@ -2122,8 +2122,7 @@
 
 imported/w3c/web-platform-tests/css/css-cascade/important-prop.html [ ImageOnlyFailure ]
 webkit.org/b/187093 [ Debug ] imported/w3c/web-platform-tests/css/css-cascade/all-prop-initial-xml.html [ Skip ]
-webkit.org/b/233937 imported/w3c/web-platform-tests/css/css-cascade/revert-layer-010.html [ ImageOnlyFailure ]
-webkit.org/b/233937 imported/w3c/web-platform-tests/css/css-cascade/revert-layer-011.html [ ImageOnlyFailure ]
+webkit.org/b/192334 imported/w3c/web-platform-tests/css/css-cascade/revert-layer-011.html [ ImageOnlyFailure ]
 
 # Initial failures on the import of css-content
 

Modified: trunk/Source/WebCore/ChangeLog (290728 => 290729)


--- trunk/Source/WebCore/ChangeLog	2022-03-02 15:06:43 UTC (rev 290728)
+++ trunk/Source/WebCore/ChangeLog	2022-03-02 15:23:29 UTC (rev 290729)
@@ -1,3 +1,24 @@
+2022-03-02  Oriol Brufau  <[email protected]>
+
+        [css-cascade] Support 'revert-layer' in @keyframes
+        https://bugs.webkit.org/show_bug.cgi?id=237152
+
+        Reviewed by Antti Koivisto.
+
+        In @keyframes, 'revert-layer' should roll back the cascaded value to
+        author origin. Resolver::styleForKeyframe already has the base style of
+        the element, so we only need to avoid applying properties with the
+        'revert-layer' value.
+
+        Test: imported/w3c/web-platform-tests/css/css-cascade/revert-layer-010.html.html
+
+        * style/StyleBuilder.cpp:
+        (WebCore::Style::Builder::applyProperty):
+        * style/StyleBuilderState.h:
+        (WebCore::Style::BuilderState::setIsBuildingKeyframeStyle):
+        * style/StyleResolver.cpp:
+        (WebCore::Style::Resolver::styleForKeyframe):
+
 2022-03-02  Michael Catanzaro  <[email protected]>
 
         [GTK] setDragImage ignores offset

Modified: trunk/Source/WebCore/style/StyleBuilder.cpp (290728 => 290729)


--- trunk/Source/WebCore/style/StyleBuilder.cpp	2022-03-02 15:06:43 UTC (rev 290728)
+++ trunk/Source/WebCore/style/StyleBuilder.cpp	2022-03-02 15:23:29 UTC (rev 290729)
@@ -300,6 +300,11 @@
     bool isRevertLayer = valueToApply->isRevertLayerValue() || customPropertyValueID == CSSValueRevertLayer;
 
     if (isRevert || isRevertLayer) {
+        // In @keyframes, 'revert-layer' rolls back the cascaded value to the author level.
+        // We can just not apply the property in order to keep the value from the base style.
+        if (isRevertLayer && m_state.m_isBuildingKeyframeStyle)
+            return;
+
         auto* rollbackCascade = isRevert ? ensureRollbackCascadeForRevert() : ensureRollbackCascadeForRevertLayer();
 
         if (rollbackCascade) {

Modified: trunk/Source/WebCore/style/StyleBuilderState.h (290728 => 290729)


--- trunk/Source/WebCore/style/StyleBuilderState.h	2022-03-02 15:06:43 UTC (rev 290728)
+++ trunk/Source/WebCore/style/StyleBuilderState.h	2022-03-02 15:23:29 UTC (rev 290729)
@@ -107,6 +107,8 @@
     const CSSToLengthConversionData& cssToLengthConversionData() const { return m_cssToLengthConversionData; }
     CSSToStyleMap& styleMap() { return m_styleMap; }
 
+    void setIsBuildingKeyframeStyle() { m_isBuildingKeyframeStyle = true; }
+
 private:
     // See the comment in maybeUpdateFontForLetterSpacing() about why this needs to be a friend.
     friend void maybeUpdateFontForLetterSpacing(BuilderState&, CSSValue&);
@@ -141,6 +143,8 @@
 
     bool m_fontDirty { false };
     Vector<AtomString> m_registeredContentAttributes;
+
+    bool m_isBuildingKeyframeStyle { false };
 };
 
 }

Modified: trunk/Source/WebCore/style/StyleResolver.cpp (290728 => 290729)


--- trunk/Source/WebCore/style/StyleResolver.cpp	2022-03-02 15:06:43 UTC (rev 290728)
+++ trunk/Source/WebCore/style/StyleResolver.cpp	2022-03-02 15:23:29 UTC (rev 290729)
@@ -308,6 +308,7 @@
     }
     collector.addAuthorKeyframeRules(keyframe);
     Builder builder(*state.style(), builderContext(state), collector.matchResult(), CascadeLevel::Author);
+    builder.state().setIsBuildingKeyframeStyle();
     builder.applyAllProperties();
 
     Adjuster adjuster(document(), *state.parentStyle(), nullptr, nullptr);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to