Title: [290561] trunk
Revision
290561
Author
[email protected]
Date
2022-02-27 08:17:03 -0800 (Sun, 27 Feb 2022)

Log Message

[css-animations] implicit keyframes should be inserted after explicit keyframes with the same offset
https://bugs.webkit.org/show_bug.cgi?id=237246

Reviewed by Dean Jackson.

LayoutTests/imported/w3c:

Update WPT test added in bug 236838 to match the spec following discussion with Brian Birtles in
https://github.com/web-platform-tests/wpt/pull/32903.

* web-platform-tests/css/css-animations/KeyframeEffect-getKeyframes.tentative.html:

Source/WebCore:

The CSS Animations spec says the following about implicit keyframes generation:

    Let initial keyframe be the keyframe in keyframes with offset 0, timing function default timing
    function and composite default composite.

    If there is no such keyframe, let initial keyframe be a new empty keyframe with offset 0, timing
    function default timing function, composite |default composite, and add it to keyframes after the
    last keyframe with offset 0.

    Let final keyframe be the keyframe in keyframes with offset 1, timing function default timing
    function and composite default composite.

    If there is no such keyframe, let final keyframe be a new empty keyframe with offset 1, timing
    function default timing function and composite default composite, and add it to keyframes after
    the last keyframe with offset 1.

Full details are at https://drafts.csswg.org/css-animations-2/#keyframes.

The KeyframeList::insert() method does the right thing already by adding a new keyframe after all
other keyframes with that same offset, so all we need to do is to use this method rather than
specifying explicit indexes.

* rendering/style/KeyframeList.cpp:
(WebCore::KeyframeList::fillImplicitKeyframes):

Modified Paths

Diff

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (290560 => 290561)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2022-02-27 16:03:42 UTC (rev 290560)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2022-02-27 16:17:03 UTC (rev 290561)
@@ -1,3 +1,15 @@
+2022-02-27  Antoine Quint  <[email protected]>
+
+        [css-animations] implicit keyframes should be inserted after explicit keyframes with the same offset
+        https://bugs.webkit.org/show_bug.cgi?id=237246
+
+        Reviewed by Dean Jackson.
+
+        Update WPT test added in bug 236838 to match the spec following discussion with Brian Birtles in
+        https://github.com/web-platform-tests/wpt/pull/32903.
+
+        * web-platform-tests/css/css-animations/KeyframeEffect-getKeyframes.tentative.html:
+
 2022-02-27  Tim Nguyen  <[email protected]>
 
         Re-import inert and <dialog> WPT

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-animations/KeyframeEffect-getKeyframes.tentative.html (290560 => 290561)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-animations/KeyframeEffect-getKeyframes.tentative.html	2022-02-27 16:03:42 UTC (rev 290560)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-animations/KeyframeEffect-getKeyframes.tentative.html	2022-02-27 16:17:03 UTC (rev 290561)
@@ -843,8 +843,8 @@
   const frames = getKeyframes(div);
 
   const expected = [
+    { offset: 0,   computedOffset: 0,   easing: "linear", composite: "auto" },
     { offset: 0,   computedOffset: 0,   easing: "ease",   composite: "auto", left: "auto" },
-    { offset: 0,   computedOffset: 0,   easing: "linear", composite: "auto" },
     { offset: 0.5, computedOffset: 0.5, easing: "ease",   composite: "auto", left: "10px" },
     { offset: 1,   computedOffset: 1,   easing: "linear", composite: "auto" },
     { offset: 1,   computedOffset: 1,   easing: "ease",   composite: "auto", left: "auto" }

Modified: trunk/Source/WebCore/ChangeLog (290560 => 290561)


--- trunk/Source/WebCore/ChangeLog	2022-02-27 16:03:42 UTC (rev 290560)
+++ trunk/Source/WebCore/ChangeLog	2022-02-27 16:17:03 UTC (rev 290561)
@@ -1,3 +1,35 @@
+2022-02-27  Antoine Quint  <[email protected]>
+
+        [css-animations] implicit keyframes should be inserted after explicit keyframes with the same offset
+        https://bugs.webkit.org/show_bug.cgi?id=237246
+
+        Reviewed by Dean Jackson.
+
+        The CSS Animations spec says the following about implicit keyframes generation:
+
+            Let initial keyframe be the keyframe in keyframes with offset 0, timing function default timing
+            function and composite default composite.
+
+            If there is no such keyframe, let initial keyframe be a new empty keyframe with offset 0, timing
+            function default timing function, composite |default composite, and add it to keyframes after the
+            last keyframe with offset 0.
+
+            Let final keyframe be the keyframe in keyframes with offset 1, timing function default timing
+            function and composite default composite.
+
+            If there is no such keyframe, let final keyframe be a new empty keyframe with offset 1, timing
+            function default timing function and composite default composite, and add it to keyframes after
+            the last keyframe with offset 1.        
+
+        Full details are at https://drafts.csswg.org/css-animations-2/#keyframes.
+
+        The KeyframeList::insert() method does the right thing already by adding a new keyframe after all
+        other keyframes with that same offset, so all we need to do is to use this method rather than
+        specifying explicit indexes.
+
+        * rendering/style/KeyframeList.cpp:
+        (WebCore::KeyframeList::fillImplicitKeyframes):
+
 2022-02-27  Tim Nguyen  <[email protected]>
 
         Use hasAttributeWithoutSynchronisation for checking inert attribute in Adjuster::adjust

Modified: trunk/Source/WebCore/rendering/style/KeyframeList.cpp (290560 => 290561)


--- trunk/Source/WebCore/rendering/style/KeyframeList.cpp	2022-02-27 16:03:42 UTC (rev 290560)
+++ trunk/Source/WebCore/rendering/style/KeyframeList.cpp	2022-02-27 16:17:03 UTC (rev 290561)
@@ -194,10 +194,7 @@
         keyframeValue.setStyle(styleResolver.styleForKeyframe(element, underlyingStyle, { nullptr }, keyframeRule, keyframeValue));
         for (auto cssPropertyId : implicitProperties)
             keyframeValue.addProperty(cssPropertyId);
-        if (!key)
-            m_keyframes.insert(0, WTFMove(keyframeValue));
-        else
-            m_keyframes.append(WTFMove(keyframeValue));
+        insert(WTFMove(keyframeValue));
     };
 
     if (!zeroKeyframeImplicitProperties.isEmpty())
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to