tor-browser

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

border-image-width-interpolation.html (5432B)


      1 <!DOCTYPE html>
      2 <meta charset="UTF-8">
      3 <title>border-image-width interpolation</title>
      4 <link rel="help" href="https://drafts.csswg.org/css-backgrounds-3/#border-image-width">
      5 <meta name="assert" content="border-image-width 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-image-width: 100px;
     14 }
     15 .target {
     16  width: 80px;
     17  height: 80px;
     18  background-color: black;
     19  display: inline-block;
     20  border: 10px;
     21  border-image-source: linear-gradient(45deg, red, blue, green);
     22  border-image-width: 10px;
     23 }
     24 .expected {
     25  background-color: green;
     26  margin-right: 2px;
     27 }
     28 </style>
     29 
     30 <body></body>
     31 
     32 <script>
     33 test_interpolation({
     34  property: 'border-image-width',
     35  from: neutralKeyframe,
     36  to: '20px',
     37 }, [
     38  {at: -0.3, expect:   '7px'},
     39  {at: 0,    expect:  '10px'},
     40  {at: 0.3,  expect:  '13px'},
     41  {at: 0.6,  expect:  '16px'},
     42  {at: 1,    expect:  '20px'},
     43  {at: 1.5,  expect:  '25px'},
     44  {at: 5,    expect:  '60px'},
     45  {at: 10,   expect: '110px'},
     46 ]);
     47 test_no_interpolation({
     48  property: 'border-image-width',
     49  from: 'initial',
     50  to: '20px',
     51 });
     52 test_interpolation({
     53  property: 'border-image-width',
     54  from: 'inherit',
     55  to: '20px',
     56 }, [
     57  {at: -0.3, expect: '124px'},
     58  {at: 0,    expect: '100px'},
     59  {at: 0.3,  expect:  '76px'},
     60  {at: 0.6,  expect:  '52px'},
     61  {at: 1,    expect:  '20px'},
     62  {at: 1.5,  expect:   '0px'},
     63  {at: 5,    expect:   '0px'},
     64  {at: 10,   expect:   '0px'},
     65 ]);
     66 test_no_interpolation({
     67  property: 'border-image-width',
     68  from: 'unset',
     69  to: '20px',
     70 });
     71 test_interpolation({
     72  property: 'border-image-width',
     73  from: '0px',
     74  to: '20px'
     75 }, [
     76  {at: -0.3, expect:   '0px'}, // CSS border-image-width can't be negative.
     77  {at: 0,    expect:   '0px'},
     78  {at: 0.3,  expect:   '6px'},
     79  {at: 0.6,  expect:  '12px'},
     80  {at: 1,    expect:  '20px'},
     81  {at: 1.5,  expect:  '30px'},
     82  {at: 5,    expect: '100px'},
     83  {at: 10,   expect: '200px'}
     84 ]);
     85 test_interpolation({
     86  property: 'border-image-width',
     87  from: '0%',
     88  to: '20%'
     89 }, [
     90  {at: -0.3, expect:   '0%'}, // CSS border-image-width can't be negative.
     91  {at: 0,    expect:   '0%'},
     92  {at: 0.3,  expect:   '6%'},
     93  {at: 0.6,  expect:  '12%'},
     94  {at: 1,    expect:  '20%'},
     95  {at: 1.5,  expect:  '30%'},
     96  {at: 5,    expect: '100%'},
     97  {at: 10,   expect: '200%'}
     98 ]);
     99 test_interpolation({
    100  property: 'border-image-width',
    101  from: '0',
    102  to: '20'
    103 }, [
    104  {at: -0.3, expect:   '0'}, // CSS border-image-width can't be negative.
    105  {at: 0,    expect:   '0'},
    106  {at: 0.3,  expect:   '6'},
    107  {at: 0.6,  expect:  '12'},
    108  {at: 1,    expect:  '20'},
    109  {at: 1.5,  expect:  '30'},
    110  {at: 5,    expect: '100'},
    111  {at: 10,   expect: '200'}
    112 ]);
    113 test_interpolation({
    114  property: 'border-image-width',
    115  from: '10px 20% 30 40px',
    116  to: '80px 70% 60 50px'
    117 }, [
    118  {at: -0.3, expect:   '0px   5%  21  37px'}, // CSS border-image-width can't be negative.
    119  {at: 0,    expect:  '10px  20%  30  40px'},
    120  {at: 0.3,  expect:  '31px  35%  39  43px'},
    121  {at: 0.6,  expect:  '52px  50%  48  46px'},
    122  {at: 1,    expect:  '80px  70%  60  50px'},
    123  {at: 1.5,  expect: '115px  95%  75  55px'},
    124  {at: 5,    expect: '360px 270% 180  90px'},
    125  {at: 10,   expect: '710px 520% 330 140px'}
    126 ]);
    127 test_interpolation({
    128  property: 'border-image-width',
    129  from: '10%',
    130  to: '20px'
    131 }, [
    132  // Percentages are relative to the size of the border image area, which is 120px.
    133  {at: -0.3, expect: 'calc(13% + -6px)'}, // Should be parsed as 16px - 6px = 10px
    134  {at: 0,    expect: '10%'},              // Should be parsed as 12px
    135  {at: 0.3,  expect: 'calc(7% + 6px)'},   // Should be parsed as 8px + 6px = 14px
    136  {at: 0.6,  expect: 'calc(4% + 12px)'},  // Should be parsed as 5px + 12px = 17px
    137  {at: 1,    expect: 'calc(0% + 20px)'},
    138  {at: 1.5,  expect: 'calc(-5% + 30px)'}, // Should be parsed as -6px + 30px = 24px
    139 ]);
    140 test_interpolation({
    141  property: 'border-image-width',
    142  from: '10px',
    143  to: '20%'
    144 }, [
    145  // Percentages are relative to the size of the border image area, which is 120px.
    146  {at: -0.3, expect: 'calc(13px + -6%)'}, // Should be parsed as 13px - 7px = 6px
    147  {at: 0,    expect: 'calc(0% + 10px)'},
    148  {at: 0.3,  expect: 'calc(7px + 6%)'},   // Should be parsed as 7px + 7px = 14px
    149  {at: 0.6,  expect: 'calc(4px + 12%)'},  // Should be parsed as 4px + 14px = 18px
    150  {at: 1,    expect: '20%'},              // Should be parsed as 24px
    151  {at: 1.5,  expect: 'calc(-5px + 30%)'}, // Should be parsed as -5px + 36px = 31px
    152 ]);
    153 
    154 test_interpolation({
    155  property: 'border-image-width',
    156  from: '10px auto auto 20',
    157  to: '110px auto auto 120'
    158 }, [
    159  {at: -0.3, expect: '  0px auto auto   0'},
    160  {at: 0,    expect: ' 10px auto auto  20'},
    161  {at: 0.3,  expect: ' 40px auto auto  50'},
    162  {at: 0.6,  expect: ' 70px auto auto  80'},
    163  {at: 1,    expect: '110px auto auto 120'},
    164  {at: 1.5,  expect: '160px auto auto 170'},
    165 ]);
    166 
    167 test_no_interpolation({
    168  property: 'border-image-width',
    169  from: '10px auto auto 20',
    170  to: '110px auto 120 auto'
    171 });
    172 test_no_interpolation({
    173  property: 'border-image-width',
    174  from: '10px',
    175  to: '20'
    176 });
    177 test_no_interpolation({
    178  property: 'border-image-width',
    179  from: '10',
    180  to: '20px'
    181 });
    182 test_no_interpolation({
    183  property: 'border-image-width',
    184  from: '10%',
    185  to: '20'
    186 });
    187 test_no_interpolation({
    188  property: 'border-image-width',
    189  from: '10',
    190  to: '20%'
    191 });
    192 </script>