accessible/tests/mochitest/elm/test_canvas.html

Tue, 06 Jan 2015 21:39:09 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 06 Jan 2015 21:39:09 +0100
branch
TOR_BUG_9701
changeset 8
97036ab72558
permissions
-rw-r--r--

Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

     1 <!DOCTYPE html>
     2 <html>
     3 <head>
     4   <title>Accessible boundaries for hit regions</title>
     5   <link rel="stylesheet" type="text/css"
     6         href="chrome://mochikit/content/tests/SimpleTest/test.css" />
     8   <script type="application/javascript"
     9           src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
    10   <script type="application/javascript"
    11           src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
    13   <script type="application/javascript"
    14           src="../common.js"></script>
    15   <script type="application/javascript"
    16           src="../role.js"></script>
    17   <script type="application/javascript"
    18           src="../layout.js"></script>
    20   <script type="application/javascript">
    21   SpecialPowers.setBoolPref("canvas.hitregions.enabled", true);
    23     function doTest()
    24     {
    25       var canv = document.getElementById("c");
    26       var context = canv.getContext('2d');
    27       var element = document.getElementById("showA");
    28       context.beginPath();
    29       context.rect(10, 10, 150, 100);
    30       context.addHitRegion({control: element});
    31       var input = getAccessible("showA");
    32       var input = getAccessible("showA");
    33       var [cnvX, cnvY, cnvWidth, cnvHeight] = getBoundsForDOMElm(canv);
    34       var [accX, accY, accWidth, accHeight] = getBounds(input);
    35       is(accX, cnvX + 10, "accX should be 10 and not " + accX);
    36       is(accY, cnvY + 10, "accY should be 10 and not " + accY);
    37       is(accWidth, 150, "accWidth should be 150 and not " + accWidth);
    38       is(accHeight, 100, "accHeight should be 100 and not " + accHeight);
    40       SpecialPowers.setBoolPref("canvas.hitregions.enabled", false);
    41       SimpleTest.finish();
    42     }
    44     SimpleTest.waitForExplicitFinish();
    45     addA11yLoadEvent(doTest);
    46   </script>
    47 </head>
    48 <body>
    50   <canvas id="c">
    51     <input id="showA" type="checkbox"><label for="showA"> Show As </label>
    52   </canvas>
    54 </body>
    55 </html>

mercurial