Fri, 16 Jan 2015 18:13:44 +0100
Integrate suggestion from review to improve consistency with existing code.
michael@0 | 1 | <!DOCTYPE html> |
michael@0 | 2 | <html> |
michael@0 | 3 | <head> |
michael@0 | 4 | <title>Accessible boundaries when page is zoomed</title> |
michael@0 | 5 | <link rel="stylesheet" type="text/css" |
michael@0 | 6 | href="chrome://mochikit/content/tests/SimpleTest/test.css" /> |
michael@0 | 7 | |
michael@0 | 8 | <script type="application/javascript" |
michael@0 | 9 | src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> |
michael@0 | 10 | <script type="application/javascript" |
michael@0 | 11 | src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script> |
michael@0 | 12 | |
michael@0 | 13 | <script type="application/javascript" |
michael@0 | 14 | src="../common.js"></script> |
michael@0 | 15 | <script type="application/javascript" |
michael@0 | 16 | src="../role.js"></script> |
michael@0 | 17 | <script type="application/javascript" |
michael@0 | 18 | src="../events.js"></script> |
michael@0 | 19 | <script type="application/javascript" |
michael@0 | 20 | src="../layout.js"></script> |
michael@0 | 21 | <script type="application/javascript" |
michael@0 | 22 | src="../browser.js"></script> |
michael@0 | 23 | |
michael@0 | 24 | <script type="application/javascript"> |
michael@0 | 25 | //gA11yEventDumpToConsole = true; |
michael@0 | 26 | function doPreTest() |
michael@0 | 27 | { |
michael@0 | 28 | var tabDocument = currentTabDocument(); |
michael@0 | 29 | var imgMap = tabDocument.getElementById("imgmap"); |
michael@0 | 30 | waitForImageMap(imgMap, doTest); |
michael@0 | 31 | } |
michael@0 | 32 | |
michael@0 | 33 | function doTest() |
michael@0 | 34 | { |
michael@0 | 35 | // Bug 746176: Failure of this whole test file on OS X. |
michael@0 | 36 | if (MAC) { |
michael@0 | 37 | todo(false, "Fix bug 746176 on Mac"); |
michael@0 | 38 | closeBrowserWindow(); |
michael@0 | 39 | SimpleTest.finish(); |
michael@0 | 40 | return; |
michael@0 | 41 | } |
michael@0 | 42 | |
michael@0 | 43 | var tabDocument = currentTabDocument(); |
michael@0 | 44 | var p1 = tabDocument.getElementById("p1"); |
michael@0 | 45 | var p2 = tabDocument.getElementById("p2"); |
michael@0 | 46 | |
michael@0 | 47 | var imgMap = tabDocument.getElementById("imgmap"); |
michael@0 | 48 | var imgMapAcc = getAccessible(imgMap); |
michael@0 | 49 | var area = imgMapAcc.firstChild; |
michael@0 | 50 | |
michael@0 | 51 | testBounds(p1); |
michael@0 | 52 | testBounds(p2); |
michael@0 | 53 | testBounds(area); |
michael@0 | 54 | |
michael@0 | 55 | zoomDocument(tabDocument, 2.0); |
michael@0 | 56 | |
michael@0 | 57 | testBounds(p1); |
michael@0 | 58 | testBounds(p2); |
michael@0 | 59 | testBounds(area); |
michael@0 | 60 | |
michael@0 | 61 | closeBrowserWindow(); |
michael@0 | 62 | SimpleTest.finish(); |
michael@0 | 63 | } |
michael@0 | 64 | |
michael@0 | 65 | var url = "data:text/html,<html><body>"; |
michael@0 | 66 | url += "<p id='p1'>para 1</p><p id='p2'>para 2</p>"; |
michael@0 | 67 | url += "<map name='atoz_map' id='map'>"; |
michael@0 | 68 | url += " <area id='area1' href='http%3A%2F%2Fmozilla.org'"; |
michael@0 | 69 | url += " coords=17,0,30,14' alt='mozilla.org' shape='rect'>"; |
michael@0 | 70 | url += "</map>"; |
michael@0 | 71 | url += "<img id='imgmap' width='447' height='15'"; |
michael@0 | 72 | url += " usemap='%23atoz_map'"; |
michael@0 | 73 | url += " src='chrome%3A%2F%2Fmochitests%2Fcontent%2Fa11y%2Faccessible%2Fletters.gif'>"; |
michael@0 | 74 | url += "</body></html>"; |
michael@0 | 75 | |
michael@0 | 76 | SimpleTest.waitForExplicitFinish(); |
michael@0 | 77 | openBrowserWindow(doPreTest, |
michael@0 | 78 | url, |
michael@0 | 79 | { left: 0, top: 0, width: 600, height: 600 }); |
michael@0 | 80 | </script> |
michael@0 | 81 | |
michael@0 | 82 | </head> |
michael@0 | 83 | <body> |
michael@0 | 84 | |
michael@0 | 85 | <a target="_blank" |
michael@0 | 86 | href="https://bugzilla.mozilla.org/show_bug.cgi?id=650241" |
michael@0 | 87 | title="Location returned by accessibles incorrect when page zoomed"> |
michael@0 | 88 | Mozilla Bug 650241 |
michael@0 | 89 | </a> |
michael@0 | 90 | <p id="display"></p> |
michael@0 | 91 | <div id="content" style="display: none"></div> |
michael@0 | 92 | <pre id="test"> |
michael@0 | 93 | </pre> |
michael@0 | 94 | </body> |
michael@0 | 95 | </html> |