Changeset 273001 in webkit


Ignore:
Timestamp:
Feb 17, 2021 8:50:30 AM (17 months ago)
Author:
graouts@webkit.org
Message:

CSS properties that disallow negative values should not animate to negative values
https://bugs.webkit.org/show_bug.cgi?id=222034

Reviewed by Antti Koivisto.

LayoutTests/imported/w3c:

Mark WPT progressions.

  • web-platform-tests/css/css-box/animation/padding-bottom-composition-expected.txt:
  • web-platform-tests/css/css-box/animation/padding-interpolation-expected.txt:
  • web-platform-tests/css/css-box/animation/padding-left-composition-expected.txt:
  • web-platform-tests/css/css-box/animation/padding-right-composition-expected.txt:
  • web-platform-tests/css/css-box/animation/padding-top-composition-expected.txt:
  • web-platform-tests/css/css-shapes/animation/shape-margin-composition-expected.txt:
  • web-platform-tests/css/css-shapes/animation/shape-margin-interpolation-expected.txt:
  • web-platform-tests/css/css-sizing/animation/min-height-composition-expected.txt:
  • web-platform-tests/css/css-sizing/animation/min-height-interpolation-expected.txt:
  • web-platform-tests/css/css-sizing/animation/min-width-composition-expected.txt:
  • web-platform-tests/css/css-sizing/animation/min-width-interpolation-expected.txt:

Source/WebCore:

Some CSS properties disallow negative values, but the blending code used for animations allows them.
We now add a new animation wrapper for those values, NonNegativeLengthPropertyWrapper, which will clamp
the blended value to 0 if negative. This new wrapper is used for the padding properties, width, height,
min-width, min-height and shape-margin.

  • animation/CSSPropertyAnimation.cpp:

(WebCore::NonNegativeLengthPropertyWrapper::NonNegativeLengthPropertyWrapper):
(WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap):

LayoutTests:

Mark WPT output changes for a couple tests with platform-specific results.

  • platform/ios-wk2/imported/w3c/web-platform-tests/css/css-box/animation/padding-bottom-composition-expected.txt:
  • platform/ios-wk2/imported/w3c/web-platform-tests/css/css-box/animation/padding-top-composition-expected.txt:
Location:
trunk
Files:
17 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r272993 r273001  
     12021-02-17  Antoine Quint  <graouts@webkit.org>
     2
     3        CSS properties that disallow negative values should not animate to negative values
     4        https://bugs.webkit.org/show_bug.cgi?id=222034
     5
     6        Reviewed by Antti Koivisto.
     7
     8        Mark WPT output changes for a couple tests with platform-specific results.
     9
     10        * platform/ios-wk2/imported/w3c/web-platform-tests/css/css-box/animation/padding-bottom-composition-expected.txt:
     11        * platform/ios-wk2/imported/w3c/web-platform-tests/css/css-box/animation/padding-top-composition-expected.txt:
     12
    1132021-02-17  Andres Gonzalez  <andresg_22@apple.com>
    214
  • trunk/LayoutTests/imported/w3c/ChangeLog

    r272983 r273001  
     12021-02-17  Antoine Quint  <graouts@webkit.org>
     2
     3        CSS properties that disallow negative values should not animate to negative values
     4        https://bugs.webkit.org/show_bug.cgi?id=222034
     5
     6        Reviewed by Antti Koivisto.
     7
     8        Mark WPT progressions.
     9
     10        * web-platform-tests/css/css-box/animation/padding-bottom-composition-expected.txt:
     11        * web-platform-tests/css/css-box/animation/padding-interpolation-expected.txt:
     12        * web-platform-tests/css/css-box/animation/padding-left-composition-expected.txt:
     13        * web-platform-tests/css/css-box/animation/padding-right-composition-expected.txt:
     14        * web-platform-tests/css/css-box/animation/padding-top-composition-expected.txt:
     15        * web-platform-tests/css/css-shapes/animation/shape-margin-composition-expected.txt:
     16        * web-platform-tests/css/css-shapes/animation/shape-margin-interpolation-expected.txt:
     17        * web-platform-tests/css/css-sizing/animation/min-height-composition-expected.txt:
     18        * web-platform-tests/css/css-sizing/animation/min-height-interpolation-expected.txt:
     19        * web-platform-tests/css/css-sizing/animation/min-width-composition-expected.txt:
     20        * web-platform-tests/css/css-sizing/animation/min-width-interpolation-expected.txt:
     21
    1222021-02-16  Manuel Rego Casasnovas  <rego@igalia.com>
    223
  • trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-box/animation/padding-bottom-composition-expected.txt

    r267650 r273001  
    99FAIL Compositing: property <padding-bottom> underlying [100px] from add [10px] to add [2px] at (0.5) should be [106px] assert_equals: expected "106px " but got "6px "
    1010FAIL Compositing: property <padding-bottom> underlying [100px] from add [10px] to add [2px] at (1) should be [102px] assert_equals: expected "102px " but got "2px "
    11 FAIL Compositing: property <padding-bottom> underlying [100px] from add [10px] to add [2px] at (1.5) should be [98px] assert_equals: expected "98px " but got "- 2px "
     11FAIL Compositing: property <padding-bottom> underlying [100px] from add [10px] to add [2px] at (1.5) should be [98px] assert_equals: expected "98px " but got "0px "
    1212FAIL Compositing: property <padding-bottom> underlying [10%] from add [100px] to add [20%] at (-0.3) should be [calc(130px + 4%)] assert_equals: expected "160.75px " but got "100px "
    1313FAIL Compositing: property <padding-bottom> underlying [10%] from add [100px] to add [20%] at (0) should be [calc(100px + 10%)] assert_equals: expected "176.89px " but got "100px "
  • trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-box/animation/padding-interpolation-expected.txt

    r272904 r273001  
    2424PASS Web Animations: property <padding> from neutral to [20px] at (1) should be [20px]
    2525PASS Web Animations: property <padding> from neutral to [20px] at (1.5) should be [25px]
    26 FAIL CSS Transitions: property <padding> from [initial] to [20px] at (-0.3) should be [0px] assert_equals: expected "0px " but got "- 6px "
     26PASS CSS Transitions: property <padding> from [initial] to [20px] at (-0.3) should be [0px]
    2727PASS CSS Transitions: property <padding> from [initial] to [20px] at (0) should be [0px]
    2828PASS CSS Transitions: property <padding> from [initial] to [20px] at (0.3) should be [6px]
     
    3030PASS CSS Transitions: property <padding> from [initial] to [20px] at (1) should be [20px]
    3131PASS CSS Transitions: property <padding> from [initial] to [20px] at (1.5) should be [30px]
    32 FAIL CSS Transitions with transition: all: property <padding> from [initial] to [20px] at (-0.3) should be [0px] assert_equals: expected "0px " but got "- 6px "
     32PASS CSS Transitions with transition: all: property <padding> from [initial] to [20px] at (-0.3) should be [0px]
    3333PASS CSS Transitions with transition: all: property <padding> from [initial] to [20px] at (0) should be [0px]
    3434PASS CSS Transitions with transition: all: property <padding> from [initial] to [20px] at (0.3) should be [6px]
     
    3636PASS CSS Transitions with transition: all: property <padding> from [initial] to [20px] at (1) should be [20px]
    3737PASS CSS Transitions with transition: all: property <padding> from [initial] to [20px] at (1.5) should be [30px]
    38 FAIL CSS Animations: property <padding> from [initial] to [20px] at (-0.3) should be [0px] assert_equals: expected "0px " but got "- 6px "
     38PASS CSS Animations: property <padding> from [initial] to [20px] at (-0.3) should be [0px]
    3939PASS CSS Animations: property <padding> from [initial] to [20px] at (0) should be [0px]
    4040PASS CSS Animations: property <padding> from [initial] to [20px] at (0.3) should be [6px]
     
    4242PASS CSS Animations: property <padding> from [initial] to [20px] at (1) should be [20px]
    4343PASS CSS Animations: property <padding> from [initial] to [20px] at (1.5) should be [30px]
    44 FAIL Web Animations: property <padding> from [initial] to [20px] at (-0.3) should be [0px] assert_equals: expected "0px " but got "- 6px "
     44PASS Web Animations: property <padding> from [initial] to [20px] at (-0.3) should be [0px]
    4545PASS Web Animations: property <padding> from [initial] to [20px] at (0) should be [0px]
    4646PASS Web Animations: property <padding> from [initial] to [20px] at (0.3) should be [6px]
     
    7272PASS Web Animations: property <padding> from [inherit] to [20px] at (1) should be [20px]
    7373PASS Web Animations: property <padding> from [inherit] to [20px] at (1.5) should be [15px]
    74 FAIL CSS Transitions: property <padding> from [unset] to [20px] at (-0.3) should be [0px] assert_equals: expected "0px " but got "- 6px "
     74PASS CSS Transitions: property <padding> from [unset] to [20px] at (-0.3) should be [0px]
    7575PASS CSS Transitions: property <padding> from [unset] to [20px] at (0) should be [0px]
    7676PASS CSS Transitions: property <padding> from [unset] to [20px] at (0.3) should be [6px]
     
    7878PASS CSS Transitions: property <padding> from [unset] to [20px] at (1) should be [20px]
    7979PASS CSS Transitions: property <padding> from [unset] to [20px] at (1.5) should be [30px]
    80 FAIL CSS Transitions with transition: all: property <padding> from [unset] to [20px] at (-0.3) should be [0px] assert_equals: expected "0px " but got "- 6px "
     80PASS CSS Transitions with transition: all: property <padding> from [unset] to [20px] at (-0.3) should be [0px]
    8181PASS CSS Transitions with transition: all: property <padding> from [unset] to [20px] at (0) should be [0px]
    8282PASS CSS Transitions with transition: all: property <padding> from [unset] to [20px] at (0.3) should be [6px]
     
    8484PASS CSS Transitions with transition: all: property <padding> from [unset] to [20px] at (1) should be [20px]
    8585PASS CSS Transitions with transition: all: property <padding> from [unset] to [20px] at (1.5) should be [30px]
    86 FAIL CSS Animations: property <padding> from [unset] to [20px] at (-0.3) should be [0px] assert_equals: expected "0px " but got "- 6px "
     86PASS CSS Animations: property <padding> from [unset] to [20px] at (-0.3) should be [0px]
    8787PASS CSS Animations: property <padding> from [unset] to [20px] at (0) should be [0px]
    8888PASS CSS Animations: property <padding> from [unset] to [20px] at (0.3) should be [6px]
     
    9090PASS CSS Animations: property <padding> from [unset] to [20px] at (1) should be [20px]
    9191PASS CSS Animations: property <padding> from [unset] to [20px] at (1.5) should be [30px]
    92 FAIL Web Animations: property <padding> from [unset] to [20px] at (-0.3) should be [0px] assert_equals: expected "0px " but got "- 6px "
     92PASS Web Animations: property <padding> from [unset] to [20px] at (-0.3) should be [0px]
    9393PASS Web Animations: property <padding> from [unset] to [20px] at (0) should be [0px]
    9494PASS Web Animations: property <padding> from [unset] to [20px] at (0.3) should be [6px]
     
    9696PASS Web Animations: property <padding> from [unset] to [20px] at (1) should be [20px]
    9797PASS Web Animations: property <padding> from [unset] to [20px] at (1.5) should be [30px]
    98 FAIL CSS Transitions: property <padding> from [0px] to [10px] at (-0.3) should be [0px] assert_equals: expected "0px " but got "- 3px "
     98PASS CSS Transitions: property <padding> from [0px] to [10px] at (-0.3) should be [0px]
    9999PASS CSS Transitions: property <padding> from [0px] to [10px] at (0) should be [0px]
    100100PASS CSS Transitions: property <padding> from [0px] to [10px] at (0.3) should be [3px]
     
    102102PASS CSS Transitions: property <padding> from [0px] to [10px] at (1) should be [10px]
    103103PASS CSS Transitions: property <padding> from [0px] to [10px] at (1.5) should be [15px]
    104 FAIL CSS Transitions with transition: all: property <padding> from [0px] to [10px] at (-0.3) should be [0px] assert_equals: expected "0px " but got "- 3px "
     104PASS CSS Transitions with transition: all: property <padding> from [0px] to [10px] at (-0.3) should be [0px]
    105105PASS CSS Transitions with transition: all: property <padding> from [0px] to [10px] at (0) should be [0px]
    106106PASS CSS Transitions with transition: all: property <padding> from [0px] to [10px] at (0.3) should be [3px]
     
    108108PASS CSS Transitions with transition: all: property <padding> from [0px] to [10px] at (1) should be [10px]
    109109PASS CSS Transitions with transition: all: property <padding> from [0px] to [10px] at (1.5) should be [15px]
    110 FAIL CSS Animations: property <padding> from [0px] to [10px] at (-0.3) should be [0px] assert_equals: expected "0px " but got "- 3px "
     110PASS CSS Animations: property <padding> from [0px] to [10px] at (-0.3) should be [0px]
    111111PASS CSS Animations: property <padding> from [0px] to [10px] at (0) should be [0px]
    112112PASS CSS Animations: property <padding> from [0px] to [10px] at (0.3) should be [3px]
     
    114114PASS CSS Animations: property <padding> from [0px] to [10px] at (1) should be [10px]
    115115PASS CSS Animations: property <padding> from [0px] to [10px] at (1.5) should be [15px]
    116 FAIL Web Animations: property <padding> from [0px] to [10px] at (-0.3) should be [0px] assert_equals: expected "0px " but got "- 3px "
     116PASS Web Animations: property <padding> from [0px] to [10px] at (-0.3) should be [0px]
    117117PASS Web Animations: property <padding> from [0px] to [10px] at (0) should be [0px]
    118118PASS Web Animations: property <padding> from [0px] to [10px] at (0.3) should be [3px]
  • trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-box/animation/padding-left-composition-expected.txt

    r267650 r273001  
    99FAIL Compositing: property <padding-left> underlying [100px] from add [10px] to add [2px] at (0.5) should be [106px] assert_equals: expected "106px " but got "6px "
    1010FAIL Compositing: property <padding-left> underlying [100px] from add [10px] to add [2px] at (1) should be [102px] assert_equals: expected "102px " but got "2px "
    11 FAIL Compositing: property <padding-left> underlying [100px] from add [10px] to add [2px] at (1.5) should be [98px] assert_equals: expected "98px " but got "- 2px "
     11FAIL Compositing: property <padding-left> underlying [100px] from add [10px] to add [2px] at (1.5) should be [98px] assert_equals: expected "98px " but got "0px "
    1212FAIL Compositing: property <padding-left> underlying [10%] from add [100px] to add [20%] at (-0.3) should be [calc(130px + 4%)] assert_equals: expected "161.36px " but got "100px "
    1313FAIL Compositing: property <padding-left> underlying [10%] from add [100px] to add [20%] at (0) should be [calc(100px + 10%)] assert_equals: expected "178.39px " but got "100px "
  • trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-box/animation/padding-right-composition-expected.txt

    r267650 r273001  
    99FAIL Compositing: property <padding-right> underlying [100px] from add [10px] to add [2px] at (0.5) should be [106px] assert_equals: expected "106px " but got "6px "
    1010FAIL Compositing: property <padding-right> underlying [100px] from add [10px] to add [2px] at (1) should be [102px] assert_equals: expected "102px " but got "2px "
    11 FAIL Compositing: property <padding-right> underlying [100px] from add [10px] to add [2px] at (1.5) should be [98px] assert_equals: expected "98px " but got "- 2px "
     11FAIL Compositing: property <padding-right> underlying [100px] from add [10px] to add [2px] at (1.5) should be [98px] assert_equals: expected "98px " but got "0px "
    1212FAIL Compositing: property <padding-right> underlying [10%] from add [100px] to add [20%] at (-0.3) should be [calc(130px + 4%)] assert_equals: expected "161.36px " but got "100px "
    1313FAIL Compositing: property <padding-right> underlying [10%] from add [100px] to add [20%] at (0) should be [calc(100px + 10%)] assert_equals: expected "178.39px " but got "100px "
  • trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-box/animation/padding-top-composition-expected.txt

    r267650 r273001  
    99FAIL Compositing: property <padding-top> underlying [100px] from add [10px] to add [2px] at (0.5) should be [106px] assert_equals: expected "106px " but got "6px "
    1010FAIL Compositing: property <padding-top> underlying [100px] from add [10px] to add [2px] at (1) should be [102px] assert_equals: expected "102px " but got "2px "
    11 FAIL Compositing: property <padding-top> underlying [100px] from add [10px] to add [2px] at (1.5) should be [98px] assert_equals: expected "98px " but got "- 2px "
     11FAIL Compositing: property <padding-top> underlying [100px] from add [10px] to add [2px] at (1.5) should be [98px] assert_equals: expected "98px " but got "0px "
    1212FAIL Compositing: property <padding-top> underlying [10%] from add [100px] to add [20%] at (-0.3) should be [calc(130px + 4%)] assert_equals: expected "160.75px " but got "100px "
    1313FAIL Compositing: property <padding-top> underlying [10%] from add [100px] to add [20%] at (0) should be [calc(100px + 10%)] assert_equals: expected "176.89px " but got "100px "
  • trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-shapes/animation/shape-margin-composition-expected.txt

    r267650 r273001  
    99FAIL Compositing: property <shape-margin> underlying [100px] from add [10px] to add [2px] at (0.5) should be [106px] assert_equals: expected "106px " but got "6px "
    1010FAIL Compositing: property <shape-margin> underlying [100px] from add [10px] to add [2px] at (1) should be [102px] assert_equals: expected "102px " but got "2px "
    11 FAIL Compositing: property <shape-margin> underlying [100px] from add [10px] to add [2px] at (1.5) should be [98px] assert_equals: expected "98px " but got "- 2px "
     11FAIL Compositing: property <shape-margin> underlying [100px] from add [10px] to add [2px] at (1.5) should be [98px] assert_equals: expected "98px " but got "0px "
    1212FAIL Compositing: property <shape-margin> underlying [10%] from add [100px] to add [20%] at (-0.3) should be [calc(130px + 4%)] assert_equals: expected "calc ( 4 % + 130px ) " but got "100px "
    1313FAIL Compositing: property <shape-margin> underlying [10%] from add [100px] to add [20%] at (0) should be [calc(100px + 10%)] assert_equals: expected "calc ( 10 % + 100px ) " but got "100px "
  • trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-shapes/animation/shape-margin-interpolation-expected.txt

    r272904 r273001  
    2424PASS Web Animations: property <shape-margin> from neutral to [20px] at (1) should be [20px]
    2525PASS Web Animations: property <shape-margin> from neutral to [20px] at (1.5) should be [25px]
    26 FAIL CSS Transitions: property <shape-margin> from [initial] to [20px] at (-0.3) should be [0px] assert_equals: expected "0px " but got "- 6px "
     26PASS CSS Transitions: property <shape-margin> from [initial] to [20px] at (-0.3) should be [0px]
    2727PASS CSS Transitions: property <shape-margin> from [initial] to [20px] at (0) should be [0px]
    2828PASS CSS Transitions: property <shape-margin> from [initial] to [20px] at (0.3) should be [6px]
     
    3030PASS CSS Transitions: property <shape-margin> from [initial] to [20px] at (1) should be [20px]
    3131PASS CSS Transitions: property <shape-margin> from [initial] to [20px] at (1.5) should be [30px]
    32 FAIL CSS Transitions with transition: all: property <shape-margin> from [initial] to [20px] at (-0.3) should be [0px] assert_equals: expected "0px " but got "- 6px "
     32PASS CSS Transitions with transition: all: property <shape-margin> from [initial] to [20px] at (-0.3) should be [0px]
    3333PASS CSS Transitions with transition: all: property <shape-margin> from [initial] to [20px] at (0) should be [0px]
    3434PASS CSS Transitions with transition: all: property <shape-margin> from [initial] to [20px] at (0.3) should be [6px]
     
    3636PASS CSS Transitions with transition: all: property <shape-margin> from [initial] to [20px] at (1) should be [20px]
    3737PASS CSS Transitions with transition: all: property <shape-margin> from [initial] to [20px] at (1.5) should be [30px]
    38 FAIL CSS Animations: property <shape-margin> from [initial] to [20px] at (-0.3) should be [0px] assert_equals: expected "0px " but got "- 6px "
     38PASS CSS Animations: property <shape-margin> from [initial] to [20px] at (-0.3) should be [0px]
    3939PASS CSS Animations: property <shape-margin> from [initial] to [20px] at (0) should be [0px]
    4040PASS CSS Animations: property <shape-margin> from [initial] to [20px] at (0.3) should be [6px]
     
    4242PASS CSS Animations: property <shape-margin> from [initial] to [20px] at (1) should be [20px]
    4343PASS CSS Animations: property <shape-margin> from [initial] to [20px] at (1.5) should be [30px]
    44 FAIL Web Animations: property <shape-margin> from [initial] to [20px] at (-0.3) should be [0px] assert_equals: expected "0px " but got "- 6px "
     44PASS Web Animations: property <shape-margin> from [initial] to [20px] at (-0.3) should be [0px]
    4545PASS Web Animations: property <shape-margin> from [initial] to [20px] at (0) should be [0px]
    4646PASS Web Animations: property <shape-margin> from [initial] to [20px] at (0.3) should be [6px]
     
    7272PASS Web Animations: property <shape-margin> from [inherit] to [20px] at (1) should be [20px]
    7373PASS Web Animations: property <shape-margin> from [inherit] to [20px] at (1.5) should be [15px]
    74 FAIL CSS Transitions: property <shape-margin> from [unset] to [20px] at (-0.3) should be [0px] assert_equals: expected "0px " but got "- 6px "
     74PASS CSS Transitions: property <shape-margin> from [unset] to [20px] at (-0.3) should be [0px]
    7575PASS CSS Transitions: property <shape-margin> from [unset] to [20px] at (0) should be [0px]
    7676PASS CSS Transitions: property <shape-margin> from [unset] to [20px] at (0.3) should be [6px]
     
    7878PASS CSS Transitions: property <shape-margin> from [unset] to [20px] at (1) should be [20px]
    7979PASS CSS Transitions: property <shape-margin> from [unset] to [20px] at (1.5) should be [30px]
    80 FAIL CSS Transitions with transition: all: property <shape-margin> from [unset] to [20px] at (-0.3) should be [0px] assert_equals: expected "0px " but got "- 6px "
     80PASS CSS Transitions with transition: all: property <shape-margin> from [unset] to [20px] at (-0.3) should be [0px]
    8181PASS CSS Transitions with transition: all: property <shape-margin> from [unset] to [20px] at (0) should be [0px]
    8282PASS CSS Transitions with transition: all: property <shape-margin> from [unset] to [20px] at (0.3) should be [6px]
     
    8484PASS CSS Transitions with transition: all: property <shape-margin> from [unset] to [20px] at (1) should be [20px]
    8585PASS CSS Transitions with transition: all: property <shape-margin> from [unset] to [20px] at (1.5) should be [30px]
    86 FAIL CSS Animations: property <shape-margin> from [unset] to [20px] at (-0.3) should be [0px] assert_equals: expected "0px " but got "- 6px "
     86PASS CSS Animations: property <shape-margin> from [unset] to [20px] at (-0.3) should be [0px]
    8787PASS CSS Animations: property <shape-margin> from [unset] to [20px] at (0) should be [0px]
    8888PASS CSS Animations: property <shape-margin> from [unset] to [20px] at (0.3) should be [6px]
     
    9090PASS CSS Animations: property <shape-margin> from [unset] to [20px] at (1) should be [20px]
    9191PASS CSS Animations: property <shape-margin> from [unset] to [20px] at (1.5) should be [30px]
    92 FAIL Web Animations: property <shape-margin> from [unset] to [20px] at (-0.3) should be [0px] assert_equals: expected "0px " but got "- 6px "
     92PASS Web Animations: property <shape-margin> from [unset] to [20px] at (-0.3) should be [0px]
    9393PASS Web Animations: property <shape-margin> from [unset] to [20px] at (0) should be [0px]
    9494PASS Web Animations: property <shape-margin> from [unset] to [20px] at (0.3) should be [6px]
     
    9696PASS Web Animations: property <shape-margin> from [unset] to [20px] at (1) should be [20px]
    9797PASS Web Animations: property <shape-margin> from [unset] to [20px] at (1.5) should be [30px]
    98 FAIL CSS Transitions: property <shape-margin> from [0px] to [100px] at (-0.3) should be [0px] assert_equals: expected "0px " but got "- 30px "
     98PASS CSS Transitions: property <shape-margin> from [0px] to [100px] at (-0.3) should be [0px]
    9999PASS CSS Transitions: property <shape-margin> from [0px] to [100px] at (0) should be [0px]
    100100PASS CSS Transitions: property <shape-margin> from [0px] to [100px] at (0.3) should be [30px]
     
    102102PASS CSS Transitions: property <shape-margin> from [0px] to [100px] at (1) should be [100px]
    103103PASS CSS Transitions: property <shape-margin> from [0px] to [100px] at (1.5) should be [150px]
    104 FAIL CSS Transitions with transition: all: property <shape-margin> from [0px] to [100px] at (-0.3) should be [0px] assert_equals: expected "0px " but got "- 30px "
     104PASS CSS Transitions with transition: all: property <shape-margin> from [0px] to [100px] at (-0.3) should be [0px]
    105105PASS CSS Transitions with transition: all: property <shape-margin> from [0px] to [100px] at (0) should be [0px]
    106106PASS CSS Transitions with transition: all: property <shape-margin> from [0px] to [100px] at (0.3) should be [30px]
     
    108108PASS CSS Transitions with transition: all: property <shape-margin> from [0px] to [100px] at (1) should be [100px]
    109109PASS CSS Transitions with transition: all: property <shape-margin> from [0px] to [100px] at (1.5) should be [150px]
    110 FAIL CSS Animations: property <shape-margin> from [0px] to [100px] at (-0.3) should be [0px] assert_equals: expected "0px " but got "- 30px "
     110PASS CSS Animations: property <shape-margin> from [0px] to [100px] at (-0.3) should be [0px]
    111111PASS CSS Animations: property <shape-margin> from [0px] to [100px] at (0) should be [0px]
    112112PASS CSS Animations: property <shape-margin> from [0px] to [100px] at (0.3) should be [30px]
     
    114114PASS CSS Animations: property <shape-margin> from [0px] to [100px] at (1) should be [100px]
    115115PASS CSS Animations: property <shape-margin> from [0px] to [100px] at (1.5) should be [150px]
    116 FAIL Web Animations: property <shape-margin> from [0px] to [100px] at (-0.3) should be [0px] assert_equals: expected "0px " but got "- 30px "
     116PASS Web Animations: property <shape-margin> from [0px] to [100px] at (-0.3) should be [0px]
    117117PASS Web Animations: property <shape-margin> from [0px] to [100px] at (0) should be [0px]
    118118PASS Web Animations: property <shape-margin> from [0px] to [100px] at (0.3) should be [30px]
  • trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-sizing/animation/min-height-composition-expected.txt

    r267650 r273001  
    99FAIL Compositing: property <min-height> underlying [100px] from add [10px] to add [2px] at (0.5) should be [106px] assert_equals: expected "106px " but got "6px "
    1010FAIL Compositing: property <min-height> underlying [100px] from add [10px] to add [2px] at (1) should be [102px] assert_equals: expected "102px " but got "2px "
    11 FAIL Compositing: property <min-height> underlying [100px] from add [10px] to add [2px] at (1.5) should be [98px] assert_equals: expected "98px " but got "- 2px "
     11FAIL Compositing: property <min-height> underlying [100px] from add [10px] to add [2px] at (1.5) should be [98px] assert_equals: expected "98px " but got "0px "
    1212FAIL Compositing: property <min-height> underlying [10%] from add [100px] to add [20%] at (-0.3) should be [calc(130px + 4%)] assert_equals: expected "calc ( 4 % + 130px ) " but got "100px "
    1313FAIL Compositing: property <min-height> underlying [10%] from add [100px] to add [20%] at (0) should be [calc(100px + 10%)] assert_equals: expected "calc ( 10 % + 100px ) " but got "100px "
  • trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-sizing/animation/min-height-interpolation-expected.txt

    r272904 r273001  
    104104PASS Web Animations: property <min-height> from [unset] to [20px] at (1) should be [20px]
    105105PASS Web Animations: property <min-height> from [unset] to [20px] at (1.5) should be [20px]
    106 FAIL CSS Transitions: property <min-height> from [0px] to [100px] at (-0.5) should be [0] assert_equals: expected "0px " but got "- 50px "
     106PASS CSS Transitions: property <min-height> from [0px] to [100px] at (-0.5) should be [0]
    107107PASS CSS Transitions: property <min-height> from [0px] to [100px] at (0) should be [0]
    108108PASS CSS Transitions: property <min-height> from [0px] to [100px] at (0.3) should be [30px]
     
    110110PASS CSS Transitions: property <min-height> from [0px] to [100px] at (1) should be [100px]
    111111PASS CSS Transitions: property <min-height> from [0px] to [100px] at (1.5) should be [150px]
    112 FAIL CSS Transitions with transition: all: property <min-height> from [0px] to [100px] at (-0.5) should be [0] assert_equals: expected "0px " but got "- 50px "
     112PASS CSS Transitions with transition: all: property <min-height> from [0px] to [100px] at (-0.5) should be [0]
    113113PASS CSS Transitions with transition: all: property <min-height> from [0px] to [100px] at (0) should be [0]
    114114PASS CSS Transitions with transition: all: property <min-height> from [0px] to [100px] at (0.3) should be [30px]
     
    116116PASS CSS Transitions with transition: all: property <min-height> from [0px] to [100px] at (1) should be [100px]
    117117PASS CSS Transitions with transition: all: property <min-height> from [0px] to [100px] at (1.5) should be [150px]
    118 FAIL CSS Animations: property <min-height> from [0px] to [100px] at (-0.5) should be [0] assert_equals: expected "0px " but got "- 50px "
     118PASS CSS Animations: property <min-height> from [0px] to [100px] at (-0.5) should be [0]
    119119PASS CSS Animations: property <min-height> from [0px] to [100px] at (0) should be [0]
    120120PASS CSS Animations: property <min-height> from [0px] to [100px] at (0.3) should be [30px]
     
    122122PASS CSS Animations: property <min-height> from [0px] to [100px] at (1) should be [100px]
    123123PASS CSS Animations: property <min-height> from [0px] to [100px] at (1.5) should be [150px]
    124 FAIL Web Animations: property <min-height> from [0px] to [100px] at (-0.5) should be [0] assert_equals: expected "0px " but got "- 50px "
     124PASS Web Animations: property <min-height> from [0px] to [100px] at (-0.5) should be [0]
    125125PASS Web Animations: property <min-height> from [0px] to [100px] at (0) should be [0]
    126126PASS Web Animations: property <min-height> from [0px] to [100px] at (0.3) should be [30px]
  • trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-sizing/animation/min-width-composition-expected.txt

    r267650 r273001  
    99FAIL Compositing: property <min-width> underlying [100px] from add [10px] to add [2px] at (0.5) should be [106px] assert_equals: expected "106px " but got "6px "
    1010FAIL Compositing: property <min-width> underlying [100px] from add [10px] to add [2px] at (1) should be [102px] assert_equals: expected "102px " but got "2px "
    11 FAIL Compositing: property <min-width> underlying [100px] from add [10px] to add [2px] at (1.5) should be [98px] assert_equals: expected "98px " but got "- 2px "
     11FAIL Compositing: property <min-width> underlying [100px] from add [10px] to add [2px] at (1.5) should be [98px] assert_equals: expected "98px " but got "0px "
    1212FAIL Compositing: property <min-width> underlying [10%] from add [100px] to add [20%] at (-0.3) should be [calc(130px + 4%)] assert_equals: expected "calc ( 4 % + 130px ) " but got "100px "
    1313FAIL Compositing: property <min-width> underlying [10%] from add [100px] to add [20%] at (0) should be [calc(100px + 10%)] assert_equals: expected "calc ( 10 % + 100px ) " but got "100px "
  • trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-sizing/animation/min-width-interpolation-expected.txt

    r272904 r273001  
    104104PASS Web Animations: property <min-width> from [unset] to [20px] at (1) should be [20px]
    105105PASS Web Animations: property <min-width> from [unset] to [20px] at (1.5) should be [20px]
    106 FAIL CSS Transitions: property <min-width> from [0px] to [100px] at (-0.5) should be [0] assert_equals: expected "0px " but got "- 50px "
     106PASS CSS Transitions: property <min-width> from [0px] to [100px] at (-0.5) should be [0]
    107107PASS CSS Transitions: property <min-width> from [0px] to [100px] at (0) should be [0]
    108108PASS CSS Transitions: property <min-width> from [0px] to [100px] at (0.3) should be [30px]
     
    110110PASS CSS Transitions: property <min-width> from [0px] to [100px] at (1) should be [100px]
    111111PASS CSS Transitions: property <min-width> from [0px] to [100px] at (1.5) should be [150px]
    112 FAIL CSS Transitions with transition: all: property <min-width> from [0px] to [100px] at (-0.5) should be [0] assert_equals: expected "0px " but got "- 50px "
     112PASS CSS Transitions with transition: all: property <min-width> from [0px] to [100px] at (-0.5) should be [0]
    113113PASS CSS Transitions with transition: all: property <min-width> from [0px] to [100px] at (0) should be [0]
    114114PASS CSS Transitions with transition: all: property <min-width> from [0px] to [100px] at (0.3) should be [30px]
     
    116116PASS CSS Transitions with transition: all: property <min-width> from [0px] to [100px] at (1) should be [100px]
    117117PASS CSS Transitions with transition: all: property <min-width> from [0px] to [100px] at (1.5) should be [150px]
    118 FAIL CSS Animations: property <min-width> from [0px] to [100px] at (-0.5) should be [0] assert_equals: expected "0px " but got "- 50px "
     118PASS CSS Animations: property <min-width> from [0px] to [100px] at (-0.5) should be [0]
    119119PASS CSS Animations: property <min-width> from [0px] to [100px] at (0) should be [0]
    120120PASS CSS Animations: property <min-width> from [0px] to [100px] at (0.3) should be [30px]
     
    122122PASS CSS Animations: property <min-width> from [0px] to [100px] at (1) should be [100px]
    123123PASS CSS Animations: property <min-width> from [0px] to [100px] at (1.5) should be [150px]
    124 FAIL Web Animations: property <min-width> from [0px] to [100px] at (-0.5) should be [0] assert_equals: expected "0px " but got "- 50px "
     124PASS Web Animations: property <min-width> from [0px] to [100px] at (-0.5) should be [0]
    125125PASS Web Animations: property <min-width> from [0px] to [100px] at (0) should be [0]
    126126PASS Web Animations: property <min-width> from [0px] to [100px] at (0.3) should be [30px]
  • trunk/LayoutTests/platform/ios-wk2/imported/w3c/web-platform-tests/css/css-box/animation/padding-bottom-composition-expected.txt

    r267658 r273001  
    99FAIL Compositing: property <padding-bottom> underlying [100px] from add [10px] to add [2px] at (0.5) should be [106px] assert_equals: expected "106px " but got "6px "
    1010FAIL Compositing: property <padding-bottom> underlying [100px] from add [10px] to add [2px] at (1) should be [102px] assert_equals: expected "102px " but got "2px "
    11 FAIL Compositing: property <padding-bottom> underlying [100px] from add [10px] to add [2px] at (1.5) should be [98px] assert_equals: expected "98px " but got "- 2px "
     11FAIL Compositing: property <padding-bottom> underlying [100px] from add [10px] to add [2px] at (1.5) should be [98px] assert_equals: expected "98px " but got "0px "
    1212FAIL Compositing: property <padding-bottom> underlying [10%] from add [100px] to add [20%] at (-0.3) should be [calc(130px + 4%)] assert_equals: expected "161.36px " but got "100px "
    1313FAIL Compositing: property <padding-bottom> underlying [10%] from add [100px] to add [20%] at (0) should be [calc(100px + 10%)] assert_equals: expected "178.39px " but got "100px "
  • trunk/LayoutTests/platform/ios-wk2/imported/w3c/web-platform-tests/css/css-box/animation/padding-top-composition-expected.txt

    r267658 r273001  
    99FAIL Compositing: property <padding-top> underlying [100px] from add [10px] to add [2px] at (0.5) should be [106px] assert_equals: expected "106px " but got "6px "
    1010FAIL Compositing: property <padding-top> underlying [100px] from add [10px] to add [2px] at (1) should be [102px] assert_equals: expected "102px " but got "2px "
    11 FAIL Compositing: property <padding-top> underlying [100px] from add [10px] to add [2px] at (1.5) should be [98px] assert_equals: expected "98px " but got "- 2px "
     11FAIL Compositing: property <padding-top> underlying [100px] from add [10px] to add [2px] at (1.5) should be [98px] assert_equals: expected "98px " but got "0px "
    1212FAIL Compositing: property <padding-top> underlying [10%] from add [100px] to add [20%] at (-0.3) should be [calc(130px + 4%)] assert_equals: expected "161.36px " but got "100px "
    1313FAIL Compositing: property <padding-top> underlying [10%] from add [100px] to add [20%] at (0) should be [calc(100px + 10%)] assert_equals: expected "178.39px " but got "100px "
  • trunk/Source/WebCore/ChangeLog

    r272999 r273001  
     12021-02-17  Antoine Quint  <graouts@webkit.org>
     2
     3        CSS properties that disallow negative values should not animate to negative values
     4        https://bugs.webkit.org/show_bug.cgi?id=222034
     5
     6        Reviewed by Antti Koivisto.
     7
     8        Some CSS properties disallow negative values, but the blending code used for animations allows them.
     9        We now add a new animation wrapper for those values, NonNegativeLengthPropertyWrapper, which will clamp
     10        the blended value to 0 if negative. This new wrapper is used for the padding properties, width, height,
     11        min-width, min-height and shape-margin.
     12
     13        * animation/CSSPropertyAnimation.cpp:
     14        (WebCore::NonNegativeLengthPropertyWrapper::NonNegativeLengthPropertyWrapper):
     15        (WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap):
     16
    1172021-02-17  Per Arne  <pvollan@apple.com>
    218
  • trunk/Source/WebCore/animation/CSSPropertyAnimation.cpp

    r272805 r273001  
    700700};
    701701
     702class NonNegativeLengthPropertyWrapper : public PropertyWrapperGetter<const Length&> {
     703    WTF_MAKE_FAST_ALLOCATED;
     704public:
     705    NonNegativeLengthPropertyWrapper(CSSPropertyID prop, const Length& (RenderStyle::*getter)() const, void (RenderStyle::*setter)(Length&&))
     706        : PropertyWrapperGetter<const Length&>(prop, getter)
     707        , m_setter(setter)
     708    {
     709    }
     710
     711    bool canInterpolate(const RenderStyle* a, const RenderStyle* b) const override
     712    {
     713        return !(a->*PropertyWrapperGetter<const Length&>::m_getter)().isAuto() && !(b->*PropertyWrapperGetter<const Length&>::m_getter)().isAuto();
     714    }
     715
     716    void blend(const CSSPropertyBlendingClient* anim, RenderStyle* dst, const RenderStyle* a, const RenderStyle* b, double progress) const override
     717    {
     718        auto blended = blendFunc(anim, (a->*PropertyWrapperGetter<const Length&>::m_getter)(), (b->*PropertyWrapperGetter<const Length&>::m_getter)(), progress);
     719        if (blended.isNegative())
     720            (dst->*m_setter)(Length(0, LengthType::Fixed));
     721        else
     722            (dst->*m_setter)(WTFMove(blended));
     723    }
     724
     725protected:
     726    void (RenderStyle::*m_setter)(Length&&);
     727};
     728
    702729template <typename T>
    703730class LengthVariantPropertyWrapper : public PropertyWrapperGetter<const T&> {
     
    17461773        new LengthPropertyWrapper(CSSPropertyBottom, &RenderStyle::bottom, &RenderStyle::setBottom),
    17471774
    1748         new LengthPropertyWrapper(CSSPropertyWidth, &RenderStyle::width, &RenderStyle::setWidth),
    1749         new LengthPropertyWrapper(CSSPropertyMinWidth, &RenderStyle::minWidth, &RenderStyle::setMinWidth),
     1775        new NonNegativeLengthPropertyWrapper(CSSPropertyWidth, &RenderStyle::width, &RenderStyle::setWidth),
     1776        new NonNegativeLengthPropertyWrapper(CSSPropertyMinWidth, &RenderStyle::minWidth, &RenderStyle::setMinWidth),
    17501777        new LengthPropertyWrapper(CSSPropertyMaxWidth, &RenderStyle::maxWidth, &RenderStyle::setMaxWidth),
    17511778
    1752         new LengthPropertyWrapper(CSSPropertyHeight, &RenderStyle::height, &RenderStyle::setHeight),
    1753         new LengthPropertyWrapper(CSSPropertyMinHeight, &RenderStyle::minHeight, &RenderStyle::setMinHeight),
     1779        new NonNegativeLengthPropertyWrapper(CSSPropertyHeight, &RenderStyle::height, &RenderStyle::setHeight),
     1780        new NonNegativeLengthPropertyWrapper(CSSPropertyMinHeight, &RenderStyle::minHeight, &RenderStyle::setMinHeight),
    17541781        new LengthPropertyWrapper(CSSPropertyMaxHeight, &RenderStyle::maxHeight, &RenderStyle::setMaxHeight),
    17551782
     
    17641791        new LengthPropertyWrapper(CSSPropertyMarginTop, &RenderStyle::marginTop, &RenderStyle::setMarginTop),
    17651792        new LengthPropertyWrapper(CSSPropertyMarginBottom, &RenderStyle::marginBottom, &RenderStyle::setMarginBottom),
    1766         new LengthPropertyWrapper(CSSPropertyPaddingLeft, &RenderStyle::paddingLeft, &RenderStyle::setPaddingLeft),
    1767         new LengthPropertyWrapper(CSSPropertyPaddingRight, &RenderStyle::paddingRight, &RenderStyle::setPaddingRight),
    1768         new LengthPropertyWrapper(CSSPropertyPaddingTop, &RenderStyle::paddingTop, &RenderStyle::setPaddingTop),
    1769         new LengthPropertyWrapper(CSSPropertyPaddingBottom, &RenderStyle::paddingBottom, &RenderStyle::setPaddingBottom),
     1793        new NonNegativeLengthPropertyWrapper(CSSPropertyPaddingLeft, &RenderStyle::paddingLeft, &RenderStyle::setPaddingLeft),
     1794        new NonNegativeLengthPropertyWrapper(CSSPropertyPaddingRight, &RenderStyle::paddingRight, &RenderStyle::setPaddingRight),
     1795        new NonNegativeLengthPropertyWrapper(CSSPropertyPaddingTop, &RenderStyle::paddingTop, &RenderStyle::setPaddingTop),
     1796        new NonNegativeLengthPropertyWrapper(CSSPropertyPaddingBottom, &RenderStyle::paddingBottom, &RenderStyle::setPaddingBottom),
    17701797
    17711798        new PropertyWrapperVisitedAffectedColor(CSSPropertyCaretColor, &RenderStyle::caretColor, &RenderStyle::setCaretColor, &RenderStyle::visitedLinkCaretColor, &RenderStyle::setVisitedLinkCaretColor),
     
    18451872
    18461873        new PropertyWrapperShape(CSSPropertyShapeOutside, &RenderStyle::shapeOutside, &RenderStyle::setShapeOutside),
    1847         new LengthPropertyWrapper(CSSPropertyShapeMargin, &RenderStyle::shapeMargin, &RenderStyle::setShapeMargin),
     1874        new NonNegativeLengthPropertyWrapper(CSSPropertyShapeMargin, &RenderStyle::shapeMargin, &RenderStyle::setShapeMargin),
    18481875        new PropertyWrapper<float>(CSSPropertyShapeImageThreshold, &RenderStyle::shapeImageThreshold, &RenderStyle::setShapeImageThreshold),
    18491876
Note: See TracChangeset for help on using the changeset viewer.