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

Unified Diff: LayoutTests/fast/forms/listbox-onchange.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/listbox-onchange.html
diff --git a/LayoutTests/fast/forms/listbox-onchange.html b/LayoutTests/fast/forms/listbox-onchange.html
index ccb3d05884b805808fec2056e93e8e2e42bd98ed..3b178ab39b65ed4f0b8497877baaa023651a6f0a 100644
--- a/LayoutTests/fast/forms/listbox-onchange.html
+++ b/LayoutTests/fast/forms/listbox-onchange.html
@@ -122,34 +122,46 @@
function mouseDownOnSelect(selId, index, shift, metaOrCtrl)
{
- var meta = false;
- var ctrl = false;
+ modifiers = [];
+ if (shift)
+ modifiers[0] = "shiftKey";
if (metaOrCtrl) {
if (navigator.userAgent.search(/\bMac OS X\b/) != -1)
- meta = true;
+ modifiers[modifiers.length] = "metaKey";
else
- ctrl = true;
+ modifiers[modifiers.length] = "ctrlKey";
}
+
var sl = document.getElementById(selId);
- var event = document.createEvent("MouseEvent");
- event.initMouseEvent("mousedown", true, true, document.defaultView, 1, 0, 0, 0, 0, ctrl, false, shift, meta, 0, document);
- sl.options[index].dispatchEvent(event);
+ var rect = sl.options[index].getBoundingClientRect();
+ if (window.eventSender) {
+ eventSender.mouseMoveTo(rect.left + 1, rect.top + 1);
+ eventSender.mouseDown(0, modifiers);
+ } else {
+ debug("FAIL: This test requires window.eventSender.");
+ }
}
function mouseUpOnSelect(selId, index, shift, metaOrCtrl)
{
- var meta = false;
- var ctrl = false;
+ modifiers = [];
+ if (shift)
+ modifiers[0] = "shiftKey";
if (metaOrCtrl) {
if (navigator.userAgent.search(/\bMac OS X\b/) != -1)
- meta = true;
+ modifiers[modifiers.length] = "metaKey";
else
- ctrl = true;
+ modifiers[modifiers.length] = "ctrlKey";
}
+
var sl = document.getElementById(selId);
- var event = document.createEvent("MouseEvent");
- event.initMouseEvent("mouseup", true, true, document.defaultView, 1, 0, 0, 0, 0, ctrl, false, shift, meta, 0, document);
- sl.options[index].dispatchEvent(event);
+ var rect = sl.options[index].getBoundingClientRect();
+ if (window.eventSender) {
+ eventSender.mouseMoveTo(rect.left + 1, rect.top + 1);
+ eventSender.mouseUp(0, modifiers);
+ } else {
+ debug("FAIL: This test requires window.eventSender.");
+ }
}
function keyDownOnSelect(selId, identifier, shift, metaOrCtrl)
@@ -161,7 +173,7 @@
if (navigator.userAgent.search(/\bMac OS X\b/) != -1)
modifiers[modifiers.length] = "metaKey";
else
- modifiers[modifiers.length] = "controlKey";
+ modifiers[modifiers.length] = "ctrlKey";
}
document.getElementById(selId).focus();

Powered by Google App Engine
This is Rietveld 408576698