Changeset 291099 in webkit


Ignore:
Timestamp:
Mar 10, 2022 3:16:02 AM (4 months ago)
Author:
graouts@webkit.org
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):

Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/imported/w3c/ChangeLog

    r291098 r291099  
     12022-03-10  Antoine Quint  <graouts@webkit.org>
     2
     3        [web-animations] counter-reset should support discrete animation
     4        https://bugs.webkit.org/show_bug.cgi?id=237644
     5
     6        Reviewed by Antti Koivisto.
     7
     8        * web-platform-tests/web-animations/animation-model/animation-types/accumulation-per-property-001-expected.txt:
     9        * web-platform-tests/web-animations/animation-model/animation-types/addition-per-property-001-expected.txt:
     10        * web-platform-tests/web-animations/animation-model/animation-types/interpolation-per-property-001-expected.txt:
     11
    1122022-03-10  Antti Koivisto  <antti@apple.com>
    213
  • trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/accumulation-per-property-001-expected.txt

    r291090 r291099  
    179179PASS counter-increment: "ident-2 2" onto "ident-1 1"
    180180PASS counter-increment: "ident-1 1" onto "ident-2 2"
     181PASS counter-reset (type: discrete) has testAccumulation function
     182PASS counter-reset: "ident-2 2" onto "ident-1 1"
     183PASS counter-reset: "ident-1 1" onto "ident-2 2"
    181184PASS cursor (type: discrete) has testAccumulation function
    182185PASS cursor: "wait" onto "pointer"
  • trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/addition-per-property-001-expected.txt

    r291090 r291099  
    179179PASS counter-increment: "ident-2 2" onto "ident-1 1"
    180180PASS counter-increment: "ident-1 1" onto "ident-2 2"
     181PASS counter-reset (type: discrete) has testAddition function
     182PASS counter-reset: "ident-2 2" onto "ident-1 1"
     183PASS counter-reset: "ident-1 1" onto "ident-2 2"
    181184PASS cursor (type: discrete) has testAddition function
    182185PASS cursor: "wait" onto "pointer"
  • trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/interpolation-per-property-001-expected.txt

    r291090 r291099  
    216216PASS counter-increment uses discrete animation when animating between "ident-1 1" and "ident-2 2" with effect easing
    217217PASS counter-increment uses discrete animation when animating between "ident-1 1" and "ident-2 2" with keyframe easing
     218PASS counter-reset (type: discrete) has testInterpolation function
     219PASS counter-reset uses discrete animation when animating between "ident-1 1" and "ident-2 2" with linear easing
     220PASS counter-reset uses discrete animation when animating between "ident-1 1" and "ident-2 2" with effect easing
     221PASS counter-reset uses discrete animation when animating between "ident-1 1" and "ident-2 2" with keyframe easing
    218222PASS cursor (type: discrete) has testInterpolation function
    219223PASS cursor uses discrete animation when animating between "pointer" and "wait" with linear easing
  • trunk/Source/WebCore/ChangeLog

    r291098 r291099  
     12022-03-10  Antoine Quint  <graouts@webkit.org>
     2
     3        [web-animations] counter-reset should support discrete animation
     4        https://bugs.webkit.org/show_bug.cgi?id=237644
     5
     6        Reviewed by Antti Koivisto.
     7
     8        Generalize the wrapper added for counter-increment to also handle counter-reset.
     9
     10        * animation/CSSPropertyAnimation.cpp:
     11        (WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap):
     12
    1132022-03-10  Antti Koivisto  <antti@apple.com>
    214
  • trunk/Source/WebCore/animation/CSSPropertyAnimation.cpp

    r291090 r291099  
    25152515};
    25162516
    2517 class CounterIncrementWrapper final : public AnimationPropertyWrapperBase {
    2518     WTF_MAKE_FAST_ALLOCATED;
    2519 public:
    2520     CounterIncrementWrapper()
    2521         : AnimationPropertyWrapperBase(CSSPropertyCounterIncrement)
    2522     {
     2517class CounterWrapper final : public AnimationPropertyWrapperBase {
     2518    WTF_MAKE_FAST_ALLOCATED;
     2519public:
     2520    CounterWrapper(CSSPropertyID property)
     2521        : AnimationPropertyWrapperBase(property)
     2522    {
     2523        ASSERT(property == CSSPropertyCounterIncrement || property == CSSPropertyCounterReset);
    25232524    }
    25242525
     
    25402541                    return false;
    25412542                auto& bDirective = it->value;
    2542                 if (aDirective.incrementValue != bDirective.incrementValue)
     2543                if ((property() == CSSPropertyCounterIncrement && aDirective.incrementValue != bDirective.incrementValue)
     2544                    || (property() == CSSPropertyCounterReset && aDirective.resetValue != bDirective.resetValue))
    25432545                    return false;
    25442546            }
     
    25512553    void logBlend(const RenderStyle&, const RenderStyle&, const RenderStyle&, double progress) const final
    25522554    {
    2553         LOG_WITH_STREAM(Animations, stream << " blending counter-increment at " << TextStream::FormatNumberRespectingIntegers(progress) << ".");
     2555        LOG_WITH_STREAM(Animations, stream << " blending " << getPropertyName(property()) << " at " << TextStream::FormatNumberRespectingIntegers(progress) << ".");
    25542556    }
    25552557#endif
     
    25622564        // Clear all existing values in the existing set of directives.
    25632565        if (destination.counterDirectives()) {
    2564             for (auto& [key, directive] : destination.accessCounterDirectives())
    2565                 directive.incrementValue = std::nullopt;
     2566            for (auto& [key, directive] : destination.accessCounterDirectives()) {
     2567                if (property() == CSSPropertyCounterIncrement)
     2568                    directive.incrementValue = std::nullopt;
     2569                else
     2570                    directive.resetValue = std::nullopt;
     2571            }
    25662572        }
    25672573
     
    25722578        auto& targetDirectives = destination.accessCounterDirectives();
    25732579        for (auto& [key, directive] : *style.counterDirectives()) {
    2574             auto updateDirective = [](CounterDirectives& target, const CounterDirectives& source) {
    2575                 target.incrementValue = source.incrementValue;
     2580            auto updateDirective = [&](CounterDirectives& target, const CounterDirectives& source) {
     2581                if (property() == CSSPropertyCounterIncrement)
     2582                    target.incrementValue = source.incrementValue;
     2583                else
     2584                    target.resetValue = source.resetValue;
    25762585            };
    25772586            auto it = targetDirectives.find(key);
     
    29162925        new DiscretePropertyWrapper<ColorInterpolation>(CSSPropertyColorInterpolationFilters, &RenderStyle::colorInterpolationFilters, &RenderStyle::setColorInterpolationFilters),
    29172926        new DiscretePropertyWrapper<DominantBaseline>(CSSPropertyDominantBaseline, &RenderStyle::dominantBaseline, &RenderStyle::setDominantBaseline),
    2918         new CounterIncrementWrapper
     2927        new CounterWrapper(CSSPropertyCounterIncrement),
     2928        new CounterWrapper(CSSPropertyCounterReset)
    29192929    };
    29202930    const unsigned animatableLonghandPropertiesCount = WTF_ARRAY_LENGTH(animatableLonghandPropertyWrappers);
Note: See TracChangeset for help on using the changeset viewer.