accessible/tests/mochitest/scroll/test_zoom_text.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.

michael@0 1 <!DOCTYPE html>
michael@0 2 <html>
michael@0 3 <head>
michael@0 4 <title>Test scrollSubstringToPoint 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="../layout.js"></script>
michael@0 19 <script type="application/javascript"
michael@0 20 src="../browser.js"></script>
michael@0 21
michael@0 22 <script type="application/javascript">
michael@0 23 function doTest()
michael@0 24 {
michael@0 25 var tabDocument = currentTabDocument();
michael@0 26 var paragraphNode = tabDocument.getElementById("paragraph");
michael@0 27 var paragraph = getAccessible(paragraphNode, [nsIAccessibleText]);
michael@0 28 var offset = 64; // beginning of 4th stanza
michael@0 29
michael@0 30 var [x, y] = getPos(paragraph);
michael@0 31 var [docX, docY] = getPos(tabDocument);
michael@0 32
michael@0 33 paragraph.scrollSubstringToPoint(offset, offset,
michael@0 34 COORDTYPE_SCREEN_RELATIVE, docX, docY);
michael@0 35 testTextPos(paragraph, offset, [x, docY], COORDTYPE_SCREEN_RELATIVE);
michael@0 36
michael@0 37 zoomDocument(tabDocument, 2.0);
michael@0 38
michael@0 39 paragraphNode = tabDocument.getElementById("paragraph2");
michael@0 40 paragraph = getAccessible(paragraphNode, [nsIAccessibleText]);
michael@0 41 offset = 52; // // beginning of 4th stanza
michael@0 42 var [x, y] = getPos(paragraph);
michael@0 43 paragraph.scrollSubstringToPoint(offset, offset,
michael@0 44 COORDTYPE_SCREEN_RELATIVE, docX, docY);
michael@0 45 testTextPos(paragraph, offset, [x, docY], COORDTYPE_SCREEN_RELATIVE);
michael@0 46
michael@0 47 closeBrowserWindow();
michael@0 48 SimpleTest.finish();
michael@0 49 }
michael@0 50
michael@0 51 var url = "data:text/html,<html>" +
michael@0 52 "<meta http-equiv='Content-Type' content='text/html;charset=utf-8' />" +
michael@0 53 "<body>" +
michael@0 54 "<br><br><br><br><br><br><br><br><br><br>" +
michael@0 55 "<br><br><br><br><br><br><br><br><br><br>" +
michael@0 56 "<br><br><br><br><br><br><br><br><br><br>" +
michael@0 57 "<br><br><br><br><br><br><br><br><br><br>" +
michael@0 58 "<br><br><br><br><br><br><br><br><br><br>" +
michael@0 59 "<br><br><br><br><br><br><br><br><br><br>" +
michael@0 60 "<br><br><br><br><br><br><br><br><br><br>" +
michael@0 61 "<br><br><br><br><br><br><br><br><br><br>" +
michael@0 62 "<br><br><br><br><br><br><br><br><br><br>" +
michael@0 63 "<br><br><br><br><br><br><br><br><br><br>" +
michael@0 64 "<br><br><br><br><br><br><br><br><br><br>" +
michael@0 65 "<br><br><br><br><br><br><br><br><br><br>" +
michael@0 66 "<br><br><br><br><br><br><br><br><br><br>" +
michael@0 67 "<br><br><br><br><br><br><br><br><br><br>" +
michael@0 68 "<br><br><br><br><br><br><br><br><br><br>" +
michael@0 69 "<br><br><br><br><br><br><br><br><br><br>" +
michael@0 70 "<br><br><br><br><br><br><br><br><br><br>" +
michael@0 71 "<br><br><br><br><br><br><br><br><br><br>" +
michael@0 72 "<br><br><br><br><br><br><br><br><br><br>" +
michael@0 73 "<br><br><br><br><br><br><br><br><br><br>" +
michael@0 74 "<br><br><br><br><br><br><br><br><br><br>" +
michael@0 75 "<br><br><br><br><br><br><br><br><br><br>" +
michael@0 76 "<br><br><br><br><br><br><br><br><br><br>" +
michael@0 77 "<br><br><br><br><br><br><br><br><br><br>" +
michael@0 78 "<br><br><br><br><br><br><br><br><br><br>" +
michael@0 79 "<br><br><br><br><br><br><br><br><br><br>" +
michael@0 80 "<br><br><br><br><br><br><br><br><br><br>" +
michael@0 81 "<br><br><br><br><br><br><br><br><br><br>" +
michael@0 82 "<br><br><br><br><br><br><br><br><br><br>" +
michael@0 83 "<br><br><br><br><br><br><br><br><br><br>" +
michael@0 84 "<br><br><br><br><br><br><br><br><br><br>" +
michael@0 85 "<br><br><br><br><br><br><br><br><br><br>" +
michael@0 86 "<br><br><br><br><br><br><br><br><br><br>" +
michael@0 87 "<br><br><br><br><br><br><br><br><br><br><hr>" +
michael@0 88 "<p id='paragraph'>" +
michael@0 89 " Пошел котик на торжок<br>" +
michael@0 90 " Купил котик пирожок<br>" +
michael@0 91 " Пошел котик на улочку<br>" +
michael@0 92 " Купил котик булочку<br>" +
michael@0 93 "</p>" +
michael@0 94 "<hr><br><br><br><br><br><br><br><br><br><br>" +
michael@0 95 "<br><br><br><br><br><br><br><br><br><br>" +
michael@0 96 "<br><br><br><br><br><br><br><br><br><br>" +
michael@0 97 "<br><br><br><br><br><br><br><br><br><br>" +
michael@0 98 "<br><br><br><br><br><br><br><br><br><br>" +
michael@0 99 "<br><br><br><br><br><br><br><br><br><br><hr>" +
michael@0 100 "<p id='paragraph2'>" +
michael@0 101 " Самому ли съесть<br>" +
michael@0 102 " Либо Сашеньке снесть<br>" +
michael@0 103 " Я и сам укушу<br>" +
michael@0 104 " Я и Сашеньке снесу<br>" +
michael@0 105 "</p>" +
michael@0 106 "<hr><br><br><br><br><br><br><br><br><br><br>" +
michael@0 107 "<br><br><br><br><br><br><br><br><br><br>" +
michael@0 108 "<br><br><br><br><br><br><br><br><br><br>" +
michael@0 109 "<br><br><br><br><br><br><br><br><br><br>" +
michael@0 110 "<br><br><br><br><br><br><br><br><br><br>" +
michael@0 111 "<br><br><br><br><br><br><br><br><br><br>" +
michael@0 112 "<br><br><br><br><br><br><br><br><br><br>" +
michael@0 113 "<br><br><br><br><br><br><br><br><br><br>" +
michael@0 114 "<br><br><br><br><br><br><br><br><br><br>" +
michael@0 115 "<br><br><br><br><br><br><br><br><br><br>" +
michael@0 116 "<br><br><br><br><br><br><br><br><br><br>" +
michael@0 117 "<br><br><br><br><br><br><br><br><br><br>" +
michael@0 118 "<br><br><br><br><br><br><br><br><br><br>" +
michael@0 119 "<br><br><br><br><br><br><br><br><br><br>" +
michael@0 120 "<br><br><br><br><br><br><br><br><br><br>" +
michael@0 121 "<br><br><br><br><br><br><br><br><br><br>" +
michael@0 122 "<br><br><br><br><br><br><br><br><br><br>" +
michael@0 123 "<br><br><br><br><br><br><br><br><br><br>" +
michael@0 124 "<br><br><br><br><br><br><br><br><br><br>" +
michael@0 125 "<br><br><br><br><br><br><br><br><br><br>" +
michael@0 126 "<br><br><br><br><br><br><br><br><br><br>" +
michael@0 127 "<br><br><br><br><br><br><br><br><br><br>" +
michael@0 128 "<br><br><br><br><br><br><br><br><br><br>" +
michael@0 129 "<br><br><br><br><br><br><br><br><br><br>" +
michael@0 130 "<br><br><br><br><br><br><br><br><br><br>" +
michael@0 131 "<br><br><br><br><br><br><br><br><br><br>" +
michael@0 132 "<br><br><br><br><br><br><br><br><br><br>" +
michael@0 133 "<br><br><br><br><br><br><br><br><br><br>" +
michael@0 134 "<br><br><br><br><br><br><br><br><br><br>" +
michael@0 135 "<br><br><br><br><br><br><br><br><br><br>" +
michael@0 136 "<br><br><br><br><br><br><br><br><br><br>" +
michael@0 137 "</body></html>";
michael@0 138
michael@0 139 SimpleTest.waitForExplicitFinish();
michael@0 140 openBrowserWindow(doTest,
michael@0 141 url,
michael@0 142 { left: 0, top: 0, width: 600, height: 600 });
michael@0 143 </script>
michael@0 144
michael@0 145 </head>
michael@0 146 <body>
michael@0 147
michael@0 148 <a target="_blank"
michael@0 149 href="https://bugzilla.mozilla.org/show_bug.cgi?id=727942"
michael@0 150 title="scrollSubstringToPoint is broken when page is zoomed">
michael@0 151 Mozilla Bug 727942
michael@0 152 </a>
michael@0 153 <p id="display"></p>
michael@0 154 <div id="content" style="display: none"></div>
michael@0 155 <pre id="test">
michael@0 156 </pre>
michael@0 157 </body>
michael@0 158 </html>

mercurial