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

Unified Diff: LayoutTests/fast/forms/select-list-box-mouse-focus.html

Issue 894913002: Prevent default actions for JS-generated mouse events other than click (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: TIL, gclient sync may rebase changes back in time Created 5 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/forms/select-list-box-mouse-focus.html
diff --git a/LayoutTests/fast/forms/select-list-box-mouse-focus.html b/LayoutTests/fast/forms/select-list-box-mouse-focus.html
index 50326506db8afd361e53eeb56121e709061d1a83..19aeb645685d5927a84556425c5843a734420717 100644
--- a/LayoutTests/fast/forms/select-list-box-mouse-focus.html
+++ b/LayoutTests/fast/forms/select-list-box-mouse-focus.html
@@ -4,11 +4,17 @@ function test()
if (window.testRunner)
testRunner.dumpAsText();
var select = document.getElementById("select");
- var x = select.clientLeft + 10;
- var y = select.clientTop + 10;
- var event = document.createEvent("MouseEvent");
- event.initMouseEvent("mousedown", true, true, document.defaultView, 1, x, y, x, y, false, false, false, false, 0, document);
- select.dispatchEvent(event);
+ var rect = select.getBoundingClientRect();
+ var x = rect.left + 10;
+ var y = rect.top + 10;
+
+ if (!eventSender) {
+ alert('Click the select to run the test.');
+ return;
+ }
+
+ eventSender.mouseMoveTo(x, y);
+ eventSender.mouseDown(0);
}
function reportFocus()
{
@@ -16,7 +22,7 @@ function reportFocus()
}
</script>
<body onload="test()">
-<p>The select below should be focused because we dispatched a mouse down event to it.</p>
+<p>The select below should be focused once clicked.</p>
<p id="result">FAIL</p>
<select id="select" size="4" onfocus="reportFocus()">
<option>one</option>
« no previous file with comments | « LayoutTests/fast/forms/range/slider-zoomed.html ('k') | LayoutTests/fast/forms/select-list-box-mouse-focus-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698