diff --git a/accessible/tests/mochitest/events.js b/accessible/tests/mochitest/events.js index 7de8be5da7ba..27b00a035b42 100644 --- a/accessible/tests/mochitest/events.js +++ b/accessible/tests/mochitest/events.js @@ -1251,11 +1251,21 @@ function synthClick(aNodeOrID, aCheckerOrEventSeq, aArgs) { var x = 1, y = 1; - if (aArgs && "where" in aArgs && aArgs.where == "right") { - if (isHTMLElement(targetNode)) { - x = targetNode.offsetWidth - 1; - } else if (isXULElement(targetNode)) { - x = targetNode.getBoundingClientRect().width - 1; + if (aArgs && "where" in aArgs) { + if (aArgs.where == "right") { + if (isHTMLElement(targetNode)) { + x = targetNode.offsetWidth - 1; + } else if (isXULElement(targetNode)) { + x = targetNode.getBoundingClientRect().width - 1; + } + } else if (aArgs.where == "center") { + if (isHTMLElement(targetNode)) { + x = targetNode.offsetWidth / 2; + y = targetNode.offsetHeight / 2; + } else if (isXULElement(targetNode)) { + x = targetNode.getBoundingClientRect().width / 2; + y = targetNode.getBoundingClientRect().height / 2; + } } } synthesizeMouse(targetNode, x, y, aArgs ? aArgs : {}); diff --git a/accessible/tests/mochitest/events/test_focus_listcontrols.xhtml b/accessible/tests/mochitest/events/test_focus_listcontrols.xhtml index 5927bec92511..848657d3b3a8 100644 --- a/accessible/tests/mochitest/events/test_focus_listcontrols.xhtml +++ b/accessible/tests/mochitest/events/test_focus_listcontrols.xhtml @@ -46,7 +46,8 @@ gQueue.push(new synthFocus("emptyrichlistbox", new focusChecker("emptyrichlistbox"))); gQueue.push(new synthFocus("menulist")); - gQueue.push(new synthClick("menulist", new focusChecker("ml_tangerine"))); + gQueue.push(new synthClick("menulist", new focusChecker("ml_tangerine"), + { where: "center" })); gQueue.push(new synthDownKey("ml_tangerine", new focusChecker("ml_marmalade"))); gQueue.push(new synthEscapeKey("ml_marmalade", new focusChecker("menulist")));