Bug 1418085 followup. Try to fix the Mac-only a11y orange. r=bustage

This commit is contained in:
Boris Zbarsky 2018-01-30 02:30:58 -05:00
Родитель 7c392f077e
Коммит 77429f6693
1 изменённых файлов: 18 добавлений и 2 удалений

Просмотреть файл

@ -62,6 +62,14 @@ var gA11yEventDumpToAppConsole = false;
*/
var gA11yEventDumpFeature = "";
/**
* Function to detect HTML elements when given a node.
*/
function isHTMLElement(aNode) {
return aNode.nodeType == aNode.ELEMENT_NODE &&
aNode.namespaceURI == "http://www.w3.org/1999/xhtml";
}
/**
* Executes the function when requested event is handled.
*
@ -1059,11 +1067,19 @@ function synthClick(aNodeOrID, aCheckerOrEventSeq, aArgs) {
}
// Scroll the node into view, otherwise synth click may fail.
targetNode.scrollIntoView(true);
if (isHTMLElement(targetNode)) {
targetNode.scrollIntoView(true);
} else if (targetNode instanceof nsIDOMXULElement) {
var targetAcc = getAccessible(targetNode);
targetAcc.scrollTo(SCROLL_TYPE_ANYWHERE);
}
var x = 1, y = 1;
if (aArgs && ("where" in aArgs) && aArgs.where == "right") {
x = targetNode.getBoundingClientRect().width - 1;
if (isHTMLElement(targetNode))
x = targetNode.offsetWidth - 1;
else if (targetNode instanceof nsIDOMXULElement)
x = targetNode.boxObject.width - 1;
}
synthesizeMouse(targetNode, x, y, aArgs ? aArgs : {});
};