blob: 690d401d88b8370c920146cf915368e07db12dd1 [file] [log] [blame]
<!DOCTYPE html>
<script src="../../resources/js-test.js"></script>
<script src="resources/expect-cursor-update.js"></script>
<style type="text/css">
#container {
padding: 30px;
cursor: pointer;
border: 1px solid blue;
}
.wait {
cursor: wait !important;
}
iframe {
width: 300px;
}
</style>
</head>
<body>
<p id="description"></p>
<div id="container">
<iframe id="frame" srcdoc="<body style='height: 500px; cursor: text;'></body>"></iframe>
</div>
<div id="console"></div>
<script>
description("Test that a cursor change that occurs due only to a style change correctly considers iframes.");
// Ensure the shouldBe calls don't trigger any changes during our testing that could alter behavior.
setPrintTestResultsLazily();
if (!window.eventSender) {
testFailed('This test requires DumpRenderTree');
}
if (window.testRunner) {
testRunner.dumpAsText();
testRunner.waitUntilDone();
window.jsTestIsAsync = true;
}
var container = document.getElementById('container');
var y;
var frame = document.getElementById('frame');
if (window.eventSender) {
frame.onload = function() {
debug('Mouse moved to cursor changing div');
eventSender.mouseMoveTo(100, container.offsetTop + 5);
shouldBeEqualToString('internals.getCurrentCursorInfo()', 'type=Hand hotSpot=0,0');
debug('Changing cursor style');
container.classList.add('wait');
expectCursorUpdate('type=Wait hotSpot=0,0', function() {
debug('');
debug('Now move mouse onto iframe above cursor changing div');
y = frame.offsetTop + 10;
eventSender.mouseMoveTo(100, y);
shouldBe('document.elementFromPoint(100, y)', 'frame');
shouldBeTrue('document.elementsFromPoint(100, y).indexOf(container) > 0');
shouldBeFalse('internals.cursorUpdatePending');
shouldBeEqualToString('internals.getCurrentCursorInfo()', 'type=IBeam hotSpot=0,0');
debug('');
debug('Changing cursor style of the background should not affect the cursor as it sits over the iframe');
container.classList.remove('wait');
expectCursorUpdate('type=IBeam hotSpot=0,0', function() {
finishJSTest();
});
});
};
} else {
function toggleCursorInMainFrame() {
container.classList.toggle('cursor');
requestAnimationFrame(toggleCursorInMainFrame);
}
requestAnimationFrame(toggleCursorInMainFrame);
}
</script>
</body>
</html>