tor-browser

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

paint-function-valid.https.html (1573B)


      1 <!DOCTYPE html>
      2 <meta charset=UTF-8>
      3 <title>CSS Painting API Level 1: parsing paint() with valid values</title>
      4 <link rel="help" href="https://drafts.css-houdini.org/css-paint-api/#paint-notation">
      5 <script src="/resources/testharness.js"></script>
      6 <script src="/resources/testharnessreport.js"></script>
      7 <script src="/css/support/parsing-testcommon.js"></script>
      8 <script src="/common/worklet-reftest.js"></script>
      9 
     10 <body>
     11 
     12 <!--
     13 
     14 This test registers the paint function it uses.  However, for access
     15 to specified and computed values, this doesn't appear to be required
     16 by the specification.  However, it does appear to be required by the
     17 current implementation in Chromium.  See https://crbug.com/1344490 .
     18 
     19 -->
     20 
     21 <script id="code" type="text/worklet">
     22 
     23 registerPaint('mypaint', class {
     24    paint(ctx, size, properties, args) { }
     25 });
     26 
     27 </script>
     28 
     29 <script>
     30 
     31 setup({ explicit_done: true });
     32 
     33 let worklet_code = document.getElementById('code').textContent;
     34 importWorklet(CSS.paintWorklet, worklet_code).then(() => {
     35  test_valid_value("background-image", "paint(mypaint)");
     36  test_valid_value("background-image", "paint( mypaint )", "paint(mypaint)");
     37  test_valid_value("background-image", "paint(mypaint ", "paint(mypaint)");
     38  test_valid_value("background-image", "paint( mypaint", "paint(mypaint)");
     39  test_valid_value("background-image", "paint(mypaint, blue)");
     40  test_valid_value("background-image", "paint(mypaint, {})");
     41  test_valid_value("background-image", "paint(mypaint, [])");
     42  test_valid_value("background-image", "paint(mypaint, ())");
     43 
     44  done();
     45 });
     46 
     47 </script>