tor-browser

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

offset-path-interpolation-005.html (5619B)


      1 <!DOCTYPE html>
      2 <html>
      3  <head>
      4    <meta charset="utf-8">
      5    <title>offset-distance interpolation</title>
      6    <link rel="author" title="Eric Willigers" href="mailto:ericwilligers@chromium.org">
      7    <link rel="help" href="https://drafts.fxtf.org/motion-1/#offset-distance-property">
      8    <meta name="assert" content="offset-distance supports animation.">
      9    <script src="/resources/testharness.js"></script>
     10    <script src="/resources/testharnessreport.js"></script>
     11    <script src="/css/support/interpolation-testcommon.js"></script>
     12  </head>
     13  <style>
     14    .parent {
     15      offset-path: ray(30deg closest-side);
     16    }
     17    .target {
     18      offset-path: ray(10deg closest-side);
     19    }
     20  </style>
     21  <body>
     22    <script>
     23      'use strict';
     24 
     25      test_no_interpolation({
     26        property: 'offset-path',
     27        from: "path('M 0 0 L 100 100 M 100 200 L 200 200 Z L 200 100 Z')",
     28        to: "ray(0deg closest-side)",
     29      });
     30 
     31      test_no_interpolation({
     32        property: 'offset-path',
     33        from: "ray(0deg closest-corner)",
     34        to: "none",
     35      });
     36 
     37      // Neutral keyframes use the inline style.
     38      test_interpolation({
     39        property: 'offset-path',
     40        from: neutralKeyframe,
     41        to: 'ray(20deg closest-side)',
     42      }, [
     43        {at: -0.3, expect: 'ray(7deg closest-side)'},
     44        {at: 0, expect: 'ray(10deg closest-side)'},
     45        {at: 0.3, expect: 'ray(13deg closest-side)'},
     46        {at: 0.6, expect: 'ray(16deg closest-side)'},
     47        {at: 1, expect: 'ray(20deg closest-side)'},
     48        {at: 1.5, expect: 'ray(25deg closest-side)'},
     49      ]);
     50 
     51      // No interpolation to a ray from the initial value 'none'.
     52      test_no_interpolation({
     53        property: 'offset-path',
     54        from: 'initial',
     55        to: 'ray(20deg closest-side)',
     56      });
     57 
     58      // 'inherit' keyframes use the parent style.
     59      test_interpolation({
     60        property: 'offset-path',
     61        from: 'inherit',
     62        to: 'ray(20deg closest-side)',
     63      }, [
     64        {at: -0.3, expect: 'ray(33deg closest-side)'},
     65        {at: 0, expect: 'ray(30deg closest-side)'},
     66        {at: 0.3, expect: 'ray(27deg closest-side)'},
     67        {at: 0.6, expect: 'ray(24deg closest-side)'},
     68        {at: 1, expect: 'ray(20deg closest-side)'},
     69        {at: 1.5, expect: 'ray(15deg closest-side)'},
     70      ]);
     71 
     72      // No interpolation to a ray from the initial value 'none'.
     73      test_no_interpolation({
     74        property: 'offset-path',
     75        from: 'unset',
     76        to: 'ray(20deg closest-side)',
     77      });
     78 
     79      // No interpolation to a ray from the initial value 'none'.
     80      test_no_interpolation({
     81        property: 'offset-path',
     82        from: 'none',
     83        to: 'ray(20deg closest-side)',
     84      });
     85 
     86      // Interpolation between rays.
     87      test_interpolation({
     88        property: 'offset-path',
     89        from: 'ray(10deg sides contain)',
     90        to: 'ray(50deg sides contain)'
     91      }, [
     92        {at: -1, expect: 'ray(-30deg sides contain)'},
     93        {at: 0, expect: 'ray(10deg sides contain)'},
     94        {at: 0.125, expect: 'ray(15deg sides contain)'},
     95        {at: 0.875, expect: 'ray(45deg sides contain)'},
     96        {at: 1, expect: 'ray(50deg sides contain)'},
     97        {at: 2, expect: 'ray(90deg sides contain)'},
     98      ]);
     99 
    100      test_interpolation({
    101        property: 'offset-path',
    102        from: 'ray(-10deg farthest-corner)',
    103        to: 'ray(-50deg farthest-corner)'
    104      }, [
    105        {at: -1, expect: 'ray(30deg farthest-corner)'},
    106        {at: 0, expect: 'ray(-10deg farthest-corner)'},
    107        {at: 0.125, expect: 'ray(-15deg farthest-corner)'},
    108        {at: 0.875, expect: 'ray(-45deg farthest-corner)'},
    109        {at: 1, expect: 'ray(-50deg farthest-corner)'},
    110        {at: 2, expect: 'ray(-90deg farthest-corner)'},
    111      ]);
    112 
    113      test_interpolation({
    114        property: 'offset-path',
    115        from: 'ray(-10deg farthest-corner at 0% 0px)',
    116        to: 'ray(-50deg farthest-corner at 100% 100px)'
    117      }, [
    118        {at: -1, expect: 'ray(30deg farthest-corner at -100% -100px)'},
    119        {at: 0, expect: 'ray(-10deg farthest-corner at 0% 0px)'},
    120        {at: 0.125, expect: 'ray(-15deg farthest-corner at 12.5% 12.5px)'},
    121        {at: 0.875, expect: 'ray(-45deg farthest-corner at 87.5% 87.5px)'},
    122        {at: 1, expect: 'ray(-50deg farthest-corner at 100% 100px)'},
    123        {at: 2, expect: 'ray(-90deg farthest-corner at 200% 200px)'},
    124      ]);
    125 
    126      test_interpolation({
    127        property: 'offset-path',
    128        from: 'ray(-10deg farthest-corner)',
    129        to: 'ray(-50deg farthest-corner at 100% 100%)'
    130      }, [
    131        // TODO: Test intermediate values as well, once the expected behavior
    132        // is clear in the spec. Right now it's a bit unclear whether or how to
    133        // interpolate to/from the initial 'auto' value.
    134        {at: 1, expect: 'ray(-50deg farthest-corner at 100% 100%)'},
    135      ]);
    136 
    137      // No interpolation between different sizes and/or different containment and/or coord-boxes.
    138      test_no_interpolation({
    139        property: 'offset-path',
    140        from: 'ray(200deg farthest-side)',
    141        to: 'ray(300deg sides)'
    142      });
    143      test_no_interpolation({
    144        property: 'offset-path',
    145        from: 'ray(200deg sides contain)',
    146        to: 'ray(300deg sides)'
    147      });
    148      test_no_interpolation({
    149        property: 'offset-path',
    150        from: 'ray(200deg farthest-side contain)',
    151        to: 'ray(300deg sides)'
    152      });
    153      test_no_interpolation({
    154        property: 'offset-path',
    155        from: 'ray(-10deg farthest-corner) content-box',
    156        to: 'ray(-50deg farthest-corner at 100% 100%) padding-box'
    157      });
    158    </script>
    159  </body>
    160 </html>