var domWindowUtils = SpecialPowers.getDOMWindowUtils(window);
var gTests = [
/*
Element elementFromPoint(in long aX,
in long aY,
in boolean aIgnoreRootScrollFrame,
in boolean aFlushLayout);
*/
async function testElementFromPoint() {
let onscreen = document.getElementById("onscreen");
let offscreen = document.getElementById("offscreen");
let htmldoc = document.documentElement;
ok(onscreen, "on screen element exists");
ok(offscreen, "off screen element exists");
ok(htmldoc, "htmldoc element exists");
let testData = [
// default behavior is to return null for items outside the viewport
[[0, 100], null, onscreen],
[[9, 109], null, onscreen],
[[0, 100000], null, null],
[[9, 100009], null, null],
// layout flush tests
// test moving element 10px to the left and down, and flushing layout
[[10, 110, false, true], [[10, 110], onscreen], onscreen],
// test moving element back, not flushing layout
// (will get the html document instead)
[[0, 100, false, false], [[0, 100], onscreen], htmldoc],
// test element at same position, flushing layout
[[0, 100, false, true], [[0, 100], onscreen], onscreen],
for (let i = 0; i < testData.length; ++i) {
let [x, y, ignoreScroll, flushLayout] = testData[i][0];
let moveData = testData[i][1];
let expected = testData[i][2];
if (moveData) {
let moveEl = moveData[1];
let [moveX, moveY] = moveData[0];
moveEl.style.left = moveX + "px";
moveEl.style.top = moveY + "px";
}
let found = SpecialPowers.unwrap(domWindowUtils.elementFromPoint(
x, y, ignoreScroll, flushLayout));
is(found, expected, "at index " + i + " for data " + JSON.stringify(testData[i][0]));
}
},
/**
* Test .isHandlingUserInput attribute.
*/
async function testHandlingUserInput() {
ok('isHandlingUserInput' in domWindowUtils, "isHandlingUserInput should be present");
is(domWindowUtils.isHandlingUserInput, false, "isHandlingUserInput should return false if nothing is happening");
for (const {eventName, result, button} of data) {
let eventPromise = new Promise(resolve => {
document.addEventListener(eventName, function() {
is(domWindowUtils.isHandlingUserInput, result,
`isHandlingUserInput should be ${result} for ${eventName}`);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.