зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1725540 - Get top level window's resolution via SpecialPowers.spawn. r=tnikkel
Thus a bunch of relevant functions need to be async. Differential Revision: https://phabricator.services.mozilla.com/D122559
This commit is contained in:
Родитель
f1f2923a0c
Коммит
77ade58a2b
|
@ -3,11 +3,13 @@
|
|||
|
||||
// Utilities for synthesizing of native events.
|
||||
|
||||
function getResolution() {
|
||||
async function getResolution() {
|
||||
let resolution = -1; // bogus value in case DWU fails us
|
||||
// Use window.top to get the root content window which is what has
|
||||
// the resolution.
|
||||
resolution = SpecialPowers.getDOMWindowUtils(window.top).getResolution();
|
||||
resolution = await SpecialPowers.spawn(window.top, [], () => {
|
||||
return SpecialPowers.getDOMWindowUtils(content.window).getResolution();
|
||||
});
|
||||
return resolution;
|
||||
}
|
||||
|
||||
|
@ -273,7 +275,7 @@ function getTargetRect(aTarget) {
|
|||
// pixels relative to the screen.
|
||||
// TODO: this function currently does not incorporate some CSS transforms on
|
||||
// elements enclosing target, e.g. scale transforms.
|
||||
function coordinatesRelativeToScreen(aParams) {
|
||||
async function coordinatesRelativeToScreen(aParams) {
|
||||
const {
|
||||
target, // The target element or window
|
||||
offsetX, // X offset relative to `target`
|
||||
|
@ -295,7 +297,7 @@ function coordinatesRelativeToScreen(aParams) {
|
|||
const utils = SpecialPowers.getDOMWindowUtils(window);
|
||||
const deviceScale = utils.screenPixelsPerCSSPixel;
|
||||
const deviceScaleNoOverride = utils.screenPixelsPerCSSPixelNoOverride;
|
||||
const resolution = getResolution();
|
||||
const resolution = await getResolution();
|
||||
const rect = getTargetRect(target);
|
||||
// moxInnerScreen{X,Y} are in CSS coordinates of the browser chrome.
|
||||
// The device scale applies to them, but the resolution only zooms the content.
|
||||
|
@ -339,8 +341,15 @@ function rectRelativeToScreen(aElement) {
|
|||
// aX and aY are relative to the top-left of |aTarget|'s bounding rect.
|
||||
// aDeltaX and aDeltaY are pixel deltas, and aObserver can be left undefined
|
||||
// if not needed.
|
||||
function synthesizeNativeWheel(aTarget, aX, aY, aDeltaX, aDeltaY, aObserver) {
|
||||
var pt = coordinatesRelativeToScreen({
|
||||
async function synthesizeNativeWheel(
|
||||
aTarget,
|
||||
aX,
|
||||
aY,
|
||||
aDeltaX,
|
||||
aDeltaY,
|
||||
aObserver
|
||||
) {
|
||||
var pt = await coordinatesRelativeToScreen({
|
||||
offsetX: aX,
|
||||
offsetY: aY,
|
||||
target: aTarget,
|
||||
|
@ -376,7 +385,7 @@ function synthesizeNativeWheel(aTarget, aX, aY, aDeltaX, aDeltaY, aObserver) {
|
|||
// NOTE: This works only on Mac.
|
||||
// You can specify kCGScrollPhaseBegan = 1, kCGScrollPhaseChanged = 2 and
|
||||
// kCGScrollPhaseEnded = 4 for |aPhase|.
|
||||
function synthesizeNativePanGestureEvent(
|
||||
async function synthesizeNativePanGestureEvent(
|
||||
aTarget,
|
||||
aX,
|
||||
aY,
|
||||
|
@ -391,7 +400,7 @@ function synthesizeNativePanGestureEvent(
|
|||
);
|
||||
}
|
||||
|
||||
var pt = coordinatesRelativeToScreen({
|
||||
var pt = await coordinatesRelativeToScreen({
|
||||
offsetX: aX,
|
||||
offsetY: aY,
|
||||
target: aTarget,
|
||||
|
@ -547,7 +556,7 @@ async function synthesizeTouchpadPinch(scales, focusX, focusY, options) {
|
|||
let transformEndPromise = promiseTransformEnd();
|
||||
|
||||
var modifierFlags = 0;
|
||||
var pt = coordinatesRelativeToScreen({
|
||||
var pt = await coordinatesRelativeToScreen({
|
||||
offsetX: focusX,
|
||||
offsetY: focusY,
|
||||
target: document.body,
|
||||
|
@ -593,7 +602,7 @@ async function synthesizeTouchpadPan(
|
|||
let transformEndPromise = promiseTransformEnd();
|
||||
|
||||
var modifierFlags = 0;
|
||||
var pt = coordinatesRelativeToScreen({
|
||||
var pt = await coordinatesRelativeToScreen({
|
||||
offsetX: focusX,
|
||||
offsetY: focusY,
|
||||
target: document.body,
|
||||
|
@ -629,7 +638,7 @@ async function synthesizeTouchpadPan(
|
|||
|
||||
// Synthesizes a native touch event and dispatches it. aX and aY in CSS pixels
|
||||
// relative to the top-left of |aTarget|'s bounding rect.
|
||||
function synthesizeNativeTouch(
|
||||
async function synthesizeNativeTouch(
|
||||
aTarget,
|
||||
aX,
|
||||
aY,
|
||||
|
@ -637,7 +646,7 @@ function synthesizeNativeTouch(
|
|||
aObserver = null,
|
||||
aTouchId = 0
|
||||
) {
|
||||
var pt = coordinatesRelativeToScreen({
|
||||
var pt = await coordinatesRelativeToScreen({
|
||||
offsetX: aX,
|
||||
offsetY: aY,
|
||||
target: aTarget,
|
||||
|
@ -699,7 +708,7 @@ function sendBasicNativePointerInput(
|
|||
* native pointer synthesis call this function makes.
|
||||
* @param aPointerIds is an array holding the pointer ID values.
|
||||
*/
|
||||
function synthesizeNativePointerSequences(
|
||||
async function synthesizeNativePointerSequences(
|
||||
aTarget,
|
||||
aPointerType,
|
||||
aPositions,
|
||||
|
@ -726,7 +735,7 @@ function synthesizeNativePointerSequences(
|
|||
// Do the conversion to screen space before actually synthesizing
|
||||
// the events, otherwise the screen space may change as a result of
|
||||
// the touch inputs and the conversion may not work as intended.
|
||||
aPositions[i][j] = coordinatesRelativeToScreen({
|
||||
aPositions[i][j] = await coordinatesRelativeToScreen({
|
||||
offsetX: aPositions[i][j].x,
|
||||
offsetY: aPositions[i][j].y,
|
||||
target: aTarget,
|
||||
|
@ -920,8 +929,8 @@ function promiseNativeTouchDrag(
|
|||
});
|
||||
}
|
||||
|
||||
function synthesizeNativeTap(aTarget, aX, aY, aObserver = null) {
|
||||
var pt = coordinatesRelativeToScreen({
|
||||
async function synthesizeNativeTap(aTarget, aX, aY, aObserver = null) {
|
||||
var pt = await coordinatesRelativeToScreen({
|
||||
offsetX: aX,
|
||||
offsetY: aY,
|
||||
target: aTarget,
|
||||
|
@ -932,13 +941,13 @@ function synthesizeNativeTap(aTarget, aX, aY, aObserver = null) {
|
|||
}
|
||||
|
||||
// only currently implemented on macOS
|
||||
function synthesizeNativeTouchpadDoubleTap(aTarget, aX, aY) {
|
||||
async function synthesizeNativeTouchpadDoubleTap(aTarget, aX, aY) {
|
||||
ok(
|
||||
getPlatform() == "mac",
|
||||
"only implemented on mac. implement sendNativeTouchpadDoubleTap for this platform," +
|
||||
" see bug 1696802 for how it was done on macOS"
|
||||
);
|
||||
let pt = coordinatesRelativeToScreen({
|
||||
let pt = await coordinatesRelativeToScreen({
|
||||
offsetX: aX,
|
||||
offsetY: aY,
|
||||
target: aTarget,
|
||||
|
@ -950,7 +959,7 @@ function synthesizeNativeTouchpadDoubleTap(aTarget, aX, aY) {
|
|||
|
||||
// If the event targets content in a subdocument, |aTarget| should be inside the
|
||||
// subdocument (or the subdocument window).
|
||||
function synthesizeNativeMouseEventWithAPZ(aParams, aObserver = null) {
|
||||
async function synthesizeNativeMouseEventWithAPZ(aParams, aObserver = null) {
|
||||
if (aParams.win !== undefined) {
|
||||
throw Error(
|
||||
"Are you trying to use EventUtils' API? `win` won't be used with synthesizeNativeMouseClickWithAPZ."
|
||||
|
@ -1001,7 +1010,7 @@ function synthesizeNativeMouseEventWithAPZ(aParams, aObserver = null) {
|
|||
);
|
||||
}
|
||||
}
|
||||
const pt = (() => {
|
||||
const pt = await (async () => {
|
||||
if (screenX != undefined) {
|
||||
return { x: screenX, y: screenY };
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ async function test() {
|
|||
let visResEvtContent = new EventCounter(window, "mozvisualresize");
|
||||
let visScrEvtContent = new EventCounter(window, "mozvisualscroll");
|
||||
|
||||
var initial_resolution = getResolution();
|
||||
var initial_resolution = await getResolution();
|
||||
ok(initial_resolution > 0,
|
||||
"The initial_resolution is " + initial_resolution + ", which is some sane value");
|
||||
|
||||
|
@ -50,7 +50,7 @@ async function test() {
|
|||
|
||||
// Flush state and get the resolution we're at now
|
||||
await promiseApzFlushedRepaints();
|
||||
let final_resolution = getResolution();
|
||||
let final_resolution = await getResolution();
|
||||
ok(final_resolution > initial_resolution, "The final resolution (" + final_resolution + ") is greater after zooming in");
|
||||
|
||||
// Check we've got the expected events.
|
||||
|
|
|
@ -23,7 +23,7 @@ async function test() {
|
|||
let visResEvtContent = new EventCounter(window, "mozvisualresize");
|
||||
let visScrEvtContent = new EventCounter(window, "mozvisualscroll");
|
||||
|
||||
var initial_resolution = getResolution();
|
||||
var initial_resolution = await getResolution();
|
||||
ok(initial_resolution > 0,
|
||||
"The initial_resolution is " + initial_resolution + ", which is some sane value");
|
||||
|
||||
|
@ -31,7 +31,7 @@ async function test() {
|
|||
|
||||
// Flush state and get the resolution we're at now
|
||||
await promiseApzFlushedRepaints();
|
||||
let final_resolution = getResolution();
|
||||
let final_resolution = await getResolution();
|
||||
ok(final_resolution > initial_resolution, "The final resolution (" + final_resolution + ") is greater after zooming in");
|
||||
|
||||
// Check we've got the expected events.
|
||||
|
|
|
@ -48,7 +48,7 @@ async function test() {
|
|||
|
||||
let startHandledPromise = handleTouchStart();
|
||||
let endHandledPromise = handleTouchEnd();
|
||||
var pt = coordinatesRelativeToScreen({ offsetX: 25, offsetY: 5, target: v });
|
||||
var pt = await coordinatesRelativeToScreen({ offsetX: 25, offsetY: 5, target: v });
|
||||
utils.sendNativeTouchPoint(0, SpecialPowers.DOMWindowUtils.TOUCH_CONTACT, pt.x, pt.y, 1, 90, null);
|
||||
await startHandledPromise;
|
||||
utils.sendNativeTouchPoint(0, SpecialPowers.DOMWindowUtils.TOUCH_REMOVE, pt.x, pt.y, 1, 90, null);
|
||||
|
@ -57,7 +57,7 @@ async function test() {
|
|||
|
||||
startHandledPromise = handleTouchStart();
|
||||
endHandledPromise = handleTouchEnd();
|
||||
pt = coordinatesRelativeToScreen({ offsetX: 25, offsetY: 5, target: d });
|
||||
pt = await coordinatesRelativeToScreen({ offsetX: 25, offsetY: 5, target: d });
|
||||
utils.sendNativeTouchPoint(0, SpecialPowers.DOMWindowUtils.TOUCH_CONTACT, pt.x, pt.y, 1, 90, null);
|
||||
await startHandledPromise;
|
||||
utils.sendNativeTouchPoint(0, SpecialPowers.DOMWindowUtils.TOUCH_REMOVE, pt.x, pt.y, 1, 90, null);
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
async function test() {
|
||||
var utils = SpecialPowers.getDOMWindowUtils(window);
|
||||
|
||||
var initial_resolution = getResolution();
|
||||
var initial_resolution = await getResolution();
|
||||
ok(initial_resolution > 0,
|
||||
"The initial_resolution is " + initial_resolution + ", which is some sane value");
|
||||
|
||||
|
@ -56,7 +56,7 @@ async function test() {
|
|||
await touchEndPromise;
|
||||
// Flush state and get the resolution we're at now
|
||||
await promiseApzFlushedRepaints();
|
||||
let final_resolution = getResolution();
|
||||
let final_resolution = await getResolution();
|
||||
ok(final_resolution > initial_resolution, "The final resolution (" + final_resolution + ") is greater than the initial resolution");
|
||||
|
||||
touchEndPromise = promiseTouchEnd(document.documentElement);
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
async function test() {
|
||||
let useTouchpad = (location.search == "?touchpad");
|
||||
|
||||
let resolution = getResolution();
|
||||
let resolution = await getResolution();
|
||||
ok(resolution > 0,
|
||||
"The initial_resolution is " + resolution + ", which is some sane value");
|
||||
|
||||
|
@ -33,7 +33,7 @@ async function test() {
|
|||
await promiseApzFlushedRepaints();
|
||||
|
||||
let prev_resolution = resolution;
|
||||
resolution = getResolution();
|
||||
resolution = await getResolution();
|
||||
is(resolution, prev_resolution, "No zoom should happen");
|
||||
}
|
||||
|
||||
|
|
|
@ -12,20 +12,20 @@
|
|||
async function test() {
|
||||
let useTouchpad = (location.search == "?touchpad");
|
||||
|
||||
var resolution = getResolution();
|
||||
var resolution = await getResolution();
|
||||
ok(resolution > 0,
|
||||
"The initial_resolution is " + resolution + ", which is some sane value");
|
||||
|
||||
// Check that double-tapping once zooms in
|
||||
await doubleTapOn(document.getElementById("target"), 10, 10, useTouchpad);
|
||||
var prev_resolution = resolution;
|
||||
resolution = getResolution();
|
||||
resolution = await getResolution();
|
||||
ok(resolution > prev_resolution, "The first double-tap has increased the resolution to " + resolution);
|
||||
|
||||
// Check that double-tapping again on the same spot zooms out
|
||||
await doubleTapOn(document.getElementById("target"), 10, 10, useTouchpad);
|
||||
prev_resolution = resolution;
|
||||
resolution = getResolution();
|
||||
resolution = await getResolution();
|
||||
ok(resolution < prev_resolution, "The second double-tap has decreased the resolution to " + resolution);
|
||||
}
|
||||
|
||||
|
|
|
@ -20,7 +20,8 @@ async function test() {
|
|||
info("window.innerwh " + window.innerWidth + " " + window.innerHeight);
|
||||
info("vv " + visualViewport.offsetLeft + " " + visualViewport.offsetTop + " " + visualViewport.width + " " + visualViewport.height);
|
||||
|
||||
let vvHeightAtUnitZoom = visualViewport.height*getResolution();
|
||||
let resolution = await getResolution();
|
||||
let vvHeightAtUnitZoom = visualViewport.height * resolution;
|
||||
|
||||
// The max amount of zoom is 10 (as defined in dom/base/nsViewportInfo.h),
|
||||
// but that includes the deviceScale (bug 1700865 is filed about this), so
|
||||
|
@ -59,20 +60,20 @@ async function test() {
|
|||
|
||||
await promiseApzFlushedRepaints();
|
||||
|
||||
var resolution = getResolution();
|
||||
resolution = await getResolution();
|
||||
ok(resolution > 0,
|
||||
"The initial_resolution is " + resolution + ", which is some sane value");
|
||||
|
||||
// Check that double-tapping once zooms in
|
||||
await doubleTapOn(document.getElementById("target1"), 10, 10, useTouchpad);
|
||||
var prev_resolution = resolution;
|
||||
resolution = getResolution();
|
||||
resolution = await getResolution();
|
||||
ok(resolution > prev_resolution, "The first double-tap has increased the resolution to " + resolution);
|
||||
|
||||
// Check that double-tapping the smaller element zooms in more
|
||||
await doubleTapOn(target2, 8, elementHeight-8, useTouchpad);
|
||||
prev_resolution = resolution;
|
||||
resolution = getResolution();
|
||||
resolution = await getResolution();
|
||||
ok(resolution > prev_resolution, "The second double-tap has increased the resolution to " + resolution);
|
||||
|
||||
let rect = target2.getBoundingClientRect();
|
||||
|
|
|
@ -29,7 +29,7 @@ async function makeActive(x, y, targetId) {
|
|||
async function test() {
|
||||
let useTouchpad = (location.search == "?touchpad");
|
||||
|
||||
let resolution = getResolution();
|
||||
let resolution = await getResolution();
|
||||
ok(resolution > 0,
|
||||
"The initial_resolution is " + resolution + ", which is some sane value");
|
||||
|
||||
|
@ -40,13 +40,13 @@ async function test() {
|
|||
// Check that double-tapping once zooms in
|
||||
await doubleTapOn(target, 100, 50, useTouchpad);
|
||||
let prev_resolution = resolution;
|
||||
resolution = getResolution();
|
||||
resolution = await getResolution();
|
||||
ok(resolution > prev_resolution, "The first double-tap has increased the resolution to " + resolution);
|
||||
|
||||
// Check that double-tapping again on the same spot zooms out
|
||||
await doubleTapOn(target, 100, 50, useTouchpad);
|
||||
prev_resolution = resolution;
|
||||
resolution = getResolution();
|
||||
resolution = await getResolution();
|
||||
ok(resolution < prev_resolution, "The second double-tap has decreased the resolution to " + resolution);
|
||||
}
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ async function makeActive(x, y, targetId) {
|
|||
async function test() {
|
||||
let useTouchpad = (location.search == "?touchpad");
|
||||
|
||||
let resolution = getResolution();
|
||||
let resolution = await getResolution();
|
||||
ok(resolution > 0,
|
||||
"The initial_resolution is " + resolution + ", which is some sane value");
|
||||
|
||||
|
@ -42,13 +42,13 @@ async function test() {
|
|||
// bug we are testing.
|
||||
await doubleTapOn(target, 25, 120, useTouchpad);
|
||||
let prev_resolution = resolution;
|
||||
resolution = getResolution();
|
||||
resolution = await getResolution();
|
||||
ok(resolution > prev_resolution, "The first double-tap has increased the resolution to " + resolution);
|
||||
|
||||
// Check that double-tapping again on the same spot zooms out
|
||||
await doubleTapOn(target, 25, 120, useTouchpad);
|
||||
prev_resolution = resolution;
|
||||
resolution = getResolution();
|
||||
resolution = await getResolution();
|
||||
ok(resolution < prev_resolution, "The second double-tap has decreased the resolution to " + resolution);
|
||||
}
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
async function test() {
|
||||
let useTouchpad = (location.search == "?touchpad");
|
||||
|
||||
let resolution = getResolution();
|
||||
let resolution = await getResolution();
|
||||
let initial_resolution = resolution;
|
||||
ok(resolution > 0,
|
||||
"The initial_resolution is " + resolution + ", which is some sane value");
|
||||
|
@ -25,14 +25,14 @@ async function test() {
|
|||
info("sending first double tap");
|
||||
await doubleTapOn(target, 10, 10, useTouchpad);
|
||||
let prev_resolution = resolution;
|
||||
resolution = getResolution();
|
||||
resolution = await getResolution();
|
||||
ok(resolution > prev_resolution, "After double-tap the resolution has increased to " + resolution);
|
||||
|
||||
// Check that second double tap zooms out
|
||||
info("sending second double tap");
|
||||
await doubleTapOn(target, 10, 10, useTouchpad);
|
||||
prev_resolution = resolution;
|
||||
resolution = getResolution();
|
||||
resolution = await getResolution();
|
||||
ok(resolution < prev_resolution, "After double-tap the resolution has decreased to " + resolution);
|
||||
ok(resolution == initial_resolution, "After double-tap the resolution has decreased to initial_resolution");
|
||||
|
||||
|
@ -42,7 +42,7 @@ async function test() {
|
|||
info("sending third double tap");
|
||||
await doubleTapOn(document.getElementById("placeholder"), 10, 10, useTouchpad);
|
||||
prev_resolution = resolution;
|
||||
resolution = getResolution();
|
||||
resolution = await getResolution();
|
||||
ok(resolution > prev_resolution, "After double-tap the resolution has increased to " + resolution);
|
||||
|
||||
info(" window.innerWidth " + window.innerWidth);
|
||||
|
@ -51,7 +51,7 @@ async function test() {
|
|||
info("sending forth double tap");
|
||||
await doubleTapOn(document.getElementById("placeholder"), 10, 10, useTouchpad);
|
||||
prev_resolution = resolution;
|
||||
resolution = getResolution();
|
||||
resolution = await getResolution();
|
||||
ok(resolution < prev_resolution, "After double-tap the resolution has decreased to " + resolution);
|
||||
ok(resolution == initial_resolution, "After double-tap the resolution has decreased to initial_resolution");
|
||||
|
||||
|
|
|
@ -12,14 +12,14 @@
|
|||
async function test() {
|
||||
let useTouchpad = (location.search == "?touchpad");
|
||||
|
||||
var resolution = getResolution();
|
||||
var resolution = await getResolution();
|
||||
ok(resolution > 0,
|
||||
"The initial_resolution is " + resolution + ", which is some sane value");
|
||||
|
||||
// Check that double-tapping once zooms in
|
||||
await doubleTapOn(document.getElementById("target"), 10, 10, useTouchpad);
|
||||
var prev_resolution = resolution;
|
||||
resolution = getResolution();
|
||||
resolution = await getResolution();
|
||||
ok(resolution > 2*prev_resolution, "The first double-tap has increased the resolution to " + resolution);
|
||||
|
||||
info("window.innerWidth " + window.innerWidth); // value when writing this test: 1280
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
async function test() {
|
||||
let useTouchpad = (location.search == "?touchpad");
|
||||
|
||||
let resolution = getResolution();
|
||||
let resolution = await getResolution();
|
||||
ok(resolution > 0,
|
||||
"The initial_resolution is " + resolution + ", which is some sane value");
|
||||
|
||||
|
@ -48,7 +48,7 @@ async function test() {
|
|||
info("sending second double tap");
|
||||
await doubleTapOn(target, x, y, useTouchpad);
|
||||
prev_resolution = resolution;
|
||||
resolution = getResolution();
|
||||
resolution = await getResolution();
|
||||
ok(resolution == prev_resolution, "After double-tap the resolution is the same: " + resolution);
|
||||
|
||||
ok(window.scrollY > window.innerHeight * 2 - 50, "window is still scrolled down");
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
async function test() {
|
||||
let useTouchpad = (location.search == "?touchpad");
|
||||
|
||||
let resolution = getResolution();
|
||||
let resolution = await getResolution();
|
||||
ok(resolution > 0,
|
||||
"The initial_resolution is " + resolution + ", which is some sane value");
|
||||
|
||||
|
@ -40,7 +40,7 @@ async function test() {
|
|||
info("sending first double tap");
|
||||
await doubleTapOn(target, 15, 15, useTouchpad);
|
||||
let prev_resolution = resolution;
|
||||
resolution = getResolution();
|
||||
resolution = await getResolution();
|
||||
ok(resolution > prev_resolution, "After double-tap the resolution increased to " + resolution);
|
||||
|
||||
// These values were determined experimentally, have not investigated the
|
||||
|
@ -60,7 +60,7 @@ async function test() {
|
|||
info("sending second double tap");
|
||||
await doubleTapOn(target, -10, 15, useTouchpad);
|
||||
prev_resolution = resolution;
|
||||
resolution = getResolution();
|
||||
resolution = await getResolution();
|
||||
ok(resolution < prev_resolution, "After double-tap the resolution decreased to " + resolution);
|
||||
|
||||
// These values were determined experimentally, have not investigated the
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
async function test() {
|
||||
let useTouchpad = (location.search == "?touchpad");
|
||||
|
||||
var resolution = getResolution();
|
||||
var resolution = await getResolution();
|
||||
var start_resolution = resolution;
|
||||
ok(resolution > 0,
|
||||
"The initial_resolution is " + resolution + ", which is some sane value");
|
||||
|
@ -20,7 +20,7 @@ async function test() {
|
|||
// Check that double-tapping once zooms in
|
||||
await doubleTapOn(document.getElementById("target"), 10, 10, useTouchpad);
|
||||
var prev_resolution = resolution;
|
||||
resolution = getResolution();
|
||||
resolution = await getResolution();
|
||||
ok(resolution > prev_resolution, "The first double-tap has increased the resolution to " + resolution);
|
||||
|
||||
// instant scroll to the middle of the page
|
||||
|
@ -42,7 +42,7 @@ async function test() {
|
|||
// Need to divide by resolution because the coords are assumed to be inside the resolution
|
||||
await doubleTapOn(window, (window.innerWidth/2)/resolution, (window.innerHeight - 5)/resolution, useTouchpad);
|
||||
prev_resolution = resolution;
|
||||
resolution = getResolution();
|
||||
resolution = await getResolution();
|
||||
ok(resolution < prev_resolution, "The second double-tap has decreased the resolution to " + resolution);
|
||||
ok(resolution == start_resolution, "The second double-tap has decreased the resolution to the start to " + resolution);
|
||||
|
||||
|
|
|
@ -12,20 +12,20 @@
|
|||
async function test() {
|
||||
let useTouchpad = (location.search == "?touchpad");
|
||||
|
||||
var resolution = getResolution();
|
||||
var resolution = await getResolution();
|
||||
ok(resolution > 0,
|
||||
"The initial_resolution is " + resolution + ", which is some sane value");
|
||||
|
||||
// Check that double-tapping once zooms in
|
||||
await doubleTapOn(document.getElementById("target"), 10, 10, useTouchpad);
|
||||
var prev_resolution = resolution;
|
||||
resolution = getResolution();
|
||||
resolution = await getResolution();
|
||||
ok(resolution > prev_resolution, "The first double-tap has increased the resolution to " + resolution);
|
||||
|
||||
// Check that double-tapping again on the same spot zooms out
|
||||
await doubleTapOn(document.getElementById("target"), 10, 10, useTouchpad);
|
||||
prev_resolution = resolution;
|
||||
resolution = getResolution();
|
||||
resolution = await getResolution();
|
||||
ok(resolution < prev_resolution, "The second double-tap has decreased the resolution to " + resolution);
|
||||
}
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
async function test() {
|
||||
let useTouchpad = (location.search == "?touchpad");
|
||||
|
||||
var resolution = getResolution();
|
||||
var resolution = await getResolution();
|
||||
ok(resolution > 0,
|
||||
"The initial_resolution is " + resolution + ", which is some sane value");
|
||||
|
||||
|
@ -42,7 +42,7 @@ async function test() {
|
|||
// Check that double-tapping once zooms in
|
||||
await doubleTapOn(target, x, y, useTouchpad);
|
||||
var prev_resolution = resolution;
|
||||
resolution = getResolution();
|
||||
resolution = await getResolution();
|
||||
ok(resolution > prev_resolution, "The first double-tap has increased the resolution to " + resolution);
|
||||
|
||||
ok(window.scrollY > 1500, "window is still scrolled down");
|
||||
|
|
|
@ -16,7 +16,7 @@ function within(a, b, tolerance) {
|
|||
async function test() {
|
||||
let useTouchpad = (location.search == "?touchpad");
|
||||
|
||||
let resolution = getResolution();
|
||||
let resolution = await getResolution();
|
||||
let initial_resolution = resolution;
|
||||
ok(resolution > 0,
|
||||
"The initial_resolution is " + resolution + ", which is some sane value");
|
||||
|
@ -27,7 +27,7 @@ async function test() {
|
|||
// Check that double-tapping once zooms in
|
||||
await doubleTapOn(document.getElementById("target"), 10, 10, useTouchpad);
|
||||
let prev_resolution = resolution;
|
||||
resolution = getResolution();
|
||||
resolution = await getResolution();
|
||||
ok(resolution > prev_resolution, "The first double-tap has increased the resolution to " + resolution);
|
||||
ok(window.scrollY == 0, "window not scrolled");
|
||||
info("window.scrollY " + window.scrollY);
|
||||
|
@ -37,7 +37,7 @@ async function test() {
|
|||
// Check that near the bottom doesn't scroll but zooms out
|
||||
await doubleTapOn(document.getElementById("target"), x, y, useTouchpad);
|
||||
prev_resolution = resolution;
|
||||
resolution = getResolution();
|
||||
resolution = await getResolution();
|
||||
ok(resolution < prev_resolution, "The second double-tap has decreased the resolution to " + resolution);
|
||||
// slight float inaccuracy, not sure why
|
||||
ok(within(resolution, initial_resolution, 0.0002), "The second double-tap has restored the resolution to " + resolution);
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
async function test() {
|
||||
let useTouchpad = (location.search == "?touchpad");
|
||||
|
||||
let resolution = getResolution();
|
||||
let resolution = await getResolution();
|
||||
let initial_resolution = resolution;
|
||||
ok(resolution > 0,
|
||||
"The initial_resolution is " + resolution + ", which is some sane value");
|
||||
|
@ -20,13 +20,13 @@ async function test() {
|
|||
// Check that double-tapping once zooms in
|
||||
await doubleTapOn(document.getElementById("thebody"), 20, 20, useTouchpad);
|
||||
let prev_resolution = resolution;
|
||||
resolution = getResolution();
|
||||
resolution = await getResolution();
|
||||
ok(resolution > prev_resolution, "The first double-tap has increased the resolution to " + resolution);
|
||||
|
||||
// Check that double-tapping again on the same spot zooms out
|
||||
await doubleTapOn(document.getElementById("thebody"), 20, 20, useTouchpad);
|
||||
prev_resolution = resolution;
|
||||
resolution = getResolution();
|
||||
resolution = await getResolution();
|
||||
ok(resolution < prev_resolution, "The second double-tap has decreased the resolution to " + resolution);
|
||||
ok(resolution == initial_resolution, "The second double-tap has decreased the resolution to the start resolution " + resolution);
|
||||
}
|
||||
|
|
|
@ -12,20 +12,20 @@
|
|||
async function test() {
|
||||
let useTouchpad = (location.search == "?touchpad");
|
||||
|
||||
let resolution = getResolution();
|
||||
let resolution = await getResolution();
|
||||
ok(resolution > 0,
|
||||
"The initial_resolution is " + resolution + ", which is some sane value");
|
||||
|
||||
// Check that double-tapping once zooms in
|
||||
await doubleTapOn(document.getElementById("target"), 20, 20, useTouchpad);
|
||||
let prev_resolution = resolution;
|
||||
resolution = getResolution();
|
||||
resolution = await getResolution();
|
||||
ok(resolution > prev_resolution, "The first double-tap has increased the resolution to " + resolution);
|
||||
|
||||
// Check that double-tapping again on the same spot zooms out
|
||||
await doubleTapOn(document.getElementById("target"), 20, 20, useTouchpad);
|
||||
prev_resolution = resolution;
|
||||
resolution = getResolution();
|
||||
resolution = await getResolution();
|
||||
ok(resolution < prev_resolution, "The second double-tap has decreased the resolution to " + resolution);
|
||||
}
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
async function test() {
|
||||
let useTouchpad = (location.search == "?touchpad");
|
||||
|
||||
var resolution = getResolution();
|
||||
var resolution = await getResolution();
|
||||
ok(resolution > 0,
|
||||
"The initial_resolution is " + resolution + ", which is some sane value");
|
||||
|
||||
|
@ -40,7 +40,7 @@ async function test() {
|
|||
info("sending double tap");
|
||||
await doubleTapOn(target, 10, 10, useTouchpad);
|
||||
var prev_resolution = resolution;
|
||||
resolution = getResolution();
|
||||
resolution = await getResolution();
|
||||
ok(resolution > prev_resolution, "The first double-tap has increased the resolution to " + resolution);
|
||||
|
||||
ok(window.scrollY > window.innerHeight + 100, "window is still scrolled down");
|
||||
|
|
|
@ -23,7 +23,7 @@ async function test() {
|
|||
|
||||
await attach();
|
||||
|
||||
var resolution = getResolution();
|
||||
var resolution = await getResolution();
|
||||
ok(resolution > 0,
|
||||
"The initial_resolution is " + resolution + ", which is some sane value");
|
||||
|
||||
|
@ -35,14 +35,14 @@ async function test() {
|
|||
info("sending first double tap");
|
||||
await doubleTapOn(document.getElementById("target"), 10, 10, useTouchpad);
|
||||
var prev_resolution = resolution;
|
||||
resolution = getResolution();
|
||||
resolution = await getResolution();
|
||||
ok(resolution > prev_resolution, "The first double-tap has increased the resolution to " + resolution);
|
||||
|
||||
// Check that double-tapping again on the same spot zooms out
|
||||
info("sending second double tap");
|
||||
await doubleTapOn(document.getElementById("target"), 10, 10, useTouchpad);
|
||||
prev_resolution = resolution;
|
||||
resolution = getResolution();
|
||||
resolution = await getResolution();
|
||||
ok(resolution < prev_resolution, "The second double-tap has decreased the resolution to " + resolution);
|
||||
}
|
||||
|
||||
|
|
|
@ -12,20 +12,20 @@
|
|||
async function test() {
|
||||
let useTouchpad = (location.search == "?touchpad");
|
||||
|
||||
var resolution = getResolution();
|
||||
var resolution = await getResolution();
|
||||
ok(resolution > 0,
|
||||
"The initial_resolution is " + resolution + ", which is some sane value");
|
||||
|
||||
// Check that double-tapping once zooms in
|
||||
await doubleTapOn(document.getElementById("target"), 1, 1, useTouchpad);
|
||||
var prev_resolution = resolution;
|
||||
resolution = getResolution();
|
||||
resolution = await getResolution();
|
||||
ok(resolution > prev_resolution, "The first double-tap has increased the resolution to " + resolution);
|
||||
|
||||
// Check that double-tapping again on the same spot zooms out
|
||||
await doubleTapOn(document.getElementById("target"), 1, 1, useTouchpad);
|
||||
prev_resolution = resolution;
|
||||
resolution = getResolution();
|
||||
resolution = await getResolution();
|
||||
ok(resolution < prev_resolution, "The second double-tap has decreased the resolution to " + resolution);
|
||||
}
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ function within(a, b, tolerance) {
|
|||
return (Math.abs(a-b) < tolerance);
|
||||
}
|
||||
|
||||
function afterpaint() {
|
||||
async function afterpaint() {
|
||||
info("vv pos " + visualViewport.pageLeft + "," + visualViewport.pageTop);
|
||||
info("vv size " + visualViewport.width + "," + visualViewport.height);
|
||||
info("win scroll " + window.scrollX + "," + window.scrollY);
|
||||
|
@ -71,12 +71,12 @@ function afterpaint() {
|
|||
const deviceScale = utils.screenPixelsPerCSSPixelNoOverride;
|
||||
const maxZoom = 10.0;
|
||||
if (!within(lastResolution, maxZoom/deviceScale, 0.0001) &&
|
||||
!within(getResolution(), maxZoom/deviceScale, 0.0001) &&
|
||||
!within(await getResolution(), maxZoom/deviceScale, 0.0001) &&
|
||||
!within(lastResolution, 1, 0.0001) &&
|
||||
!within(getResolution(), 1, 0.0001)) {
|
||||
!within(await getResolution(), 1, 0.0001)) {
|
||||
ok(zoomingIn ?
|
||||
lastResolution <= getResolution() :
|
||||
lastResolution >= getResolution(),
|
||||
lastResolution <= await getResolution() :
|
||||
lastResolution >= await getResolution(),
|
||||
"resolution monotonic");
|
||||
}
|
||||
|
||||
|
@ -91,7 +91,7 @@ function afterpaint() {
|
|||
if (!within(lastScrollY, window.scrollY, 2)) {
|
||||
lastScrollY = window.scrollY;
|
||||
}
|
||||
lastResolution = getResolution();
|
||||
lastResolution = await getResolution();
|
||||
}
|
||||
|
||||
async function test() {
|
||||
|
@ -102,7 +102,7 @@ async function test() {
|
|||
window.addEventListener("MozAfterPaint", afterpaint);
|
||||
let intervalID = setInterval(afterpaint, 16);
|
||||
|
||||
let resolution = getResolution();
|
||||
let resolution = await getResolution();
|
||||
ok(resolution > 0,
|
||||
"The initial_resolution is " + resolution + ", which is some sane value");
|
||||
|
||||
|
@ -110,7 +110,7 @@ async function test() {
|
|||
info("sending first double tap");
|
||||
await doubleTapOn(document.getElementById("target2"), 10, 10, useTouchpad);
|
||||
let prev_resolution = resolution;
|
||||
resolution = getResolution();
|
||||
resolution = await getResolution();
|
||||
ok(resolution > prev_resolution, "The first double-tap has increased the resolution to " + resolution);
|
||||
|
||||
await promiseApzFlushedRepaints();
|
||||
|
@ -123,7 +123,7 @@ async function test() {
|
|||
await doubleTapOn(document.getElementById("target2"), 5, 65, useTouchpad);
|
||||
await promiseApzFlushedRepaints();
|
||||
prev_resolution = resolution;
|
||||
resolution = getResolution();
|
||||
resolution = await getResolution();
|
||||
ok(resolution < prev_resolution, "The second double-tap has decreased the resolution to " + resolution);
|
||||
|
||||
clearInterval(intervalID);
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
async function test() {
|
||||
let useTouchpad = (location.search == "?touchpad");
|
||||
|
||||
let resolution = getResolution();
|
||||
let resolution = await getResolution();
|
||||
let initial_resolution = resolution;
|
||||
ok(resolution > 0,
|
||||
"The initial_resolution is " + resolution + ", which is some sane value");
|
||||
|
@ -23,7 +23,7 @@ async function test() {
|
|||
info("sending first double tap");
|
||||
await doubleTapOn(target, 20, 20, useTouchpad);
|
||||
let prev_resolution = resolution;
|
||||
resolution = getResolution();
|
||||
resolution = await getResolution();
|
||||
ok(resolution > prev_resolution, "The first double-tap has increased the resolution to " + resolution);
|
||||
|
||||
let rect = target.getBoundingClientRect();
|
||||
|
@ -36,7 +36,7 @@ async function test() {
|
|||
info("sending second double tap");
|
||||
await doubleTapOn(target, 20, 20, useTouchpad);
|
||||
prev_resolution = resolution;
|
||||
resolution = getResolution();
|
||||
resolution = await getResolution();
|
||||
ok(resolution < prev_resolution, "The second double-tap has decreased the resolution to " + resolution);
|
||||
ok(resolution == initial_resolution, "The second double-tap has restored the resolution to " + resolution);
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
async function test() {
|
||||
let useTouchpad = (location.search == "?touchpad");
|
||||
|
||||
let resolution = getResolution();
|
||||
let resolution = await getResolution();
|
||||
ok(resolution > 0,
|
||||
"The initial_resolution is " + resolution + ", which is some sane value");
|
||||
|
||||
|
@ -20,21 +20,21 @@ async function test() {
|
|||
info("sending first double tap");
|
||||
await doubleTapOn(document.getElementById("target1"), 10, 10, useTouchpad);
|
||||
let prev_resolution = resolution;
|
||||
resolution = getResolution();
|
||||
resolution = await getResolution();
|
||||
ok(resolution == prev_resolution, "The first double-tap did not change the resolution: " + resolution);
|
||||
|
||||
// Check that double-tapping does not zoom in
|
||||
info("sending second double tap");
|
||||
await doubleTapOn(document.getElementById("target2"), 10, 10, useTouchpad);
|
||||
prev_resolution = resolution;
|
||||
resolution = getResolution();
|
||||
resolution = await getResolution();
|
||||
ok(resolution == prev_resolution, "The second double-tap did not change the resolution: " + resolution);
|
||||
|
||||
// Check that double-tapping does zoom in
|
||||
info("sending third double tap");
|
||||
await doubleTapOn(document.getElementById("target3"), 10, 10, useTouchpad);
|
||||
prev_resolution = resolution;
|
||||
resolution = getResolution();
|
||||
resolution = await getResolution();
|
||||
ok(resolution > prev_resolution, "The third double-tap has increased the resolution to " + resolution);
|
||||
}
|
||||
|
||||
|
|
|
@ -12,14 +12,14 @@
|
|||
async function test() {
|
||||
let useTouchpad = (location.search == "?touchpad");
|
||||
|
||||
var resolution = getResolution();
|
||||
var resolution = await getResolution();
|
||||
ok(resolution > 0,
|
||||
"The initial_resolution is " + resolution + ", which is some sane value");
|
||||
|
||||
// Check that double-tapping once on a small element zooms in
|
||||
await doubleTapOn(document.getElementById("target2"), 10, 10, useTouchpad);
|
||||
let prev_resolution = resolution;
|
||||
resolution = getResolution();
|
||||
resolution = await getResolution();
|
||||
ok(resolution > prev_resolution, "The first double-tap has increased the resolution to " + resolution);
|
||||
|
||||
// instant scroll to the bottom of the page
|
||||
|
@ -47,7 +47,7 @@ async function test() {
|
|||
// Check that double-tapping on the big element zooms out
|
||||
await doubleTapOn(target, x, y, useTouchpad);
|
||||
prev_resolution = resolution;
|
||||
resolution = getResolution();
|
||||
resolution = await getResolution();
|
||||
ok(resolution < prev_resolution, "The second double-tap has decreased the resolution to " + resolution);
|
||||
|
||||
info("scrollPos " + scrollPos);
|
||||
|
|
|
@ -12,20 +12,20 @@
|
|||
async function test() {
|
||||
let useTouchpad = (location.search == "?touchpad");
|
||||
|
||||
var resolution = getResolution();
|
||||
var resolution = await getResolution();
|
||||
ok(resolution > 0,
|
||||
"The initial_resolution is " + resolution + ", which is some sane value");
|
||||
|
||||
// Check that double-tapping once zooms in
|
||||
await doubleTapOn(document.getElementById("target"), 10, 10, useTouchpad);
|
||||
var prev_resolution = resolution;
|
||||
resolution = getResolution();
|
||||
resolution = await getResolution();
|
||||
ok(resolution > prev_resolution, "The first double-tap has increased the resolution to " + resolution);
|
||||
|
||||
// Check that double-tapping again on the same spot zooms out
|
||||
await doubleTapOn(document.getElementById("target"), 10, 10, useTouchpad);
|
||||
prev_resolution = resolution;
|
||||
resolution = getResolution();
|
||||
resolution = await getResolution();
|
||||
ok(resolution < prev_resolution, "The second double-tap has decreased the resolution to " + resolution);
|
||||
}
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
<script>
|
||||
|
||||
async function test() {
|
||||
let initial_resolution = getResolution();
|
||||
let initial_resolution = await getResolution();
|
||||
ok(initial_resolution > 0,
|
||||
"The initial_resolution is " + initial_resolution + ", which is some sane value");
|
||||
|
||||
|
@ -18,7 +18,7 @@ async function test() {
|
|||
SpecialPowers.getDOMWindowUtils(window).setResolutionAndScaleTo(2.0*initial_resolution);
|
||||
await promiseApzFlushedRepaints();
|
||||
|
||||
let resolution = getResolution();
|
||||
let resolution = await getResolution();
|
||||
ok(resolution > 1.5*initial_resolution,
|
||||
"The resolution is " + resolution + ", after zooming in");
|
||||
|
||||
|
@ -45,7 +45,7 @@ async function test() {
|
|||
SpecialPowers.getDOMWindowUtils(window).setResolutionAndScaleTo(initial_resolution);
|
||||
await promiseApzFlushedRepaints();
|
||||
|
||||
resolution = getResolution();
|
||||
resolution = await getResolution();
|
||||
ok(resolution == initial_resolution,
|
||||
"The resolution is " + resolution + ", after restoring");
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ async function test_onetouchpinch() {
|
|||
|
||||
ok(isLayerized("scroller"), "scroller has been successfully layerized");
|
||||
|
||||
var initial_resolution = getResolution();
|
||||
var initial_resolution = await getResolution();
|
||||
ok(initial_resolution > 0,
|
||||
"The initial_resolution is " + initial_resolution + ", which is some sane value");
|
||||
|
||||
|
@ -48,7 +48,7 @@ async function test_onetouchpinch() {
|
|||
|
||||
// Flush state and get the resolution we're at now
|
||||
await promiseApzFlushedRepaints();
|
||||
let final_resolution = getResolution();
|
||||
let final_resolution = await getResolution();
|
||||
ok(final_resolution > initial_resolution, "The final resolution (" + final_resolution + ") is greater after zooming in");
|
||||
|
||||
// Also check that the scroller didn't get scrolled.
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
const utils = SpecialPowers.getDOMWindowUtils(window);
|
||||
|
||||
async function test() {
|
||||
is(getResolution(), 1.0, "should not be zoomed (1)");
|
||||
is(await getResolution(), 1.0, "should not be zoomed (1)");
|
||||
|
||||
is(window.scrollX, 0, "shouldn't have scrolled (2)");
|
||||
is(window.scrollY, 0, "shouldn't have scrolled (3)");
|
||||
|
@ -32,7 +32,7 @@
|
|||
document.documentElement.style.display = "";
|
||||
document.documentElement.offsetLeft;
|
||||
|
||||
is(getResolution(), 1.0, "should not be zoomed (6)");
|
||||
is(await getResolution(), 1.0, "should not be zoomed (6)");
|
||||
|
||||
is(window.scrollX, 0, "shouldn't have scrolled (7)");
|
||||
is(window.scrollY, 0, "shouldn't have scrolled (8)");
|
||||
|
@ -43,7 +43,7 @@
|
|||
SpecialPowers.getDOMWindowUtils(window).setResolutionAndScaleTo(4.0);
|
||||
await promiseApzFlushedRepaints();
|
||||
|
||||
is(getResolution(), 4.0, "should be zoomed (11)");
|
||||
is(await getResolution(), 4.0, "should be zoomed (11)");
|
||||
|
||||
is(window.scrollX, 0, "shouldn't have scrolled (12)");
|
||||
is(window.scrollY, 0, "shouldn't have scrolled (13)");
|
||||
|
@ -56,7 +56,7 @@
|
|||
|
||||
await promiseApzFlushedRepaints();
|
||||
|
||||
is(getResolution(), 4.0, "should be zoomed (16)");
|
||||
is(await getResolution(), 4.0, "should be zoomed (16)");
|
||||
|
||||
is(window.scrollX, 0, "shouldn't have scrolled (17)");
|
||||
is(window.scrollY, 0, "shouldn't have scrolled (18)");
|
||||
|
@ -67,7 +67,7 @@
|
|||
SpecialPowers.getDOMWindowUtils(window).setResolutionAndScaleTo(1.0);
|
||||
await promiseApzFlushedRepaints();
|
||||
|
||||
is(getResolution(), 1.0, "should not be zoomed (21)");
|
||||
is(await getResolution(), 1.0, "should not be zoomed (21)");
|
||||
|
||||
is(window.scrollX, 0, "shouldn't have scrolled (22)");
|
||||
is(window.scrollY, 0, "shouldn't have scrolled (23)");
|
||||
|
|
|
@ -123,9 +123,9 @@ function RunAfterProcessedQueuedInputEvents(aCallback) {
|
|||
}
|
||||
|
||||
var scrollerPosition;
|
||||
function getScrollerPosition() {
|
||||
async function getScrollerPosition() {
|
||||
const scroller = document.getElementById("scroller");
|
||||
scrollerPosition = coordinatesRelativeToScreen({
|
||||
scrollerPosition = await coordinatesRelativeToScreen({
|
||||
offsetX: 0,
|
||||
offsetY: 0,
|
||||
target: scroller,
|
||||
|
@ -328,7 +328,7 @@ if (SpecialPowers.isMainProcess()) {
|
|||
subtestDone();
|
||||
} else {
|
||||
waitUntilApzStable()
|
||||
.then(getScrollerPosition)
|
||||
.then(async () => { await getScrollerPosition(); })
|
||||
.then(runContinuation(test))
|
||||
.then(subtestDone, subtestFailed);
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
const utils = SpecialPowers.getDOMWindowUtils(window);
|
||||
|
||||
async function test() {
|
||||
is(getResolution(), 1.0, "should not be zoomed (1)");
|
||||
is(await getResolution(), 1.0, "should not be zoomed (1)");
|
||||
|
||||
is(window.scrollX, 0, "shouldn't have scrolled (2)");
|
||||
is(window.scrollY, 0, "shouldn't have scrolled (3)");
|
||||
|
@ -26,7 +26,7 @@
|
|||
SpecialPowers.getDOMWindowUtils(window).setResolutionAndScaleTo(2.0);
|
||||
await promiseApzFlushedRepaints();
|
||||
|
||||
is(getResolution(), 2.0, "should have zoomed (6)");
|
||||
is(await getResolution(), 2.0, "should have zoomed (6)");
|
||||
|
||||
is(window.scrollX, 0, "shouldn't have scrolled (7)");
|
||||
is(window.scrollY, 0, "shouldn't have scrolled (8)");
|
||||
|
@ -37,7 +37,7 @@
|
|||
|
||||
await promiseApzFlushedRepaints();
|
||||
|
||||
is(getResolution(), 2.0, "should be zoomed (11)");
|
||||
is(await getResolution(), 2.0, "should be zoomed (11)");
|
||||
|
||||
is(window.scrollX, 0, "shouldn't have scrolled (12)");
|
||||
is(window.scrollY, 0, "shouldn't have scrolled (13)");
|
||||
|
@ -48,7 +48,7 @@
|
|||
|
||||
await promiseApzFlushedRepaints();
|
||||
|
||||
is(getResolution(), 2.0, "should be zoomed (16)");
|
||||
is(await getResolution(), 2.0, "should be zoomed (16)");
|
||||
|
||||
is(window.scrollX, 0, "shouldn't have scrolled (17)");
|
||||
is(window.scrollY, 0, "shouldn't have scrolled (18)");
|
||||
|
@ -59,7 +59,7 @@
|
|||
SpecialPowers.getDOMWindowUtils(window).setResolutionAndScaleTo(1.0);
|
||||
await promiseApzFlushedRepaints();
|
||||
|
||||
is(getResolution(), 1.0, "should not be zoomed (21)");
|
||||
is(await getResolution(), 1.0, "should not be zoomed (21)");
|
||||
}
|
||||
|
||||
waitUntilApzStable()
|
||||
|
|
|
@ -18,7 +18,7 @@ async function test() {
|
|||
let x = r.x + r.width/2;
|
||||
let y = r.y + r.height/2;
|
||||
|
||||
let initial_resolution = getResolution();
|
||||
let initial_resolution = await getResolution();
|
||||
ok(initial_resolution > 0,
|
||||
"The initial_resolution is " + initial_resolution + ", which is some sane value");
|
||||
if (useTouchpad) {
|
||||
|
@ -28,7 +28,7 @@ async function test() {
|
|||
}
|
||||
// Flush state and get the resolution we're at now
|
||||
await promiseApzFlushedRepaints();
|
||||
let final_resolution = getResolution();
|
||||
let final_resolution = await getResolution();
|
||||
ok(final_resolution > initial_resolution, "The final resolution (" + final_resolution + ") is greater after zooming in");
|
||||
}
|
||||
|
||||
|
|
|
@ -16,13 +16,13 @@
|
|||
|
||||
async function test() {
|
||||
// Initial state
|
||||
is(getResolution(), 1.0, "should not be zoomed");
|
||||
is(await getResolution(), 1.0, "should not be zoomed");
|
||||
|
||||
// Zoom in
|
||||
utils.setResolutionAndScaleTo(2.0);
|
||||
await promiseApzFlushedRepaints();
|
||||
// Check that we're still at 0,0 in both layout and visual viewport
|
||||
is(getResolution(), 2.0, "should be zoomed to 2.0");
|
||||
is(await getResolution(), 2.0, "should be zoomed to 2.0");
|
||||
is(window.scrollX, 0, "shouldn't have scrolled (1)");
|
||||
is(window.scrollY, 0, "shouldn't have scrolled (2)");
|
||||
is(visualViewport.pageLeft, 0, "shouldn't have scrolled (3)");
|
||||
|
@ -70,7 +70,7 @@
|
|||
await promiseApzFlushedRepaints();
|
||||
|
||||
// Check that we're back at 1.0 resolution
|
||||
is(getResolution(), 1.0, "should be back at initial resolution");
|
||||
is(await getResolution(), 1.0, "should be back at initial resolution");
|
||||
|
||||
// More sanity checks
|
||||
is(window.scrollX, 0, "shouldn't have scrolled (5)");
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
async function test() {
|
||||
// Initial state
|
||||
is(getResolution(), 1.0, "should not be zoomed");
|
||||
is(await getResolution(), 1.0, "should not be zoomed");
|
||||
|
||||
// Zoom in and go to the bottom-right corner. This ensures the layout
|
||||
// and visual scroll offsets are nonzero, which increases the chances
|
||||
|
@ -31,7 +31,7 @@
|
|||
await promiseApzFlushedRepaints();
|
||||
|
||||
// Check that we're at the right place
|
||||
is(getResolution(), 5.0, "should be zoomed to 5.0");
|
||||
is(await getResolution(), 5.0, "should be zoomed to 5.0");
|
||||
is(window.scrollX, window.scrollMaxX, "layout x-coord should be maxed");
|
||||
is(window.scrollY, window.scrollMaxY, "layout y-coord should be maxed");
|
||||
ok(visualViewport.offsetLeft > 0, "visual x-coord should be even further");
|
||||
|
@ -52,7 +52,7 @@
|
|||
// visual viewport.
|
||||
for (let entry of zoom_out) {
|
||||
for (let i = 0; i < entry.length; i++) {
|
||||
entry[i] = coordinatesRelativeToScreen({
|
||||
entry[i] = await coordinatesRelativeToScreen({
|
||||
offsetX: entry[i].x,
|
||||
offsetY: entry[i].y,
|
||||
target: document.body,
|
||||
|
@ -101,7 +101,7 @@
|
|||
await promiseApzFlushedRepaints();
|
||||
|
||||
// Verify that the zoom completed and we're back at 1.0 resolution
|
||||
isfuzzy(getResolution(), 1.0, 0.0001, "should be back at initial resolution");
|
||||
isfuzzy(await getResolution(), 1.0, 0.0001, "should be back at initial resolution");
|
||||
}
|
||||
|
||||
waitUntilApzStable().then(test).then(subtestDone, subtestFailed);
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
<script type="application/javascript">
|
||||
|
||||
async function testPreventDefault(aTouchStartToCancel) {
|
||||
var initial_resolution = getResolution();
|
||||
var initial_resolution = await getResolution();
|
||||
ok(initial_resolution > 0,
|
||||
"The initial_resolution is " + initial_resolution + ", which is some sane value");
|
||||
|
||||
|
@ -39,7 +39,7 @@ async function testPreventDefault(aTouchStartToCancel) {
|
|||
|
||||
// Flush state and get the resolution we're at now
|
||||
await promiseApzFlushedRepaints();
|
||||
let final_resolution = getResolution();
|
||||
let final_resolution = await getResolution();
|
||||
is(final_resolution, initial_resolution, "The final resolution (" + final_resolution + ") matches the initial resolution");
|
||||
}
|
||||
|
||||
|
|
|
@ -12,13 +12,13 @@
|
|||
|
||||
async function test() {
|
||||
// Scenario 1: zoom in
|
||||
var initial_resolution = getResolution();
|
||||
var initial_resolution = await getResolution();
|
||||
ok(initial_resolution > 0,
|
||||
"The initial_resolution is " + initial_resolution + ", which is some sane value");
|
||||
await pinchZoomInWithTouchpad(641, 465);
|
||||
// Flush state and get the resolution we're at now
|
||||
await promiseApzFlushedRepaints();
|
||||
let final_resolution = getResolution();
|
||||
let final_resolution = await getResolution();
|
||||
ok(final_resolution > initial_resolution, "The final resolution (" + final_resolution + ") is greater after zooming in");
|
||||
|
||||
// Scenario 2: zoom out
|
||||
|
@ -27,7 +27,7 @@ async function test() {
|
|||
"The initial_resolution is " + initial_resolution + ", which is some sane value");
|
||||
await pinchZoomOutWithTouchpad(641, 465);
|
||||
await promiseApzFlushedRepaints();
|
||||
final_resolution = getResolution();
|
||||
final_resolution = await getResolution();
|
||||
ok(final_resolution < initial_resolution, "The final resolution (" + final_resolution + ") is smaller after zooming Out");
|
||||
|
||||
// Scenario 3: zoom in and out in the same gesture
|
||||
|
@ -36,7 +36,7 @@ async function test() {
|
|||
"The initial_resolution is " + initial_resolution + ", which is some sane value");
|
||||
await pinchZoomInOutWithTouchpad (641, 465);
|
||||
await promiseApzFlushedRepaints();
|
||||
final_resolution = getResolution();
|
||||
final_resolution = await getResolution();
|
||||
isfuzzy(initial_resolution, final_resolution, 0.0001, "The final resolution approximatly the same after zooming In and Out");
|
||||
|
||||
// Scenario 4: zoom in, with the page using preventDefault()
|
||||
|
@ -64,7 +64,7 @@ async function test() {
|
|||
await pinchZoomInWithTouchpad(641, 465, { waitForTransformEnd: false });
|
||||
await wheelPromise;
|
||||
document.removeEventListener("wheel", onWheel, { passive: false });
|
||||
final_resolution = getResolution();
|
||||
final_resolution = await getResolution();
|
||||
is(final_resolution, initial_resolution,
|
||||
"Calling preventDefault() on wheel event successfully prevents zooming");
|
||||
|
||||
|
@ -91,7 +91,7 @@ async function test() {
|
|||
});
|
||||
await DOMMouseScrollPromise;
|
||||
document.removeEventListener("DOMMouseScroll", onDOMMouseScroll, { passive: false });
|
||||
final_resolution = getResolution();
|
||||
final_resolution = await getResolution();
|
||||
is(final_resolution, initial_resolution,
|
||||
"Calling preventDefault() on DOMMouseScroll event successfully prevents zooming");
|
||||
}
|
||||
|
|
|
@ -14,16 +14,16 @@
|
|||
[test_bug1151667.html]
|
||||
skip-if =
|
||||
os == 'android' # wheel events not supported on mobile
|
||||
xorigin # JavaScript error: http://mochi.test:8888/tests/gfx/layers/apz/test/mochitest/apz_test_native_event_utils.js, line 10: Error: Permission denied to access property "getResolution"
|
||||
xorigin # JavaScript error: , line 0: uncaught exception: Object
|
||||
[test_bug1253683.html]
|
||||
skip-if =
|
||||
os == 'android' # wheel events not supported on mobile
|
||||
verify && debug && os == 'linux'
|
||||
xorigin # JavaScript error: http://mochi.test:8888/tests/gfx/layers/apz/test/mochitest/apz_test_native_event_utils.js, line 10: Error: Permission denied to access property "getResolution"
|
||||
xorigin # JavaScript error: , line 0: uncaught exception: Object
|
||||
[test_bug1277814.html]
|
||||
skip-if =
|
||||
os == 'android' # wheel events not supported on mobile
|
||||
xorigin # JavaScript error: http://mochi.test:8888/tests/gfx/layers/apz/test/mochitest/apz_test_native_event_utils.js, line 10: Error: Permission denied to access property "getResolution"
|
||||
xorigin # JavaScript error: , line 0: uncaught exception: Object
|
||||
[test_bug1304689.html]
|
||||
[test_bug1304689-2.html]
|
||||
[test_group_bug1464568.html]
|
||||
|
@ -66,12 +66,12 @@
|
|||
[test_layerization.html]
|
||||
skip-if =
|
||||
os == 'android' # wheel events not supported on mobile
|
||||
xorigin # JavaScript error: http://mochi.test:8888/tests/gfx/layers/apz/test/mochitest/apz_test_native_event_utils.js, line 10: Error: Permission denied to access property "getResolution"
|
||||
os == 'linux' && fission && headless # Bug 1722907
|
||||
xorigin # JavaScript error: , line 0: uncaught exception: Object
|
||||
[test_relative_update.html]
|
||||
skip-if =
|
||||
os == 'android' # wheel events not supported on mobile
|
||||
xorigin # JavaScript error: http://mochi.test:8888/tests/gfx/layers/apz/test/mochitest/apz_test_native_event_utils.js, line 10: Error: Permission denied to access property "getResolution"
|
||||
xorigin # JavaScript error: , line 0: uncaught exception: Object
|
||||
[test_scroll_inactive_bug1190112.html]
|
||||
skip-if = (os == 'android') # wheel events not supported on mobile
|
||||
[test_scroll_inactive_flattened_frame.html]
|
||||
|
@ -82,15 +82,15 @@
|
|||
skip-if =
|
||||
toolkit == 'android' # wheel events not supported on mobile
|
||||
toolkit == 'cocoa' # synthesized wheel smooth-scrolling not supported on OS X
|
||||
xorigin # JavaScript error: http://mochi.test:8888/tests/gfx/layers/apz/test/mochitest/apz_test_native_event_utils.js, line 10: Error: Permission denied to access property "getResolution"
|
||||
xorigin # JavaScript error: , line 0: uncaught exception: Object
|
||||
[test_wheel_scroll.html]
|
||||
skip-if =
|
||||
os == 'android' # wheel events not supported on mobile
|
||||
xorigin # Hangs
|
||||
xorigin # JavaScript error: , line 0: uncaught exception: Object
|
||||
[test_wheel_transactions.html]
|
||||
skip-if =
|
||||
toolkit == 'android' # wheel events not supported on mobile
|
||||
xorigin # Hangs
|
||||
xorigin # JavaScript error: , line 0: uncaught exception: Object
|
||||
[test_group_overrides.html]
|
||||
skip-if =
|
||||
toolkit == 'android' # wheel events not supported on mobile
|
||||
|
|
Загрузка…
Ссылка в новой задаче