⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 290898 in webkit


Ignore:
Timestamp:
Mar 7, 2022, 11:13:52 AM (5 years ago)
Author:
graouts@webkit.org
Message:

[web-animations] animating "fill" and "stroke" to or from "currentColor" should work
​https://bugs.webkit.org/show_bug.cgi?id=237531

Reviewed by Antti Koivisto.

LayoutTests/imported/w3c:

  • web-platform-tests/web-animations/responsive/to-color-change-expected.txt:

Source/WebCore:

Invalid colors should use the value for the "color" property on the provided RenderStyle.

  • animation/CSSPropertyAnimation.cpp:
Location:
trunk
Files:
4 edited

Legend:

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

    r290897 r290898  
     12022-03-07  Antoine Quint  <graouts@webkit.org>
     2
     3        [web-animations] animating "fill" and "stroke" to or from "currentColor" should work
     4        https://bugs.webkit.org/show_bug.cgi?id=237531
     5
     6        Reviewed by Antti Koivisto.
     7
     8        * web-platform-tests/web-animations/responsive/to-color-change-expected.txt:
     9
    1102022-03-07  Antoine Quint  <graouts@webkit.org>
    211
  • trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/responsive/to-color-change-expected.txt

    r290897 r290898  
    11
    22PASS Background color responsive to currentColor changes
    3 FAIL Fill color responsive to currentColor changes assert_equals: expected "rgb(0, 34, 102)" but got "rgb(0, 0, 0)"
     3PASS Fill color responsive to currentColor changes
    44PASS Color interpolation uses pre-multiplied colors
    55PASS Border color responsive to currentColor changes
    66PASS Border color responsive to currentColor changes again
    77PASS Outline color responsive to currentColor changes
    8 FAIL Stroke color responsive to currentColor changes assert_equals: expected "rgb(0, 34, 102)" but got "none"
     8PASS Stroke color responsive to currentColor changes
    99PASS Text decoration color responsive to currentColor changes
    1010FAIL Color responsive to parent currentColor changes assert_equals: expected "rgb(34, 51, 34)" but got "rgb(0, 51, 51)"
  • trunk/Source/WebCore/ChangeLog

    r290897 r290898  
     12022-03-07  Antoine Quint  <graouts@webkit.org>
     2
     3        [web-animations] animating "fill" and "stroke" to or from "currentColor" should work
     4        https://bugs.webkit.org/show_bug.cgi?id=237531
     5
     6        Reviewed by Antti Koivisto.
     7
     8        Invalid colors should use the value for the "color" property on the provided RenderStyle.
     9
     10        * animation/CSSPropertyAnimation.cpp:
     11
    1122022-03-07  Antoine Quint  <graouts@webkit.org>
    213
  • trunk/Source/WebCore/animation/CSSPropertyAnimation.cpp

    r290897 r290898  
    21222122
    21232123            if (!fromColor.isValid())
    2124                 fromColor = Color();
     2124                fromColor = a.color();
    21252125            if (!toColor.isValid())
    2126                 toColor = Color();
     2126                toColor = b.color();
    21272127
    21282128            return fromColor == toColor;
    … …  
    21332133    void blend(RenderStyle& destination, const RenderStyle& from, const RenderStyle& to, const CSSPropertyBlendingContext& context) const final
    21342134    {
    2135         if ((from.*m_paintTypeGetter)() != SVGPaintType::RGBColor
    2136             || (to.*m_paintTypeGetter)() != SVGPaintType::RGBColor)
     2135        auto isValidPaintType = [](SVGPaintType paintType) {
     2136            return paintType == SVGPaintType::RGBColor || paintType == SVGPaintType::CurrentColor;
     2137        };
     2138
     2139        if (!isValidPaintType((from.*m_paintTypeGetter)()) || !isValidPaintType((to.*m_paintTypeGetter)()))
    21372140            return;
    21382141
    … …  
    21442147
    21452148        if (!fromColor.isValid())
    2146             fromColor = Color();
     2149            fromColor = from.color();
    21472150        if (!toColor.isValid())
    2148             toColor = Color();
     2151            toColor = to.color();
    21492152        (destination.*m_setter)(blendFunc(fromColor, toColor, context));
    21502153    }
Note: See TracChangeset for help on using the changeset viewer.