accessible/tests/mochitest/scroll/test_zoom.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 scrollToPoint 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
michael@0 20 <script type="application/javascript">
michael@0 21 function testScrollToPoint()
michael@0 22 {
michael@0 23 // scrollToPoint relative screen
michael@0 24 var anchor = getAccessible("bottom1");
michael@0 25 var [x, y] = getPos(anchor);
michael@0 26 var [docX, docY] = getPos(document);
michael@0 27
michael@0 28 anchor.scrollToPoint(COORDTYPE_SCREEN_RELATIVE, docX, docY);
michael@0 29 testPos(anchor, [x, docY]);
michael@0 30
michael@0 31 // scrollToPoint relative window
michael@0 32 anchor = getAccessible("bottom2");
michael@0 33 var [x, y] = getPos(anchor);
michael@0 34 var wnd = getRootAccessible().DOMDocument.defaultView;
michael@0 35 var scrollToX = docX - wnd.screenX, scrollToY = docY - wnd.screenY;
michael@0 36
michael@0 37 anchor.scrollToPoint(COORDTYPE_WINDOW_RELATIVE, scrollToX, scrollToY);
michael@0 38 testPos(anchor, [x, docY]);
michael@0 39
michael@0 40 // scrollToPoint relative parent
michael@0 41 anchor = getAccessible("bottom3");
michael@0 42 var [x, y] = getPos(anchor);
michael@0 43 var [parentX, parentY] = getPos(anchor.parent);
michael@0 44 var scrollToX = parentX - docX, scrollToY = parentY - docY;
michael@0 45
michael@0 46 anchor.scrollToPoint(COORDTYPE_PARENT_RELATIVE, scrollToX, scrollToY);
michael@0 47 testPos(anchor, [x, docY]);
michael@0 48 }
michael@0 49
michael@0 50 function doTest()
michael@0 51 {
michael@0 52 testScrollToPoint();
michael@0 53 zoomDocument(document, 2.0);
michael@0 54 testScrollToPoint(); // zoom and test again
michael@0 55
michael@0 56 zoomDocument(document, 1.0);
michael@0 57 SimpleTest.finish();
michael@0 58 }
michael@0 59
michael@0 60 addA11yLoadEvent(doTest);
michael@0 61 SimpleTest.waitForExplicitFinish();
michael@0 62 </script>
michael@0 63
michael@0 64 </head>
michael@0 65 <body>
michael@0 66
michael@0 67 <a target="_blank"
michael@0 68 href="https://bugzilla.mozilla.org/show_bug.cgi?id=727942"
michael@0 69 title="scrollToPoint is broken when page is zoomed">
michael@0 70 Mozilla Bug 727942
michael@0 71 </a>
michael@0 72 <p id="display"></p>
michael@0 73 <div id="content" style="display: none"></div>
michael@0 74 <pre id="test">
michael@0 75 </pre>
michael@0 76
michael@0 77 <h1>Below there is a bunch of named anchors</h1>
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>
michael@0 88 <br><br><br><br><br><br><br><br><br><br>
michael@0 89 <br><br><br><br><br><br><br><br><br><br>
michael@0 90 <br><br><br><br><br><br><br><br><br><br>
michael@0 91 <br><br><br><br><br><br><br><br><br><br>
michael@0 92 <br><br><br><br><br><br><br><br><br><br>
michael@0 93 <br><br><br><br><br><br><br><br><br><br>
michael@0 94 <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>
michael@0 100 <br><br><br><br><br><br><br><br><br><br>
michael@0 101 <br><br><br><br><br><br><br><br><br><br>
michael@0 102 <br><br><br><br><br><br><br><br><br><br>
michael@0 103 <br><br><br><br><br><br><br><br><br><br>
michael@0 104 <br><br><br><br><br><br><br><br><br><br>
michael@0 105 <br><br><br><br><br><br><br><br><br><br>
michael@0 106 <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 This is in the middle anchor #1<a id="bottom1"></a>
michael@0 113 <br><br><br><br><br><br><br><br><br><br>
michael@0 114 This is in the middle anchor #2<a id="bottom2"></a>
michael@0 115 <br><br><br><br><br><br><br><br><br><br>
michael@0 116 This is in the middle anchor #3<a id="bottom3"></a>
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 <br><br><br><br><br><br><br><br><br><br>
michael@0 138 <br><br><br><br><br><br><br><br><br><br>
michael@0 139 <br><br><br><br><br><br><br><br><br><br>
michael@0 140 <br><br><br><br><br><br><br><br><br><br>
michael@0 141 <br><br><br><br><br><br><br><br><br><br>
michael@0 142 <br><br><br><br><br><br><br><br><br><br>
michael@0 143 <br><br><br><br><br><br><br><br><br><br>
michael@0 144 <br><br><br><br><br><br><br><br><br><br>
michael@0 145 <br><br><br><br><br><br><br><br><br><br>
michael@0 146 </body>
michael@0 147 </html>

mercurial