Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | <!DOCTYPE html> |
michael@0 | 2 | <html> |
michael@0 | 3 | <head> |
michael@0 | 4 | <title>nsIAccessible::childAtPoint() from browser tests</title> |
michael@0 | 5 | <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" /> |
michael@0 | 6 | |
michael@0 | 7 | <script type="application/javascript" |
michael@0 | 8 | src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> |
michael@0 | 9 | |
michael@0 | 10 | <script type="application/javascript" |
michael@0 | 11 | src="../common.js"></script> |
michael@0 | 12 | <script type="application/javascript" |
michael@0 | 13 | src="../layout.js"></script> |
michael@0 | 14 | |
michael@0 | 15 | <script type="application/javascript"> |
michael@0 | 16 | function doTest() |
michael@0 | 17 | { |
michael@0 | 18 | // Hit testing. See bug #726097 |
michael@0 | 19 | getNode("hittest").scrollIntoView(true); |
michael@0 | 20 | |
michael@0 | 21 | var hititem = getAccessible("hititem"); |
michael@0 | 22 | var hittest = getAccessible("hittest"); |
michael@0 | 23 | |
michael@0 | 24 | var [hitX, hitY, hitWidth, hitHeight] = getBounds(hititem); |
michael@0 | 25 | var tgtX = hitX + hitWidth / 2; |
michael@0 | 26 | var tgtY = hitY + hitHeight / 2; |
michael@0 | 27 | |
michael@0 | 28 | var rootAcc = getRootAccessible(); |
michael@0 | 29 | var docAcc = getAccessible(document); |
michael@0 | 30 | var outerDocAcc = docAcc.parent; |
michael@0 | 31 | |
michael@0 | 32 | var hitAcc = rootAcc.getDeepestChildAtPoint(tgtX, tgtY); |
michael@0 | 33 | is(hitAcc, hititem, "Hit match at " + tgtX + "," + tgtY + |
michael@0 | 34 | ". Found: " + prettyName(hitAcc)); |
michael@0 | 35 | var hitAcc2 = docAcc.getDeepestChildAtPoint(tgtX, tgtY); |
michael@0 | 36 | is(hitAcc, hitAcc2, "Hit match at " + tgtX + "," + tgtY + |
michael@0 | 37 | ". Found: " + prettyName(hitAcc2)); |
michael@0 | 38 | |
michael@0 | 39 | hitAcc = outerDocAcc.getChildAtPoint(tgtX, tgtY); |
michael@0 | 40 | is(hitAcc, docAcc, "Hit match at " + tgtX + "," + tgtY + |
michael@0 | 41 | ". Found: " + prettyName(hitAcc)); |
michael@0 | 42 | hitAcc = docAcc.getChildAtPoint(tgtX, tgtY); |
michael@0 | 43 | is(hitAcc, hittest, "Hit match at " + tgtX + "," + tgtY + |
michael@0 | 44 | ". Found: " + prettyName(hitAcc)); |
michael@0 | 45 | |
michael@0 | 46 | SimpleTest.finish(); |
michael@0 | 47 | } |
michael@0 | 48 | |
michael@0 | 49 | SimpleTest.waitForExplicitFinish(); |
michael@0 | 50 | addA11yLoadEvent(doTest); |
michael@0 | 51 | </script> |
michael@0 | 52 | </head> |
michael@0 | 53 | <body> |
michael@0 | 54 | |
michael@0 | 55 | <a target="_blank" |
michael@0 | 56 | href="https://bugzilla.mozilla.org/show_bug.cgi?id=726097" |
michael@0 | 57 | title="nsIAccessible::childAtPoint() from browser tests">Mozilla Bug 726097</a> |
michael@0 | 58 | |
michael@0 | 59 | <div id="hittest"> |
michael@0 | 60 | <div id="hititem"><span role="image">img</span>item</div> |
michael@0 | 61 | </div> |
michael@0 | 62 | </body> |
michael@0 | 63 | </html> |