tor-browser

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

clip-path-computed.html (2875B)


      1 <!DOCTYPE html>
      2 <html>
      3 <head>
      4 <meta charset="utf-8">
      5 <title>CSS Shapes Module Level 1: getComputedStyle().clipPath</title>
      6 <link rel="help" href="https://drafts.csswg.org/css-shapes/#clip-path-property">
      7 <meta name="assert" content="clip-path computed value is as specified.">
      8 <script src="/resources/testharness.js"></script>
      9 <script src="/resources/testharnessreport.js"></script>
     10 <script src="/css/support/computed-testcommon.js"></script>
     11 </head>
     12 <body>
     13 <style>
     14  #target {
     15    font-size: 40px;
     16  }
     17 </style>
     18 <div id="target"></div>
     19 <script>
     20 test_computed_value("clip-path", "circle(calc(10px + 0.5em) at -50% 50%)", "circle(30px at -50% 50%)");
     21 test_computed_value("clip-path", "circle(calc(10px - 0.5em) at 50% -50%)", "circle(0px at 50% -50%)");
     22 test_computed_value("clip-path", "ellipse(at 50% 50%)");
     23 test_computed_value("clip-path", "ellipse(60% closest-side at 50% 50%)");
     24 
     25 // All <basic-shape-rect> functions compute to the equivalent inset() function.
     26 // Given "xywh(x y w h)", the equivalent function is
     27 // "inset(y calc(100% - x - w) calc(100% - y - h) x)".
     28 // https://drafts.csswg.org/css-shapes-1/#basic-shape-computed-values
     29 // https://github.com/w3c/csswg-drafts/issues/9053
     30 test_computed_value("clip-path", "xywh(0 1% 2px 0.5em)", "inset(1% calc(100% - 2px) calc(99% - 20px) 0px)");
     31 test_computed_value("clip-path", "xywh(0px 1% 2px 0.5em round 0)", "inset(1% calc(100% - 2px) calc(99% - 20px) 0px)");
     32 test_computed_value("clip-path", "xywh(0px 1% 2px 3% round 0 1px)", "inset(1% calc(100% - 2px) 96% 0px round 0px 1px)");
     33 test_computed_value("clip-path", "xywh(0px 1% 2px 3% round 0px 1px 2em)", "inset(1% calc(100% - 2px) 96% 0px round 0px 1px 80px)");
     34 test_computed_value("clip-path", "xywh(0px 1% 2px 3% round 0px 1px 2% 3px)", "inset(1% calc(100% - 2px) 96% 0px round 0px 1px 2% 3px)");
     35 test_computed_value("clip-path", "xywh(calc(0px) calc(1px + 1%) calc(2px + 2%) calc(3px + 3%))", "inset(calc(1% + 1px) calc(98% - 2px) calc(96% - 4px) 0px)");
     36 // Given "rect(t r b l)", the equivalent function is
     37 // "inset(t calc(100% - r) calc(100% - b) l)".
     38 test_computed_value("clip-path", "rect(auto auto auto auto)", "inset(0%)");
     39 test_computed_value("clip-path", "rect(0 1% 2px 0.5em)", "inset(0px 99% calc(100% - 2px) 20px)");
     40 test_computed_value("clip-path", "rect(0px 1% auto 0.5em round 0)", "inset(0px 99% 0% 20px)");
     41 test_computed_value("clip-path", "rect(0px 1% auto 3% round 0 1px)", "inset(0px 99% 0% 3% round 0px 1px)");
     42 test_computed_value("clip-path", "rect(0px 1% auto 3% round 0px 1px 2em)", "inset(0px 99% 0% 3% round 0px 1px 80px)");
     43 test_computed_value("clip-path", "rect(0px 1% auto 3% round 0px 1px 2% 3px)", "inset(0px 99% 0% 3% round 0px 1px 2% 3px)");
     44 test_computed_value("clip-path", "rect(calc(0px) calc(1px + 1%) calc(2px + 2%) calc(3px + 3%))", "inset(0px calc(99% - 1px) calc(98% - 2px) calc(3% + 3px))");
     45 </script>
     46 </body>
     47 </html>