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..19b50b037e925e91933ede1fe45995ff40f2a6b1 100644 |
--- a/LayoutTests/fast/forms/listbox-onchange.html |
+++ b/LayoutTests/fast/forms/listbox-onchange.html |
@@ -119,53 +119,51 @@ |
if (window.testRunner) |
testRunner.notifyDone(); |
} |
+ |
+ function buildModifiers(shift, metaOrCtrl) { |
+ modifiers = []; |
+ if (shift) |
+ modifiers.push("shiftKey"); |
+ if (metaOrCtrl) |
+ modifiers.push("addSelectionKey"); |
+ return modifiers; |
+ } |
function mouseDownOnSelect(selId, index, shift, metaOrCtrl) |
{ |
- var meta = false; |
- var ctrl = false; |
- if (metaOrCtrl) { |
- if (navigator.userAgent.search(/\bMac OS X\b/) != -1) |
- meta = true; |
- else |
- ctrl = true; |
- } |
+ modifiers = buildModifiers(shift, metaOrCtrl); |
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 { |
+ testFailed("This test requires window.eventSender."); |
+ } |
} |
function mouseUpOnSelect(selId, index, shift, metaOrCtrl) |
{ |
- var meta = false; |
- var ctrl = false; |
- if (metaOrCtrl) { |
- if (navigator.userAgent.search(/\bMac OS X\b/) != -1) |
- meta = true; |
- else |
- ctrl = true; |
- } |
+ modifiers = buildModifiers(shift, metaOrCtrl); |
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 { |
+ testFailed("This test requires window.eventSender."); |
+ } |
} |
function keyDownOnSelect(selId, identifier, shift, metaOrCtrl) |
{ |
- modifiers = []; |
- if (shift) |
- modifiers[0] = "shiftKey"; |
- if (metaOrCtrl) { |
- if (navigator.userAgent.search(/\bMac OS X\b/) != -1) |
- modifiers[modifiers.length] = "metaKey"; |
- else |
- modifiers[modifiers.length] = "controlKey"; |
- } |
- |
+ modifiers = buildModifiers(shift, metaOrCtrl); |
document.getElementById(selId).focus(); |
- eventSender.keyDown(identifier, modifiers); |
+ if (window.eventSender) { |
+ eventSender.keyDown(identifier, modifiers); |
+ } else { |
+ testFailed("This test requires window.eventSender."); |
+ } |
} |
function getSelectedOptions(selId) |