tor-browser

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

browser_test_zoom.js (1335B)


      1 /* This Source Code Form is subject to the terms of the Mozilla Public
      2 * License, v. 2.0. If a copy of the MPL was not distributed with this
      3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
      4 
      5 "use strict";
      6 
      7 async function runTests(browser, accDoc) {
      8  if (Services.appinfo.OS !== "Darwin") {
      9    const p1 = findAccessibleChildByID(accDoc, "p1");
     10    const p2 = findAccessibleChildByID(accDoc, "p2");
     11    await hitTest(browser, accDoc, p1, p1.firstChild);
     12    await hitTest(browser, accDoc, p2, p2.firstChild);
     13 
     14    await invokeContentTask(browser, [], () => {
     15      const { Layout } = ChromeUtils.importESModule(
     16        "chrome://mochitests/content/browser/accessible/tests/browser/Layout.sys.mjs"
     17      );
     18 
     19      Layout.zoomDocument(content.document, 2.0);
     20      content.document.body.offsetTop; // getBounds doesn't flush layout on its own.
     21    });
     22 
     23    await hitTest(browser, accDoc, p1, p1.firstChild);
     24    await hitTest(browser, accDoc, p2, p2.firstChild);
     25  } else {
     26    todo(
     27      false,
     28      "Bug 746974 - deepest child must be correct on all platforms, disabling on Mac!"
     29    );
     30  }
     31 }
     32 
     33 addAccessibleTask(`<p id="p1">para 1</p><p id="p2">para 2</p>`, runTests, {
     34  iframe: true,
     35  remoteIframe: true,
     36  // Ensure that all hittest elements are in view.
     37  iframeAttrs: { style: "left: 100px; top: 100px;" },
     38 });