tor-browser

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

custom-highlight-painting-invalidation-005.html (1144B)


      1 <!DOCTYPE html>
      2 <html class="reftest-wait">
      3 <meta charset="UTF-8">
      4 <title>CSS Highlight API Test: </title>
      5 <link rel="help" href="https://drafts.csswg.org/css-highlight-api-1/">
      6 <link rel="match" href="custom-highlight-painting-001-ref.html">
      7 <meta name="assert" value="::highlight overlay is correctly invalidated and repainted after modifying its priority">
      8 <script src="resources/run-after-layout-and-paint.js"></script>
      9 <style>
     10  ::highlight(example-highlight) {
     11    background-color: yellow;
     12    color: blue;
     13  }
     14  ::highlight(another-highlight) {
     15    background-color: red;
     16    color: orange;
     17  }
     18 </style>
     19 <body><span>One </span><span>two </span><span>three…</span>
     20 <script>
     21  let r = new Range();
     22  r.setStart(document.body, 0);
     23  r.setEnd(document.body, 2);
     24  let h1 = new Highlight(r);
     25  let h2 = new Highlight(r);
     26  h1.priority = 1;
     27  h2.priority = 2;
     28  CSS.highlights.set("example-highlight", h1);
     29  CSS.highlights.set("another-highlight", h2);
     30 
     31  // Force frame paint before modifying the Highlight.
     32  runAfterLayoutAndPaint(()=>{
     33    h1.priority = 3;
     34    document.documentElement.removeAttribute("class");
     35  });
     36 </script>
     37 </html>