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.
1 <!DOCTYPE HTML>
2 <html>
3 <!--
4 https://bugzilla.mozilla.org/show_bug.cgi?id=717878
5 -->
6 <head>
7 <meta charset="utf-8">
8 <title>Test for Bug 717878</title>
9 <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
10 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
11 </head>
12 <body>
13 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=717878">Mozilla Bug 717878</a>
14 <p id="display"></p>
15 <div id="content" style="display: none">
16 </div>
17 <!-- size=10 and monospace font ensure there's no overflow in either direction -->
18 <input id="no-overflow" type="text"
19 size="10"
20 style="
21 font-family: monospace;
22 font-size: 1em;"
23 value="Short">
24 <!-- size=10, monospace font, and height=0.5em ensure overflow in both directions -->
25 <input id="overflow" type="text"
26 size="10"
27 style="
28 font-family: monospace;
29 font-size: 1em;
30 height: 0.5em;"
31 value="This is a long string">
32 <pre id="test">
33 <script type="application/javascript">
35 /** Test for Bug 717878 **/
37 /**
38 * Test an element's scroll properties for correctness
39 *
40 * @param element Element to test
41 * @param prop Specify the property to test,
42 * i.e. "scrollLeft" or "scrollTop"
43 * @param propMax Specify the scrollMax property to test,
44 * i.e. "scrollLeftMax" or "scrollTopMax"
45 * @param is_overflow Specify whether the element is
46 * scrollable in the above direction
47 */
48 function test_scroll(element, scroll, scrollMax, is_overflow) {
50 is(element[scroll], 0, element.id + " initial " + scroll + " != 0");
51 if (is_overflow) {
52 isnot(element[scrollMax], 0, element.id + " " + scrollMax + " == 0");
53 } else {
54 is(element[scrollMax], 0, element.id + " " + scrollMax + " != 0");
55 }
57 element[scroll] = 10;
58 if (is_overflow) {
59 isnot(element[scroll], 0, element.id + " unable to scroll " + scroll);
60 } else {
61 is(element[scroll], 0, element.id + " able to scroll " + scroll);
62 }
64 element[scroll] = element[scrollMax];
65 is(element[scroll], element[scrollMax], element.id + " did not scroll to " + scrollMax);
67 element[scroll] = element[scrollMax] + 10;
68 is(element[scroll], element[scrollMax], element.id + " scrolled past " + scrollMax);
69 }
71 var no_overflow = document.getElementById("no-overflow");
72 test_scroll(no_overflow, "scrollLeft", "scrollLeftMax", /* is_overflow */ false);
73 test_scroll(no_overflow, "scrollTop", "scrollTopMax", /* is_overflow */ false);
75 var overflow = document.getElementById("overflow");
76 test_scroll(overflow, "scrollLeft", "scrollLeftMax", /* is_overflow */ true);
77 test_scroll(overflow, "scrollTop", "scrollTopMax", /* is_overflow */ true);
79 </script>
80 </pre>
81 </body>
82 </html>