| OLD | NEW |
| (Empty) | |
| 1 <!DOCTYPE html> |
| 2 <script src="../../resources/js-test.js"></script> |
| 3 <style type="text/css"> |
| 4 #container { |
| 5 padding: 30px; |
| 6 cursor: pointer; |
| 7 border: 1px solid blue; |
| 8 } |
| 9 .wait { |
| 10 cursor: wait !important; |
| 11 } |
| 12 iframe { |
| 13 width: 300px; |
| 14 } |
| 15 </style> |
| 16 </head> |
| 17 <body> |
| 18 <p id="description"></p> |
| 19 <div id="container"> |
| 20 <iframe id="frame" srcdoc="<body style='height: 500px; cursor: text;'></body
>"></iframe> |
| 21 </div> |
| 22 <div id="console"></div> |
| 23 <script> |
| 24 // Must be at least the value of cursorUpdateInterval from EventHandler.cpp |
| 25 // which is used to throttle update requests. |
| 26 var CURSOR_UPDATE_DELAY = 50; |
| 27 |
| 28 description("Test that a cursor change that occurs due only to a style chang
e correctly considers iframes."); |
| 29 |
| 30 if (!window.eventSender) { |
| 31 testFailed('This test requires DumpRenderTree'); |
| 32 } |
| 33 |
| 34 if (window.testRunner) { |
| 35 testRunner.dumpAsText(); |
| 36 testRunner.waitUntilDone(); |
| 37 window.jsTestIsAsync = true; |
| 38 } |
| 39 |
| 40 var container = document.getElementById('container'); |
| 41 |
| 42 var y; |
| 43 var frame; |
| 44 |
| 45 if (window.eventSender) { |
| 46 debug('Mouse moved to cursor changing div'); |
| 47 eventSender.mouseMoveTo(100, container.offsetTop + 5); |
| 48 debug('Cursor Info: ' + window.internals.getCurrentCursorInfo(document))
; |
| 49 shouldBeEqualToString('window.internals.getCurrentCursorInfo(document)',
'type=Hand hotSpot=0,0'); |
| 50 |
| 51 debug('Changing cursor style'); |
| 52 container.classList.add('wait'); |
| 53 setTimeout(function() { |
| 54 shouldBeEqualToString('window.internals.getCurrentCursorInfo(documen
t)', 'type=Wait hotSpot=0,0'); |
| 55 debug(''); |
| 56 |
| 57 debug('Now move mouse onto iframe above cursor changing div'); |
| 58 frame = document.getElementById('frame'); |
| 59 y = frame.offsetTop + 10; |
| 60 eventSender.mouseMoveTo(100, y); |
| 61 shouldBe('document.elementFromPoint(100, y)', 'frame'); |
| 62 shouldBeTrue('document.elementsFromPoint(100, y).indexOf(container)
> 0'); |
| 63 shouldBeEqualToString('window.internals.getCurrentCursorInfo(documen
t)', 'type=IBeam hotSpot=0,0'); |
| 64 debug(''); |
| 65 |
| 66 debug('Changing cursor style of the background should not affect the
cursor as it sits over the iframe'); |
| 67 container.classList.remove('wait'); |
| 68 setTimeout(function() { |
| 69 shouldBeEqualToString('window.internals.getCurrentCursorInfo(doc
ument)', 'type=IBeam hotSpot=0,0'); |
| 70 finishJSTest(); |
| 71 }, CURSOR_UPDATE_DELAY); |
| 72 }, CURSOR_UPDATE_DELAY); |
| 73 |
| 74 } else { |
| 75 function toggleCursorInMainFrame() { |
| 76 container.classList.toggle('cursor'); |
| 77 requestAnimationFrame(toggleCursorInMainFrame); |
| 78 } |
| 79 requestAnimationFrame(toggleCursorInMainFrame); |
| 80 } |
| 81 </script> |
| 82 </body> |
| 83 </html> |
| OLD | NEW |