Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(149)

Unified Diff: LayoutTests/fast/dom/HTMLDialogElement/inert-inlines.html

Issue 16240007: Fix hit testing to be aware of inert inlines. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: de-dupe visibleToHitTesting Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: LayoutTests/fast/dom/HTMLDialogElement/inert-inlines.html
diff --git a/LayoutTests/fast/dom/HTMLDialogElement/inert-inlines.html b/LayoutTests/fast/dom/HTMLDialogElement/inert-inlines.html
new file mode 100644
index 0000000000000000000000000000000000000000..e1222e650ad397efabd39760e339f7d5d581bbf2
--- /dev/null
+++ b/LayoutTests/fast/dom/HTMLDialogElement/inert-inlines.html
@@ -0,0 +1,80 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+dialog {
+ width: 50px;
+}
+</style>
+<script src="../../js/resources/js-test-pre.js"></script>
+</head>
+<body>
+<a id="a" href="javascript:void(0)">Click me</a>
+<button id="button">Click me</button>
+<div id="div" style="background-color: blue; width: 50px; height: 50px">Click meeee</div>
+<span id="span">Click me</span>
+<div id="dialog-parent" style="width: 50px; height: 50px">
+ <span id="dialog-sibling">Click meeee</span>
+ <dialog></dialog>
+</div>
+<script>
+function clickOn(element)
+{
+ if (!window.eventSender)
+ return;
+
+ var absoluteTop = 0;
+ var absoluteLeft = 0;
+ for (var parentNode = element; parentNode; parentNode = parentNode.offsetParent) {
+ absoluteLeft += parentNode.offsetLeft;
+ absoluteTop += parentNode.offsetTop;
+ }
+
+ var x = absoluteLeft + element.offsetWidth / 2;
+ var y = absoluteTop + element.offsetHeight / 2;
+ eventSender.mouseMoveTo(x, y);
+ eventSender.mouseDown();
+ eventSender.mouseUp();
+ eventSender.mouseMoveTo(0, 0);
+}
+
+function eventFiredOnInertElement(e) {
+ e.target.style.background = 'red';
+ inertElementFiredOn = true;
+}
+
+description('Tests that inert inlines do not receive mouse events. ' +
+ 'To test manually, click on all the "Click me"s. The test ' +
+ 'fails if you see red.');
+inertElements = ['a', 'button', 'div', 'span']
+inertElements.forEach(function(id) {
+ element = document.getElementById(id);
+ element.addEventListener('click', eventFiredOnInertElement);
+ element.addEventListener('mousemove', eventFiredOnInertElement);
+});
+
+document.body.addEventListener('click', function(e) {
+ document.body.firedOn = true;
+});
+
+document.getElementById('dialog-parent').addEventListener('click', function(e) {
+ e.target.firedOn = true;
+});
+
+document.querySelector('dialog').showModal();
+inertElements.forEach(function(id) {
+ expectedTarget = document.body;
+ if (id == 'dialog-sibling')
+ expectedTarget = document.getElementById('dialog-parent')
+ element = document.getElementById(id);
+ inertElementFiredOn = false;
+ expectedTarget.firedOn = false;
+ debug('clicking on ' + id);
+ clickOn(element);
+ shouldBeFalse('inertElementFiredOn');
+ shouldBeTrue('expectedTarget.firedOn');
+});
+</script>
+<script src="../../js/resources/js-test-post.js"></script>
+</body>
+</html>
« no previous file with comments | « no previous file | LayoutTests/fast/dom/HTMLDialogElement/inert-inlines-expected.txt » ('j') | Source/core/rendering/InlineBox.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698