blob: 610f852df9321fa477b80aa6770f0ff8ba05ff21 [file] [log] [blame]
simon.fraser@apple.coma10a6d42016-01-02 04:45:36 +00001<html dir="rtl">
2<head>
3 <style>
4 .wide {
5 width: 2000px;
6 height: 10px;
7 background-color: silver;
8 }
9 .origin {
10 position: absolute;
11 top: 0;
12 left: 0;
13 width: 10px;
14 height: 10px;
15 background-color: blue;
16 }
17
18 #lefty {
19 position: absolute;
20 left: -200px;
21 width: 100px;
22 height: 100px;
23 background-color: orange;
24 }
25 </style>
26 <script>
27 var desiredScrollOffset = -200;
28 function runTest()
29 {
30 if (!window.sessionStorage)
31 return;
32
33 if (window.testRunner) {
34 testRunner.waitUntilDone();
35 testRunner.dumpAsText();
36 }
37
38 if (sessionStorage.testCompleted) {
39 window.setTimeout(function() {
40 var currentOffset = document.scrollingElement.scrollLeft;
41 if (currentOffset == desiredScrollOffset)
42 document.getElementById('result').textContent = 'PASS: scrollLeft after reload is ' + desiredScrollOffset;
43 else
44 document.getElementById('result').textContent = 'FAIL: scrollLeft after reload is ' + currentOffset + ', should be' + desiredScrollOffset;
45
46 delete sessionStorage.testCompleted;
47 if (window.testRunner)
48 testRunner.notifyDone();
49 }, 0);
50 } else {
51 document.scrollingElement.scrollLeft = desiredScrollOffset;
52 sessionStorage.testCompleted = true;
53 document.location.reload(true);
54 }
55 }
56
57 window.addEventListener('load', runTest, false);
58 </script>
59</head>
60<body>
61 <div class="wide"></div>
62 <div class="origin"></div>
63 <div id="lefty"></div>
64 <div id="result"></div>
65</body>
66</html>