tor-browser

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

test_zoom_text.html (1818B)


      1 <!DOCTYPE html>
      2 <html>
      3 <head>
      4  <title>getOffsetAtPoint when page is zoomed</title>
      5  <link rel="stylesheet" type="text/css"
      6        href="chrome://mochikit/content/tests/SimpleTest/test.css" />
      7 
      8  <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
      9 
     10  <script type="application/javascript"
     11          src="../common.js"></script>
     12  <script type="application/javascript"
     13          src="../role.js"></script>
     14  <script type="application/javascript"
     15          src="../layout.js"></script>
     16 
     17  <script type="application/javascript">
     18    function doTest() {
     19      var hyperText = getNode("paragraph");
     20      var textNode = hyperText.firstChild;
     21      let [x, y, width, height] = getBounds(textNode);
     22      testOffsetAtPoint(hyperText, x + width / 2, y + height / 2,
     23                        COORDTYPE_SCREEN_RELATIVE,
     24                        hyperText.textContent.length / 2);
     25 
     26      zoomDocument(document, 2.0);
     27 
     28      document.body.offsetTop; // getBounds doesn't flush layout on its own, looks like.
     29 
     30      [x, y, width, height] = getBounds(textNode);
     31      testOffsetAtPoint(hyperText, x + width / 2, y + height / 2,
     32                        COORDTYPE_SCREEN_RELATIVE,
     33                        hyperText.textContent.length / 2);
     34 
     35      zoomDocument(document, 1.0);
     36 
     37      SimpleTest.finish();
     38    }
     39 
     40    SimpleTest.waitForExplicitFinish();
     41    addA11yLoadEvent(doTest);
     42  </script>
     43 </head>
     44 <body>
     45 
     46  <a target="_blank"
     47     href="https://bugzilla.mozilla.org/show_bug.cgi?id=727942"
     48     title="getOffsetAtPoint returns incorrect value when page is zoomed">
     49    Mozilla Bug 727942
     50  </a>
     51  <p id="display"></p>
     52  <div id="content" style="display: none"></div>
     53  <pre id="test">
     54  </pre>
     55  <p id="paragraph" style="font-family: monospace;">Болтали две сороки</p>
     56 </body>
     57 </html>