OLD | NEW |
---|---|
(Empty) | |
1 <!DOCTYPE html> | |
2 <html> | |
ojan
2014/06/06 02:02:55
Nit: normally we leave out the html/head/body elem
raymes
2014/06/06 04:47:40
I've kept the <head> tags for <style> is that ok?
| |
3 <head> | |
4 <script src="../../resources/js-test.js"></script> | |
5 <style> | |
6 body { | |
7 height: 200vh; | |
8 width: 200vw; | |
9 margin: 0; | |
10 } | |
11 #subframe { | |
12 width: 100px; | |
13 height: 100px; | |
14 background-color: black; | |
15 overflow: scroll; | |
16 } | |
17 #subframe-content { | |
18 width: 200px; | |
19 height: 200px; | |
20 background-color: black; | |
21 } | |
22 </style> | |
23 </head> | |
24 <body> | |
25 <div id="subframe"> | |
26 <div id="subframe-content"></div> | |
27 </div> | |
28 <pre id="console"></pre> | |
29 </body> | |
30 <script> | |
31 description('This tests that scrollbars always receive events even when ther e is an element underneath the scrollbar which swallows the event. In this case an event handler is added to the window which swallows the event but this may al so happen with elements underneath of overlay scrollbars.'); | |
32 if (window.testRunner) | |
33 testRunner.dumpAsText(); | |
34 if (window.internals) | |
35 internals.settings.setMockScrollbarsEnabled(true) | |
36 | |
37 window.receivedMousedownEvent = false; | |
38 | |
39 document.addEventListener('mousedown', function(e) { | |
40 e.preventDefault(); | |
41 window.receivedMousedownEvent = true; | |
42 }); | |
43 | |
44 // Test the frame scrollbar. | |
45 window.scrollTo(0, 10); | |
46 if (window.eventSender) { | |
47 eventSender.mouseMoveTo(window.innerWidth - 5, 1); | |
48 eventSender.mouseDown(); | |
49 eventSender.mouseUp(); | |
50 } | |
51 | |
52 shouldBe('window.scrollY', '0'); | |
53 shouldBe('window.receivedMousedownEvent', 'true'); | |
54 | |
55 // Test a div scrollbar. | |
56 window.receivedMousedownEvent = false; | |
57 var subframe = document.getElementById('subframe'); | |
58 subframe.scrollTop = 10; | |
59 if (window.eventSender) { | |
60 eventSender.mouseMoveTo(100 - 5, 1); | |
61 eventSender.mouseDown(); | |
62 eventSender.mouseUp(); | |
63 } | |
64 | |
65 shouldBe('subframe.scrollTop', '0'); | |
66 shouldBe('window.receivedMousedownEvent', 'true'); | |
67 </script> | |
68 </html> | |
OLD | NEW |