Chromium Code Reviews| 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> | |
|
bokan
2015/05/01 15:55:56
Nit: frame -> "frame"
Rick Byers
2015/05/01 17:26:47
Done.
| |
| 21 </div> | |
| 22 <div id="console"></div> | |
| 23 <script> | |
| 24 var CURSOR_UPDATE_DELAY = 50; | |
|
bokan
2015/05/01 15:55:56
It looks like we need this delay because the curso
Rick Byers
2015/05/01 17:26:47
Done.
| |
| 25 | |
| 26 description("Test that a cursor change that occurs due only to a style chang e correctly considers iframes."); | |
| 27 | |
| 28 if (!window.eventSender) { | |
| 29 testFailed('This test requires DumpRenderTree'); | |
| 30 } | |
| 31 | |
| 32 if (window.testRunner) { | |
| 33 testRunner.dumpAsText(); | |
| 34 testRunner.waitUntilDone(); | |
| 35 window.jsTestIsAsync = true; | |
| 36 } | |
| 37 | |
| 38 var container = document.getElementById('container'); | |
| 39 | |
| 40 var y; | |
| 41 var frame; | |
| 42 | |
| 43 if (window.eventSender) { | |
| 44 debug('Mouse moved to cursor changing div'); | |
| 45 eventSender.mouseMoveTo(100, container.offsetTop + 5); | |
| 46 debug('Cursor Info: ' + window.internals.getCurrentCursorInfo(document)) ; | |
| 47 shouldBeEqualToString('window.internals.getCurrentCursorInfo(document)', 'type=Hand hotSpot=0,0'); | |
| 48 | |
| 49 debug('Changing cursor style'); | |
| 50 container.classList.add('wait'); | |
| 51 setTimeout(function() { | |
| 52 shouldBeEqualToString('window.internals.getCurrentCursorInfo(documen t)', 'type=Wait hotSpot=0,0'); | |
| 53 debug(''); | |
| 54 | |
| 55 debug('Now move mouse onto iframe above cursor changing div'); | |
| 56 frame = document.getElementById('frame'); | |
| 57 y = frame.offsetTop + 10; | |
| 58 eventSender.mouseMoveTo(100, y); | |
| 59 eventSender.mouseMoveTo(101, y); | |
|
bokan
2015/05/01 15:55:56
Why the 1px move?
Rick Byers
2015/05/01 17:26:47
Whoops, that was leftover from trying to diagnose
| |
| 60 shouldBe('document.elementFromPoint(100, y)', 'frame'); | |
| 61 shouldBeTrue('document.elementsFromPoint(100, y).indexOf(container) > 0'); | |
| 62 shouldBeEqualToString('window.internals.getCurrentCursorInfo(documen t)', 'type=IBeam hotSpot=0,0'); | |
| 63 debug(''); | |
| 64 | |
| 65 debug('Changing cursor style of the background should not affect the cursor as it sits over the iframe'); | |
| 66 container.classList.remove('wait'); | |
| 67 setTimeout(function() { | |
| 68 shouldBeEqualToString('window.internals.getCurrentCursorInfo(doc ument)', 'type=IBeam hotSpot=0,0'); | |
| 69 finishJSTest(); | |
| 70 }, CURSOR_UPDATE_DELAY); | |
| 71 }, CURSOR_UPDATE_DELAY); | |
| 72 | |
| 73 } else { | |
| 74 function toggleCursorInMainFrame() { | |
| 75 container.classList.toggle('cursor'); | |
| 76 requestAnimationFrame(toggleCursorInMainFrame); | |
| 77 } | |
| 78 requestAnimationFrame(toggleCursorInMainFrame); | |
| 79 } | |
| 80 </script> | |
| 81 </body> | |
| 82 </html> | |
| OLD | NEW |