<!DOCTYPE HTML>
<script src="../../../../resources/js-test.js"></script>
<style>
</style>
<p id=target>Tap to the<br><span id=span>right:</span></p>
<div id=console></div>
<script>
var event;
function eventLogger(e) {
debug("Received " + e.type + " on " + (e.target.id || e.target.nodeName));
event = e;
shouldBeEqualToString("event.target.id", "target");
shouldBeEqualToString("document.elementFromPoint(event.clientX, event.clientY).id", "target");
}
description("Verifies that tapping in the whitespace at the end of a paragraph sends mouse events properly to the paragraph node (even though there are no text line boxes here). http://crbug.com/398205");
// Tap at the far right edge of a paragraph.
var rect = target.getBoundingClientRect();
var point = {
x: rect.right - 50,
y: rect.bottom - 5
};
// This should be inside the paragraph but outside the span
shouldBeGreaterThan("point.x", "span.getBoundingClientRect().right");
shouldBeEqualToString("document.elementFromPoint(point.x, point.y).id", "target");
document.addEventListener('mousemove', eventLogger);
document.addEventListener('mousedown', eventLogger);
document.addEventListener('mouseup', eventLogger);
document.addEventListener('click', eventLogger);
if (window.eventSender) {
debug("Sending GestureTapDown");
eventSender.gestureTapDown(point.x, point.y, 30, 30);
debug("Sending GestureShowPress");
eventSender.gestureShowPress(point.x, point.y, 30, 30);
debug("Sending GestureTap");
eventSender.gestureTap(point.x, point.y, 1, 30, 30);
} else {
debug("This test requires eventSender");
}
</script>