Changeset 287817 in webkit


Ignore:
Timestamp:
Jan 8, 2022 11:43:09 PM (6 months ago)
Author:
Simon Fraser
Message:

If the drop-shadow filter has no color, it should use the value of the color property
https://bugs.webkit.org/show_bug.cgi?id=235012

Reviewed by Alan Bujtas.

LayoutTests/imported/w3c:

  • web-platform-tests/css/filter-effects/animation/filter-interpolation-004-expected.txt:
  • web-platform-tests/css/filter-effects/parsing/filter-computed-expected.txt:

Source/WebCore:

https://drafts.fxtf.org/filter-effects-1/#funcdef-filter-drop-shadow states that if
drop-shadow() does not specify a color, the value of the color property should be used.

Test: css3/filters/drop-shadow-no-color.html

  • style/StyleBuilderState.cpp:

(WebCore::Style::BuilderState::createFilterOperations):

LayoutTests:

Fix tests to serialize with rgb(0, 0, 0) instead of the transparent color.

  • css3/filters/backdrop/backdropfilter-property-computed-style-expected.txt:
  • css3/filters/backdrop/backdropfilter-property-computed-style.html:
  • css3/filters/drop-shadow-no-color-expected.html: Added.
  • css3/filters/drop-shadow-no-color.html: Added.
  • css3/filters/filter-property-computed-style-expected.txt:
  • css3/filters/filter-property-computed-style.html:
  • css3/filters/unprefixed-expected.txt:
  • css3/filters/unprefixed.html:
Location:
trunk
Files:
2 added
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r287816 r287817  
     12022-01-08  Simon Fraser  <simon.fraser@apple.com>
     2
     3        If the drop-shadow filter has no color, it should use the value of the color property
     4        https://bugs.webkit.org/show_bug.cgi?id=235012
     5
     6        Reviewed by Alan Bujtas.
     7
     8        Fix tests to serialize with rgb(0, 0, 0) instead of the transparent color.
     9
     10        * css3/filters/backdrop/backdropfilter-property-computed-style-expected.txt:
     11        * css3/filters/backdrop/backdropfilter-property-computed-style.html:
     12        * css3/filters/drop-shadow-no-color-expected.html: Added.
     13        * css3/filters/drop-shadow-no-color.html: Added.
     14        * css3/filters/filter-property-computed-style-expected.txt:
     15        * css3/filters/filter-property-computed-style.html:
     16        * css3/filters/unprefixed-expected.txt:
     17        * css3/filters/unprefixed.html:
     18
    1192022-01-08  Arcady Goldmints-Orlov  <agoldmints@igalia.com>
    220
  • trunk/LayoutTests/css3/filters/backdrop/backdropfilter-property-computed-style-expected.txt

    r231359 r287817  
    267267Three values with zero length : drop-shadow(0 0 0)
    268268PASS filterStyle.length is 1
    269 PASS subRule.cssText is "drop-shadow(rgba(0, 0, 0, 0) 0px 0px 0px)"
     269PASS subRule.cssText is "drop-shadow(rgb(0, 0, 0) 0px 0px 0px)"
    270270
    271271Two values no color : drop-shadow(1px 2px)
    272272PASS filterStyle.length is 1
    273 PASS subRule.cssText is "drop-shadow(rgba(0, 0, 0, 0) 1px 2px 0px)"
     273PASS subRule.cssText is "drop-shadow(rgb(0, 0, 0) 1px 2px 0px)"
    274274
    275275Multiple operations : grayscale(0.5) sepia(0.25) saturate(0.75) hue-rotate(35deg) invert(0.2) opacity(0.9) blur(5px)
  • trunk/LayoutTests/css3/filters/backdrop/backdropfilter-property-computed-style.html

    r231359 r287817  
    1 <!DOCTYPE>
    2 <html>
     1<!DOCTYPE html>
    32<head>
    43<script src="../../../resources/js-test-pre.js"></script>
     
    278277testComputedFilterRule("Three values with zero length",
    279278                       "drop-shadow(0 0 0)", 1,
    280                        ["drop-shadow(rgba(0, 0, 0, 0) 0px 0px 0px)"]);
     279                       ["drop-shadow(rgb(0, 0, 0) 0px 0px 0px)"]);
    281280
    282281testComputedFilterRule("Two values no color",
    283282                       "drop-shadow(1px 2px)", 1,
    284                        ["drop-shadow(rgba(0, 0, 0, 0) 1px 2px 0px)"]);
     283                       ["drop-shadow(rgb(0, 0, 0) 1px 2px 0px)"]);
    285284
    286285testComputedFilterRule("Multiple operations",
  • trunk/LayoutTests/css3/filters/filter-property-computed-style-expected.txt

    r231359 r287817  
    267267Three values with zero length : drop-shadow(0 0 0)
    268268PASS filterStyle.length is 1
    269 PASS subRule.cssText is "drop-shadow(rgba(0, 0, 0, 0) 0px 0px 0px)"
     269PASS subRule.cssText is "drop-shadow(rgb(0, 0, 0) 0px 0px 0px)"
    270270
    271271Two values no color : drop-shadow(1px 2px)
    272272PASS filterStyle.length is 1
    273 PASS subRule.cssText is "drop-shadow(rgba(0, 0, 0, 0) 1px 2px 0px)"
     273PASS subRule.cssText is "drop-shadow(rgb(0, 0, 0) 1px 2px 0px)"
    274274
    275275Multiple operations : grayscale(0.5) sepia(0.25) saturate(0.75) hue-rotate(35deg) invert(0.2) opacity(0.9) blur(5px)
  • trunk/LayoutTests/css3/filters/filter-property-computed-style.html

    r231359 r287817  
    278278testComputedFilterRule("Three values with zero length",
    279279                       "drop-shadow(0 0 0)", 1,
    280                        ["drop-shadow(rgba(0, 0, 0, 0) 0px 0px 0px)"]);
     280                       ["drop-shadow(rgb(0, 0, 0) 0px 0px 0px)"]);
    281281
    282282testComputedFilterRule("Two values no color",
    283283                       "drop-shadow(1px 2px)", 1,
    284                        ["drop-shadow(rgba(0, 0, 0, 0) 1px 2px 0px)"]);
     284                       ["drop-shadow(rgb(0, 0, 0) 1px 2px 0px)"]);
    285285
    286286testComputedFilterRule("Multiple operations",
  • trunk/LayoutTests/css3/filters/unprefixed-expected.txt

    r231359 r287817  
    267267Three values with zero length : drop-shadow(0 0 0)
    268268PASS filterStyle.length is 1
    269 PASS subRule.cssText is "drop-shadow(rgba(0, 0, 0, 0) 0px 0px 0px)"
     269PASS subRule.cssText is "drop-shadow(rgb(0, 0, 0) 0px 0px 0px)"
    270270
    271271Two values no color : drop-shadow(1px 2px)
    272272PASS filterStyle.length is 1
    273 PASS subRule.cssText is "drop-shadow(rgba(0, 0, 0, 0) 1px 2px 0px)"
     273PASS subRule.cssText is "drop-shadow(rgb(0, 0, 0) 1px 2px 0px)"
    274274
    275275Multiple operations : grayscale(0.5) sepia(0.25) saturate(0.75) hue-rotate(35deg) invert(0.2) opacity(0.9) blur(5px)
  • trunk/LayoutTests/css3/filters/unprefixed.html

    r231359 r287817  
    278278testComputedFilterRule("Three values with zero length",
    279279                       "drop-shadow(0 0 0)", 1,
    280                        ["drop-shadow(rgba(0, 0, 0, 0) 0px 0px 0px)"]);
     280                       ["drop-shadow(rgb(0, 0, 0) 0px 0px 0px)"]);
    281281
    282282testComputedFilterRule("Two values no color",
    283283                       "drop-shadow(1px 2px)", 1,
    284                        ["drop-shadow(rgba(0, 0, 0, 0) 1px 2px 0px)"]);
     284                       ["drop-shadow(rgb(0, 0, 0) 1px 2px 0px)"]);
    285285
    286286testComputedFilterRule("Multiple operations",
  • trunk/LayoutTests/imported/w3c/ChangeLog

    r287815 r287817  
     12022-01-08  Simon Fraser  <simon.fraser@apple.com>
     2
     3        If the drop-shadow filter has no color, it should use the value of the color property
     4        https://bugs.webkit.org/show_bug.cgi?id=235012
     5
     6        Reviewed by Alan Bujtas.
     7
     8        * web-platform-tests/css/filter-effects/animation/filter-interpolation-004-expected.txt:
     9        * web-platform-tests/css/filter-effects/parsing/filter-computed-expected.txt:
     10
    1112022-01-08  Simon Fraser  <simon.fraser@apple.com>
    212
  • trunk/LayoutTests/imported/w3c/web-platform-tests/css/filter-effects/animation/filter-interpolation-004-expected.txt

    r287815 r287817  
    6060PASS Web Animations: property <filter> from [contrast(0)] to [contrast()] at (1) should be [contrast()]
    6161PASS Web Animations: property <filter> from [contrast(0)] to [contrast()] at (1.5) should be [contrast(1.5)]
    62 FAIL CSS Transitions: property <filter> from [drop-shadow(0px 0px)] to [drop-shadow(20px 10px 30px green)] at (-1) should be [drop-shadow(-20px -10px blue)] assert_equals: expected "drop - shadow ( rgb ( 0 , 0 , 255 ) - 20px - 10px 0px ) " but got "drop - shadow ( rgba ( 0 , 0 , 0 , 0 ) - 20px - 10px 0px ) "
    63 FAIL CSS Transitions: property <filter> from [drop-shadow(0px 0px)] to [drop-shadow(20px 10px 30px green)] at (0) should be [drop-shadow(0px 0px blue)] assert_equals: expected "drop - shadow ( rgb ( 0 , 0 , 255 ) 0px 0px 0px ) " but got "drop - shadow ( rgba ( 0 , 0 , 0 , 0 ) 0px 0px 0px ) "
    64 FAIL CSS Transitions: property <filter> from [drop-shadow(0px 0px)] to [drop-shadow(20px 10px 30px green)] at (0.5) should be [drop-shadow(10px 5px 15px rgb(0, 64, 128))] assert_equals: expected "drop - shadow ( rgb ( 0 , 64 , 128 ) 10px 5px 15px ) " but got "drop - shadow ( rgba ( 0 , 128 , 0 , 0.5 ) 10px 5px 15px ) "
     62PASS CSS Transitions: property <filter> from [drop-shadow(0px 0px)] to [drop-shadow(20px 10px 30px green)] at (-1) should be [drop-shadow(-20px -10px blue)]
     63PASS CSS Transitions: property <filter> from [drop-shadow(0px 0px)] to [drop-shadow(20px 10px 30px green)] at (0) should be [drop-shadow(0px 0px blue)]
     64PASS CSS Transitions: property <filter> from [drop-shadow(0px 0px)] to [drop-shadow(20px 10px 30px green)] at (0.5) should be [drop-shadow(10px 5px 15px rgb(0, 64, 128))]
    6565PASS CSS Transitions: property <filter> from [drop-shadow(0px 0px)] to [drop-shadow(20px 10px 30px green)] at (1) should be [drop-shadow(20px 10px 30px green)]
    6666PASS CSS Transitions: property <filter> from [drop-shadow(0px 0px)] to [drop-shadow(20px 10px 30px green)] at (1.5) should be [drop-shadow(30px 15px 45px rgb(0, 192, 0))]
    67 FAIL CSS Transitions with transition: all: property <filter> from [drop-shadow(0px 0px)] to [drop-shadow(20px 10px 30px green)] at (-1) should be [drop-shadow(-20px -10px blue)] assert_equals: expected "drop - shadow ( rgb ( 0 , 0 , 255 ) - 20px - 10px 0px ) " but got "drop - shadow ( rgba ( 0 , 0 , 0 , 0 ) - 20px - 10px 0px ) "
    68 FAIL CSS Transitions with transition: all: property <filter> from [drop-shadow(0px 0px)] to [drop-shadow(20px 10px 30px green)] at (0) should be [drop-shadow(0px 0px blue)] assert_equals: expected "drop - shadow ( rgb ( 0 , 0 , 255 ) 0px 0px 0px ) " but got "drop - shadow ( rgba ( 0 , 0 , 0 , 0 ) 0px 0px 0px ) "
    69 FAIL CSS Transitions with transition: all: property <filter> from [drop-shadow(0px 0px)] to [drop-shadow(20px 10px 30px green)] at (0.5) should be [drop-shadow(10px 5px 15px rgb(0, 64, 128))] assert_equals: expected "drop - shadow ( rgb ( 0 , 64 , 128 ) 10px 5px 15px ) " but got "drop - shadow ( rgba ( 0 , 128 , 0 , 0.5 ) 10px 5px 15px ) "
     67PASS CSS Transitions with transition: all: property <filter> from [drop-shadow(0px 0px)] to [drop-shadow(20px 10px 30px green)] at (-1) should be [drop-shadow(-20px -10px blue)]
     68PASS CSS Transitions with transition: all: property <filter> from [drop-shadow(0px 0px)] to [drop-shadow(20px 10px 30px green)] at (0) should be [drop-shadow(0px 0px blue)]
     69PASS CSS Transitions with transition: all: property <filter> from [drop-shadow(0px 0px)] to [drop-shadow(20px 10px 30px green)] at (0.5) should be [drop-shadow(10px 5px 15px rgb(0, 64, 128))]
    7070PASS CSS Transitions with transition: all: property <filter> from [drop-shadow(0px 0px)] to [drop-shadow(20px 10px 30px green)] at (1) should be [drop-shadow(20px 10px 30px green)]
    7171PASS CSS Transitions with transition: all: property <filter> from [drop-shadow(0px 0px)] to [drop-shadow(20px 10px 30px green)] at (1.5) should be [drop-shadow(30px 15px 45px rgb(0, 192, 0))]
    72 FAIL CSS Animations: property <filter> from [drop-shadow(0px 0px)] to [drop-shadow(20px 10px 30px green)] at (-1) should be [drop-shadow(-20px -10px blue)] assert_equals: expected "drop - shadow ( rgb ( 0 , 0 , 255 ) - 20px - 10px 0px ) " but got "drop - shadow ( rgba ( 0 , 0 , 0 , 0 ) - 20px - 10px 0px ) "
    73 FAIL CSS Animations: property <filter> from [drop-shadow(0px 0px)] to [drop-shadow(20px 10px 30px green)] at (0) should be [drop-shadow(0px 0px blue)] assert_equals: expected "drop - shadow ( rgb ( 0 , 0 , 255 ) 0px 0px 0px ) " but got "drop - shadow ( rgba ( 0 , 0 , 0 , 0 ) 0px 0px 0px ) "
    74 FAIL CSS Animations: property <filter> from [drop-shadow(0px 0px)] to [drop-shadow(20px 10px 30px green)] at (0.5) should be [drop-shadow(10px 5px 15px rgb(0, 64, 128))] assert_equals: expected "drop - shadow ( rgb ( 0 , 64 , 128 ) 10px 5px 15px ) " but got "drop - shadow ( rgba ( 0 , 128 , 0 , 0.5 ) 10px 5px 15px ) "
     72PASS CSS Animations: property <filter> from [drop-shadow(0px 0px)] to [drop-shadow(20px 10px 30px green)] at (-1) should be [drop-shadow(-20px -10px blue)]
     73PASS CSS Animations: property <filter> from [drop-shadow(0px 0px)] to [drop-shadow(20px 10px 30px green)] at (0) should be [drop-shadow(0px 0px blue)]
     74PASS CSS Animations: property <filter> from [drop-shadow(0px 0px)] to [drop-shadow(20px 10px 30px green)] at (0.5) should be [drop-shadow(10px 5px 15px rgb(0, 64, 128))]
    7575PASS CSS Animations: property <filter> from [drop-shadow(0px 0px)] to [drop-shadow(20px 10px 30px green)] at (1) should be [drop-shadow(20px 10px 30px green)]
    7676PASS CSS Animations: property <filter> from [drop-shadow(0px 0px)] to [drop-shadow(20px 10px 30px green)] at (1.5) should be [drop-shadow(30px 15px 45px rgb(0, 192, 0))]
    77 FAIL Web Animations: property <filter> from [drop-shadow(0px 0px)] to [drop-shadow(20px 10px 30px green)] at (-1) should be [drop-shadow(-20px -10px blue)] assert_equals: expected "drop - shadow ( rgb ( 0 , 0 , 255 ) - 20px - 10px 0px ) " but got "drop - shadow ( rgba ( 0 , 0 , 0 , 0 ) - 20px - 10px 0px ) "
    78 FAIL Web Animations: property <filter> from [drop-shadow(0px 0px)] to [drop-shadow(20px 10px 30px green)] at (0) should be [drop-shadow(0px 0px blue)] assert_equals: expected "drop - shadow ( rgb ( 0 , 0 , 255 ) 0px 0px 0px ) " but got "drop - shadow ( rgba ( 0 , 0 , 0 , 0 ) 0px 0px 0px ) "
    79 FAIL Web Animations: property <filter> from [drop-shadow(0px 0px)] to [drop-shadow(20px 10px 30px green)] at (0.5) should be [drop-shadow(10px 5px 15px rgb(0, 64, 128))] assert_equals: expected "drop - shadow ( rgb ( 0 , 64 , 128 ) 10px 5px 15px ) " but got "drop - shadow ( rgba ( 0 , 128 , 0 , 0.5 ) 10px 5px 15px ) "
     77PASS Web Animations: property <filter> from [drop-shadow(0px 0px)] to [drop-shadow(20px 10px 30px green)] at (-1) should be [drop-shadow(-20px -10px blue)]
     78PASS Web Animations: property <filter> from [drop-shadow(0px 0px)] to [drop-shadow(20px 10px 30px green)] at (0) should be [drop-shadow(0px 0px blue)]
     79PASS Web Animations: property <filter> from [drop-shadow(0px 0px)] to [drop-shadow(20px 10px 30px green)] at (0.5) should be [drop-shadow(10px 5px 15px rgb(0, 64, 128))]
    8080PASS Web Animations: property <filter> from [drop-shadow(0px 0px)] to [drop-shadow(20px 10px 30px green)] at (1) should be [drop-shadow(20px 10px 30px green)]
    8181PASS Web Animations: property <filter> from [drop-shadow(0px 0px)] to [drop-shadow(20px 10px 30px green)] at (1.5) should be [drop-shadow(30px 15px 45px rgb(0, 192, 0))]
  • trunk/LayoutTests/imported/w3c/web-platform-tests/css/filter-effects/parsing/filter-computed-expected.txt

    r287813 r287817  
    99PASS Property filter value 'contrast(300%)'
    1010PASS Property filter value 'contrast()'
    11 FAIL Property filter value 'drop-shadow(1px 2px)' assert_equals: expected "drop-shadow(rgb(0, 255, 0) 1px 2px 0px)" but got "drop-shadow(rgba(0, 0, 0, 0) 1px 2px 0px)"
     11PASS Property filter value 'drop-shadow(1px 2px)'
    1212PASS Property filter value 'drop-shadow(rgb(4, 5, 6) 1px 2px 0px)'
    1313PASS Property filter value 'grayscale(50%)'
  • trunk/Source/WebCore/ChangeLog

    r287815 r287817  
     12022-01-08  Simon Fraser  <simon.fraser@apple.com>
     2
     3        If the drop-shadow filter has no color, it should use the value of the color property
     4        https://bugs.webkit.org/show_bug.cgi?id=235012
     5
     6        Reviewed by Alan Bujtas.
     7
     8        https://drafts.fxtf.org/filter-effects-1/#funcdef-filter-drop-shadow states that if
     9        drop-shadow() does not specify a color, the value of the color property should be used.
     10
     11        Test: css3/filters/drop-shadow-no-color.html
     12
     13        * style/StyleBuilderState.cpp:
     14        (WebCore::Style::BuilderState::createFilterOperations):
     15
    1162022-01-08  Simon Fraser  <simon.fraser@apple.com>
    217
  • trunk/Source/WebCore/style/StyleBuilderState.cpp

    r286392 r287817  
    264264            IntPoint location(x, y);
    265265            int blur = item.blur ? item.blur->computeLength<int>(cssToLengthConversionData()) : 0;
    266             Color color;
    267             if (item.color)
    268                 color = colorFromPrimitiveValueWithResolvedCurrentColor(*item.color);
     266            auto color = item.color ? colorFromPrimitiveValueWithResolvedCurrentColor(*item.color) : m_style.color();
    269267
    270268            operations.operations().append(DropShadowFilterOperation::create(location, blur, color.isValid() ? color : Color::transparentBlack));
Note: See TracChangeset for help on using the changeset viewer.