2 <script src=
"../../resources/js-test.js"></script>
3 <script src=
"resources/expect-cursor-update.js"></script>
4 <style type=
"text/css">
8 border: 1px solid blue
;
11 cursor: wait
!important
;
19 <p id=
"description"></p>
21 <iframe id=
"frame" srcdoc=
"<body style='height: 500px; cursor: text;'></body>"></iframe>
23 <div id=
"console"></div>
25 description("Test that a cursor change that occurs due only to a style change correctly considers iframes.");
27 // Ensure the shouldBe calls don't trigger any changes during our testing that could alter behavior.
28 setPrintTestResultsLazily();
30 if (!window
.eventSender
) {
31 testFailed('This test requires DumpRenderTree');
34 if (window
.testRunner
) {
35 testRunner
.dumpAsText();
36 testRunner
.waitUntilDone();
37 window
.jsTestIsAsync
= true;
40 var container
= document
.getElementById('container');
43 var frame
= document
.getElementById('frame');
45 if (window
.eventSender
) {
46 frame
.onload = function() {
47 debug('Mouse moved to cursor changing div');
48 eventSender
.mouseMoveTo(100, container
.offsetTop
+ 5);
49 shouldBeEqualToString('window.internals.getCurrentCursorInfo()', 'type=Hand hotSpot=0,0');
51 debug('Changing cursor style');
52 container
.classList
.add('wait');
53 expectCursorUpdate('type=Wait hotSpot=0,0', function() {
56 debug('Now move mouse onto iframe above cursor changing div');
57 y
= frame
.offsetTop
+ 10;
58 eventSender
.mouseMoveTo(100, y
);
59 shouldBe('document.elementFromPoint(100, y)', 'frame');
60 shouldBeTrue('document.elementsFromPoint(100, y).indexOf(container) > 0');
61 shouldBeFalse('internals.cursorUpdatePending');
62 shouldBeEqualToString('window.internals.getCurrentCursorInfo()', 'type=IBeam hotSpot=0,0');
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 expectCursorUpdate('type=IBeam hotSpot=0,0', function() {
74 function toggleCursorInMainFrame() {
75 container
.classList
.toggle('cursor');
76 requestAnimationFrame(toggleCursorInMainFrame
);
78 requestAnimationFrame(toggleCursorInMainFrame
);