blob: 976e5e8931db42a2317ba9ef7f3bbf107a1c1952 [file] [log] [blame]
<!doctype html>
<html lang="en">
<head>
<style>
/* Make sure the console and the description don't interfere with the rest of the layout. */
#description {
position: absolute;
top: 0px;
}
#console {
position: absolute;
top: 100px;
}
.hugeBox {
width: 300px;
height: 300px;
}
.bigBox {
width: 200px;
height: 200px;
}
.smallBox {
width: 100px;
height: 100px;
}
#parent {
border: 2px solid red;
margin: 20px;
padding: 10px;
background-color: darkred;
-webkit-flow-into: flowParent;
}
#parent:hover {
background-color: green;
}
#child {
border: 5px solid orange;
background-color: orange;
-webkit-flow-into: flowChild;
}
#child:hover {
background-color: yellow;
}
#regionParent {
border: 5px solid green;
margin: 50px;
-webkit-flow-from: flowParent;
}
#regionChild {
border: 5px solid blue;
margin: 50px;
position: relative;
left: 400px;
top: -300px;
padding: 20px;
-webkit-flow-from: flowChild;
}
</style>
<script src="../../resources/js-test-pre.js"></script>
</head>
<script type="text/javascript">
if (!window.testRunner) {
description("This test covers the case when the child is flowed into a region and the parent is flowed into a different region.")
var elementsToHide = document.querySelectorAll("#console, #description");
for (var i=0; i<elementsToHide.length; i++)
elementsToHide[i].style.visibility = "hidden";
}
if (window.testRunner)
testRunner.waitUntilDone();
function beginTest() {
if (window.eventSender) {
var child = document.querySelector("#child");
var parent = document.querySelector("#parent");
// move mouse on the child object
eventSender.mouseMoveTo(child.offsetLeft + 50, child.offsetTop + 50);
eventSender.mouseDown(0);
// force a re-layout to ensure the hover events gets propagated before we check the results
var top = document.body.offsetTop;
setTimeout(release, 0);
}
}
function release() {
var child = document.querySelector("#child");
var parent = document.querySelector("#parent");
var childColor = window.getComputedStyle(child).getPropertyValue("background-color");
var parentColor = window.getComputedStyle(parent).getPropertyValue("background-color");
if (childColor == "rgb(255, 255, 0)")
testPassed("Child hover event processed OK.");
else
testFailed("Child hover event FAILED to process.");
if (parentColor == "rgb(0, 128, 0)")
testPassed("Parent hover event processed OK.");
else
testFailed("Parent hover event FAILED to process.");
var elementsToHide = document.querySelectorAll(".visibleElement, .tinyBox, .smallBox, .bigBox, .hugeBox");
for (var i=0; i<elementsToHide.length; i++)
elementsToHide[i].style.visibility = "hidden";
if (window.eventSender)
eventSender.mouseUp(0);
if (window.testRunner)
setTimeout("testRunner.notifyDone()", 0);
}
</script>
<body onload="beginTest()">
<p class="visibleElement">This test covers the case when the <span style="color: orange;"><b>child</b></span> is flowed into a <span style="color: blue;"><b>region</b></span> and the <span style="color: darkred;"><b>parent</b></span> is flowed into a different <span style="color: green;"><b>region</b></span>.</p>
<ol class="visibleElement">
<li>Move the mouse inside the orange square</li>
<li>The orange square should turn yellow and the big darkred square should turn green</li>
</ol>
<div class="bigBox" id="parent">
<div class="smallBox" id="child"></div>
</div>
<div class="hugeBox" id="regionParent"></div>
<div class="bigBox" id="regionChild"></div>
<div
</body>
</html>