Changeset 291147 in webkit


Ignore:
Timestamp:
Mar 10, 2022 11:26:25 PM (4 months ago)
Author:
graouts@webkit.org
Message:

[web-animations] font-variant-numeric should support discrete animation
https://bugs.webkit.org/show_bug.cgi?id=237669

Reviewed by Antti Koivisto.

LayoutTests/imported/w3c:

  • web-platform-tests/css/css-pseudo/parsing/marker-supported-properties-in-animation-expected.txt:
  • 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:

We can also add support for animating the font-variant shorthand since
font-variant-numeric is the last of its longhands that was lacking
animation support.

  • animation/CSSPropertyAnimation.cpp:

(WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap):

Location:
trunk
Files:
7 edited

Legend:

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

    r291130 r291147  
     12022-03-10  Antoine Quint  <graouts@webkit.org>
     2
     3        [web-animations] font-variant-numeric should support discrete animation
     4        https://bugs.webkit.org/show_bug.cgi?id=237669
     5
     6        Reviewed by Antti Koivisto.
     7
     8        * web-platform-tests/css/css-pseudo/parsing/marker-supported-properties-in-animation-expected.txt:
     9        * web-platform-tests/web-animations/animation-model/animation-types/accumulation-per-property-001-expected.txt:
     10        * web-platform-tests/web-animations/animation-model/animation-types/addition-per-property-001-expected.txt:
     11        * web-platform-tests/web-animations/animation-model/animation-types/interpolation-per-property-001-expected.txt:
     12
    1132022-03-10  Antoine Quint  <graouts@webkit.org>
    214
  • trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-pseudo/parsing/marker-supported-properties-in-animation-expected.txt

    r291119 r291147  
    1212FAIL Animation of font-synthesis-style in ::marker assert_true: font-synthesis-style doesn't seem to be supported in the computed style expected true got false
    1313FAIL Animation of font-synthesis-weight in ::marker assert_true: font-synthesis-weight doesn't seem to be supported in the computed style expected true got false
    14 FAIL Animation of font-variant in ::marker assert_equals: expected "small-caps" but got "small-caps tabular-nums"
     14PASS Animation of font-variant in ::marker
    1515PASS Animation of font-variant-caps in ::marker
    1616PASS Animation of font-variant-east-asian in ::marker
    1717PASS Animation of font-variant-ligatures in ::marker
    18 FAIL Animation of font-variant-numeric in ::marker assert_equals: expected "slashed-zero" but got "tabular-nums"
     18PASS Animation of font-variant-numeric in ::marker
    1919PASS Animation of font-variant-position in ::marker
    2020PASS Animation of font-weight in ::marker
  • trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/accumulation-per-property-001-expected.txt

    r291122 r291147  
    267267PASS font-variant-ligatures: "no-common-ligatures" onto "common-ligatures"
    268268PASS font-variant-ligatures: "common-ligatures" onto "no-common-ligatures"
     269PASS font-variant-numeric (type: discrete) has testAccumulation function
     270PASS font-variant-numeric: "oldstyle-nums" onto "lining-nums"
     271PASS font-variant-numeric: "lining-nums" onto "oldstyle-nums"
    269272PASS font-variant-position (type: discrete) has testAccumulation function
    270273PASS font-variant-position: "super" onto "sub"
  • trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/addition-per-property-001-expected.txt

    r291122 r291147  
    267267PASS font-variant-ligatures: "no-common-ligatures" onto "common-ligatures"
    268268PASS font-variant-ligatures: "common-ligatures" onto "no-common-ligatures"
     269PASS font-variant-numeric (type: discrete) has testAddition function
     270PASS font-variant-numeric: "oldstyle-nums" onto "lining-nums"
     271PASS font-variant-numeric: "lining-nums" onto "oldstyle-nums"
    269272PASS font-variant-position (type: discrete) has testAddition function
    270273PASS font-variant-position: "super" onto "sub"
  • trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/interpolation-per-property-001-expected.txt

    r291122 r291147  
    326326PASS font-variant-ligatures uses discrete animation when animating between "common-ligatures" and "no-common-ligatures" with effect easing
    327327PASS font-variant-ligatures uses discrete animation when animating between "common-ligatures" and "no-common-ligatures" with keyframe easing
     328PASS font-variant-numeric (type: discrete) has testInterpolation function
     329PASS font-variant-numeric uses discrete animation when animating between "lining-nums" and "oldstyle-nums" with linear easing
     330PASS font-variant-numeric uses discrete animation when animating between "lining-nums" and "oldstyle-nums" with effect easing
     331PASS font-variant-numeric uses discrete animation when animating between "lining-nums" and "oldstyle-nums" with keyframe easing
    328332PASS font-variant-position (type: discrete) has testInterpolation function
    329333PASS font-variant-position uses discrete animation when animating between "sub" and "super" with linear easing
  • trunk/Source/WebCore/ChangeLog

    r291144 r291147  
     12022-03-10  Antoine Quint  <graouts@webkit.org>
     2
     3        [web-animations] font-variant-numeric should support discrete animation
     4        https://bugs.webkit.org/show_bug.cgi?id=237669
     5
     6        Reviewed by Antti Koivisto.
     7
     8        We can also add support for animating the font-variant shorthand since
     9        font-variant-numeric is the last of its longhands that was lacking
     10        animation support.
     11
     12        * animation/CSSPropertyAnimation.cpp:
     13        (WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap):
     14
    1152022-03-10  Peng Liu  <peng.liu6@apple.com>
    216
  • trunk/Source/WebCore/animation/CSSPropertyAnimation.cpp

    r291130 r291147  
    27542754        destination.setNamedGridAreaColumnCount(source.namedGridAreaColumnCount());
    27552755    }
     2756};
     2757
     2758class FontVariantNumericWrapper final : public AnimationPropertyWrapperBase {
     2759    WTF_MAKE_FAST_ALLOCATED;
     2760public:
     2761    FontVariantNumericWrapper()
     2762        : AnimationPropertyWrapperBase(CSSPropertyFontVariantNumeric)
     2763    {
     2764    }
     2765
     2766private:
     2767    bool canInterpolate(const RenderStyle&, const RenderStyle&, CompositeOperation) const override { return false; }
     2768
     2769    bool equals(const RenderStyle& a, const RenderStyle& b) const override
     2770    {
     2771        auto& aFontDescription = a.fontDescription();
     2772        auto& bFontDescription = b.fontDescription();
     2773        return aFontDescription.variantNumericFigure() == bFontDescription.variantNumericFigure()
     2774            && aFontDescription.variantNumericSpacing() == bFontDescription.variantNumericSpacing()
     2775            && aFontDescription.variantNumericFraction() == bFontDescription.variantNumericFraction()
     2776            && aFontDescription.variantNumericOrdinal() == bFontDescription.variantNumericOrdinal()
     2777            && aFontDescription.variantNumericSlashedZero() == bFontDescription.variantNumericSlashedZero();
     2778    }
     2779
     2780    void blend(RenderStyle& destination, const RenderStyle& from, const RenderStyle& to, const CSSPropertyBlendingContext& context) const override
     2781    {
     2782        ASSERT(!context.progress || context.progress == 1.0);
     2783        auto& sourceFontDescription = (context.progress ? to : from).fontDescription();
     2784
     2785        FontSelector* currentFontSelector = destination.fontCascade().fontSelector();
     2786        auto description = destination.fontDescription();
     2787        description.setVariantNumericFigure(sourceFontDescription.variantNumericFigure());
     2788        description.setVariantNumericSpacing(sourceFontDescription.variantNumericSpacing());
     2789        description.setVariantNumericFraction(sourceFontDescription.variantNumericFraction());
     2790        description.setVariantNumericOrdinal(sourceFontDescription.variantNumericOrdinal());
     2791        description.setVariantNumericSlashedZero(sourceFontDescription.variantNumericSlashedZero());
     2792        destination.setFontDescription(WTFMove(description));
     2793        destination.fontCascade().update(currentFontSelector);
     2794    }
     2795
     2796#if !LOG_DISABLED
     2797    void logBlend(const RenderStyle&, const RenderStyle&, const RenderStyle&, double) const override
     2798    {
     2799    }
     2800#endif
    27562801};
    27572802
     
    31253170        new FontVariantEastAsianWrapper,
    31263171        new FontVariantLigaturesWrapper,
     3172        new FontVariantNumericWrapper,
    31273173        new DiscretePropertyWrapper<FontVariantPosition>(CSSPropertyFontVariantPosition, &RenderStyle::fontVariantPosition, &RenderStyle::setFontVariantPosition),
    31283174        new DiscretePropertyWrapper<FontVariantCaps>(CSSPropertyFontVariantCaps, &RenderStyle::fontVariantCaps, &RenderStyle::setFontVariantCaps),
     
    31623208        CSSPropertyPerspectiveOrigin,
    31633209        CSSPropertyOffset,
    3164         CSSPropertyTextEmphasis
     3210        CSSPropertyTextEmphasis,
     3211        CSSPropertyFontVariant
    31653212    };
    31663213    const unsigned animatableShorthandPropertiesCount = WTF_ARRAY_LENGTH(animatableShorthandProperties);
Note: See TracChangeset for help on using the changeset viewer.