tor-browser

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

content-visibility-svg-text.html (1998B)


      1 <!DOCTYPE html>
      2 <link rel="author" href="mailto:rbuis@igalia.com">
      3 <link rel="help" href="https://drafts.csswg.org/css-contain/#content-visibility">
      4 <script src="/resources/testharness.js"></script>
      5 <script src="/resources/testharnessreport.js"></script>
      6 
      7 <style>
      8 body {
      9  margin: 0;
     10  padding: 0;
     11 }
     12 #container {
     13  content-visibility:hidden;
     14 }
     15 </style>
     16 
     17 <div id="container">
     18  <svg xmlns="http://www.w3.org/2000/svg">
     19    <text transform="scale(2, 2)"><tspan id="tspan1" x="50 150 100" y="100">abc</tspan></text>
     20  </svg>
     21 </div>
     22 
     23 <script>
     24  test(() => {
     25    const element = document.querySelector('#tspan1');
     26    assert_greater_than(element.getComputedTextLength(), 0);
     27  }, `getComputedTextLength() should return nonzero values in a c-v:hidden subtree.`);
     28 
     29  test(() => {
     30    const element = document.querySelector('#tspan1');
     31    assert_greater_than(element.getCharNumAtPosition(new DOMPoint(51, 101), 0), -1, "position");
     32  }, `getCharNumAtPosition() should return nonzero values in a c-v:hidden subtree.`);
     33 
     34  test(() => {
     35    const element = document.querySelector('#tspan1');
     36    assert_equals(element.getNumberOfChars(), 3);
     37  }, `getNumberOfChars() should return nonzero values in a c-v:hidden subtree.`);
     38 
     39  test(() => {
     40    const element = document.querySelector('#tspan1');
     41    const ctm = element.getCTM();
     42    assert_equals(ctm.a, 2, 'a');
     43    assert_equals(ctm.b, 0, 'b');
     44    assert_equals(ctm.c, 0, 'c');
     45    assert_equals(ctm.d, 2, 'd');
     46    assert_equals(ctm.e, 0, 'e');
     47    assert_equals(ctm.f, 0, 'f');
     48  }, `getCTM() should return nonzero values in a c-v:hidden subtree.`);
     49 
     50  test(() => {
     51    const element = document.querySelector('#tspan1');
     52    const ctm = element.getScreenCTM();
     53    assert_equals(ctm.a, 2, 'a');
     54    assert_equals(ctm.b, 0, 'b');
     55    assert_equals(ctm.c, 0, 'c');
     56    assert_equals(ctm.d, 2, 'd');
     57    assert_equals(ctm.e, 0, 'e');
     58    assert_equals(ctm.f, 0, 'f');
     59  }, `getScreenCTM() should return nonzero values in a c-v:hidden subtree.`);
     60 </script>