tor-browser

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

clip-path-valid.html (4462B)


      1 <!DOCTYPE html>
      2 <html>
      3 <head>
      4 <meta charset="utf-8">
      5 <title>CSS Masking Module Level 1: parsing clip-path with valid values</title>
      6 <link rel="author" title="Eric Willigers" href="mailto:ericwilligers@chromium.org">
      7 <link rel="help" href="https://drafts.fxtf.org/css-masking-1/#the-clip-path">
      8 <meta name="assert" content="clip-path supports the full grammar '<clip-source> | [ <basic-shape> || <geometry-box> ] | none'.">
      9 <script src="/resources/testharness.js"></script>
     10 <script src="/resources/testharnessreport.js"></script>
     11 <script src="/css/support/parsing-testcommon.js"></script>
     12 </head>
     13 <body>
     14 <script>
     15 test_valid_value("clip-path", "none");
     16 
     17 // <basic-shape>
     18 test_valid_value("clip-path", "inset(100%)");
     19 test_valid_value("clip-path", "inset(0 1px)", "inset(0px 1px)");
     20 test_valid_value("clip-path", "inset(0px 1px 2%)");
     21 test_valid_value("clip-path", "inset(0px 1px 2% 3em)");
     22 test_valid_value("clip-path", "inset(0px round 100%)");
     23 test_valid_value("clip-path", "inset(0px round 0 1px)", "inset(0px round 0px 1px)");
     24 test_valid_value("clip-path", "inset(0px round 0px 1px 2%)");
     25 test_valid_value("clip-path", "inset(0px round 0px 1px 2% 3em)");
     26 test_valid_value("clip-path", "inset(10px round 20% / 0px 1px 2% 3em)");
     27 
     28 test_valid_value("clip-path", "circle()");
     29 test_valid_value("clip-path", "circle(1px)", "circle(1px)");
     30 test_valid_value("clip-path", "circle(closest-side)", "circle()");
     31 test_valid_value("clip-path", "circle(at 10% 20%)");
     32 test_valid_value("clip-path", "circle(farthest-side at center top)", "circle(farthest-side at 50% 0%)");
     33 test_valid_value("clip-path", "circle(4% at top right)", "circle(4% at 100% 0%)");
     34 
     35 test_valid_value("clip-path", "ellipse()");
     36 test_valid_value("clip-path", "ellipse(1px closest-side)");
     37 test_valid_value("clip-path", "ellipse(at 10% 20%)");
     38 test_valid_value("clip-path", "ellipse(closest-side closest-side at 10% 20%)", "ellipse(at 10% 20%)");
     39 test_valid_value("clip-path", "ellipse(farthest-side 4% at bottom left)", "ellipse(farthest-side 4% at 0% 100%)");
     40 
     41 test_valid_value("clip-path", "polygon(1% 2%)");
     42 test_valid_value("clip-path", "polygon(nonzero, 1px 2px, 3em 4em)", "polygon(1px 2px, 3em 4em)");
     43 test_valid_value("clip-path", "polygon(evenodd, 1px 2px, 3em 4em, 5pt 6%)");
     44 
     45 // New supported shape in [css-shapes-2]
     46 // https://drafts.csswg.org/css-shapes-2/#supported-basic-shapes
     47 test_valid_value("clip-path", 'path("m 20 0 h -100")');
     48 test_valid_value("clip-path", 'path(evenodd, "M 20 20 h 60 v 60 h -60 Z M 30 30 h 40 v 40 h -40 Z")');
     49 test_valid_value("clip-path",
     50  'path(nonzero, "M20,20h60 v60 h-60z M30,30 h40 v40 h-40z")',
     51  'path("M 20 20 h 60 v 60 h -60 Z M 30 30 h 40 v 40 h -40 Z")');
     52 
     53 test_valid_value("clip-path", "xywh(0 1% 2px 3em)", "xywh(0px 1% 2px 3em)");
     54 test_valid_value("clip-path", "xywh(0px 1% 2px 3em round 0)", "xywh(0px 1% 2px 3em)");
     55 test_valid_value("clip-path", "xywh(0px 1% 2px 3em round 0 1px)", "xywh(0px 1% 2px 3em round 0px 1px)");
     56 test_valid_value("clip-path", "xywh(0px 1% 2px 3em round 0px 1px 2%)");
     57 test_valid_value("clip-path", "xywh(0px 1% 2px 3em round 0px 1px 2% 3em)");
     58 
     59 test_valid_value("clip-path", "rect(0 100% 200px 4em)", "rect(0px 100% 200px 4em)");
     60 test_valid_value("clip-path", "rect(auto auto auto auto)");
     61 test_valid_value("clip-path", "rect(0px 100% auto 4em round 0)", "rect(0px 100% auto 4em)");
     62 test_valid_value("clip-path", "rect(0px 100% auto 4em round 0 1px)", "rect(0px 100% auto 4em round 0px 1px)");
     63 test_valid_value("clip-path", "rect(0px 100% auto 4em round 0px 1px 2%)");
     64 test_valid_value("clip-path", "rect(0px 100% auto 4em round 0px 1px 2% 3em)");
     65 
     66 // <geometry-box>
     67 test_valid_value("clip-path", "border-box");
     68 test_valid_value("clip-path", "padding-box");
     69 test_valid_value("clip-path", "content-box");
     70 test_valid_value("clip-path", "margin-box");
     71 test_valid_value("clip-path", "fill-box");
     72 test_valid_value("clip-path", "stroke-box");
     73 test_valid_value("clip-path", "view-box");
     74 
     75 // <basic-shape> <geometry-box>
     76 test_valid_value("clip-path", "circle(7% at 8% 9%) border-box", "circle(7% at 8% 9%)");
     77 
     78 // <geometry-box> <basic-shape>
     79 test_valid_value("clip-path", "border-box circle(7% at 8% 9%)", "circle(7% at 8% 9%)");
     80 
     81 // <clip-source>
     82 test_valid_value("clip-path", "url(https://example.com/)", ["url(https://example.com/)", "url(\"https://example.com/\")"]);
     83 test_valid_value("clip-path", "url(\"https://example.com/\")", ["url(https://example.com/)", "url(\"https://example.com/\")"]);
     84 </script>
     85 </body>
     86 </html>