OLD | NEW |
1 function $(id) { return document.getElementById(id); } | 1 function $(id) { return document.getElementById(id); } |
2 | 2 |
3 var lastScrollLeft; | 3 var lastScrollLeft; |
4 var lastScrollTop; | 4 var lastScrollTop; |
5 window.onload = function() { | 5 window.onload = function() { |
6 var draggable = $('draggable'); | 6 var draggable = $('draggable'); |
7 var sample = $('sample'); | 7 var sample = $('sample'); |
8 var scrollBarWidth = $('scrollbars').offsetWidth - $('scrollbars').firstChil
d.offsetWidth; | 8 var scrollBarWidth = $('scrollbars').offsetWidth - $('scrollbars').firstChil
d.offsetWidth; |
9 var scrollBarHeight = $('scrollbars').offsetHeight - $('scrollbars').firstCh
ild.offsetHeight; | 9 var scrollBarHeight = $('scrollbars').offsetHeight - $('scrollbars').firstCh
ild.offsetHeight; |
10 var eastX = window.innerWidth - scrollBarWidth - 10; | 10 var eastX = window.innerWidth - scrollBarWidth - 10; |
11 var northY = 10; | 11 var northY = 10; |
12 var southY= window.innerHeight - scrollBarHeight - 10; | 12 var southY= window.innerHeight - scrollBarHeight - 10; |
13 var westX = 10; | 13 var westX = 10; |
14 | 14 |
15 function moveTo(newState, x, y) | 15 function moveTo(newState, x, y) |
16 { | 16 { |
17 state = newState; | 17 state = newState; |
18 lastScrollLeft = document.body.scrollLeft; | 18 lastScrollLeft = document.scrollingElement.scrollLeft; |
19 lastScrollTop = document.body.scrollTop; | 19 lastScrollTop = document.scrollingElement.scrollTop; |
20 eventSender.mouseMoveTo(x, y); | 20 eventSender.mouseMoveTo(x, y); |
21 } | 21 } |
22 | 22 |
23 var state = 'START'; | 23 var state = 'START'; |
24 function process(event) | 24 function process(event) |
25 { | 25 { |
26 debug('state=' + state); | 26 debug('state=' + state); |
27 switch (state) { | 27 switch (state) { |
28 case 'NE': | 28 case 'NE': |
29 shouldBeTrue('document.body.scrollLeft > 0'); | 29 shouldBeTrue('document.scrollingElement.scrollLeft > 0'); |
30 shouldBeTrue('!document.body.scrollTop'); | 30 shouldBeTrue('!document.scrollingElement.scrollTop'); |
31 moveTo('SE', westX, southY); | 31 moveTo('SE', westX, southY); |
32 break; | 32 break; |
33 case 'SE': | 33 case 'SE': |
34 shouldBeTrue('document.body.scrollLeft > 0'); | 34 shouldBeTrue('document.scrollingElement.scrollLeft > 0'); |
35 shouldBeTrue('document.body.scrollTop > 0'); | 35 shouldBeTrue('document.scrollingElement.scrollTop > 0'); |
36 moveTo('SW', westX, southY); | 36 moveTo('SW', westX, southY); |
37 break; | 37 break; |
38 case 'SW': | 38 case 'SW': |
39 shouldBeTrue('document.body.scrollLeft < lastScrollLeft'); | 39 shouldBeTrue('document.scrollingElement.scrollLeft < lastScrollLeft'
); |
40 shouldBeTrue('document.body.scrollTop > 0'); | 40 shouldBeTrue('document.scrollingElement.scrollTop > 0'); |
41 moveTo('NW', westX, northY); | 41 moveTo('NW', westX, northY); |
42 break; | 42 break; |
43 case 'NW': | 43 case 'NW': |
44 shouldBeTrue('document.body.scrollLeft <= lastScrollLeft'); | 44 shouldBeTrue('document.scrollingElement.scrollLeft <= lastScrollLeft
'); |
45 shouldBeTrue('document.body.scrollTop < lastScrollTop'); | 45 shouldBeTrue('document.scrollingElement.scrollTop < lastScrollTop'); |
46 eventSender.mouseUp(); | 46 eventSender.mouseUp(); |
47 $('container').outerHTML = ''; | 47 $('container').outerHTML = ''; |
48 if (window.parent !== window) | 48 if (window.parent !== window) |
49 window.jsTestIsAsync = false; | 49 window.jsTestIsAsync = false; |
50 finishJSTest(); | 50 finishJSTest(); |
51 if (!window.jsTestIsAsync) | 51 if (!window.jsTestIsAsync) |
52 window.parent.postMessage($('console').innerHTML, '*'); | 52 window.parent.postMessage($('console').innerHTML, '*'); |
53 state = 'DONE'; | 53 state = 'DONE'; |
54 break; | 54 break; |
55 case 'DONE': | 55 case 'DONE': |
(...skipping 12 matching lines...) Expand all Loading... |
68 | 68 |
69 eventSender.dragMode = false; | 69 eventSender.dragMode = false; |
70 | 70 |
71 // Grab draggable | 71 // Grab draggable |
72 eventSender.mouseMoveTo(draggable.offsetLeft + 5, draggable.offsetTop + 5); | 72 eventSender.mouseMoveTo(draggable.offsetLeft + 5, draggable.offsetTop + 5); |
73 eventSender.mouseDown(); | 73 eventSender.mouseDown(); |
74 | 74 |
75 window.onscroll = process; | 75 window.onscroll = process; |
76 process(); | 76 process(); |
77 }; | 77 }; |
OLD | NEW |