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() 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 | <script type="application/javascript" |
michael@0 | 10 | src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script> |
michael@0 | 11 | |
michael@0 | 12 | <script type="application/javascript" |
michael@0 | 13 | src="../common.js"></script> |
michael@0 | 14 | <script type="application/javascript" |
michael@0 | 15 | src="../layout.js"></script> |
michael@0 | 16 | <script type="application/javascript" |
michael@0 | 17 | src="../events.js"></script> |
michael@0 | 18 | |
michael@0 | 19 | <script type="application/javascript"> |
michael@0 | 20 | function doPreTest() |
michael@0 | 21 | { |
michael@0 | 22 | waitForImageMap("imgmap", doTest); |
michael@0 | 23 | } |
michael@0 | 24 | |
michael@0 | 25 | function doTest() |
michael@0 | 26 | { |
michael@0 | 27 | // Not specific case, child and deepchild testing. |
michael@0 | 28 | var list = getAccessible("list"); |
michael@0 | 29 | var listitem = getAccessible("listitem"); |
michael@0 | 30 | var image = getAccessible("image"); |
michael@0 | 31 | if (!MAC) { |
michael@0 | 32 | testChildAtPoint(list, 1, 1, listitem, image.firstChild); |
michael@0 | 33 | } else { |
michael@0 | 34 | todo(false, "Bug 746974 - children must match on all platforms, disable failing test on Mac"); |
michael@0 | 35 | } |
michael@0 | 36 | |
michael@0 | 37 | // ::MustPrune case (in this case childAtPoint doesn't look inside a |
michael@0 | 38 | // textbox), point is inside of textbox. |
michael@0 | 39 | var txt = getAccessible("txt"); |
michael@0 | 40 | testChildAtPoint(txt, 1, 1, txt, txt); |
michael@0 | 41 | |
michael@0 | 42 | // ::MustPrune case, point is outside of textbox accessible but is in |
michael@0 | 43 | // document. |
michael@0 | 44 | testChildAtPoint(txt, -1, 1, null, null); |
michael@0 | 45 | |
michael@0 | 46 | // ::MustPrune case, point is outside of root accessible. |
michael@0 | 47 | testChildAtPoint(txt, -10000, 10000, null, null); |
michael@0 | 48 | |
michael@0 | 49 | // Not specific case, point is inside of btn accessible. |
michael@0 | 50 | var btn = getAccessible("btn"); |
michael@0 | 51 | var btnText = btn.firstChild; |
michael@0 | 52 | testChildAtPoint(btn, 1, 1, btn, btn); |
michael@0 | 53 | |
michael@0 | 54 | // Not specific case, point is outside of btn accessible. |
michael@0 | 55 | testChildAtPoint(btn, -1, 1, null, null); |
michael@0 | 56 | |
michael@0 | 57 | // Out of flow accessible testing, do not return out of flow accessible |
michael@0 | 58 | // because it's not a child of the accessible even visually it is. |
michael@0 | 59 | var rectArea = getNode("area").getBoundingClientRect(); |
michael@0 | 60 | var outOfFlow = getNode("outofflow"); |
michael@0 | 61 | outOfFlow.style.left = rectArea.left + "px"; |
michael@0 | 62 | outOfFlow.style.top = rectArea.top + "px"; |
michael@0 | 63 | |
michael@0 | 64 | testChildAtPoint("area", 1, 1, "area", "area"); |
michael@0 | 65 | |
michael@0 | 66 | // Test image maps. Their children are not in the layout tree. |
michael@0 | 67 | var theLetterA = getAccessible("imgmap").firstChild; |
michael@0 | 68 | hitTest("imgmap", theLetterA, theLetterA); |
michael@0 | 69 | hitTest("container", "imgmap", theLetterA); |
michael@0 | 70 | |
michael@0 | 71 | SimpleTest.finish(); |
michael@0 | 72 | } |
michael@0 | 73 | |
michael@0 | 74 | SimpleTest.waitForExplicitFinish(); |
michael@0 | 75 | addA11yLoadEvent(doPreTest); |
michael@0 | 76 | </script> |
michael@0 | 77 | </head> |
michael@0 | 78 | <body> |
michael@0 | 79 | |
michael@0 | 80 | <a target="_blank" |
michael@0 | 81 | href="https://bugzilla.mozilla.org/show_bug.cgi?id=491657" |
michael@0 | 82 | title="nsIAccessible::childAtPoint() tests">Mozilla Bug 491657</a> |
michael@0 | 83 | <p id="display"></p> |
michael@0 | 84 | <div id="content" style="display: none"></div> |
michael@0 | 85 | <pre id="test"> |
michael@0 | 86 | </pre> |
michael@0 | 87 | |
michael@0 | 88 | <div role="list" id="list"> |
michael@0 | 89 | <div role="listitem" id="listitem"><span role="image" id="image">img</span>item</div> |
michael@0 | 90 | </div> |
michael@0 | 91 | |
michael@0 | 92 | <span role="button">button1</span><span role="button" id="btn">button2</span> |
michael@0 | 93 | |
michael@0 | 94 | <span role="textbox">textbox1</span><span role="textbox" id="txt">textbox2</span> |
michael@0 | 95 | |
michael@0 | 96 | <div id="outofflow" style="width: 10px; height: 10px; position: absolute; left: 0px; top: 0px; background-color: yellow;"> |
michael@0 | 97 | </div> |
michael@0 | 98 | <div id="area" style="width: 100px; height: 100px; background-color: blue;"></div> |
michael@0 | 99 | |
michael@0 | 100 | <map name="atoz_map"> |
michael@0 | 101 | <area href="http://www.bbc.co.uk/radio4/atoz/index.shtml#a" |
michael@0 | 102 | coords="0,0,15,15" alt="thelettera" shape="rect"/> |
michael@0 | 103 | </map> |
michael@0 | 104 | |
michael@0 | 105 | <div id="container"> |
michael@0 | 106 | <img id="imgmap" width="447" height="15" usemap="#atoz_map" src="../letters.gif"/> |
michael@0 | 107 | </div> |
michael@0 | 108 | |
michael@0 | 109 | </body> |
michael@0 | 110 | </html> |