Bug 1706750 - Scroll img into view manually if the context menu test is skipped. r=morgan

Differential Revision: https://phabricator.services.mozilla.com/D113019
This commit is contained in:
Markus Stange 2021-04-21 23:33:43 +00:00
Родитель 7cfba28563
Коммит 1fd143238a
2 изменённых файлов: 29 добавлений и 0 удалений

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

@ -1281,6 +1281,27 @@ function synthClick(aNodeOrID, aCheckerOrEventSeq, aArgs) {
};
}
/**
* Scrolls the node into view.
*/
function scrollIntoView(aNodeOrID, aCheckerOrEventSeq) {
this.__proto__ = new synthAction(aNodeOrID, aCheckerOrEventSeq);
this.invoke = function scrollIntoView_invoke() {
var targetNode = this.DOMNode;
if (isHTMLElement(targetNode)) {
targetNode.scrollIntoView(true);
} else if (isXULElement(targetNode)) {
var targetAcc = getAccessible(targetNode);
targetAcc.scrollTo(SCROLL_TYPE_ANYWHERE);
}
};
this.getID = function scrollIntoView_getID() {
return prettyName(aNodeOrID) + " scrollIntoView";
};
}
/**
* Mouse move invoker.
*/

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

@ -105,6 +105,14 @@
gQueue.push(new synthContextMenu(editableDoc, new contextMenuChecker()));
gQueue.push(new synthDownKey(editableDoc, new focusContextMenuItemChecker()));
gQueue.push(new synthEscapeKey(editableDoc, new focusChecker(editableDoc)));
} else {
// If this test is run as part of multiple tests, it is displayed in the test harness iframe.
// In the non-native context menu case, right-clicking the editableDoc causes the editableDoc
// to scroll fully into view, and as a side-effect, the img below it ends up on the screen.
// When we're skipping the context menu check, scroll img onto the screen manually, because
// otherwise it may remain out-of-view and clipped by the test harness iframe.
var img = document.querySelector("img");
gQueue.push(new scrollIntoView(img, new nofocusChecker(img)));
}
if (SEAMONKEY) {
todo(false, "shift tab from editable document fails on (Windows) SeaMonkey! (Bug 718235)");