Modified: trunk/LayoutTests/imported/w3c/ChangeLog (291089 => 291090)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2022-03-10 04:36:00 UTC (rev 291089)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2022-03-10 06:12:17 UTC (rev 291090)
@@ -1,5 +1,16 @@
2022-03-09 Antoine Quint <[email protected]>
+ [web-animations] counter-increment should support discrete animation
+ https://bugs.webkit.org/show_bug.cgi?id=237640
+
+ 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-09 Antoine Quint <[email protected]>
+
[web-animations] dominant-baseline should support discrete animation
https://bugs.webkit.org/show_bug.cgi?id=237645
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/accumulation-per-property-001-expected.txt (291089 => 291090)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/accumulation-per-property-001-expected.txt 2022-03-10 04:36:00 UTC (rev 291089)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/accumulation-per-property-001-expected.txt 2022-03-10 06:12:17 UTC (rev 291090)
@@ -175,6 +175,9 @@
PASS column-width (type: discrete) has testAccumulation function
PASS column-width: "1px" onto "auto"
PASS column-width: "auto" onto "1px"
+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 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 (291089 => 291090)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/addition-per-property-001-expected.txt 2022-03-10 04:36:00 UTC (rev 291089)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/addition-per-property-001-expected.txt 2022-03-10 06:12:17 UTC (rev 291090)
@@ -175,6 +175,9 @@
PASS column-width (type: discrete) has testAddition function
PASS column-width: "1px" onto "auto"
PASS column-width: "auto" onto "1px"
+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 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 (291089 => 291090)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/interpolation-per-property-001-expected.txt 2022-03-10 04:36:00 UTC (rev 291089)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/interpolation-per-property-001-expected.txt 2022-03-10 06:12:17 UTC (rev 291090)
@@ -211,6 +211,10 @@
PASS column-width uses discrete animation when animating between "auto" and "1px" with linear easing
PASS column-width uses discrete animation when animating between "auto" and "1px" with effect easing
PASS column-width uses discrete animation when animating between "auto" and "1px" with keyframe easing
+PASS counter-increment (type: discrete) has testInterpolation function
+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 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 (291089 => 291090)
--- trunk/Source/WebCore/ChangeLog 2022-03-10 04:36:00 UTC (rev 291089)
+++ trunk/Source/WebCore/ChangeLog 2022-03-10 06:12:17 UTC (rev 291090)
@@ -1,3 +1,17 @@
+2022-03-09 Antoine Quint <[email protected]>
+
+ [web-animations] counter-increment should support discrete animation
+ https://bugs.webkit.org/show_bug.cgi?id=237640
+
+ Reviewed by Antti Koivisto.
+
+ The counter-increment and counter-reset properties are represented via a single data structure
+ held by RenderStyle. This lays up the groundwork for animation support of counter-reset as well
+ but right now we only handle counter-increment to keep this patch focused.
+
+ * animation/CSSPropertyAnimation.cpp:
+ (WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap):
+
2022-03-09 Andres Gonzalez <[email protected]>
Remove unused AccessibilityObject member variable.
Modified: trunk/Source/WebCore/animation/CSSPropertyAnimation.cpp (291089 => 291090)
--- trunk/Source/WebCore/animation/CSSPropertyAnimation.cpp 2022-03-10 04:36:00 UTC (rev 291089)
+++ trunk/Source/WebCore/animation/CSSPropertyAnimation.cpp 2022-03-10 06:12:17 UTC (rev 291090)
@@ -43,6 +43,7 @@
#include "CalculationValue.h"
#include "ColorBlending.h"
#include "ContentData.h"
+#include "CounterDirectives.h"
#include "FloatConversion.h"
#include "FontCascade.h"
#include "FontSelectionAlgorithm.h"
@@ -2513,6 +2514,75 @@
#endif
};
+class CounterIncrementWrapper final : public AnimationPropertyWrapperBase {
+ WTF_MAKE_FAST_ALLOCATED;
+public:
+ CounterIncrementWrapper()
+ : AnimationPropertyWrapperBase(CSSPropertyCounterIncrement)
+ {
+ }
+
+ bool canInterpolate(const RenderStyle&, const RenderStyle&, CompositeOperation) const override { return false; }
+
+ bool equals(const RenderStyle& a, const RenderStyle& b) const final
+ {
+ auto* aCounterDirectives = a.counterDirectives();
+ auto* bCounterDirectives = b.counterDirectives();
+
+ if (!aCounterDirectives && !bCounterDirectives)
+ return true;
+ if (aCounterDirectives && bCounterDirectives) {
+ if (aCounterDirectives->size() != bCounterDirectives->size())
+ return false;
+ for (auto& [key, aDirective] : *aCounterDirectives) {
+ auto it = bCounterDirectives->find(key);
+ if (it == bCounterDirectives->end())
+ return false;
+ auto& bDirective = it->value;
+ if (aDirective.incrementValue != bDirective.incrementValue)
+ return false;
+ }
+ return true;
+ }
+ return false;
+ }
+
+#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) << ".");
+ }
+#endif
+
+ void blend(RenderStyle& destination, const RenderStyle& from, const RenderStyle& to, const CSSPropertyBlendingContext& context) const final
+ {
+ ASSERT(context.isDiscrete);
+ ASSERT(!context.progress || context.progress == 1);
+
+ // Clear all existing values in the existing set of directives.
+ if (destination.counterDirectives()) {
+ for (auto& [key, directive] : destination.accessCounterDirectives())
+ directive.incrementValue = std::nullopt;
+ }
+
+ auto& style = context.progress ? to : from;
+ if (!style.counterDirectives())
+ return;
+
+ auto& targetDirectives = destination.accessCounterDirectives();
+ for (auto& [key, directive] : *style.counterDirectives()) {
+ auto updateDirective = [](CounterDirectives& target, const CounterDirectives& source) {
+ target.incrementValue = source.incrementValue;
+ };
+ auto it = targetDirectives.find(key);
+ if (it == targetDirectives.end())
+ updateDirective(targetDirectives.add(key, CounterDirectives { }).iterator->value, directive);
+ else
+ updateDirective(it->value, directive);
+ }
+ }
+};
+
class CSSPropertyAnimationWrapperMap final {
WTF_MAKE_FAST_ALLOCATED;
public:
@@ -2844,7 +2914,8 @@
new FontFamilyWrapper,
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 DiscretePropertyWrapper<DominantBaseline>(CSSPropertyDominantBaseline, &RenderStyle::dominantBaseline, &RenderStyle::setDominantBaseline),
+ new CounterIncrementWrapper
};
const unsigned animatableLonghandPropertiesCount = WTF_ARRAY_LENGTH(animatableLonghandPropertyWrappers);