Title: [291099] trunk
Revision
291099
Author
[email protected]
Date
2022-03-10 03:16:02 -0800 (Thu, 10 Mar 2022)

Log Message

[web-animations] counter-reset should support discrete animation
https://bugs.webkit.org/show_bug.cgi?id=237644

Reviewed by Antti Koivisto.

LayoutTests/imported/w3c:

* web-platform-tests/web-animations/animation-model/animation-types/accumulation-per-property-001-expected.txt:
* web-platform-tests/web-animations/animation-model/animation-types/addition-per-property-001-expected.txt:
* web-platform-tests/web-animations/animation-model/animation-types/interpolation-per-property-001-expected.txt:

Source/WebCore:

Generalize the wrapper added for counter-increment to also handle counter-reset.

* animation/CSSPropertyAnimation.cpp:
(WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap):

Modified Paths

Diff

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (291098 => 291099)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2022-03-10 10:22:14 UTC (rev 291098)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2022-03-10 11:16:02 UTC (rev 291099)
@@ -1,3 +1,14 @@
+2022-03-10  Antoine Quint  <[email protected]>
+
+        [web-animations] counter-reset should support discrete animation
+        https://bugs.webkit.org/show_bug.cgi?id=237644
+
+        Reviewed by Antti Koivisto.
+
+        * web-platform-tests/web-animations/animation-model/animation-types/accumulation-per-property-001-expected.txt:
+        * web-platform-tests/web-animations/animation-model/animation-types/addition-per-property-001-expected.txt:
+        * web-platform-tests/web-animations/animation-model/animation-types/interpolation-per-property-001-expected.txt:
+
 2022-03-10  Antti Koivisto  <[email protected]>
 
         [CSS Container Queries] Implement new container selection algorithm

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/accumulation-per-property-001-expected.txt (291098 => 291099)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/accumulation-per-property-001-expected.txt	2022-03-10 10:22:14 UTC (rev 291098)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/accumulation-per-property-001-expected.txt	2022-03-10 11:16:02 UTC (rev 291099)
@@ -178,6 +178,9 @@
 PASS counter-increment (type: discrete) has testAccumulation function
 PASS counter-increment: "ident-2 2" onto "ident-1 1"
 PASS counter-increment: "ident-1 1" onto "ident-2 2"
+PASS counter-reset (type: discrete) has testAccumulation function
+PASS counter-reset: "ident-2 2" onto "ident-1 1"
+PASS counter-reset: "ident-1 1" onto "ident-2 2"
 PASS cursor (type: discrete) has testAccumulation function
 PASS cursor: "wait" onto "pointer"
 PASS cursor: "pointer" onto "wait"

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/addition-per-property-001-expected.txt (291098 => 291099)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/addition-per-property-001-expected.txt	2022-03-10 10:22:14 UTC (rev 291098)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/addition-per-property-001-expected.txt	2022-03-10 11:16:02 UTC (rev 291099)
@@ -178,6 +178,9 @@
 PASS counter-increment (type: discrete) has testAddition function
 PASS counter-increment: "ident-2 2" onto "ident-1 1"
 PASS counter-increment: "ident-1 1" onto "ident-2 2"
+PASS counter-reset (type: discrete) has testAddition function
+PASS counter-reset: "ident-2 2" onto "ident-1 1"
+PASS counter-reset: "ident-1 1" onto "ident-2 2"
 PASS cursor (type: discrete) has testAddition function
 PASS cursor: "wait" onto "pointer"
 PASS cursor: "pointer" onto "wait"

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/interpolation-per-property-001-expected.txt (291098 => 291099)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/interpolation-per-property-001-expected.txt	2022-03-10 10:22:14 UTC (rev 291098)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/interpolation-per-property-001-expected.txt	2022-03-10 11:16:02 UTC (rev 291099)
@@ -215,6 +215,10 @@
 PASS counter-increment uses discrete animation when animating between "ident-1 1" and "ident-2 2" with linear easing
 PASS counter-increment uses discrete animation when animating between "ident-1 1" and "ident-2 2" with effect easing
 PASS counter-increment uses discrete animation when animating between "ident-1 1" and "ident-2 2" with keyframe easing
+PASS counter-reset (type: discrete) has testInterpolation function
+PASS counter-reset uses discrete animation when animating between "ident-1 1" and "ident-2 2" with linear easing
+PASS counter-reset uses discrete animation when animating between "ident-1 1" and "ident-2 2" with effect easing
+PASS counter-reset uses discrete animation when animating between "ident-1 1" and "ident-2 2" with keyframe easing
 PASS cursor (type: discrete) has testInterpolation function
 PASS cursor uses discrete animation when animating between "pointer" and "wait" with linear easing
 PASS cursor uses discrete animation when animating between "pointer" and "wait" with effect easing

Modified: trunk/Source/WebCore/ChangeLog (291098 => 291099)


--- trunk/Source/WebCore/ChangeLog	2022-03-10 10:22:14 UTC (rev 291098)
+++ trunk/Source/WebCore/ChangeLog	2022-03-10 11:16:02 UTC (rev 291099)
@@ -1,3 +1,15 @@
+2022-03-10  Antoine Quint  <[email protected]>
+
+        [web-animations] counter-reset should support discrete animation
+        https://bugs.webkit.org/show_bug.cgi?id=237644
+
+        Reviewed by Antti Koivisto.
+
+        Generalize the wrapper added for counter-increment to also handle counter-reset.
+
+        * animation/CSSPropertyAnimation.cpp:
+        (WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap):
+
 2022-03-10  Antti Koivisto  <[email protected]>
 
         [CSS Container Queries] Implement new container selection algorithm

Modified: trunk/Source/WebCore/animation/CSSPropertyAnimation.cpp (291098 => 291099)


--- trunk/Source/WebCore/animation/CSSPropertyAnimation.cpp	2022-03-10 10:22:14 UTC (rev 291098)
+++ trunk/Source/WebCore/animation/CSSPropertyAnimation.cpp	2022-03-10 11:16:02 UTC (rev 291099)
@@ -2514,12 +2514,13 @@
 #endif
 };
 
-class CounterIncrementWrapper final : public AnimationPropertyWrapperBase {
+class CounterWrapper final : public AnimationPropertyWrapperBase {
     WTF_MAKE_FAST_ALLOCATED;
 public:
-    CounterIncrementWrapper()
-        : AnimationPropertyWrapperBase(CSSPropertyCounterIncrement)
+    CounterWrapper(CSSPropertyID property)
+        : AnimationPropertyWrapperBase(property)
     {
+        ASSERT(property == CSSPropertyCounterIncrement || property == CSSPropertyCounterReset);
     }
 
     bool canInterpolate(const RenderStyle&, const RenderStyle&, CompositeOperation) const override { return false; }
@@ -2539,7 +2540,8 @@
                 if (it == bCounterDirectives->end())
                     return false;
                 auto& bDirective = it->value;
-                if (aDirective.incrementValue != bDirective.incrementValue)
+                if ((property() == CSSPropertyCounterIncrement && aDirective.incrementValue != bDirective.incrementValue)
+                    || (property() == CSSPropertyCounterReset && aDirective.resetValue != bDirective.resetValue))
                     return false;
             }
             return true;
@@ -2550,7 +2552,7 @@
 #if !LOG_DISABLED
     void logBlend(const RenderStyle&, const RenderStyle&, const RenderStyle&, double progress) const final
     {
-        LOG_WITH_STREAM(Animations, stream << " blending counter-increment at " << TextStream::FormatNumberRespectingIntegers(progress) << ".");
+        LOG_WITH_STREAM(Animations, stream << " blending " << getPropertyName(property()) << " at " << TextStream::FormatNumberRespectingIntegers(progress) << ".");
     }
 #endif
 
@@ -2561,8 +2563,12 @@
 
         // Clear all existing values in the existing set of directives.
         if (destination.counterDirectives()) {
-            for (auto& [key, directive] : destination.accessCounterDirectives())
-                directive.incrementValue = std::nullopt;
+            for (auto& [key, directive] : destination.accessCounterDirectives()) {
+                if (property() == CSSPropertyCounterIncrement)
+                    directive.incrementValue = std::nullopt;
+                else
+                    directive.resetValue = std::nullopt;
+            }
         }
 
         auto& style = context.progress ? to : from;
@@ -2571,8 +2577,11 @@
 
         auto& targetDirectives = destination.accessCounterDirectives();
         for (auto& [key, directive] : *style.counterDirectives()) {
-            auto updateDirective = [](CounterDirectives& target, const CounterDirectives& source) {
-                target.incrementValue = source.incrementValue;
+            auto updateDirective = [&](CounterDirectives& target, const CounterDirectives& source) {
+                if (property() == CSSPropertyCounterIncrement)
+                    target.incrementValue = source.incrementValue;
+                else
+                    target.resetValue = source.resetValue;
             };
             auto it = targetDirectives.find(key);
             if (it == targetDirectives.end())
@@ -2915,7 +2924,8 @@
         new DiscretePropertyWrapper<WindRule>(CSSPropertyClipRule, &RenderStyle::clipRule, &RenderStyle::setClipRule),
         new DiscretePropertyWrapper<ColorInterpolation>(CSSPropertyColorInterpolationFilters, &RenderStyle::colorInterpolationFilters, &RenderStyle::setColorInterpolationFilters),
         new DiscretePropertyWrapper<DominantBaseline>(CSSPropertyDominantBaseline, &RenderStyle::dominantBaseline, &RenderStyle::setDominantBaseline),
-        new CounterIncrementWrapper
+        new CounterWrapper(CSSPropertyCounterIncrement),
+        new CounterWrapper(CSSPropertyCounterReset)
     };
     const unsigned animatableLonghandPropertiesCount = WTF_ARRAY_LENGTH(animatableLonghandPropertyWrappers);
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to