tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

border-radius-interpolation.html (3770B)


      1 <!DOCTYPE html>
      2 <meta charset="UTF-8">
      3 <title>border-radius interpolation</title>
      4 <link rel="help" href="https://drafts.csswg.org/css-backgrounds-3/#border-radius">
      5 <meta name="assert" content="border-radius supports animation by computed value">
      6 
      7 <script src="/resources/testharness.js"></script>
      8 <script src="/resources/testharnessreport.js"></script>
      9 <script src="/css/support/interpolation-testcommon.js"></script>
     10 
     11 <style>
     12 .parent {
     13  border-radius: 30px;
     14 }
     15 .target {
     16  width: 80px;
     17  height: 80px;
     18  display: inline-block;
     19  background-color: black;
     20  margin-right: 5px;
     21  border-radius: 10px;
     22 }
     23 .expected {
     24  background-color: green;
     25  margin-right: 15px;
     26 }
     27 </style>
     28 
     29 <body></body>
     30 
     31 <script>
     32 // As per https://bugzilla.mozilla.org/show_bug.cgi?id=137688, Firefox does not
     33 // support getComputedStyle for shorthands. As such, we have one test for this
     34 // which explicitly checks the shorthand variant, but most tests use one of the
     35 // longhands instead.
     36 function compareNotEmpty(actual, expected) {
     37  assert_equals(actual, expected);
     38  assert_not_equals(actual, '');
     39 }
     40 
     41 test_interpolation({
     42  property: 'border-radius',
     43  from: '20px 40px 60px 80px / 120px 140px 160px 180px',
     44  to: '30px 50px 70px 90px / 130px 150px 170px 190px',
     45  comparisonFunction: compareNotEmpty,
     46 }, [
     47  {at: -0.3, expect: '17px 37px 57px 77px / 117px 137px 157px 177px'},
     48  {at: 0, expect: '20px 40px 60px 80px / 120px 140px 160px 180px'},
     49  {at: 0.3, expect: '23px 43px 63px 83px / 123px 143px 163px 183px'},
     50  {at: 0.6, expect: '26px 46px 66px 86px / 126px 146px 166px 186px'},
     51  {at: 1, expect: '30px 50px 70px 90px / 130px 150px 170px 190px'},
     52  {at: 1.5, expect: '35px 55px 75px 95px / 135px 155px 175px 195px'}
     53 ]);
     54 
     55 test_interpolation({
     56  property: 'border-top-left-radius',
     57  from: neutralKeyframe,
     58  to: '20px',
     59 }, [
     60  {at: -0.3, expect: '7px'},
     61  {at: 0, expect: '10px'},
     62  {at: 0.3, expect: '13px'},
     63  {at: 0.6, expect: '16px'},
     64  {at: 1, expect: '20px'},
     65  {at: 1.5, expect: '25px'},
     66 ]);
     67 test_interpolation({
     68  property: 'border-top-left-radius',
     69  from: 'initial',
     70  to: '20px',
     71 }, [
     72  {at: -0.3, expect: '0px'},
     73  {at: 0, expect: '0px'},
     74  {at: 0.3, expect: '6px'},
     75  {at: 0.6, expect: '12px'},
     76  {at: 1, expect: '20px'},
     77  {at: 1.5, expect: '30px'},
     78 ]);
     79 test_interpolation({
     80  property: 'border-top-left-radius',
     81  from: 'inherit',
     82  to: '20px',
     83 }, [
     84  {at: -0.3, expect: '33px'},
     85  {at: 0, expect: '30px'},
     86  {at: 0.3, expect: '27px'},
     87  {at: 0.6, expect: '24px'},
     88  {at: 1, expect: '20px'},
     89  {at: 1.5, expect: '15px'},
     90 ]);
     91 test_interpolation({
     92  property: 'border-top-left-radius',
     93  from: 'unset',
     94  to: '20px',
     95 }, [
     96  {at: -0.3, expect: '0px'},
     97  {at: 0, expect: '0px'},
     98  {at: 0.3, expect: '6px'},
     99  {at: 0.6, expect: '12px'},
    100  {at: 1, expect: '20px'},
    101  {at: 1.5, expect: '30px'},
    102 ]);
    103 test_interpolation({
    104  property: 'border-top-left-radius',
    105  from: '10px',
    106  to: '50px'
    107 }, [
    108  {at: -0.3, expect: '0px'}, // CSS border-top-left-radius can't be negative.
    109  {at: 0, expect: '10px'},
    110  {at: 0.3, expect: '22px'},
    111  {at: 0.6, expect: '34px'},
    112  {at: 1, expect: '50px'},
    113  {at: 1.5, expect: '70px'},
    114 ]);
    115 test_interpolation({
    116  property: 'border-top-left-radius',
    117  from: '10px',
    118  to: '100%'
    119 }, [
    120  {at: -0.3, expect: 'calc(13px + -30%)'},
    121  {at: 0, expect: 'calc(10px + 0%)'},
    122  {at: 0.3, expect: 'calc(7px + 30%)'},
    123  {at: 0.6, expect: 'calc(4px + 60%)'},
    124  {at: 1, expect: '100%'},
    125  {at: 1.5, expect: 'calc(-5px + 150%)'},
    126 ]);
    127 
    128 test_interpolation({
    129  property: 'border-top-left-radius',
    130  from: '20px',
    131  to: '10px 30px'
    132 }, [
    133  {at: -2, expect: '40px 0px'},
    134  {at: -0.3, expect: '23px 17px'},
    135  {at: 0, expect: '20px'},
    136  {at: 0.3, expect: '17px 23px'},
    137  {at: 0.6, expect: '14px 26px'},
    138  {at: 1, expect: '10px 30px'},
    139  {at: 1.5, expect: '5px 35px'}
    140 ]);
    141 </script>