blob: 8f2fe2b695b15d1dffe6d4e8f3ac46169490be6c [file] [log] [blame]
<html>
<head>
<script>
function print(message, color) {
var paragraph = document.createElement("div");
paragraph.appendChild(document.createTextNode(message));
paragraph.style.fontFamily = "monospace";
if (color)
paragraph.style.color = color;
document.getElementById("console").appendChild(paragraph);
}
function shouldBe(description, actual, expected)
{
if (expected === actual) {
print("PASS: " + description + " should be " + expected +
" and is\n",
"green");
} else {
print("FAIL: " + description + " should be " + expected +
" but instead is " + actual + "\n",
"red");
}
}
function mouseeventverify(event, x, y, target, type)
{
shouldBe("event type", event.type, type);
shouldBe("event target", event.target, target);
shouldBe("event.pageX", event.pageX, x);
shouldBe("event.pageY", event.pageY, y);
shouldBe("event.offsetX", event.offsetX, x);
shouldBe("event.offsetY", event.offsetY, y);
shouldBe("event.x", event.x, x);
shouldBe("event.y", event.y, y);
}
function mouseeventverify2(event, x, y, offsetX, offsetY, target, type)
{
shouldBe("event type", event.type, type);
shouldBe("event target", event.target, target);
shouldBe("event.pageX", event.pageX, x);
shouldBe("event.pageY", event.pageY, y);
shouldBe("event.offsetX", event.offsetX, offsetX);
shouldBe("event.offsetY", event.offsetY, offsetY);
shouldBe("event.x", event.x, x);
shouldBe("event.y", event.y, y);
}
function test() {
if (window.testRunner) {
testRunner.dumpAsText();
testRunner.waitUntilDone();
}
if (window.eventSender) {
eventSender.mouseMoveTo(22, 104);
eventSender.mouseDown();
eventSender.mouseUp();
}
if (window.eventSender) {
eventSender.mouseMoveTo(22, 184);
eventSender.mouseDown();
eventSender.mouseUp();
}
if (window.eventSender) {
eventSender.mouseMoveTo(22, 262);
eventSender.mouseDown();
eventSender.mouseUp();
}
if (window.eventSender) {
eventSender.mouseMoveTo(22, 344);
eventSender.mouseDown();
eventSender.mouseUp();
eventSender.mouseDown();
eventSender.mouseUp();
}
if (window.eventSender) {
eventSender.mouseMoveTo(22, 448);
eventSender.mouseDown();
eventSender.mouseUp();
eventSender.mouseDown();
eventSender.mouseUp();
}
if (window.testRunner)
testRunner.notifyDone();
}
</script>
</head>
<body onload="test();">
<p>This page tests whether a click event on a list box item propogates with the correct target and positioning values.<br>
Bug 3248: Mouse events on OPTION element seem to be ignored<br>
<a href="https://bugs.webkit.org/show_bug.cgi?id=3248">https://bugs.webkit.org/show_bug.cgi?id=3248</a></p>
<form action="" method="post">
<select style="position:absolute; top: 84;" size="2" onmousedown="mouseeventverify(event, 22, 104, document.getElementById('o1'), 'mousedown')">
<option>One
<option id="o1" onmousedown="mouseeventverify(event, 22, 104, this, 'mousedown')">Two
</select>
</form>
<form action="" method="post">
<select style="position:absolute; top: 164;" size="2" onmouseup="mouseeventverify(event, 22, 184, document.getElementById('o2'), 'mouseup')">
<option>One
<option id="o2" onmouseup="mouseeventverify(event, 22, 184, this, 'mouseup')">Two
</select>
</form>
<form action="" method="post">
<select style="position:absolute; top: 242;" size="2" onclick="mouseeventverify(event, 22, 262, document.getElementById('o3'), 'click')">
<option>One
<option id="o3" onclick="mouseeventverify(event, 22, 262, this, 'click')">Two
</select>
</form>
<form action="" method="post">
<select style="position:absolute; top: 324;" size="2" ondblclick="mouseeventverify(event, 22, 344, document.getElementById('o4'), 'dblclick')">
<option>One
<option id="o4" ondblclick="mouseeventverify(event, 22, 344, this, 'dblclick')">Two
</select>
</form>
<select style="position:absolute; top: 408;" size="3" onmousedown="mouseeventverify2(event, 22, 448, 12, 38, this, 'mousedown')">
<option>One
<option id="o5" onmousedown="mouseeventverify2(event, 22, 448, 12, 38, this, 'mousedown')">Two
</select>
</form>
<div style="position:absolute; top: 550;" id='console'></div>
</body>
</html>