Merge mozilla-central to inbound

This commit is contained in:
arthur.iakab 2018-12-27 23:59:04 +02:00
Родитель 10e8b50221 9bcc2b137f
Коммит b725756ed4
170 изменённых файлов: 2933 добавлений и 1920 удалений

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

@ -104,6 +104,7 @@ jobs:
type: decision-task
treeherder-symbol: customv8
target-tasks-method: customv8_update
optimize-target-tasks: false
run-on-projects:
- mozilla-central
when:

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

@ -20,10 +20,6 @@ docshell/test/mochitest/**
extensions/cookie/**
extensions/spellcheck/**
extensions/universalchardet/**
gfx/layers/**
gfx/tests/browser/**
gfx/tests/chrome/**
gfx/tests/mochitest/**
image/**
layout/**
modules/**

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

@ -46,5 +46,11 @@ module.exports = {
"rules": {
"mozilla/reject-importGlobalProperties": "off",
}
}, {
// TODO: Bug 1515949. Enable no-undef for gfx/
"files": "gfx/layers/apz/test/mochitest/**",
"rules": {
"no-undef": "off",
}
}]
};

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

@ -55,7 +55,11 @@ body {
width: 100%;
}
tr:hover td {
tbody tr {
transition: background cubic-bezier(.07, .95, 0, 1) 250ms;
}
tbody tr:hover {
background-color: #d7d7db;
}
@ -72,7 +76,6 @@ th {
td {
padding: 1rem;
transition: background cubic-bezier(.07, .95, 0, 1) 250ms;
}
/*
@ -88,6 +91,12 @@ tbody:nth-child(4n + 1) {
background-color: #ededf0;
}
.active-policies tr.odd:hover,
.errors tr:nth-child(odd):hover,
tbody:nth-child(4n + 1):hover {
background-color: #d7d7db;
}
.arr_sep.odd:not(:last-child) td:not(:first-child) {
border-bottom: 2px solid #f9f9fa;
}

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

@ -72,7 +72,7 @@ def rust_compiler(rustc_info, cargo_info):
You can install rust by running './mach bootstrap'
or by directly running the installer from https://rustup.rs/
'''))
rustc_min_version = Version('1.30.0')
rustc_min_version = Version('1.31.0')
cargo_min_version = rustc_min_version
version = rustc_info.version

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

@ -3,7 +3,7 @@
# Mark failing (fail-if) and crashing (skip-if) tests in mochitest-errata.ini.
[DEFAULT]
skip-if = toolkit == 'android' && e10s && isEmulator
support-files = always-fail.html
checkout/00_test_list.txt

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

@ -21,6 +21,8 @@
# * Windows 10: 10.0
[DEFAULT]
# Cross-process WebGL doesn't seem to work under an emulator
skip-if = toolkit == 'android' && e10s && is_emulator
[generated/test_..__always-fail.html]
fail-if = 1

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

@ -80,11 +80,11 @@ WeakCipherSuiteWarning=This site uses the cipher RC4 for encryption, which is de
#XCTO: nosniff
# LOCALIZATION NOTE: Do not translate "X-Content-Type-Options: nosniff".
MimeTypeMismatch=The resource from “%1$S” was blocked due to MIME type mismatch (X-Content-Type-Options: nosniff).
MimeTypeMismatch2=The resource from “%1$S” was blocked due to MIME type (“%2$S”) mismatch (X-Content-Type-Options: nosniff).
# LOCALIZATION NOTE: Do not translate "X-Content-Type-Options" and also do not trasnlate "nosniff".
XCTOHeaderValueMissing=X-Content-Type-Options header warning: value was “%1$S”; did you mean to send “nosniff”?
BlockScriptWithWrongMimeType=Script from “%1$S” was blocked because of a disallowed MIME type.
BlockScriptWithWrongMimeType2=Script from “%1$S” was blocked because of a disallowed MIME type (“%2$S”).
# LOCALIZATION NOTE: Do not translate "data: URI".
BlockTopLevelDataURINavigation=Navigation to toplevel data: URI not allowed (Blocked loading of: “%1$S”)

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

@ -190,7 +190,8 @@ skip-if = android_version == '18' # android(Bug 1319019, timeouts on 4.3 emulato
[test_peerConnection_multiple_captureStream_canvas_2d.html]
skip-if = (android_version == '18' && debug) # android(Bug 1189784, timeouts on 4.3 emulator)
[test_peerConnection_captureStream_canvas_webgl.html]
skip-if = (android_version <= '17' || android_version == '18') # (<17: bug 1346630, 18: bug 1385950)
# Cross process WebGL doesn't seem to work in the emulator
skip-if = (toolkit == 'android' && e10s && is_emulator) || (android_version <= '17' || android_version == '18') # (<17: bug 1346630, 18: bug 1385950)
[test_peerConnection_certificates.html]
disabled=bug 1180968
[test_peerConnection_close.html]

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

@ -1,3 +1,6 @@
// ownerGlobal isn't defined in content privileged windows.
/* eslint-disable mozilla/use-ownerGlobal */
// Utilities for synthesizing of native events.
function getResolution() {
@ -15,7 +18,7 @@ function getPlatform() {
}
// Check for Android before Linux
if (navigator.appVersion.includes("Android")) {
return "android"
return "android";
}
if (navigator.platform.indexOf("Linux") == 0) {
return "linux";
@ -111,7 +114,7 @@ function getBoundingClientRectRelativeToVisualViewport(aElement) {
return rect;
}
// Several event sythesization functions below (and their helpers) take a "target"
// Several event sythesization functions below (and their helpers) take a "target"
// parameter which may be either an element or a window. For such functions,
// the target's "bounding rect" refers to the bounding client rect for an element,
// and the window's origin for a window.
@ -131,7 +134,7 @@ function coordinatesRelativeToScreen(aX, aY, aTarget) {
// The device scale applies to them, but the resolution only zooms the content.
return {
x: (targetWindow.mozInnerScreenX + ((rect.left + aX) * resolution)) * deviceScale,
y: (targetWindow.mozInnerScreenY + ((rect.top + aY) * resolution)) * deviceScale
y: (targetWindow.mozInnerScreenY + ((rect.top + aY) * resolution)) * deviceScale,
};
}
@ -145,7 +148,7 @@ function rectRelativeToScreen(aElement) {
x: (targetWindow.mozInnerScreenX + rect.left) * scale,
y: (targetWindow.mozInnerScreenY + rect.top) * scale,
w: (rect.width * scale),
h: (rect.height * scale)
h: (rect.height * scale),
};
}
@ -175,11 +178,11 @@ function synthesizeNativeWheel(aTarget, aX, aY, aDeltaX, aDeltaY, aObserver) {
// synthesizeNativeWheel for details on the parameters.
function synthesizeNativeWheelAndWaitForObserver(aElement, aX, aY, aDeltaX, aDeltaY, aCallback) {
var observer = {
observe: function(aSubject, aTopic, aData) {
observe(aSubject, aTopic, aData) {
if (aCallback && aTopic == "mousescrollevent") {
setTimeout(aCallback, 0);
}
}
},
};
return synthesizeNativeWheel(aElement, aX, aY, aDeltaX, aDeltaY, observer);
}
@ -187,7 +190,7 @@ function synthesizeNativeWheelAndWaitForObserver(aElement, aX, aY, aDeltaX, aDel
// Synthesizes a native mousewheel event and invokes the callback once the
// wheel event is dispatched to |aTarget|'s containing window. If the event
// targets content in a subdocument, |aTarget| should be inside the
// subdocument (or the subdocument's window). See synthesizeNativeWheel for
// subdocument (or the subdocument's window). See synthesizeNativeWheel for
// details on the other parameters.
function synthesizeNativeWheelAndWaitForWheelEvent(aTarget, aX, aY, aDeltaX, aDeltaY, aCallback) {
var targetWindow = windowForTarget(aTarget);
@ -200,7 +203,7 @@ function synthesizeNativeWheelAndWaitForWheelEvent(aTarget, aX, aY, aDeltaX, aDe
// Synthesizes a native mousewheel event and invokes the callback once the
// first resulting scroll event is dispatched to |aTarget|'s containing window.
// If the event targets content in a subdocument, |aTarget| should be inside
// the subdocument (or the subdocument's window). See synthesizeNativeWheel
// the subdocument (or the subdocument's window). See synthesizeNativeWheel
// for details on the other parameters.
function synthesizeNativeWheelAndWaitForScrollEvent(aTarget, aX, aY, aDeltaX, aDeltaY, aCallback) {
var targetWindow = windowForTarget(aTarget);
@ -223,7 +226,7 @@ function synthesizeNativeMouseMove(aTarget, aX, aY) {
// Synthesizes a native mouse move event and invokes the callback once the
// mouse move event is dispatched to |aTarget|'s containing window. If the event
// targets content in a subdocument, |aTarget| should be inside the
// subdocument (or the subdocument window). See synthesizeNativeMouseMove for
// subdocument (or the subdocument window). See synthesizeNativeMouseMove for
// details on the other parameters.
function synthesizeNativeMouseMoveAndWaitForMoveEvent(aTarget, aX, aY, aCallback) {
var targetWindow = windowForTarget(aTarget);
@ -265,7 +268,7 @@ function* synthesizeNativeTouchSequences(aTarget, aPositions, aObserver = null,
// will be the last one we make, so that we can register aObserver on it.
var lastNonNullValue = -1;
var yields = 0;
for (var i = 0; i < aPositions.length; i++) {
for (let i = 0; i < aPositions.length; i++) {
if (aPositions[i] == null) {
yields++;
continue;
@ -273,7 +276,7 @@ function* synthesizeNativeTouchSequences(aTarget, aPositions, aObserver = null,
if (aPositions[i].length != aTouchIds.length) {
throw "aPositions[" + i + "] did not have the expected number of positions; expected " + aTouchIds.length + " touch points but found " + aPositions[i].length;
}
for (var j = 0; j < aTouchIds.length; j++) {
for (let j = 0; j < aTouchIds.length; j++) {
if (aPositions[i][j] != null) {
lastNonNullValue = ((i - yields) * aTouchIds.length) + j;
}
@ -300,13 +303,13 @@ function* synthesizeNativeTouchSequences(aTarget, aPositions, aObserver = null,
// Iterate over the position data now, and generate the touches requested
yields = 0;
for (var i = 0; i < aPositions.length; i++) {
for (let i = 0; i < aPositions.length; i++) {
if (aPositions[i] == null) {
yields++;
yield i;
continue;
}
for (var j = 0; j < aTouchIds.length; j++) {
for (let j = 0; j < aTouchIds.length; j++) {
if (aPositions[i][j] == null) {
// null means lift the finger
if (currentPositions[j] == null) {
@ -333,8 +336,7 @@ function* synthesizeNativeTouchSequences(aTarget, aPositions, aObserver = null,
// consumed to overcome the panning threshold.
function synthesizeNativeTouchDrag(aTarget, aX, aY, aDeltaX, aDeltaY, aObserver = null, aTouchId = 0) {
var steps = Math.max(Math.abs(aDeltaX), Math.abs(aDeltaY));
var positions = new Array();
positions.push([{ x: aX, y: aY }]);
var positions = [[{ x: aX, y: aY }]];
for (var i = 1; i < steps; i++) {
var dx = i * (aDeltaX / steps);
var dy = i * (aDeltaY / steps);
@ -425,7 +427,7 @@ function* dragVerticalScrollbar(element, testDriver, distance = 20, increment =
yield synthesizeNativeMouseEvent(element, mouseX, mouseY + distance, nativeMouseMoveEventMsg(), testDriver);
// and return a generator to call afterwards to finish up the drag
return function*() {
return function* () {
dump("Finishing drag of #" + element.id + "\n");
yield synthesizeNativeMouseEvent(element, mouseX, mouseY + distance, nativeMouseUpEventMsg(), testDriver);
};

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

@ -8,6 +8,9 @@
// we really want, but we can't express in directly in WebIDL.)
// ----------------------------------------------------------------------
// getHitTestConfig() expects apz_test_native_event_utils.js to be loaded as well.
/* import-globals-from apz_test_native_event_utils.js */
function convertEntries(entries) {
var result = {};
for (var i = 0; i < entries.length; ++i) {
@ -18,12 +21,12 @@ function convertEntries(entries) {
function getPropertyAsRect(scrollFrames, scrollId, prop) {
SimpleTest.ok(scrollId in scrollFrames,
'expected scroll frame data for scroll id ' + scrollId);
"expected scroll frame data for scroll id " + scrollId);
var scrollFrameData = scrollFrames[scrollId];
SimpleTest.ok('displayport' in scrollFrameData,
'expected a ' + prop + ' for scroll id ' + scrollId);
SimpleTest.ok("displayport" in scrollFrameData,
"expected a " + prop + " for scroll id " + scrollId);
var value = scrollFrameData[prop];
var pieces = value.replace(/[()\s]+/g, '').split(',');
var pieces = value.replace(/[()\s]+/g, "").split(",");
SimpleTest.is(pieces.length, 4, "expected string of form (x,y,w,h)");
return { x: parseInt(pieces[0]),
y: parseInt(pieces[1]),
@ -87,11 +90,11 @@ function buildApzcTree(paint) {
// so we invent a node that is the parent of all roots.
// This 'root' does not correspond to an APZC.
var root = {scrollId: -1, children: []};
for (var scrollId in paint) {
for (let scrollId in paint) {
paint[scrollId].children = [];
paint[scrollId].scrollId = scrollId;
}
for (var scrollId in paint) {
for (let scrollId in paint) {
var parentNode = null;
if ("hasNoParentWithSameLayersId" in paint[scrollId]) {
parentNode = root;
@ -106,7 +109,7 @@ function buildApzcTree(paint) {
// Given an APZC tree produced by buildApzcTree, return the RCD node in
// the tree, or null if there was none.
function findRcdNode(apzcTree) {
if (!!apzcTree.isRootContent) { // isRootContent will be undefined or "1"
if (apzcTree.isRootContent) { // isRootContent will be undefined or "1"
return apzcTree;
}
for (var i = 0; i < apzcTree.children.length; i++) {
@ -129,7 +132,7 @@ function isLayerized(elementId) {
var paint = contentTestData.paints[seqno];
for (var scrollId in paint) {
if ("contentDescription" in paint[scrollId]) {
if (paint[scrollId]["contentDescription"].includes(elementId)) {
if (paint[scrollId].contentDescription.includes(elementId)) {
return true;
}
}
@ -138,7 +141,7 @@ function isLayerized(elementId) {
}
function promiseApzRepaintsFlushed(aWindow = window) {
return new Promise(function (resolve, reject) {
return new Promise(function(resolve, reject) {
var repaintDone = function() {
SpecialPowers.Services.obs.removeObserver(repaintDone, "apz-repaints-flushed");
setTimeout(resolve, 0);
@ -227,7 +230,7 @@ function runSubtestsSeriallyInFreshWindows(aSubtests) {
if (w.ApzCleanup) { // guard against the subtest not loading apz_test_utils.js
w.ApzCleanup.execute();
}
if (typeof test.dp_suppression != 'undefined') {
if (typeof test.dp_suppression != "undefined") {
// We modified the suppression when starting the test, so now undo that.
SpecialPowers.getDOMWindowUtils(window).respectDisplayPortSuppression(!test.dp_suppression);
}
@ -261,7 +264,7 @@ function runSubtestsSeriallyInFreshWindows(aSubtests) {
SimpleTest.ok(true, "Starting subtest " + test.file);
if (typeof test.dp_suppression != 'undefined') {
if (typeof test.dp_suppression != "undefined") {
// Normally during a test, the displayport will get suppressed during page
// load, and unsuppressed at a non-deterministic time during the test. The
// unsuppression can trigger a repaint which interferes with the test, so
@ -271,7 +274,7 @@ function runSubtestsSeriallyInFreshWindows(aSubtests) {
}
function spawnTest(aFile) {
w = window.open('', "_blank");
w = window.open("", "_blank");
w.subtestDone = advanceSubtestExecution;
w.isApzSubtest = true;
w.SimpleTest = SimpleTest;
@ -282,15 +285,15 @@ function runSubtestsSeriallyInFreshWindows(aSubtests) {
// called with at most 2 arguments.
return SimpleTest.ok.apply(SimpleTest, arguments);
};
w.todo_is = function(a, b, msg) { return todo_is(a, b, aFile + " | " + msg); };
w.todo_is = function(a, b, msg) { return todo_is(a, b, aFile + " | " + msg); };
w.todo = function(cond, msg) { return todo(cond, aFile + " | " + msg); };
if (test.onload) {
w.addEventListener('load', function(e) { test.onload(w); }, { once: true });
w.addEventListener("load", function(e) { test.onload(w); }, { once: true });
}
var subtestUrl = location.href.substring(0, location.href.lastIndexOf('/') + 1) + aFile;
var subtestUrl = location.href.substring(0, location.href.lastIndexOf("/") + 1) + aFile;
function urlResolves(url) {
var request = new XMLHttpRequest();
request.open('GET', url, false);
request.open("GET", url, false);
request.send();
return request.status !== 404;
}
@ -298,7 +301,7 @@ function runSubtestsSeriallyInFreshWindows(aSubtests) {
SimpleTest.ok(false, "Subtest URL " + subtestUrl + " does not resolve. " +
"Be sure it's present in the support-files section of mochitest.ini.");
reject();
return;
return undefined;
}
w.location = subtestUrl;
return w;
@ -321,7 +324,7 @@ function runSubtestsSeriallyInFreshWindows(aSubtests) {
}
function pushPrefs(prefs) {
return SpecialPowers.pushPrefEnv({'set': prefs});
return SpecialPowers.pushPrefEnv({"set": prefs});
}
async function waitUntilApzStable() {
@ -335,12 +338,13 @@ async function waitUntilApzStable() {
// Sadly this helper function cannot reuse any code from other places because
// it must be totally self-contained to be shipped over to the parent process.
/* eslint-env mozilla/frame-script */
function parentProcessFlush() {
addMessageListener("apz-flush", function() {
ChromeUtils.import("resource://gre/modules/Services.jsm");
var topWin = Services.wm.getMostRecentWindow('navigator:browser');
var topWin = Services.wm.getMostRecentWindow("navigator:browser");
if (!topWin) {
topWin = Services.wm.getMostRecentWindow('navigator:geckoview');
topWin = Services.wm.getMostRecentWindow("navigator:geckoview");
}
var topUtils = topWin.windowUtils;
@ -362,7 +366,7 @@ async function waitUntilApzStable() {
dump("Parent process: flushing APZ repaints was a no-op, triggering callback directly...\n");
repaintDone();
}
}
};
// Flush APZ repaints, but wait until all the pending paints have been
// sent.
@ -481,35 +485,37 @@ function runContinuation(testFunction) {
// The snapshot is returned in the form of a data URL.
function getSnapshot(rect) {
function parentProcessSnapshot() {
addMessageListener('snapshot', function(rect) {
ChromeUtils.import('resource://gre/modules/Services.jsm');
var topWin = Services.wm.getMostRecentWindow('navigator:browser');
addMessageListener("snapshot", function(parentRect) {
ChromeUtils.import("resource://gre/modules/Services.jsm");
var topWin = Services.wm.getMostRecentWindow("navigator:browser");
if (!topWin) {
topWin = Services.wm.getMostRecentWindow('navigator:geckoview');
topWin = Services.wm.getMostRecentWindow("navigator:geckoview");
}
// reposition the rect relative to the top-level browser window
rect = JSON.parse(rect);
rect.x -= topWin.mozInnerScreenX;
rect.y -= topWin.mozInnerScreenY;
parentRect = JSON.parse(parentRect);
parentRect.x -= topWin.mozInnerScreenX;
parentRect.y -= topWin.mozInnerScreenY;
// take the snapshot
var canvas = topWin.document.createElementNS("http://www.w3.org/1999/xhtml", "canvas");
canvas.width = rect.w;
canvas.height = rect.h;
canvas.width = parentRect.w;
canvas.height = parentRect.h;
var ctx = canvas.getContext("2d");
ctx.drawWindow(topWin, rect.x, rect.y, rect.w, rect.h, 'rgb(255,255,255)', ctx.DRAWWINDOW_DRAW_VIEW | ctx.DRAWWINDOW_USE_WIDGET_LAYERS | ctx.DRAWWINDOW_DRAW_CARET);
ctx.drawWindow(topWin, parentRect.x, parentRect.y, parentRect.w, parentRect.h,
"rgb(255,255,255)",
ctx.DRAWWINDOW_DRAW_VIEW | ctx.DRAWWINDOW_USE_WIDGET_LAYERS | ctx.DRAWWINDOW_DRAW_CARET);
return canvas.toDataURL();
});
}
if (typeof getSnapshot.chromeHelper == 'undefined') {
if (typeof getSnapshot.chromeHelper == "undefined") {
// This is the first time getSnapshot is being called; do initialization
getSnapshot.chromeHelper = SpecialPowers.loadChromeScript(parentProcessSnapshot);
ApzCleanup.register(function() { getSnapshot.chromeHelper.destroy() });
ApzCleanup.register(function() { getSnapshot.chromeHelper.destroy(); });
}
return getSnapshot.chromeHelper.sendSyncMessage('snapshot', JSON.stringify(rect)).toString();
return getSnapshot.chromeHelper.sendSyncMessage("snapshot", JSON.stringify(rect)).toString();
}
// Takes the document's query string and parses it, assuming the query string
@ -524,9 +530,9 @@ function getSnapshot(rect) {
function getQueryArgs() {
var args = {};
if (location.search.length > 0) {
var params = location.search.substr(1).split('&');
var params = location.search.substr(1).split("&");
for (var p of params) {
var [k, v] = p.split('=');
var [k, v] = p.split("=");
args[k] = JSON.parse(v);
}
}
@ -545,17 +551,17 @@ function getQueryArgs() {
function injectScript(aScript, aWindow = window) {
return function() {
return new Promise(function(resolve, reject) {
var e = aWindow.document.createElement('script');
e.type = 'text/javascript';
var e = aWindow.document.createElement("script");
e.type = "text/javascript";
e.onload = function() {
resolve();
};
e.onerror = function() {
dump('Script [' + aScript + '] errored out\n');
dump("Script [" + aScript + "] errored out\n");
reject();
};
e.src = aScript;
aWindow.document.getElementsByTagName('head')[0].appendChild(e);
aWindow.document.getElementsByTagName("head")[0].appendChild(e);
});
};
}
@ -570,8 +576,8 @@ function injectScript(aScript, aWindow = window) {
function getHitTestConfig() {
if (!("hitTestConfig" in window)) {
var utils = SpecialPowers.getDOMWindowUtils(window);
var isWebRender = (utils.layerManagerType == 'WebRender');
var isWindows = (getPlatform() == 'windows');
var isWebRender = (utils.layerManagerType == "WebRender");
var isWindows = (getPlatform() == "windows");
window.hitTestConfig = { utils, isWebRender, isWindows };
}
return window.hitTestConfig;
@ -630,11 +636,11 @@ function checkHitResult(hitResult, expectedHitInfo, expectedScrollId, desc) {
// Symbolic constants used by hitTestScrollbar().
var ScrollbarTrackLocation = {
START: 1,
END: 2
END: 2,
};
var LayerState = {
ACTIVE: 1,
INACTIVE: 2
INACTIVE: 2,
};
// Perform a hit test on the scrollbar(s) of a scroll frame.
@ -699,7 +705,7 @@ function hitTestScrollbar(params) {
x: boundingClientRect.right - (verticalScrollbarWidth / 2),
y: (params.trackLocation == ScrollbarTrackLocation.START)
? (boundingClientRect.y + scrollbarArrowButtonHeight + 5)
: (boundingClientRect.bottom - horizontalScrollbarHeight - scrollbarArrowButtonHeight - 5)
: (boundingClientRect.bottom - horizontalScrollbarHeight - scrollbarArrowButtonHeight - 5),
};
checkHitResult(hitTest(verticalScrollbarPoint),
expectedHitInfo | APZHitResultFlags.SCROLLBAR_VERTICAL,
@ -754,7 +760,7 @@ function getPrefs(ident) {
var ApzCleanup = {
_cleanups: [],
register: function(func) {
register(func) {
if (this._cleanups.length == 0) {
if (!window.isApzSubtest) {
SimpleTest.registerCleanupFunction(this.execute.bind(this));
@ -763,7 +769,7 @@ var ApzCleanup = {
this._cleanups.push(func);
},
execute: function() {
execute() {
while (this._cleanups.length > 0) {
var func = this._cleanups.pop();
try {
@ -772,5 +778,5 @@ var ApzCleanup = {
SimpleTest.ok(false, "Subtest cleanup function [" + func.toString() + "] threw exception [" + ex + "] on page [" + location.href + "]");
}
}
}
},
};

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

@ -22,7 +22,7 @@ function* doubleTapOn(element, x, y, testDriver) {
// We get here once the APZ:TransformEnd has fired, so we don't need that
// observer any more.
SpecialPowers.Services.obs.removeObserver(testDriver, "APZ:TransformEnd", false);
SpecialPowers.Services.obs.removeObserver(testDriver, "APZ:TransformEnd");
// Flush state so we can query an accurate resolution
yield flushApzRepaints(testDriver);
@ -31,19 +31,19 @@ function* doubleTapOn(element, x, y, testDriver) {
function* test(testDriver) {
var resolution = getResolution();
ok(resolution > 0,
'The initial_resolution is ' + resolution + ', which is some sane value');
"The initial_resolution is " + resolution + ", which is some sane value");
// Check that double-tapping once zooms in
yield* doubleTapOn(document.getElementById('target'), 10, 10, testDriver);
yield* doubleTapOn(document.getElementById("target"), 10, 10, testDriver);
var prev_resolution = resolution;
resolution = getResolution();
ok(resolution > prev_resolution, 'The first double-tap has increased the resolution to ' + resolution);
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
yield* doubleTapOn(document.getElementById('target'), 10, 10, testDriver);
yield* doubleTapOn(document.getElementById("target"), 10, 10, testDriver);
prev_resolution = resolution;
resolution = getResolution();
ok(resolution < prev_resolution, 'The second double-tap has decreased the resolution to ' + resolution);
ok(resolution < prev_resolution, "The second double-tap has decreased the resolution to " + resolution);
}
waitUntilApzStable()

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

@ -31,7 +31,7 @@ function* test(testDriver) {
// We get here once the APZ:TransformEnd has fired, so we don't need that
// observer any more.
SpecialPowers.Services.obs.removeObserver(testDriver, "APZ:TransformEnd", false);
SpecialPowers.Services.obs.removeObserver(testDriver, "APZ:TransformEnd");
// Flush state.
yield waitForApzFlushedRepaints(testDriver);

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

@ -25,7 +25,7 @@ function* test(testDriver) {
var initial_resolution = getResolution();
ok(initial_resolution > 0,
'The initial_resolution is ' + initial_resolution + ', which is some sane value');
"The initial_resolution is " + initial_resolution + ", which is some sane value");
// This listener will trigger the test to continue once APZ is done with
// processing the scroll.
@ -48,12 +48,12 @@ function* test(testDriver) {
// We get here once the APZ:TransformEnd has fired, so we don't need that
// observer any more.
SpecialPowers.Services.obs.removeObserver(testDriver, "APZ:TransformEnd", false);
SpecialPowers.Services.obs.removeObserver(testDriver, "APZ:TransformEnd");
// Flush state and get the resolution we're at now
yield waitForApzFlushedRepaints(testDriver);
let final_resolution = getResolution();
ok(final_resolution > initial_resolution, 'The final resolution (' + final_resolution + ') is greater after zooming in');
ok(final_resolution > initial_resolution, "The final resolution (" + final_resolution + ") is greater after zooming in");
// Check we've got the expected events.
// Pinch-zooming the page should fire visual viewport resize events:

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

@ -19,7 +19,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1151663
// --------------------------------------------------------------------
// The actual logic for testing bug 1151663.
//
// In this test we have a simple page which is scrollable, with a
// In this test we have a simple page which is scrollable, with a
// scrollable <div> which is also scrollable. We test that the
// <div> does not get an initial APZC, since primary scrollable
// frame is the page's root scroll frame.

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

@ -10,16 +10,16 @@
<script type="application/javascript">
function* test(testDriver) {
var v = document.getElementById('video');
var a = document.getElementById('audio');
var d = document.getElementById('div');
var v = document.getElementById("video");
var a = document.getElementById("audio");
var d = document.getElementById("div");
document.body.ontouchstart = function(e) {
if (e.target === v || e.target === a || e.target === d) {
e.target.style.display = 'none';
ok(true, 'Set display to none on #' + e.target.id);
e.target.style.display = "none";
ok(true, "Set display to none on #" + e.target.id);
} else {
ok(false, 'Got unexpected touchstart on ' + e.target);
ok(false, "Got unexpected touchstart on " + e.target);
}
waitForAllPaints(testDriver);
};
@ -27,7 +27,7 @@ function* test(testDriver) {
document.body.ontouchend = function(e) {
if (e.target === v || e.target === a || e.target === d) {
e.target._gotTouchend = true;
ok(true, 'Got touchend event on #' + e.target.id);
ok(true, "Got touchend event on #" + e.target.id);
}
testDriver();
};
@ -37,17 +37,17 @@ function* test(testDriver) {
var pt = coordinatesRelativeToScreen(25, 5, v);
yield utils.sendNativeTouchPoint(0, SpecialPowers.DOMWindowUtils.TOUCH_CONTACT, pt.x, pt.y, 1, 90, null);
yield utils.sendNativeTouchPoint(0, SpecialPowers.DOMWindowUtils.TOUCH_REMOVE, pt.x, pt.y, 1, 90, null);
ok(v._gotTouchend, 'Touchend was received on video element');
ok(v._gotTouchend, "Touchend was received on video element");
pt = coordinatesRelativeToScreen(25, 5, a);
yield utils.sendNativeTouchPoint(0, SpecialPowers.DOMWindowUtils.TOUCH_CONTACT, pt.x, pt.y, 1, 90, null);
yield utils.sendNativeTouchPoint(0, SpecialPowers.DOMWindowUtils.TOUCH_REMOVE, pt.x, pt.y, 1, 90, null);
ok(a._gotTouchend, 'Touchend was received on audio element');
ok(a._gotTouchend, "Touchend was received on audio element");
pt = coordinatesRelativeToScreen(25, 5, d);
yield utils.sendNativeTouchPoint(0, SpecialPowers.DOMWindowUtils.TOUCH_CONTACT, pt.x, pt.y, 1, 90, null);
yield utils.sendNativeTouchPoint(0, SpecialPowers.DOMWindowUtils.TOUCH_REMOVE, pt.x, pt.y, 1, 90, null);
ok(d._gotTouchend, 'Touchend was received on div element');
ok(d._gotTouchend, "Touchend was received on div element");
}
waitUntilApzStable()

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

@ -5,7 +5,7 @@
<script type="application/javascript" src="/tests/SimpleTest/paint_listener.js"></script>
<script type="application/javascript">
function* test(testDriver) {
var scroller = document.getElementById('scroller');
var scroller = document.getElementById("scroller");
var scrollerPos = scroller.scrollTop;
var dx = 100, dy = 50;

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

@ -38,11 +38,11 @@ function* test(testDriver) {
is(window.scrollY, 0, "Main-thread scroll position is still at 0");
// Scroll the iframe by 300px.
var subframe = document.getElementById('subframe');
var subframe = document.getElementById("subframe");
yield synthesizeNativeTouchDrag(subframe, 10, 200, 0, -300);
// Remove the observer, we don't need it any more.
SpecialPowers.Services.obs.removeObserver(testDriver, "APZ:TransformEnd", false);
SpecialPowers.Services.obs.removeObserver(testDriver, "APZ:TransformEnd");
// Flush any pending paints
yield flushApzRepaints(testDriver);
@ -53,11 +53,11 @@ function* test(testDriver) {
var lastPaint = convertScrollFrameData(getLastNonemptyBucket(contentPaints).scrollFrames);
var foundIt = 0;
for (var scrollId in lastPaint) {
if (('contentDescription' in lastPaint[scrollId]) &&
(lastPaint[scrollId]['contentDescription'].includes('tall_html'))) {
var dp = getPropertyAsRect(lastPaint, scrollId, 'displayport');
ok(dp.y <= 0, 'The displayport top should be less than or equal to zero to cover the visible part of the subframe; it is ' + dp.y);
ok(dp.y + dp.h >= subframe.clientHeight, 'The displayport bottom should be greater than the clientHeight; it is ' + (dp.y + dp.h));
if (("contentDescription" in lastPaint[scrollId]) &&
(lastPaint[scrollId].contentDescription.includes("tall_html"))) {
var dp = getPropertyAsRect(lastPaint, scrollId, "displayport");
ok(dp.y <= 0, "The displayport top should be less than or equal to zero to cover the visible part of the subframe; it is " + dp.y);
ok(dp.y + dp.h >= subframe.clientHeight, "The displayport bottom should be greater than the clientHeight; it is " + (dp.y + dp.h));
foundIt++;
}
}

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

@ -17,21 +17,21 @@
eventsList.forEach((eventName) => {
eventsCount[eventName] = 0;
document.getElementById('div1').addEventListener(eventName, (event) => {
document.getElementById("div1").addEventListener(eventName, (event) => {
++eventsCount[event.type];
ok(true, "Received event " + event.type);
});
});
document.addEventListener("click", (event) => {
is(event.target, document.getElementById('div1'), "Clicked on div (at " + event.clientX + "," + event.clientY + ")");
is(event.target, document.getElementById("div1"), "Clicked on div (at " + event.clientX + "," + event.clientY + ")");
for (var key in eventsCount) {
is(eventsCount[key], 1, "Event " + key + " should be generated once");
}
subtestDone();
});
synthesizeNativeTap(document.getElementById('div1'), 100, 100);
synthesizeNativeTap(document.getElementById("div1"), 100, 100);
}
waitUntilApzStable().then(test);

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

@ -35,8 +35,8 @@
target0.addEventListener("pointerdown", () => {
++pointerdown_count;
});
synthesizeNativeTap(document.getElementById('target0'), 100, 100);
synthesizeNativeTap(document.getElementById('target0'), 100, 100);
synthesizeNativeTap(document.getElementById("target0"), 100, 100);
synthesizeNativeTap(document.getElementById("target0"), 100, 100);
}
waitUntilApzStable().then(runTests);
</script>

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

@ -21,8 +21,8 @@
<script type="text/javascript">
function* test(testDriver) {
var scrollableDiv = document.getElementById('scrollable');
scrollableDiv.addEventListener('scroll', () => setTimeout(testDriver, 0), {once: true});
var scrollableDiv = document.getElementById("scrollable");
scrollableDiv.addEventListener("scroll", () => setTimeout(testDriver, 0), {once: true});
var dragFinisher = yield* dragVerticalScrollbar(scrollableDiv, testDriver);
if (!dragFinisher) {

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

@ -10,8 +10,8 @@
<script type="text/javascript">
function* test(testDriver) {
var scrollableDiv = document.getElementById('scrollable');
scrollableDiv.addEventListener('scroll', () => setTimeout(testDriver, 0), {once: true});
var scrollableDiv = document.getElementById("scrollable");
scrollableDiv.addEventListener("scroll", () => setTimeout(testDriver, 0), {once: true});
var dragFinisher = yield* dragVerticalScrollbar(scrollableDiv, testDriver);
if (!dragFinisher) {

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

@ -28,7 +28,7 @@
function* test(testDriver) {
var root = document.scrollingElement;
var scrollPos = root.scrollTop;
document.addEventListener('scroll', () => {
document.addEventListener("scroll", () => {
ok(root.scrollTop > scrollPos, "document scrolled after dragging scrollbar");
setTimeout(testDriver, 0);
}, {once: true});

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

@ -10,8 +10,8 @@
<script type="text/javascript">
function* test(testDriver) {
var scrollableDiv = document.getElementById('scrollable');
scrollableDiv.addEventListener('scroll', () => setTimeout(testDriver, 0), {once: true});
var scrollableDiv = document.getElementById("scrollable");
scrollableDiv.addEventListener("scroll", () => setTimeout(testDriver, 0), {once: true});
// Scroll down a small amount (10px). The bug in this case is that the
// scrollthumb remains a little "above" where it's supposed to be, so if the

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

@ -28,7 +28,7 @@
<div id="anim"></div>
</body>
<script>
'use strict';
"use strict";
const utils = SpecialPowers.getDOMWindowUtils(window);
@ -50,7 +50,7 @@ async function test_opacity() {
"Element should have been moved by the offset");
}
if (utils.layerManagerType == 'WebRender') {
if (utils.layerManagerType == "WebRender") {
ok(true, "This test doesn't need to run on WebRender");
subtestDone();
} else {

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

@ -28,7 +28,7 @@
<div id="anim"></div>
</body>
<script>
'use strict';
"use strict";
const utils = SpecialPowers.getDOMWindowUtils(window);
@ -50,7 +50,7 @@ async function test_transform() {
"Element should have been moved by the offset");
}
if (utils.layerManagerType == 'WebRender') {
if (utils.layerManagerType == "WebRender") {
ok(true, "This test doesn't need to run on WebRender");
subtestDone();
} else {

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

@ -38,7 +38,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1473108
waitUntilApzStable().then(() => {
let target = document.getElementById("target");
target.addEventListener('click', function(e) {
target.addEventListener("click", function(e) {
is(e.target, target, `Clicked on at (${e.clientX}, ${e.clientY})`);
subtestDone();
});

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

@ -10,8 +10,8 @@
<script type="text/javascript">
function* test(testDriver) {
var scrollableDiv = document.getElementById('scrollable');
scrollableDiv.addEventListener('scroll', () => setTimeout(testDriver, 0), {once: true});
var scrollableDiv = document.getElementById("scrollable");
scrollableDiv.addEventListener("scroll", () => setTimeout(testDriver, 0), {once: true});
// Scroll down a small amount (10px). The bug in this case is that the
// scrollthumb "jumps" by an additional 40 pixels (height of the "gap" div)

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

@ -10,8 +10,8 @@
<script type="text/javascript">
function* test(testDriver) {
var scrollableDiv = document.getElementById('scrollable');
scrollableDiv.addEventListener('scroll', () => setTimeout(testDriver, 0), {once: true});
var scrollableDiv = document.getElementById("scrollable");
scrollableDiv.addEventListener("scroll", () => setTimeout(testDriver, 0), {once: true});
// Scroll down a small amount (10px). The bug in this case is that the
// scrollthumb "jumps" by an additional 40 pixels (height of the "gap" div)

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

@ -15,8 +15,8 @@
function checkForTestEnd() {
if (apzFlushed && endEventReceived) {
var target = document.getElementById('carousel');
target.removeEventListener('pointermove', moveListener);
var target = document.getElementById("carousel");
target.removeEventListener("pointermove", moveListener);
ok(pointerMoveCount > 0, "Got " + pointerMoveCount + " pointermove events");
is(document.scrollingElement.scrollTop, 0, "Document didn't y-scroll");
@ -33,19 +33,19 @@
}
function* test(testDriver) {
var target = document.getElementById('carousel');
target.addEventListener('pointercancel', (event) => {
var target = document.getElementById("carousel");
target.addEventListener("pointercancel", (event) => {
ok(false, "Received pointercancel, uh-oh!");
endEventReceived = true;
setTimeout(checkForTestEnd, 0);
}, {once: true});
target.addEventListener('pointerup', () => {
target.addEventListener("pointerup", () => {
ok(true, "Received pointerup");
endEventReceived = true;
setTimeout(checkForTestEnd, 0);
}, {once: true});
target.addEventListener('pointermove', moveListener);
target.addEventListener("pointermove", moveListener);
// Drag mostly horizontally but also slightly vertically. If the
// touch-action were not respected due to a bug this might result

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

@ -60,8 +60,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=982141
"expected a content paint with sequence number" + lastCompositorPaintSeqNo);
var correspondingContentPaint = contentTestData.paints[lastCompositorPaintSeqNo];
var dp = getPropertyAsRect(correspondingContentPaint, childScrollId, 'displayport');
var subframe = document.getElementById('subframe');
var dp = getPropertyAsRect(correspondingContentPaint, childScrollId, "displayport");
var subframe = document.getElementById("subframe");
// The clientWidth and clientHeight may be less than 50 if there are scrollbars showing.
// In general they will be (50 - <scrollbarwidth>, 50 - <scrollbarheight>).
SimpleTest.ok(subframe.clientWidth > 0, "Expected a non-zero clientWidth, got: " + subframe.clientWidth);

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

@ -10,23 +10,23 @@
<script type="application/javascript">
function* clickButton(testDriver) {
document.addEventListener('click', clicked);
document.addEventListener("click", clicked);
if (getQueryArgs()['dtc']) {
if (getQueryArgs().dtc) {
// force a dispatch-to-content region on the document
document.addEventListener('wheel', function() { /* no-op */ }, { passive: false });
document.addEventListener("wheel", function() { /* no-op */ }, { passive: false });
yield waitForAllPaints(function() {
flushApzRepaints(testDriver);
});
}
synthesizeNativeClick(document.getElementById('b'), 5, 5, function() {
synthesizeNativeClick(document.getElementById("b"), 5, 5, function() {
dump("Finished synthesizing click, waiting for button to be clicked...\n");
});
}
function clicked(e) {
is(e.target, document.getElementById('b'), "Clicked on button, yay! (at " + e.clientX + "," + e.clientY + ")");
is(e.target, document.getElementById("b"), "Clicked on button, yay! (at " + e.clientX + "," + e.clientY + ")");
subtestDone();
}

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

@ -11,18 +11,18 @@
function scrollOuter() {
var transformEnd = function() {
SpecialPowers.Services.obs.removeObserver(transformEnd, "APZ:TransformEnd", false);
SpecialPowers.Services.obs.removeObserver(transformEnd, "APZ:TransformEnd");
dump("Transform complete; flushing repaints...\n");
flushApzRepaints(checkScroll);
};
SpecialPowers.Services.obs.addObserver(transformEnd, "APZ:TransformEnd");
synthesizeNativeTouchDrag(document.getElementById('outer'), 10, 100, 0, -50);
synthesizeNativeTouchDrag(document.getElementById("outer"), 10, 100, 0, -50);
dump("Finished native drag, waiting for transform-end observer...\n");
}
function checkScroll() {
var outerScroll = document.getElementById('outer').scrollTop;
var outerScroll = document.getElementById("outer").scrollTop;
is(outerScroll, 50, "check that the div scrolled");
subtestDone();
}

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

@ -10,25 +10,25 @@
<script type="application/javascript">
function* test(testDriver) {
document.addEventListener('click', clicked);
document.addEventListener("click", clicked);
// Ensure the pointer is inside the window
yield synthesizeNativeMouseEvent(document.getElementById('b'), 5, 5, nativeMouseMoveEventMsg(), testDriver);
yield synthesizeNativeMouseEvent(document.getElementById("b"), 5, 5, nativeMouseMoveEventMsg(), testDriver);
// mouse down, move it around, and release it near where it went down. this
// should generate a click at the release point
yield synthesizeNativeMouseEvent(document.getElementById('b'), 5, 5, nativeMouseDownEventMsg(), testDriver);
yield synthesizeNativeMouseEvent(document.getElementById('b'), 100, 100, nativeMouseMoveEventMsg(), testDriver);
yield synthesizeNativeMouseEvent(document.getElementById('b'), 10, 10, nativeMouseMoveEventMsg(), testDriver);
yield synthesizeNativeMouseEvent(document.getElementById('b'), 8, 8, nativeMouseUpEventMsg(), testDriver);
yield synthesizeNativeMouseEvent(document.getElementById("b"), 5, 5, nativeMouseDownEventMsg(), testDriver);
yield synthesizeNativeMouseEvent(document.getElementById("b"), 100, 100, nativeMouseMoveEventMsg(), testDriver);
yield synthesizeNativeMouseEvent(document.getElementById("b"), 10, 10, nativeMouseMoveEventMsg(), testDriver);
yield synthesizeNativeMouseEvent(document.getElementById("b"), 8, 8, nativeMouseUpEventMsg(), testDriver);
dump("Finished synthesizing click with a drag in the middle\n");
}
function clicked(e) {
// The mouse down at (5, 5) should not have generated a click, but the up
// at (8, 8) should have.
is(e.target, document.getElementById('b'), "Clicked on button, yay! (at " + e.clientX + "," + e.clientY + ")");
is(e.clientX, 8 + Math.floor(document.getElementById('b').getBoundingClientRect().left), 'x-coord of click event looks sane');
is(e.clientY, 8 + Math.floor(document.getElementById('b').getBoundingClientRect().top), 'y-coord of click event looks sane');
is(e.target, document.getElementById("b"), "Clicked on button, yay! (at " + e.clientX + "," + e.clientY + ")");
is(e.clientX, 8 + Math.floor(document.getElementById("b").getBoundingClientRect().left), "x-coord of click event looks sane");
is(e.clientY, 8 + Math.floor(document.getElementById("b").getBoundingClientRect().top), "y-coord of click event looks sane");
subtestDone();
}

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

@ -41,15 +41,15 @@ function moveTo(mouseY, testDriver) {
}
function setupDragging(testDriver) {
bar = document.getElementById('scrollbar');
bar = document.getElementById("scrollbar");
mouseDown = false;
bar.addEventListener('mousedown', function(e) {
bar.addEventListener("mousedown", function(e) {
mouseDown = true;
moveTo(e.clientY, testDriver);
}, true);
bar.addEventListener('mousemove', function(e) {
bar.addEventListener("mousemove", function(e) {
if (mouseDown) {
dump("Got mousemove clientY " + e.clientY + "\n");
moveTo(e.clientY, testDriver);
@ -57,11 +57,11 @@ function setupDragging(testDriver) {
}
}, true);
bar.addEventListener('mouseup', function(e) {
bar.addEventListener("mouseup", function(e) {
mouseDown = false;
}, true);
window.addEventListener('mousemove', function(e) {
window.addEventListener("mousemove", function(e) {
if (mouseDown) {
ok(false, "The mousemove at " + e.clientY + " was not stopped by the bar listener, and is a glitchy event!");
setTimeout(testDriver, 0);

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

@ -32,7 +32,7 @@
function* test(testDriver) {
SpecialPowers.Services.obs.addObserver(testDriver, "APZ:TransformEnd");
yield synthesizeNativeTouchDrag(document.body, 10, 10, -2000, 0);
SpecialPowers.Services.obs.removeObserver(testDriver, "APZ:TransformEnd", false);
SpecialPowers.Services.obs.removeObserver(testDriver, "APZ:TransformEnd");
yield waitForApzFlushedRepaints(testDriver);
@ -41,7 +41,7 @@
// why and/or rewrite this test entirely.
SpecialPowers.Services.obs.addObserver(testDriver, "mouseevent");
yield synthesizeNativeClick(input, 10, 10, testDriver);
SpecialPowers.Services.obs.removeObserver(testDriver, "mouseevent", false);
SpecialPowers.Services.obs.removeObserver(testDriver, "mouseevent");
}
window.addEventListener("click", (e) => {
is(e.target, input, "got click");

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

@ -43,7 +43,7 @@
function* test(testDriver) {
var config = getHitTestConfig();
var subframe = document.getElementById('front');
var subframe = document.getElementById("front");
// Set a displayport to ensure the subframe is layerized.
// This is not required for exercising the behavior we want to test,
@ -53,7 +53,7 @@ function* test(testDriver) {
var subframeViewId = config.utils.getViewId(subframe);
var {hitInfo, scrollId} = hitTest(centerOf(subframe));
var {scrollId} = hitTest(centerOf(subframe));
is(scrollId, subframeViewId,
"hit the scroll frame behind the backface-visibility:hidden element");

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

@ -21,8 +21,8 @@ function* test(testDriver) {
var config = getHitTestConfig();
var utils = config.utils;
var scroller = document.getElementById('scroller');
var apzaware = document.getElementById('apzaware');
var scroller = document.getElementById("scroller");
var apzaware = document.getElementById("apzaware");
checkHitResult(hitTest(centerOf(scroller)),
APZHitResultFlags.VISIBLE | APZHitResultFlags.DISPATCH_TO_CONTENT,
@ -44,7 +44,7 @@ function* test(testDriver) {
expectedScrollId: utils.getViewId(document.scrollingElement),
trackLocation: ScrollbarTrackLocation.START,
expectThumb: true,
layerState: LayerState.INACTIVE
layerState: LayerState.INACTIVE,
});
// activate the scrollframe but keep the main-thread scroll position at 0.
@ -89,7 +89,7 @@ function* test(testDriver) {
expectedScrollId: scrollerViewId,
trackLocation: ScrollbarTrackLocation.START,
expectThumb: false,
layerState: LayerState.ACTIVE
layerState: LayerState.ACTIVE,
});
// bottom of scrollbar track (scrollthumb)
hitTestScrollbar({
@ -98,7 +98,7 @@ function* test(testDriver) {
expectedScrollId: scrollerViewId,
trackLocation: ScrollbarTrackLocation.END,
expectThumb: true,
layerState: LayerState.ACTIVE
layerState: LayerState.ACTIVE,
});
// left part of scrollbar track (has scrollthumb)
hitTestScrollbar({
@ -107,7 +107,7 @@ function* test(testDriver) {
expectedScrollId: scrollerViewId,
trackLocation: ScrollbarTrackLocation.START,
expectThumb: true,
layerState: LayerState.ACTIVE
layerState: LayerState.ACTIVE,
});
// right part of scrollbar track
hitTestScrollbar({
@ -116,7 +116,7 @@ function* test(testDriver) {
expectedScrollId: scrollerViewId,
trackLocation: ScrollbarTrackLocation.END,
expectThumb: false,
layerState: LayerState.ACTIVE
layerState: LayerState.ACTIVE,
});
subtestDone();

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

@ -21,7 +21,7 @@ function* test(testDriver) {
var config = getHitTestConfig();
var utils = config.utils;
var scroller = document.getElementById('scroller');
var scroller = document.getElementById("scroller");
// Activate the scrollframe but keep the main-thread scroll position at 0.
// Also apply an async scroll offset in the y-direction such that the

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

@ -68,11 +68,11 @@ function* test(testDriver) {
var utils = config.utils;
// layerize the scrollable frame
var subframe = document.querySelector('.subframe');
var subframe = document.querySelector(".subframe");
utils.setDisplayPortForElement(0, 0, 800, 2000, subframe, 1);
yield waitForApzFlushedRepaints(testDriver);
var target = document.querySelector('.absoluteClip');
var target = document.querySelector(".absoluteClip");
checkHitResult(hitTest(centerOf(target)),
APZHitResultFlags.VISIBLE,
utils.getViewId(subframe),

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

@ -38,12 +38,12 @@ function* test(testDriver) {
var utils = getHitTestConfig().utils;
hitTestScrollbar({
element: document.getElementById('subframe'),
element: document.getElementById("subframe"),
directions: { vertical: true },
expectedScrollId: utils.getViewId(document.scrollingElement),
trackLocation: ScrollbarTrackLocation.START,
expectThumb: true,
layerState: LayerState.INACTIVE
layerState: LayerState.INACTIVE,
});
subtestDone();

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

@ -38,12 +38,12 @@ function* test(testDriver) {
var utils = getHitTestConfig().utils;
hitTestScrollbar({
element: document.getElementById('subframe'),
element: document.getElementById("subframe"),
directions: { horizontal: true },
expectedScrollId: utils.getViewId(document.scrollingElement),
trackLocation: ScrollbarTrackLocation.START,
expectThumb: true,
layerState: LayerState.INACTIVE
layerState: LayerState.INACTIVE,
});
subtestDone();

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

@ -106,7 +106,7 @@
var config = getHitTestConfig();
function* test(testDriver) {
for (var scroller of document.querySelectorAll('.taBigBox > div')) {
for (var scroller of document.querySelectorAll(".taBigBox > div")) {
// layerize all the scrollable divs
config.utils.setDisplayPortForElement(0, 0, 100, 100, scroller, 1);
}
@ -115,7 +115,7 @@ function* test(testDriver) {
var scrollId = config.utils.getViewId(document.scrollingElement);
checkHitResult(
hitTest(centerOf('taNone')),
hitTest(centerOf("taNone")),
APZHitResultFlags.VISIBLE |
APZHitResultFlags.PAN_X_DISABLED |
APZHitResultFlags.PAN_Y_DISABLED |
@ -124,7 +124,7 @@ function* test(testDriver) {
scrollId,
"touch-action: none");
checkHitResult(
hitTest(centerOf('taInnerNonePanX')),
hitTest(centerOf("taInnerNonePanX")),
APZHitResultFlags.VISIBLE |
APZHitResultFlags.PAN_X_DISABLED |
APZHitResultFlags.PAN_Y_DISABLED |
@ -133,7 +133,7 @@ function* test(testDriver) {
scrollId,
"touch-action: pan-x inside touch-action: none");
checkHitResult(
hitTest(centerOf('taInnerNoneManip')),
hitTest(centerOf("taInnerNoneManip")),
APZHitResultFlags.VISIBLE |
APZHitResultFlags.PAN_X_DISABLED |
APZHitResultFlags.PAN_Y_DISABLED |
@ -143,7 +143,7 @@ function* test(testDriver) {
"touch-action: manipulation inside touch-action: none");
checkHitResult(
hitTest(centerOf('taPanX')),
hitTest(centerOf("taPanX")),
APZHitResultFlags.VISIBLE |
APZHitResultFlags.PAN_Y_DISABLED |
APZHitResultFlags.PINCH_ZOOM_DISABLED |
@ -151,7 +151,7 @@ function* test(testDriver) {
scrollId,
"touch-action: pan-x");
checkHitResult(
hitTest(centerOf('taInnerPanXY')),
hitTest(centerOf("taInnerPanXY")),
APZHitResultFlags.VISIBLE |
APZHitResultFlags.PAN_X_DISABLED |
APZHitResultFlags.PAN_Y_DISABLED |
@ -160,7 +160,7 @@ function* test(testDriver) {
scrollId,
"touch-action: pan-y inside touch-action: pan-x");
checkHitResult(
hitTest(centerOf('taInnerPanXManip')),
hitTest(centerOf("taInnerPanXManip")),
APZHitResultFlags.VISIBLE |
APZHitResultFlags.PAN_Y_DISABLED |
APZHitResultFlags.PINCH_ZOOM_DISABLED |
@ -169,7 +169,7 @@ function* test(testDriver) {
"touch-action: manipulation inside touch-action: pan-x");
checkHitResult(
hitTest(centerOf('taPanY')),
hitTest(centerOf("taPanY")),
APZHitResultFlags.VISIBLE |
APZHitResultFlags.PAN_X_DISABLED |
APZHitResultFlags.PINCH_ZOOM_DISABLED |
@ -177,7 +177,7 @@ function* test(testDriver) {
scrollId,
"touch-action: pan-y");
checkHitResult(
hitTest(centerOf('taInnerPanYX')),
hitTest(centerOf("taInnerPanYX")),
APZHitResultFlags.VISIBLE |
APZHitResultFlags.PAN_X_DISABLED |
APZHitResultFlags.PAN_Y_DISABLED |
@ -186,7 +186,7 @@ function* test(testDriver) {
scrollId,
"touch-action: pan-x inside touch-action: pan-y");
checkHitResult(
hitTest(centerOf('taInnerPanYY')),
hitTest(centerOf("taInnerPanYY")),
APZHitResultFlags.VISIBLE |
APZHitResultFlags.PAN_X_DISABLED |
APZHitResultFlags.PINCH_ZOOM_DISABLED |
@ -195,14 +195,14 @@ function* test(testDriver) {
"touch-action: pan-y inside touch-action: pan-y");
checkHitResult(
hitTest(centerOf('taPanXY')),
hitTest(centerOf("taPanXY")),
APZHitResultFlags.VISIBLE |
APZHitResultFlags.PINCH_ZOOM_DISABLED |
APZHitResultFlags.DOUBLE_TAP_ZOOM_DISABLED,
scrollId,
"touch-action: pan-x pan-y");
checkHitResult(
hitTest(centerOf('taInnerPanXYNone')),
hitTest(centerOf("taInnerPanXYNone")),
APZHitResultFlags.VISIBLE |
APZHitResultFlags.PAN_X_DISABLED |
APZHitResultFlags.PAN_Y_DISABLED |
@ -212,13 +212,13 @@ function* test(testDriver) {
"touch-action: none inside touch-action: pan-x pan-y");
checkHitResult(
hitTest(centerOf('taManip')),
hitTest(centerOf("taManip")),
APZHitResultFlags.VISIBLE |
APZHitResultFlags.DOUBLE_TAP_ZOOM_DISABLED,
scrollId,
"touch-action: manipulation");
checkHitResult(
hitTest(centerOf('taInnerManipPanX')),
hitTest(centerOf("taInnerManipPanX")),
APZHitResultFlags.VISIBLE |
APZHitResultFlags.PAN_Y_DISABLED |
APZHitResultFlags.PINCH_ZOOM_DISABLED |
@ -226,7 +226,7 @@ function* test(testDriver) {
scrollId,
"touch-action: pan-x inside touch-action: manipulation");
checkHitResult(
hitTest(centerOf('taInnerManipNone')),
hitTest(centerOf("taInnerManipNone")),
APZHitResultFlags.VISIBLE |
APZHitResultFlags.PAN_X_DISABLED |
APZHitResultFlags.PAN_Y_DISABLED |
@ -235,7 +235,7 @@ function* test(testDriver) {
scrollId,
"touch-action: none inside touch-action: manipulation");
checkHitResult(
hitTest(centerOf('taInnerManipListener')),
hitTest(centerOf("taInnerManipListener")),
APZHitResultFlags.VISIBLE |
APZHitResultFlags.DISPATCH_TO_CONTENT |
APZHitResultFlags.DOUBLE_TAP_ZOOM_DISABLED,
@ -243,13 +243,13 @@ function* test(testDriver) {
"div with touch listener inside touch-action: manipulation");
checkHitResult(
hitTest(centerOf('taListener')),
hitTest(centerOf("taListener")),
APZHitResultFlags.VISIBLE |
APZHitResultFlags.DISPATCH_TO_CONTENT,
scrollId,
"div with touch listener");
checkHitResult(
hitTest(centerOf('taInnerListenerPanX')),
hitTest(centerOf("taInnerListenerPanX")),
APZHitResultFlags.VISIBLE |
APZHitResultFlags.DISPATCH_TO_CONTENT |
APZHitResultFlags.PAN_Y_DISABLED |
@ -259,42 +259,42 @@ function* test(testDriver) {
"touch-action: pan-x inside div with touch listener");
checkHitResult(
hitTest(centerOf('taScrollerPanY')),
hitTest(centerOf("taScrollerPanY")),
APZHitResultFlags.VISIBLE |
APZHitResultFlags.PAN_X_DISABLED |
APZHitResultFlags.PINCH_ZOOM_DISABLED |
APZHitResultFlags.DOUBLE_TAP_ZOOM_DISABLED,
config.utils.getViewId(document.getElementById('taScrollerPanY')),
config.utils.getViewId(document.getElementById("taScrollerPanY")),
"touch-action: pan-y on scroller");
checkHitResult(
hitTest(centerOf('taScroller')),
hitTest(centerOf("taScroller")),
APZHitResultFlags.VISIBLE |
APZHitResultFlags.PAN_X_DISABLED |
APZHitResultFlags.PINCH_ZOOM_DISABLED |
APZHitResultFlags.DOUBLE_TAP_ZOOM_DISABLED,
config.utils.getViewId(document.getElementById('taScroller')),
config.utils.getViewId(document.getElementById("taScroller")),
"touch-action: pan-y on div inside scroller");
checkHitResult(
hitTest(centerOf('taScroller2')),
hitTest(centerOf("taScroller2")),
APZHitResultFlags.VISIBLE |
APZHitResultFlags.PINCH_ZOOM_DISABLED |
APZHitResultFlags.DOUBLE_TAP_ZOOM_DISABLED,
config.utils.getViewId(document.getElementById('taScroller2')),
config.utils.getViewId(document.getElementById("taScroller2")),
"zooming restrictions from pan-x outside scroller get inherited in");
checkHitResult(
hitTest(centerOf('taScrollerPanX')),
hitTest(centerOf("taScrollerPanX")),
APZHitResultFlags.VISIBLE |
APZHitResultFlags.PAN_Y_DISABLED |
APZHitResultFlags.PINCH_ZOOM_DISABLED |
APZHitResultFlags.DOUBLE_TAP_ZOOM_DISABLED,
config.utils.getViewId(document.getElementById('taScrollerPanX')),
config.utils.getViewId(document.getElementById("taScrollerPanX")),
"touch-action: pan-x on scroller inside manipulation");
checkHitResult(
hitTest(centerOf('taScroller3')),
hitTest(centerOf("taScroller3")),
APZHitResultFlags.VISIBLE |
APZHitResultFlags.DOUBLE_TAP_ZOOM_DISABLED,
config.utils.getViewId(document.getElementById('taScroller3')),
config.utils.getViewId(document.getElementById("taScroller3")),
"touch-action: manipulation outside scroller gets inherited in");
}

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

@ -10,9 +10,9 @@
<script type="application/javascript">
function scrollOuter() {
var outer = document.getElementById('outer');
var outer = document.getElementById("outer");
var transformEnd = function() {
SpecialPowers.Services.obs.removeObserver(transformEnd, "APZ:TransformEnd", false);
SpecialPowers.Services.obs.removeObserver(transformEnd, "APZ:TransformEnd");
dump("Transform complete; flushing repaints...\n");
flushApzRepaints(checkScroll, outer.contentWindow);
};
@ -23,7 +23,7 @@ function scrollOuter() {
}
function checkScroll() {
var outerScroll = document.getElementById('outer').contentWindow.scrollY;
var outerScroll = document.getElementById("outer").contentWindow.scrollY;
if (getPlatform() == "windows") {
// On windows, because we run this test with native event synthesization,
// Windows can end up eating the first touchmove which can result in the

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

@ -33,7 +33,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1383365
// current focus state at page load.
window.addEventListener("scroll", waitForScrollBottom);
window.synthesizeKey("KEY_End");
};
}
function waitForScrollBottom() {
if (window.scrollY < window.scrollMaxY) {
@ -53,14 +53,14 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1383365
// Wait for the APZ to reach a stable state as well, before dispatching
// the next key input or the default action won't occur.
waitForApzFlushedRepaints(function () {
waitForApzFlushedRepaints(function() {
is(checkHasAsyncKeyScrolled(false), false, "expected no async key scrolling before KEY_Home dispatch");
// This scroll should be asynchronous now that the focus state is up to date.
window.addEventListener("scroll", waitForScrollTop);
window.synthesizeKey("KEY_Home");
});
};
}
function waitForScrollTop() {
if (window.scrollY > 0) {
@ -70,11 +70,11 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1383365
window.removeEventListener("scroll", waitForScrollTop);
// Wait for APZ to settle and then check that async scrolling happened.
waitForApzFlushedRepaints(function () {
waitForApzFlushedRepaints(function() {
is(checkHasAsyncKeyScrolled(true), true, "expected async key scrolling after test");
subtestDone();
});
};
}
function checkHasAsyncKeyScrolled(requirePaints) {
// Get the compositor-side test data from nsIDOMWindowUtils.
@ -101,10 +101,10 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1383365
if (rcd) {
return rcd.hasAsyncKeyScrolled === "1";
} else {
SimpleTest.info("Last paint rcd is null");
return false;
}
SimpleTest.info("Last paint rcd is null");
return false;
}
waitUntilApzStable().then(forceLayerTreeToCompositor).then(runTests);

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

@ -10,7 +10,7 @@
<script type="application/javascript">
function longPressLink() {
synthesizeNativeTouch(document.getElementById('b'), 5, 5, SpecialPowers.DOMWindowUtils.TOUCH_CONTACT, function() {
synthesizeNativeTouch(document.getElementById("b"), 5, 5, SpecialPowers.DOMWindowUtils.TOUCH_CONTACT, function() {
dump("Finished synthesizing touch-start, waiting for events...\n");
});
}
@ -22,14 +22,14 @@ function recordEvent(e) {
// by APZ, and that's what we use as the trigger to lift the finger. That then
// triggers the contextmenu. This matches the platform convention.
switch (eventsFired) {
case 0: is(e.type, 'touchstart', 'Got a touchstart'); break;
case 0: is(e.type, "touchstart", "Got a touchstart"); break;
case 1:
is(e.type, 'mouselongtap', 'Got a mouselongtap');
synthesizeNativeTouch(document.getElementById('b'), 5, 5, SpecialPowers.DOMWindowUtils.TOUCH_REMOVE);
is(e.type, "mouselongtap", "Got a mouselongtap");
synthesizeNativeTouch(document.getElementById("b"), 5, 5, SpecialPowers.DOMWindowUtils.TOUCH_REMOVE);
break;
case 2: is(e.type, 'touchend', 'Got a touchend'); break;
case 3: is(e.type, 'contextmenu', 'Got a contextmenu'); e.preventDefault(); break;
default: ok(false, 'Got an unexpected event of type ' + e.type); break;
case 2: is(e.type, "touchend", "Got a touchend"); break;
case 3: is(e.type, "contextmenu", "Got a contextmenu"); e.preventDefault(); break;
default: ok(false, "Got an unexpected event of type " + e.type); break;
}
eventsFired++;
@ -45,15 +45,15 @@ function recordEvent(e) {
// been detected. Since we prevent-default that, we don't get a mouselongtap
// event at all, and instead get a touchcancel.
switch (eventsFired) {
case 0: is(e.type, 'touchstart', 'Got a touchstart'); break;
case 1: is(e.type, 'contextmenu', 'Got a contextmenu'); e.preventDefault(); break;
case 2: is(e.type, 'touchcancel', 'Got a touchcancel'); break;
default: ok(false, 'Got an unexpected event of type ' + e.type); break;
case 0: is(e.type, "touchstart", "Got a touchstart"); break;
case 1: is(e.type, "contextmenu", "Got a contextmenu"); e.preventDefault(); break;
case 2: is(e.type, "touchcancel", "Got a touchcancel"); break;
default: ok(false, "Got an unexpected event of type " + e.type); break;
}
eventsFired++;
if (eventsFired == 3) {
synthesizeNativeTouch(document.getElementById('b'), 5, 5, SpecialPowers.DOMWindowUtils.TOUCH_REMOVE, function() {
synthesizeNativeTouch(document.getElementById("b"), 5, 5, SpecialPowers.DOMWindowUtils.TOUCH_REMOVE, function() {
dump("Finished synthesizing touch-end, doing an APZ flush to see if any more unexpected events come through...\n");
flushApzRepaints(function() {
dump("Done APZ flush, ending test...\n");
@ -64,11 +64,11 @@ function recordEvent(e) {
}
}
window.addEventListener('touchstart', recordEvent, { passive: true, capture: true });
window.addEventListener('touchend', recordEvent, { passive: true, capture: true });
window.addEventListener('touchcancel', recordEvent, true);
window.addEventListener('contextmenu', recordEvent, true);
SpecialPowers.addChromeEventListener('mouselongtap', recordEvent, true);
window.addEventListener("touchstart", recordEvent, { passive: true, capture: true });
window.addEventListener("touchend", recordEvent, { passive: true, capture: true });
window.addEventListener("touchcancel", recordEvent, true);
window.addEventListener("contextmenu", recordEvent, true);
SpecialPowers.addChromeEventListener("mouselongtap", recordEvent, true);
waitUntilApzStable()
.then(longPressLink);

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

@ -12,7 +12,7 @@
// Add a non-passive listener on the document, so that we have a document-level
// APZ-aware listener, and the entire document is put in the dispatch-to-content
// region
document.addEventListener('wheel', function(e) {
document.addEventListener("wheel", function(e) {
dump("Wheel listener running...\n");
// spin for 2 seconds to give APZ time to scroll, if the event region override
@ -30,7 +30,7 @@ document.addEventListener('wheel', function(e) {
setTimeout(function() {
flushApzRepaints(checkScroll);
}, 0);
}, false);
});
function scrollPage() {
synthesizeNativeWheel(document.body, 100, 100, 0, -50);

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

@ -7,11 +7,11 @@
<script type="application/javascript">
function* test(testDriver) {
var subframe = document.getElementById('scroll');
var subframe = document.getElementById("scroll");
// scroll over the middle of the subframe, and make sure that the page
// does not scroll.
var waitForScroll = false; // don't wait for a scroll event, it will never come
var waitForScroll = false; // don't wait for a scroll event, it will never come
yield moveMouseAndScrollWheelOver(subframe, 100, 100, testDriver, waitForScroll);
ok(window.scrollY == 0, "overscroll-behavior was respected");
}

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

@ -34,7 +34,7 @@ function* test(testDriver) {
var config = getHitTestConfig();
var utils = config.utils;
var subframe = document.getElementById('subframe');
var subframe = document.getElementById("subframe");
// Activate the scrollframe but keep the main-thread scroll position at 0.
// Also apply an async scroll offset in the y-direction large enough
@ -65,7 +65,7 @@ function* test(testDriver) {
// Scroll over the subframe, and make sure that the page does not scroll,
// i.e. overscroll-behavior is respected.
var waitForScroll = false; // don't wait for a scroll event, it will never come
var waitForScroll = false; // don't wait for a scroll event, it will never come
yield moveMouseAndScrollWheelOver(subframe, 50, 50, testDriver, waitForScroll);
ok(window.scrollY == 0, "overscroll-behavior was respected");

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

@ -13,9 +13,8 @@
<script type="application/javascript">
function* test(testDriver) {
var iframe = document.getElementById('scroll');
var iframe = document.getElementById("scroll");
var iframeWindow = iframe.contentWindow;
var iframeContent = iframeWindow.document.documentElement;
// scroll the iframe to the bottom, such that a subsequent scroll on it
// _would_ hand off to the page if overscroll-behavior allowed it

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

@ -7,7 +7,7 @@
<script type="application/javascript">
function* test(testDriver) {
var subframe = document.getElementById('scroll');
var subframe = document.getElementById("scroll");
// scroll over the middle of the subframe, to make sure it scrolls,
// not the page

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

@ -7,7 +7,7 @@
<script type="application/javascript">
function* test(testDriver) {
var subframe = document.getElementById('scroll');
var subframe = document.getElementById("scroll");
// scroll over the middle of the subframe, and make sure that it scrolls,
// not the page

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

@ -7,7 +7,7 @@
<script type="application/javascript">
function* test(testDriver) {
var iframeWin = document.getElementById('iframe').contentWindow;
var iframeWin = document.getElementById("iframe").contentWindow;
// scroll over the middle of the iframe's position:sticky element, check
// that it scrolls the iframe
@ -21,7 +21,7 @@ function* test(testDriver) {
ok(iframeWin.scrollY > scrollPos, "iframe scrolled after wheeling over the position:fixed element");
// same, but scrolling the scrollable frame *inside* the position:fixed item
var fpos = document.getElementById('fpos_scrollable');
var fpos = document.getElementById("fpos_scrollable");
scrollPos = fpos.scrollTop;
yield moveMouseAndScrollWheelOver(fpos, 50, 150, testDriver);
ok(fpos.scrollTop > scrollPos, "scrollable item inside fixed-pos element scrolled");

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

@ -7,7 +7,7 @@
<script type="application/javascript">
function* test(testDriver) {
var subframe = document.getElementById('scroll');
var subframe = document.getElementById("scroll");
// scroll over the scrollbar, and make sure the subframe scrolls
var scrollPos = subframe.scrollTop;

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

@ -5,7 +5,7 @@
<script type="application/javascript" src="/tests/SimpleTest/paint_listener.js"></script>
<script type="application/javascript">
function* test(testDriver) {
var subframe = document.getElementById('content-wrapper');
var subframe = document.getElementById("content-wrapper");
// scroll over the middle of the subframe, to make sure it scrolls,
// not the page

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

@ -26,7 +26,7 @@ function* test(testDriver) {
// like. However if any bugfixes are made to that function this code might
// need to be updated as well.
var scrollableDiv = document.getElementById('scrollable');
var scrollableDiv = document.getElementById("scrollable");
var boundingClientRect = scrollableDiv.getBoundingClientRect();
var verticalScrollbarWidth = boundingClientRect.width - scrollableDiv.clientWidth;
if (verticalScrollbarWidth == 0) {
@ -35,7 +35,7 @@ function* test(testDriver) {
}
// register a scroll listener for the initial drag
scrollableDiv.addEventListener('scroll', () => setTimeout(testDriver, 0), {once: true});
scrollableDiv.addEventListener("scroll", () => setTimeout(testDriver, 0), {once: true});
var upArrowHeight = verticalScrollbarWidth; // assume square scrollbar buttons
var mouseX = scrollableDiv.clientWidth + (verticalScrollbarWidth / 2);
@ -61,7 +61,7 @@ function* test(testDriver) {
// the mouse to. This allows us to wait for a scroll event in either case.
// If we only triggered the snapback case then waiting for the scroll to
// "not happen" in the other case would be more error-prone.
scrollableDiv.addEventListener('scroll', () => setTimeout(testDriver, 0), {once: true});
scrollableDiv.addEventListener("scroll", () => setTimeout(testDriver, 0), {once: true});
// Add 2 to snapMultipler just to make sure we get far enough away from the scrollbar
var snapBackDistance = (snapMultiplier + 2) * verticalScrollbarWidth;
yield synthesizeNativeMouseEvent(scrollableDiv, mouseX + snapBackDistance, mouseY + 10, nativeMouseMoveEventMsg(), testDriver);
@ -76,7 +76,7 @@ function* test(testDriver) {
// Now we move the mouse back to the old position to ensure the scroll position
// gets restored properly
scrollableDiv.addEventListener('scroll', () => setTimeout(testDriver, 0), {once: true});
scrollableDiv.addEventListener("scroll", () => setTimeout(testDriver, 0), {once: true});
yield synthesizeNativeMouseEvent(scrollableDiv, mouseX, mouseY, nativeMouseMoveEventMsg(), testDriver);
// wait here until the scroll happens

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

@ -24,7 +24,7 @@ function startTest() {
// by ensuring the document element did not get painted.
var utils = window.opener.SpecialPowers.getDOMWindowUtils(window);
var elem = document.documentElement;
var skipping = location.search == '?true';
var skipping = location.search == "?true";
utils.checkAndClearPaintedState(elem);
window.scrollTo(0, 20);
waitForAllPaints(function() {
@ -38,15 +38,15 @@ function startTest() {
}
function clickButton() {
document.addEventListener('click', clicked);
document.addEventListener("click", clicked);
synthesizeNativeTap(document.getElementById('b'), 5, 5, function() {
synthesizeNativeTap(document.getElementById("b"), 5, 5, function() {
dump("Finished synthesizing tap, waiting for button to be clicked...\n");
});
}
function clicked(e) {
is(e.target, document.getElementById('b'), "Clicked on button, yay! (at " + e.clientX + "," + e.clientY + ")");
is(e.target, document.getElementById("b"), "Clicked on button, yay! (at " + e.clientX + "," + e.clientY + ")");
subtestDone();
}

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

@ -10,15 +10,15 @@
<script type="application/javascript">
function clickButton() {
document.addEventListener('click', clicked);
document.addEventListener("click", clicked);
synthesizeNativeTap(document.getElementById('b'), 5, 5, function() {
synthesizeNativeTap(document.getElementById("b"), 5, 5, function() {
dump("Finished synthesizing tap, waiting for button to be clicked...\n");
});
}
function clicked(e) {
is(e.target, document.getElementById('b'), "Clicked on button, yay! (at " + e.clientX + "," + e.clientY + ")");
is(e.target, document.getElementById("b"), "Clicked on button, yay! (at " + e.clientX + "," + e.clientY + ")");
subtestDone();
}

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

@ -12,7 +12,7 @@
var touchdownTime;
function longPressLink() {
synthesizeNativeTouch(document.getElementById('b'), 5, 5, SpecialPowers.DOMWindowUtils.TOUCH_CONTACT, function() {
synthesizeNativeTouch(document.getElementById("b"), 5, 5, SpecialPowers.DOMWindowUtils.TOUCH_CONTACT, function() {
dump("Finished synthesizing touch-start, waiting for events...\n");
});
}
@ -21,7 +21,7 @@ var touchstartReceived = false;
function recordEvent(e) {
if (!touchstartReceived) {
touchstartReceived = true;
is(e.type, 'touchstart', 'Got a touchstart');
is(e.type, "touchstart", "Got a touchstart");
e.preventDefault(); // should be a no-op because it's a passive listener
return;
}
@ -34,24 +34,24 @@ function recordEvent(e) {
// not to wait for the content response, which is the desired behaviour, since
// the touchstart listener was registered as a passive listener.
if (getPlatform() == "windows") {
is(e.type, 'mouselongtap', 'Got a mouselongtap');
is(e.type, "mouselongtap", "Got a mouselongtap");
} else {
is(e.type, 'contextmenu', 'Got a contextmenu');
is(e.type, "contextmenu", "Got a contextmenu");
}
e.preventDefault();
synthesizeNativeTouch(document.getElementById('b'), 5, 5, SpecialPowers.DOMWindowUtils.TOUCH_REMOVE, function() {
synthesizeNativeTouch(document.getElementById("b"), 5, 5, SpecialPowers.DOMWindowUtils.TOUCH_REMOVE, function() {
dump("Finished synthesizing touch-end to clear state; finishing test...\n");
subtestDone();
});
}
// Note, not passing 'passive'.
window.addEventListener('touchstart', recordEvent, { capture: true });
window.addEventListener("touchstart", recordEvent, { capture: true });
if (getPlatform() == "windows") {
SpecialPowers.addChromeEventListener('mouselongtap', recordEvent, true);
SpecialPowers.addChromeEventListener("mouselongtap", recordEvent, true);
} else {
window.addEventListener('contextmenu', recordEvent, true);
window.addEventListener("contextmenu", recordEvent, true);
}
waitUntilApzStable()

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

@ -10,15 +10,15 @@
<script type="application/javascript">
function clickButton() {
document.addEventListener('click', clicked);
document.addEventListener("click", clicked);
synthesizeNativeTap(document.getElementById('b'), 5, 5, function() {
synthesizeNativeTap(document.getElementById("b"), 5, 5, function() {
dump("Finished synthesizing tap, waiting for button to be clicked...\n");
});
}
function clicked(e) {
is(e.target, document.getElementById('b'), "Clicked on button, yay! (at " + e.clientX + "," + e.clientY + ")");
is(e.target, document.getElementById("b"), "Clicked on button, yay! (at " + e.clientX + "," + e.clientY + ")");
subtestDone();
}

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

@ -12,7 +12,7 @@
var touchdownTime;
function longPressLink() {
synthesizeNativeTouch(document.getElementById('b'), 5, 5, SpecialPowers.DOMWindowUtils.TOUCH_CONTACT, function() {
synthesizeNativeTouch(document.getElementById("b"), 5, 5, SpecialPowers.DOMWindowUtils.TOUCH_CONTACT, function() {
dump("Finished synthesizing touch-start, waiting for events...\n");
});
}
@ -21,7 +21,7 @@ var touchstartReceived = false;
function recordEvent(e) {
if (!touchstartReceived) {
touchstartReceived = true;
is(e.type, 'touchstart', 'Got a touchstart');
is(e.type, "touchstart", "Got a touchstart");
e.preventDefault(); // should be a no-op because it's a passive listener
return;
}
@ -34,23 +34,23 @@ function recordEvent(e) {
// not to wait for the content response, which is the desired behaviour, since
// the touchstart listener was registered as a passive listener.
if (getPlatform() == "windows") {
is(e.type, 'mouselongtap', 'Got a mouselongtap');
is(e.type, "mouselongtap", "Got a mouselongtap");
} else {
is(e.type, 'contextmenu', 'Got a contextmenu');
is(e.type, "contextmenu", "Got a contextmenu");
}
e.preventDefault();
synthesizeNativeTouch(document.getElementById('b'), 5, 5, SpecialPowers.DOMWindowUtils.TOUCH_REMOVE, function() {
synthesizeNativeTouch(document.getElementById("b"), 5, 5, SpecialPowers.DOMWindowUtils.TOUCH_REMOVE, function() {
dump("Finished synthesizing touch-end to clear state; finishing test...\n");
subtestDone();
});
}
window.addEventListener('touchstart', recordEvent, { passive: true, capture: true });
window.addEventListener("touchstart", recordEvent, { passive: true, capture: true });
if (getPlatform() == "windows") {
SpecialPowers.addChromeEventListener('mouselongtap', recordEvent, true);
SpecialPowers.addChromeEventListener("mouselongtap", recordEvent, true);
} else {
window.addEventListener('contextmenu', recordEvent, true);
window.addEventListener("contextmenu", recordEvent, true);
}
waitUntilApzStable()

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

@ -15,9 +15,9 @@ function checkScroll(x, y, desc) {
}
function* test(testDriver) {
var target = document.getElementById('target');
var target = document.getElementById("target");
document.body.addEventListener('touchend', testDriver, { passive: true });
document.body.addEventListener("touchend", testDriver, { passive: true });
// drag the page up to scroll down by 50px
yield ok(synthesizeNativeTouchDrag(target, 10, 100, 0, -50),
@ -26,7 +26,7 @@ function* test(testDriver) {
checkScroll(0, 50, "After first vertical drag, with pan-y" );
// switch style to pan-x
document.body.style.touchAction = 'pan-x';
document.body.style.touchAction = "pan-x";
ok(true, "Waiting for pan-x to propagate...");
yield waitForAllPaintsFlushed(function() {
flushApzRepaints(testDriver);
@ -52,7 +52,7 @@ function* test(testDriver) {
checkScroll(10, 50, "After first diagonal drag, with pan-x");
// switch style back to pan-y
document.body.style.touchAction = 'pan-y';
document.body.style.touchAction = "pan-y";
ok(true, "Waiting for pan-y to propagate...");
yield waitForAllPaintsFlushed(function() {
flushApzRepaints(testDriver);
@ -66,7 +66,7 @@ function* test(testDriver) {
checkScroll(10, 10, "After second diagonal drag, with pan-y");
// switch style to none
document.body.style.touchAction = 'none';
document.body.style.touchAction = "none";
ok(true, "Waiting for none to propagate...");
yield waitForAllPaintsFlushed(function() {
flushApzRepaints(testDriver);
@ -79,7 +79,7 @@ function* test(testDriver) {
yield flushApzRepaints(testDriver);
checkScroll(10, 10, "After third diagonal drag, with none");
document.body.style.touchAction = 'manipulation';
document.body.style.touchAction = "manipulation";
ok(true, "Waiting for manipulation to propagate...");
yield waitForAllPaintsFlushed(function() {
flushApzRepaints(testDriver);

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

@ -20,7 +20,7 @@ function resetConfiguration(config, testDriver) {
var i = 0;
while (true) {
i++;
var element = document.getElementById('configuration_' + i);
var element = document.getElementById("configuration_" + i);
if (element == null) {
if (i <= config) {
ok(false, "The configuration requested was not encountered!");
@ -29,14 +29,14 @@ function resetConfiguration(config, testDriver) {
}
if (i == config) {
element.style.display = 'block';
element.style.display = "block";
} else {
element.style.display = 'none';
element.style.display = "none";
}
}
// Also reset the scroll position on the scrollframe
var s = document.getElementById('scrollframe');
var s = document.getElementById("scrollframe");
s.scrollLeft = 0;
s.scrollTop = 0;
@ -46,9 +46,9 @@ function resetConfiguration(config, testDriver) {
}
function* test(testDriver) {
var scrollframe = document.getElementById('scrollframe');
var scrollframe = document.getElementById("scrollframe");
document.body.addEventListener('touchend', testDriver, { passive: true });
document.body.addEventListener("touchend", testDriver, { passive: true });
// Helper function for the tests below.
// Touch-pan configuration |configuration| towards scroll offset (dx, dy) with
@ -67,42 +67,42 @@ function* test(testDriver) {
flushApzRepaints(testDriver);
});
// Check for expected scroll position
checkScroll(scrollframe, ex, ey, 'configuration ' + configuration + ' ' + desc);
checkScroll(scrollframe, ex, ey, "configuration " + configuration + " " + desc);
}
// Test configuration_1, which contains two sibling elements that are
// overlapping. The touch-action from the second sibling (which is on top)
// should be used for the overlapping area.
yield* scrollAndCheck(1, 25, 75, 20, 0, 20, 0, "first element horizontal scroll");
yield* scrollAndCheck(1, 25, 75, 0, 50, 0, 0, "first element vertical scroll");
yield* scrollAndCheck(1, 75, 75, 50, 0, 0, 0, "overlap horizontal scroll");
yield* scrollAndCheck(1, 75, 75, 0, 50, 0, 50, "overlap vertical scroll");
yield* scrollAndCheck(1, 125, 75, 20, 0, 0, 0, "second element horizontal scroll");
yield* scrollAndCheck(1, 125, 75, 0, 50, 0, 50, "second element vertical scroll");
yield* scrollAndCheck(1, 25, 75, 20, 0, 20, 0, "first element horizontal scroll");
yield* scrollAndCheck(1, 25, 75, 0, 50, 0, 0, "first element vertical scroll");
yield* scrollAndCheck(1, 75, 75, 50, 0, 0, 0, "overlap horizontal scroll");
yield* scrollAndCheck(1, 75, 75, 0, 50, 0, 50, "overlap vertical scroll");
yield* scrollAndCheck(1, 125, 75, 20, 0, 0, 0, "second element horizontal scroll");
yield* scrollAndCheck(1, 125, 75, 0, 50, 0, 50, "second element vertical scroll");
// Test configuration_2, which contains two overlapping elements with a
// parent/child relationship. The parent has pan-x and the child has pan-y,
// which means that panning on the parent should work horizontally only, and
// on the child no panning should occur at all.
yield* scrollAndCheck(2, 125, 125, 50, 50, 0, 0, "child scroll");
yield* scrollAndCheck(2, 75, 75, 50, 50, 0, 0, "overlap scroll");
yield* scrollAndCheck(2, 25, 75, 0, 50, 0, 0, "parent vertical scroll");
yield* scrollAndCheck(2, 75, 25, 50, 0, 50, 0, "parent horizontal scroll");
yield* scrollAndCheck(2, 125, 125, 50, 50, 0, 0, "child scroll");
yield* scrollAndCheck(2, 75, 75, 50, 50, 0, 0, "overlap scroll");
yield* scrollAndCheck(2, 25, 75, 0, 50, 0, 0, "parent vertical scroll");
yield* scrollAndCheck(2, 75, 25, 50, 0, 50, 0, "parent horizontal scroll");
// Test configuration_3, which is the same as configuration_2, except the child
// has a rotation transform applied. This forces the event regions on the two
// elements to be built separately and then get merged.
yield* scrollAndCheck(3, 125, 125, 50, 50, 0, 0, "child scroll");
yield* scrollAndCheck(3, 75, 75, 50, 50, 0, 0, "overlap scroll");
yield* scrollAndCheck(3, 25, 75, 0, 50, 0, 0, "parent vertical scroll");
yield* scrollAndCheck(3, 75, 25, 50, 0, 50, 0, "parent horizontal scroll");
yield* scrollAndCheck(3, 125, 125, 50, 50, 0, 0, "child scroll");
yield* scrollAndCheck(3, 75, 75, 50, 50, 0, 0, "overlap scroll");
yield* scrollAndCheck(3, 25, 75, 0, 50, 0, 0, "parent vertical scroll");
yield* scrollAndCheck(3, 75, 25, 50, 0, 50, 0, "parent horizontal scroll");
// Test configuration_4 has two elements, one above the other, not overlapping,
// and the second element is a child of the first. The parent has pan-x, the
// child has pan-y, but that means panning horizontally on the parent should
// work and panning in any direction on the child should not do anything.
yield* scrollAndCheck(4, 75, 75, 50, 50, 50, 0, "parent diagonal scroll");
yield* scrollAndCheck(4, 75, 150, 50, 50, 0, 0, "child diagonal scroll");
yield* scrollAndCheck(4, 75, 75, 50, 50, 50, 0, "parent diagonal scroll");
yield* scrollAndCheck(4, 75, 150, 50, 50, 0, 0, "child diagonal scroll");
}
waitUntilApzStable()

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

@ -15,7 +15,7 @@ function failure(e) {
function listener(callback) {
return function(e) {
ok(e.type == 'touchstart', "The touchstart event handler was triggered after snapshotting completed");
ok(e.type == "touchstart", "The touchstart event handler was triggered after snapshotting completed");
setTimeout(callback, 0);
};
}
@ -30,53 +30,54 @@ function listener(callback) {
// (in JSON string format) containing the counters.
// The 'end' invocation tears down the listeners, and should be invoked once
// at the end to clean up. Returns true on success, false on failure.
/* eslint-env mozilla/frame-script */
function chromeTouchEventCounter(operation) {
function chromeProcessCounter() {
addMessageListener('start', function() {
ChromeUtils.import('resource://gre/modules/Services.jsm');
var topWin = Services.wm.getMostRecentWindow('navigator:browser');
if (typeof topWin.eventCounts != 'undefined') {
dump('Found pre-existing eventCounts object on the top window!\n');
addMessageListener("start", function() {
ChromeUtils.import("resource://gre/modules/Services.jsm");
var topWin = Services.wm.getMostRecentWindow("navigator:browser");
if (typeof topWin.eventCounts != "undefined") {
dump("Found pre-existing eventCounts object on the top window!\n");
return false;
}
topWin.eventCounts = { 'touchstart': 0, 'touchmove': 0, 'touchend': 0 };
topWin.eventCounts = { "touchstart": 0, "touchmove": 0, "touchend": 0 };
topWin.counter = function(e) {
topWin.eventCounts[e.type]++;
}
};
topWin.addEventListener('touchstart', topWin.counter, { passive: true });
topWin.addEventListener('touchmove', topWin.counter, { passive: true });
topWin.addEventListener('touchend', topWin.counter, { passive: true });
topWin.addEventListener("touchstart", topWin.counter, { passive: true });
topWin.addEventListener("touchmove", topWin.counter, { passive: true });
topWin.addEventListener("touchend", topWin.counter, { passive: true });
return true;
});
addMessageListener('report', function() {
ChromeUtils.import('resource://gre/modules/Services.jsm');
var topWin = Services.wm.getMostRecentWindow('navigator:browser');
addMessageListener("report", function() {
ChromeUtils.import("resource://gre/modules/Services.jsm");
var topWin = Services.wm.getMostRecentWindow("navigator:browser");
return JSON.stringify(topWin.eventCounts);
});
addMessageListener('end', function() {
ChromeUtils.import('resource://gre/modules/Services.jsm');
var topWin = Services.wm.getMostRecentWindow('navigator:browser');
if (typeof topWin.eventCounts == 'undefined') {
dump('The eventCounts object was not found on the top window!\n');
addMessageListener("end", function() {
ChromeUtils.import("resource://gre/modules/Services.jsm");
var topWin = Services.wm.getMostRecentWindow("navigator:browser");
if (typeof topWin.eventCounts == "undefined") {
dump("The eventCounts object was not found on the top window!\n");
return false;
}
topWin.removeEventListener('touchstart', topWin.counter);
topWin.removeEventListener('touchmove', topWin.counter);
topWin.removeEventListener('touchend', topWin.counter);
topWin.removeEventListener("touchstart", topWin.counter);
topWin.removeEventListener("touchmove", topWin.counter);
topWin.removeEventListener("touchend", topWin.counter);
delete topWin.counter;
delete topWin.eventCounts;
return true;
});
}
if (typeof chromeTouchEventCounter.chromeHelper == 'undefined') {
if (typeof chromeTouchEventCounter.chromeHelper == "undefined") {
// This is the first time chromeTouchEventCounter is being called; do initialization
chromeTouchEventCounter.chromeHelper = SpecialPowers.loadChromeScript(chromeProcessCounter);
ApzCleanup.register(function() { chromeTouchEventCounter.chromeHelper.destroy() });
ApzCleanup.register(function() { chromeTouchEventCounter.chromeHelper.destroy(); });
}
return chromeTouchEventCounter.chromeHelper.sendSyncMessage(operation, "");
@ -87,7 +88,7 @@ function chromeTouchEventCounter(operation) {
// go by without the condition being satisfied.
function waitFor(eventType, count) {
var start = Date.now();
while (JSON.parse(chromeTouchEventCounter('report'))[eventType] != count) {
while (JSON.parse(chromeTouchEventCounter("report"))[eventType] != count) {
if (Date.now() - start > 10000) {
// It's taking too long, let's abort
return false;
@ -104,7 +105,7 @@ function RunAfterProcessedQueuedInputEvents(aCallback) {
function* test(testDriver) {
// The main part of this test should run completely before the child process'
// main-thread deals with the touch event, so check to make sure that happens.
document.body.addEventListener('touchstart', failure, { passive: true });
document.body.addEventListener("touchstart", failure, { passive: true });
// What we want here is to synthesize all of the touch events (from this code in
// the child process), and have the chrome process generate and process them,
@ -175,13 +176,13 @@ function* test(testDriver) {
// So, here we go...
// Set up the chrome process touch listener
ok(chromeTouchEventCounter('start'), "Chrome touch counter registered");
ok(chromeTouchEventCounter("start"), "Chrome touch counter registered");
// Set up the child process events and callbacks
var scroller = document.getElementById('scroller');
var scroller = document.getElementById("scroller");
synthesizeNativeTouch(scroller, 10, 110, SpecialPowers.DOMWindowUtils.TOUCH_CONTACT, null, 0);
RunAfterProcessedQueuedInputEvents(testDriver);
for (var i = 1; i < 10; i++) {
for (let i = 1; i < 10; i++) {
synthesizeNativeTouch(scroller, 10, 110 - (i * 10), SpecialPowers.DOMWindowUtils.TOUCH_CONTACT, null, 0);
RunAfterProcessedQueuedInputEvents(testDriver);
}
@ -197,12 +198,12 @@ function* test(testDriver) {
yield; // this will tell the chrome process to synthesize the touchstart event
// and then we wait to make sure it got processed:
ok(waitFor('touchstart', 1), "Touchstart processed in chrome process");
ok(waitFor("touchstart", 1), "Touchstart processed in chrome process");
// Loop through the touchmove events
for (var i = 1; i < 10; i++) {
for (let i = 1; i < 10; i++) {
yield;
ok(waitFor('touchmove', i), "Touchmove processed in chrome process");
ok(waitFor("touchmove", i), "Touchmove processed in chrome process");
// Take a snapshot after each touch move event. This forces
// a composite each time, even we don't get a vsync in this
@ -225,20 +226,20 @@ function* test(testDriver) {
// Wait for the touchend as well, to clear all pending testDriver resumes
yield;
ok(waitFor('touchend', 1), "Touchend processed in chrome process");
ok(waitFor("touchend", 1), "Touchend processed in chrome process");
// Clean up the chrome process hooks
chromeTouchEventCounter('end');
chromeTouchEventCounter("end");
// Now we are going to release our grip on the child process main thread,
// so that all the DOM events that were queued up can be processed. We
// register a touchstart listener to make sure this happens.
document.body.removeEventListener('touchstart', failure);
document.body.removeEventListener("touchstart", failure);
var listenerFunc = listener(testDriver);
document.body.addEventListener('touchstart', listenerFunc, { passive: true });
dump('done registering listener, going to yield\n');
document.body.addEventListener("touchstart", listenerFunc, { passive: true });
dump("done registering listener, going to yield\n");
yield;
document.body.removeEventListener('touchstart', listenerFunc);
document.body.removeEventListener("touchstart", listenerFunc);
}
if (SpecialPowers.isMainProcess()) {

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

@ -9,9 +9,9 @@
<script type="application/javascript" src="/tests/SimpleTest/paint_listener.js"></script>
<script type="application/javascript">
function* test(testDriver) {
var target = document.getElementById('target');
var target = document.getElementById("target");
document.body.addEventListener('touchend', testDriver, { passive: true });
document.body.addEventListener("touchend", testDriver, { passive: true });
// drag the page up to scroll down by 50px
yield ok(synthesizeNativeTouchDrag(target, 10, 100, 0, -50),

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

@ -27,7 +27,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1151663
function finishTest() {
w.close();
SimpleTest.finish();
};
}
</script>
</head>

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

@ -45,12 +45,12 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1151667
<script type="application/javascript">
function startTest() {
var subframe = document.getElementById('subframe');
var subframe = document.getElementById("subframe");
synthesizeNativeWheelAndWaitForScrollEvent(subframe, 100, 150, 0, -10, continueTest);
}
function continueTest() {
var subframe = document.getElementById('subframe');
var subframe = document.getElementById("subframe");
is(subframe.scrollTop > 0, true, "We should have scrolled the subframe down");
is(document.documentElement.scrollTop, 0, "We should not have scrolled the page");
SimpleTest.finish();

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

@ -22,12 +22,12 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1253683
<script type="application/javascript">
function* test(testDriver) {
var container = document.getElementById('container');
var no_layer = document.getElementById('no_layer');
var container = document.getElementById("container");
var no_layer = document.getElementById("no_layer");
// Check initial state
is(container.scrollTop, 0, "Initial scrollY should be 0");
ok(!isLayerized('no_layer'), "initially 'no_layer' should not be layerized");
ok(!isLayerized("no_layer"), "initially 'no_layer' should not be layerized");
// Scrolling over outer1 should layerize outer1, but not inner1.
yield moveMouseAndScrollWheelOver(no_layer, 10, 10, testDriver, true);
@ -36,7 +36,7 @@ function* test(testDriver) {
});
ok(container.scrollTop > 0, "We should have scrolled the body");
ok(!isLayerized('no_layer'), "no_layer should still not be layerized");
ok(!isLayerized("no_layer"), "no_layer should still not be layerized");
}
if (isApzEnabled()) {

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

@ -14,8 +14,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1277814
<script type="application/javascript">
function* test(testDriver) {
// Trigger the buggy scenario
var subframe = document.getElementById('bug1277814-div');
subframe.classList.add('a');
var subframe = document.getElementById("bug1277814-div");
subframe.classList.add("a");
// The transform change is animated, so let's step through 1s of animation
var utils = SpecialPowers.getDOMWindowUtils(window);
@ -50,8 +50,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1277814
var paint = contentTestData.paints[seqNo];
for (var scrollId in paint) {
var scrollFrame = paint[scrollId];
if ('contentDescription' in scrollFrame &&
scrollFrame['contentDescription'].includes('bug1277814-div')) {
if ("contentDescription" in scrollFrame &&
scrollFrame.contentDescription.includes("bug1277814-div")) {
foundIt = true;
}
}

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

@ -32,10 +32,10 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1304689
function* test(testDriver) {
var utils = SpecialPowers.DOMWindowUtils;
var elm = document.getElementById('outer');
var elm = document.getElementById("outer");
// Set margins on the element, to ensure it is layerized
utils.setDisplayPortMarginsForElement(0, 0, 0, 0, elm, /*priority*/ 1);
utils.setDisplayPortMarginsForElement(0, 0, 0, 0, elm, /* priority*/ 1);
yield waitForAllPaints(function() {
flushApzRepaints(testDriver);
});
@ -55,7 +55,7 @@ function* test(testDriver) {
// Do another scroll update but also do a frame reconstruction within the same
// tick of the refresh driver.
elm.scrollTop = 100;
elm.classList.add('contentBefore');
elm.classList.add("contentBefore");
// Now let everything settle and all the animations run out
for (var i = 0; i < 60; i++) {

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

@ -35,10 +35,10 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1304689
function* test(testDriver) {
var utils = SpecialPowers.DOMWindowUtils;
var elm = document.getElementById('outer');
var elm = document.getElementById("outer");
// Set margins on the element, to ensure it is layerized
utils.setDisplayPortMarginsForElement(0, 0, 0, 0, elm, /*priority*/ 1);
utils.setDisplayPortMarginsForElement(0, 0, 0, 0, elm, /* priority*/ 1);
yield waitForAllPaints(function() {
flushApzRepaints(testDriver);
});
@ -57,9 +57,9 @@ function* test(testDriver) {
// Do another scroll update but also do a frame reconstruction within the same
// tick of the refresh driver.
elm.classList.add('instant');
elm.classList.add("instant");
elm.scrollTop = 100;
elm.classList.add('contentBefore');
elm.classList.add("contentBefore");
// Now let everything settle and all the animations run out
for (var i = 0; i < 60; i++) {

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

@ -10,9 +10,9 @@
SimpleTest.waitForExplicitFinish();
const subtests = [
{ file: 'helper_bug1464568_transform.html',
{ file: "helper_bug1464568_transform.html",
prefs: [["apz.test.logging_enabled", true]] },
{ file: 'helper_bug1464568_opacity.html',
{ file: "helper_bug1464568_opacity.html",
prefs: [["apz.test.logging_enabled", true]] },
];
// Run the actual test in its own window, because it requires that the

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

@ -28,7 +28,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=982141
function finishTest() {
w.close();
SimpleTest.finish();
};
}
</script>
</head>

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

@ -155,7 +155,7 @@
<pre id="test">
<script type="application/javascript">
function* test(testDriver) {
var elm = document.getElementsByClassName('inner')[0];
var elm = document.getElementsByClassName("inner")[0];
elm.scrollTop = 0;
yield flushApzRepaints(testDriver);
@ -178,13 +178,13 @@ function* test(testDriver) {
// Register the listener that triggers the frame reconstruction
elm.onscroll = function() {
// Do the reconstruction
elm.parentNode.classList.add('contentBefore');
elm.parentNode.classList.add("contentBefore");
frameReconstructionTriggered++;
// schedule a thing to undo the changes above
setTimeout(function() {
elm.parentNode.classList.remove('contentBefore');
elm.parentNode.classList.remove("contentBefore");
}, 0);
}
};
// and do a few more frames of the animation, this should trigger the listener
// and the frame reconstruction

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

@ -23,19 +23,19 @@ var prefs = [
// APZ as a MouseInput so the hit result is recorded.
["test.events.async.enabled", true],
// Turns on APZTestData logging which we use to obtain the hit test results.
["apz.test.logging_enabled", true]
["apz.test.logging_enabled", true],
];
var subtests = [
{'file': 'helper_hittest_basic.html', 'prefs': prefs},
{'file': 'helper_hittest_fixed_in_scrolled_transform.html', 'prefs': prefs},
{'file': 'helper_hittest_float_bug1434846.html', 'prefs': prefs},
{'file': 'helper_hittest_float_bug1443518.html', 'prefs': prefs},
{'file': 'helper_hittest_checkerboard.html', 'prefs': prefs},
{'file': 'helper_hittest_backface_hidden.html', 'prefs': prefs},
{'file': 'helper_hittest_touchaction.html', 'prefs': prefs},
{'file': 'helper_hittest_nested_transforms_bug1459696.html', 'prefs': prefs},
{'file': 'helper_hittest_sticky_bug1478304.html', 'prefs': prefs}
{"file": "helper_hittest_basic.html", "prefs": prefs},
{"file": "helper_hittest_fixed_in_scrolled_transform.html", "prefs": prefs},
{"file": "helper_hittest_float_bug1434846.html", "prefs": prefs},
{"file": "helper_hittest_float_bug1443518.html", "prefs": prefs},
{"file": "helper_hittest_checkerboard.html", "prefs": prefs},
{"file": "helper_hittest_backface_hidden.html", "prefs": prefs},
{"file": "helper_hittest_touchaction.html", "prefs": prefs},
{"file": "helper_hittest_nested_transforms_bug1459696.html", "prefs": prefs},
{"file": "helper_hittest_sticky_bug1478304.html", "prefs": prefs},
];
if (isApzEnabled()) {

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

@ -9,7 +9,7 @@
<script type="application/javascript">
var subtests = [
{'file': 'helper_key_scroll.html', prefs: [["apz.test.logging_enabled", true],
{"file": "helper_key_scroll.html", prefs: [["apz.test.logging_enabled", true],
["test.events.async.enabled", true]]},
];

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

@ -10,28 +10,28 @@
var subtests = [
// Sanity test to synthesize a mouse click
{'file': 'helper_click.html?dtc=false'},
{"file": "helper_click.html?dtc=false"},
// Same as above, but with a dispatch-to-content region that exercises the
// main-thread notification codepaths for mouse events
{'file': 'helper_click.html?dtc=true'},
{"file": "helper_click.html?dtc=true"},
// Sanity test for click but with some mouse movement between the down and up
{'file': 'helper_drag_click.html'},
{"file": "helper_drag_click.html"},
// Test for dragging on a fake-scrollbar element that scrolls the page
{'file': 'helper_drag_scroll.html'},
{"file": "helper_drag_scroll.html"},
// Test for dragging the scrollbar with a fixed-pos element overlaying it
{'file': 'helper_bug1346632.html'},
{"file": "helper_bug1346632.html"},
// Test for scrollbar-dragging on a scrollframe that's inactive
{'file': 'helper_bug1326290.html'},
{"file": "helper_bug1326290.html"},
// Test for scrollbar-dragging on a scrollframe inside an SVGEffects
{'file': 'helper_bug1331693.html'},
{"file": "helper_bug1331693.html"},
// Test for scrollbar-dragging on a transformed scrollframe inside a fixed-pos item
{'file': 'helper_bug1462961.html'},
{"file": "helper_bug1462961.html"},
// Scrollbar dragging where we exercise the snapback behaviour by moving the
// mouse away from the scrollbar during drag
{'file': 'helper_scrollbar_snap_bug1501062.html'},
{"file": "helper_scrollbar_snap_bug1501062.html"},
// Tests for scrollbar-dragging on scrollframes inside nested transforms
{'file': 'helper_bug1490393.html'},
{'file': 'helper_bug1490393-2.html'}
{"file": "helper_bug1490393.html"},
{"file": "helper_bug1490393-2.html"},
];
if (isApzEnabled()) {

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

@ -11,15 +11,15 @@
var prefs = [
// turn off smooth scrolling so that we don't have to wait for
// APZ animations to finish before sampling the scroll offset
['general.smoothScroll', false],
["general.smoothScroll", false],
// Increase the content response timeout because these tests do preventDefault
// and we want to make sure APZ actually waits for them.
['apz.content_response_timeout', 10000],
]
["apz.content_response_timeout", 10000],
];
var subtests = [
{'file': 'helper_override_root.html', 'prefs': prefs},
{'file': 'helper_override_subdoc.html', 'prefs': prefs},
{"file": "helper_override_root.html", "prefs": prefs},
{"file": "helper_override_subdoc.html", "prefs": prefs},
];
if (isApzEnabled()) {

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

@ -14,12 +14,12 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1285070
let isWindows = navigator.platform.indexOf("Win") == 0;
let enablePE = ["dom.w3c_pointer_events.enabled", true];
var subtests = [
{'file': 'helper_bug1285070.html', 'prefs': [enablePE]},
{'file': 'helper_bug1299195.html', 'prefs': [enablePE]},
{'file': 'helper_bug1414336.html', 'prefs': [enablePE,
["apz.test.fails_with_native_injection", isWindows]
{"file": "helper_bug1285070.html", "prefs": [enablePE]},
{"file": "helper_bug1299195.html", "prefs": [enablePE]},
{"file": "helper_bug1414336.html", "prefs": [enablePE,
["apz.test.fails_with_native_injection", isWindows],
]},
{'file': 'helper_bug1502010_unconsumed_pan.html', 'prefs': [enablePE]}
{"file": "helper_bug1502010_unconsumed_pan.html", "prefs": [enablePE]},
];
if (isApzEnabled()) {

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

@ -19,22 +19,22 @@ var subtests = [
// an injected touch event every 100ms, because it waits for a paint between
// the touchstart and the touchend, so we have to use the "fake injection"
// code instead.
{'file': 'helper_bug1162771.html', 'prefs': [["ui.click_hold_context_menus.delay", 10000],
{"file": "helper_bug1162771.html", "prefs": [["ui.click_hold_context_menus.delay", 10000],
["apz.test.fails_with_native_injection", isWindows]]},
// As with the previous test, this test cannot inject touch events every 100ms
// because it waits for a long-tap, so we have to use the "fake injection" code
// instead.
{'file': 'helper_long_tap.html', 'prefs': [["apz.test.fails_with_native_injection", isWindows]]},
{"file": "helper_long_tap.html", "prefs": [["apz.test.fails_with_native_injection", isWindows]]},
// For the following tests, we want to make sure APZ doesn't wait for a content
// response that is never going to arrive. To detect this we set the content response
// timeout to a day, so that the entire test times out and fails if APZ does
// end up waiting.
{'file': 'helper_tap_passive.html', 'prefs': [["apz.content_response_timeout", 24 * 60 * 60 * 1000],
{"file": "helper_tap_passive.html", "prefs": [["apz.content_response_timeout", 24 * 60 * 60 * 1000],
["apz.test.fails_with_native_injection", isWindows]]},
{'file': 'helper_tap_default_passive.html', 'prefs': [["apz.content_response_timeout", 24 * 60 * 60 * 1000],
{"file": "helper_tap_default_passive.html", "prefs": [["apz.content_response_timeout", 24 * 60 * 60 * 1000],
["apz.test.fails_with_native_injection", isWindows],
["dom.event.default_to_passive_touch_listeners", true]]},

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

@ -17,14 +17,14 @@ var touch_action_prefs = [
var subtests = [
// Simple test to exercise touch-action CSS property
{'file': 'helper_touch_action.html', 'prefs': touch_action_prefs},
{"file": "helper_touch_action.html", "prefs": touch_action_prefs},
// More complex touch-action tests, with overlapping regions and such
{'file': 'helper_touch_action_complex.html', 'prefs': touch_action_prefs},
{"file": "helper_touch_action_complex.html", "prefs": touch_action_prefs},
// Tests that touch-action CSS properties are handled in APZ without waiting
// on the main-thread, when possible
{'file': 'helper_touch_action_regions.html', 'prefs': touch_action_prefs},
{"file": "helper_touch_action_regions.html", "prefs": touch_action_prefs},
// Tests that touch-action inside zero-opacity items are respected
{'file': 'helper_touch_action_zero_opacity_bug1500864.html', 'prefs': touch_action_prefs},
{"file": "helper_touch_action_zero_opacity_bug1500864.html", "prefs": touch_action_prefs},
// Add new subtests to test_group_touchevents-4.html, not this file (exceptions
// may be made for quick-running tests that need the touch-action prefs)

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

@ -11,7 +11,7 @@
var subtests = [
// clicking on element with :active::after CSS property
{'file': 'helper_bug1473108.html'},
{"file": "helper_bug1473108.html"},
// Add new subtests here. If this starts timing out because it's taking too
// long, create a test_group_touchevents-5.html file. Refer to 1423011#c57
// for more details.

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

@ -14,19 +14,19 @@ var basic_pan_prefs = getPrefs("TOUCH_EVENTS:PAN");
var subtests = [
// Simple tests to exercise basic panning behaviour
// The visual viewport isn't yet enabled by default and we want to test its events, too.
{'file': 'helper_basic_pan.html', 'prefs': basic_pan_prefs.concat([["dom.visualviewport.enabled", true]])},
{'file': 'helper_div_pan.html', 'prefs': basic_pan_prefs},
{'file': 'helper_iframe_pan.html', 'prefs': basic_pan_prefs},
{"file": "helper_basic_pan.html", "prefs": basic_pan_prefs.concat([["dom.visualviewport.enabled", true]])},
{"file": "helper_div_pan.html", "prefs": basic_pan_prefs},
{"file": "helper_iframe_pan.html", "prefs": basic_pan_prefs},
// Simple test to exercise touch-tapping behaviour
{'file': 'helper_tap.html'},
{"file": "helper_tap.html"},
// Tapping, but with a full-zoom applied
{'file': 'helper_tap_fullzoom.html'},
{"file": "helper_tap_fullzoom.html"},
// For the following two tests, disable displayport suppression to make sure it
// doesn't interfere with the test by scheduling paints non-deterministically.
{'file': 'helper_scrollto_tap.html?true', 'prefs': [["apz.paint_skipping.enabled", true]], 'dp_suppression': false},
{'file': 'helper_scrollto_tap.html?false', 'prefs': [["apz.paint_skipping.enabled", false]], 'dp_suppression': false},
{"file": "helper_scrollto_tap.html?true", "prefs": [["apz.paint_skipping.enabled", true]], "dp_suppression": false},
{"file": "helper_scrollto_tap.html?false", "prefs": [["apz.paint_skipping.enabled", false]], "dp_suppression": false},
// Add new subtests to test_group_touch_events-4.html, not this file.
];

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

@ -11,36 +11,36 @@
var prefs = [
// turn off smooth scrolling so that we don't have to wait for
// APZ animations to finish before sampling the scroll offset
['general.smoothScroll', false],
["general.smoothScroll", false],
// ensure that any mouse movement will trigger a new wheel transaction,
// because in this test we move the mouse a bunch and want to recalculate
// the target APZC after each such movement.
['mousewheel.transaction.ignoremovedelay', 0],
['mousewheel.transaction.timeout', 0]
]
["mousewheel.transaction.ignoremovedelay", 0],
["mousewheel.transaction.timeout", 0],
];
// For helper_scroll_over_scrollbar, we need to set a pref to force
// layerization of the scrollbar track to reproduce the bug being fixed.
// Otherwise, the bug only manifests with overlay scrollbars on macOS,
// or in a XUL RCD, both of which are hard to materialize in a test.
var scrollbar_prefs = prefs.slice(); // make a copy
var scrollbar_prefs = prefs.slice(); // make a copy
scrollbar_prefs.push(["layout.scrollbars.always-layerize-track", true]);
// For helper_overscroll_behavior_bug1425573, we need to set the APZ content
// response timeout to 0, so we exercise the fallback codepath.
var timeout_prefs = prefs.slice(); // make a copy
var timeout_prefs = prefs.slice(); // make a copy
timeout_prefs.push(["apz.content_response_timeout", 0]);
var subtests = [
{'file': 'helper_scroll_on_position_fixed.html', 'prefs': prefs},
{'file': 'helper_bug1271432.html', 'prefs': prefs},
{'file': 'helper_overscroll_behavior_bug1425573.html', 'prefs': timeout_prefs},
{'file': 'helper_overscroll_behavior_bug1425603.html', 'prefs': prefs},
{'file': 'helper_overscroll_behavior_bug1494440.html', 'prefs': prefs},
{'file': 'helper_scroll_inactive_perspective.html', 'prefs': prefs},
{'file': 'helper_scroll_inactive_zindex.html', 'prefs': prefs},
{'file': 'helper_scroll_over_scrollbar.html', 'prefs': scrollbar_prefs},
{'file': 'helper_scroll_tables_perspective.html', 'prefs': prefs},
{"file": "helper_scroll_on_position_fixed.html", "prefs": prefs},
{"file": "helper_bug1271432.html", "prefs": prefs},
{"file": "helper_overscroll_behavior_bug1425573.html", "prefs": timeout_prefs},
{"file": "helper_overscroll_behavior_bug1425603.html", "prefs": prefs},
{"file": "helper_overscroll_behavior_bug1494440.html", "prefs": prefs},
{"file": "helper_scroll_inactive_perspective.html", "prefs": prefs},
{"file": "helper_scroll_inactive_zindex.html", "prefs": prefs},
{"file": "helper_scroll_over_scrollbar.html", "prefs": scrollbar_prefs},
{"file": "helper_scroll_tables_perspective.html", "prefs": prefs},
];
if (isApzEnabled()) {

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

@ -52,11 +52,11 @@ var doubletap_prefs = [
];
var subtests = [
{'file': 'helper_bug1280013.html', 'prefs': prefs},
{'file': 'helper_basic_zoom.html', 'prefs': prefs},
{'file': 'helper_zoomed_pan.html', 'prefs': prefs},
{'file': 'helper_fixed_position_scroll_hittest.html', 'prefs': prefs},
{'file': 'helper_basic_doubletap_zoom.html', 'prefs': doubletap_prefs},
{"file": "helper_bug1280013.html", "prefs": prefs},
{"file": "helper_basic_zoom.html", "prefs": prefs},
{"file": "helper_zoomed_pan.html", "prefs": prefs},
{"file": "helper_fixed_position_scroll_hittest.html", "prefs": prefs},
{"file": "helper_basic_doubletap_zoom.html", "prefs": doubletap_prefs},
];
if (isApzEnabled()) {

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

@ -586,7 +586,7 @@ function getAsyncScrollOffsets(aPaintsToIgnore) {
ok(rcd.children.length == 1, "Root content APZC has exactly one child");
var scroll = rcd.children[0].asyncScrollOffset;
var pieces = scroll.replace(/[()\s]+/g, '').split(',');
var pieces = scroll.replace(/[()\s]+/g, "").split(",");
is(pieces.length, 2, "expected string of form (x,y)");
offsets.push({ x: parseInt(pieces[0]),
y: parseInt(pieces[1]) });
@ -602,7 +602,7 @@ function* test(testDriver) {
// and discard those later.
var framesToSkip = SpecialPowers.getDOMWindowUtils(window).getCompositorAPZTestData().paints.length;
var elm = document.getElementsByClassName('inner')[0];
var elm = document.getElementsByClassName("inner")[0];
// Set a zero-margin displayport to ensure that the element is async-scrollable
// otherwise on Fennec it is not
utils.setDisplayPortMarginsForElement(0, 0, 0, 0, elm, 0);
@ -624,11 +624,11 @@ function* test(testDriver) {
// interruptible reflow. That reflow *will* be interrupted (because of the flag
// we set above), and we should end up with a transient 0,0 scroll offset
// being sent to the compositor.
elm.parentNode.classList.add('contentBefore');
elm.parentNode.classList.add("contentBefore");
utils.advanceTimeAndRefresh(0);
// On android, and maybe non-e10s platforms generally, we need to manually
// kick the paint to send the layer transaction to the compositor.
yield waitForAllPaints(function() { setTimeout(testDriver, 0) });
yield waitForAllPaints(function() { setTimeout(testDriver, 0); });
// Read the main-thread scroll offset; although this is temporarily 0,0 that
// temporary value is never exposed to content - instead reading this value

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

@ -74,65 +74,65 @@ function asyncWrapper(testDriver) {
function* test(testDriver) {
// Initially, nothing should be layerized.
ok(!isLayerized('outer1'), "initially 'outer1' should not be layerized");
ok(!isLayerized('inner1'), "initially 'inner1' should not be layerized");
ok(!isLayerized('outer2'), "initially 'outer2' should not be layerized");
ok(!isLayerized('inner2'), "initially 'inner2' should not be layerized");
ok(!isLayerized('outer3'), "initially 'outer3' should not be layerized");
ok(!isLayerized('inner3'), "initially 'inner3' should not be layerized");
ok(!isLayerized('outer4'), "initially 'outer4' should not be layerized");
ok(!isLayerized('inner4'), "initially 'inner4' should not be layerized");
ok(!isLayerized("outer1"), "initially 'outer1' should not be layerized");
ok(!isLayerized("inner1"), "initially 'inner1' should not be layerized");
ok(!isLayerized("outer2"), "initially 'outer2' should not be layerized");
ok(!isLayerized("inner2"), "initially 'inner2' should not be layerized");
ok(!isLayerized("outer3"), "initially 'outer3' should not be layerized");
ok(!isLayerized("inner3"), "initially 'inner3' should not be layerized");
ok(!isLayerized("outer4"), "initially 'outer4' should not be layerized");
ok(!isLayerized("inner4"), "initially 'inner4' should not be layerized");
// Scrolling over outer1 should layerize outer1, but not inner1.
yield scrollWheelOver(document.getElementById('outer1'), true, testDriver);
ok(isLayerized('outer1'), "scrolling 'outer1' should cause it to be layerized");
ok(!isLayerized('inner1'), "scrolling 'outer1' should not cause 'inner1' to be layerized");
yield scrollWheelOver(document.getElementById("outer1"), true, testDriver);
ok(isLayerized("outer1"), "scrolling 'outer1' should cause it to be layerized");
ok(!isLayerized("inner1"), "scrolling 'outer1' should not cause 'inner1' to be layerized");
// Scrolling over inner2 should layerize both outer2 and inner2.
yield scrollWheelOver(document.getElementById('inner2'), true, testDriver);
ok(isLayerized('inner2'), "scrolling 'inner2' should cause it to be layerized");
ok(isLayerized('outer2'), "scrolling 'inner2' should also cause 'outer2' to be layerized");
yield scrollWheelOver(document.getElementById("inner2"), true, testDriver);
ok(isLayerized("inner2"), "scrolling 'inner2' should cause it to be layerized");
ok(isLayerized("outer2"), "scrolling 'inner2' should also cause 'outer2' to be layerized");
// The second half of the test repeats the same checks as the first half,
// but with an iframe as the outer scrollable frame.
// Scrolling over outer3 should layerize outer3, but not inner3.
yield scrollWheelOver(document.getElementById('outer3').contentDocument.documentElement, true, testDriver);
ok(isLayerized('outer3'), "scrolling 'outer3' should cause it to be layerized");
ok(!isLayerized('inner3'), "scrolling 'outer3' should not cause 'inner3' to be layerized");
yield scrollWheelOver(document.getElementById("outer3").contentDocument.documentElement, true, testDriver);
ok(isLayerized("outer3"), "scrolling 'outer3' should cause it to be layerized");
ok(!isLayerized("inner3"), "scrolling 'outer3' should not cause 'inner3' to be layerized");
// Scrolling over outer4 should layerize both outer4 and inner4.
yield scrollWheelOver(document.getElementById('outer4').contentDocument.getElementById('inner4'), true, testDriver);
ok(isLayerized('inner4'), "scrolling 'inner4' should cause it to be layerized");
ok(isLayerized('outer4'), "scrolling 'inner4' should also cause 'outer4' to be layerized");
yield scrollWheelOver(document.getElementById("outer4").contentDocument.getElementById("inner4"), true, testDriver);
ok(isLayerized("inner4"), "scrolling 'inner4' should cause it to be layerized");
ok(isLayerized("outer4"), "scrolling 'inner4' should also cause 'outer4' to be layerized");
// Now we enable displayport expiry, and verify that things are still
// layerized as they were before.
yield SpecialPowers.pushPrefEnv({"set": [["apz.displayport_expiry_ms", DISPLAYPORT_EXPIRY]]}, testDriver);
ok(isLayerized('outer1'), "outer1 is still layerized after enabling expiry");
ok(!isLayerized('inner1'), "inner1 is still not layerized after enabling expiry");
ok(isLayerized('outer2'), "outer2 is still layerized after enabling expiry");
ok(isLayerized('inner2'), "inner2 is still layerized after enabling expiry");
ok(isLayerized('outer3'), "outer3 is still layerized after enabling expiry");
ok(!isLayerized('inner3'), "inner3 is still not layerized after enabling expiry");
ok(isLayerized('outer4'), "outer4 is still layerized after enabling expiry");
ok(isLayerized('inner4'), "inner4 is still layerized after enabling expiry");
ok(isLayerized("outer1"), "outer1 is still layerized after enabling expiry");
ok(!isLayerized("inner1"), "inner1 is still not layerized after enabling expiry");
ok(isLayerized("outer2"), "outer2 is still layerized after enabling expiry");
ok(isLayerized("inner2"), "inner2 is still layerized after enabling expiry");
ok(isLayerized("outer3"), "outer3 is still layerized after enabling expiry");
ok(!isLayerized("inner3"), "inner3 is still not layerized after enabling expiry");
ok(isLayerized("outer4"), "outer4 is still layerized after enabling expiry");
ok(isLayerized("inner4"), "inner4 is still layerized after enabling expiry");
// Now we trigger a scroll on some of the things still layerized, so that
// the displayport expiry gets triggered.
// Expire displayport with scrolling on outer1
yield scrollWheelOver(document.getElementById('outer1'), true, testDriver);
yield scrollWheelOver(document.getElementById("outer1"), true, testDriver);
yield waitForAllPaints(function() {
flushApzRepaints(testDriver);
});
yield setTimeout(testDriver, DISPLAYPORT_EXPIRY);
yield waitForAllPaints(asyncWrapper(testDriver));
ok(!isLayerized('outer1'), "outer1 is no longer layerized after displayport expiry");
ok(!isLayerized('inner1'), "inner1 is still not layerized after displayport expiry");
ok(!isLayerized("outer1"), "outer1 is no longer layerized after displayport expiry");
ok(!isLayerized("inner1"), "inner1 is still not layerized after displayport expiry");
// Expire displayport with scrolling on inner2
yield scrollWheelOver(document.getElementById('inner2'), true, testDriver);
yield scrollWheelOver(document.getElementById("inner2"), true, testDriver);
yield waitForAllPaints(function() {
flushApzRepaints(testDriver);
});
@ -140,10 +140,10 @@ function* test(testDriver) {
// both, one at a time.
yield setTimeout(testDriver, DISPLAYPORT_EXPIRY);
yield waitForAllPaints(asyncWrapper(testDriver));
ok(!isLayerized('inner2'), "inner2 is no longer layerized after displayport expiry");
ok(!isLayerized("inner2"), "inner2 is no longer layerized after displayport expiry");
yield setTimeout(testDriver, DISPLAYPORT_EXPIRY);
yield waitForAllPaints(asyncWrapper(testDriver));
ok(!isLayerized('outer2'), "outer2 got de-layerized with inner2");
ok(!isLayerized("outer2"), "outer2 got de-layerized with inner2");
// Scroll on inner3. inner3 isn't layerized, and this will cause it to
// get layerized, but it will also trigger displayport expiration for inner3
@ -154,7 +154,7 @@ function* test(testDriver) {
// However, if we do get a scroll event while waiting for the expiry, we need
// to restart the expiry timer because the displayport expiry got reset. There's
// no good way that I can think of to deterministically avoid doing this.
let inner3 = document.getElementById('outer3').contentDocument.getElementById('inner3');
let inner3 = document.getElementById("outer3").contentDocument.getElementById("inner3");
yield scrollWheelOver(inner3, false, testDriver);
yield waitForAllPaints(function() {
flushApzRepaints(testDriver);
@ -167,27 +167,27 @@ function* test(testDriver) {
// by not updating timerId we ensure that this listener resets the timeout
// at most once.
};
inner3.addEventListener('scroll', timeoutResetter);
inner3.addEventListener("scroll", timeoutResetter);
yield; // wait for the setTimeout to elapse
inner3.removeEventListener('scroll', timeoutResetter);
inner3.removeEventListener("scroll", timeoutResetter);
yield waitForAllPaints(asyncWrapper(testDriver));
ok(!isLayerized('inner3'), "inner3 becomes unlayerized after expiry");
ok(!isLayerized("inner3"), "inner3 becomes unlayerized after expiry");
yield setTimeout(testDriver, DISPLAYPORT_EXPIRY);
yield waitForAllPaints(asyncWrapper(testDriver));
ok(!isLayerized('outer3'), "outer3 is no longer layerized after inner3 triggered expiry");
ok(!isLayerized("outer3"), "outer3 is no longer layerized after inner3 triggered expiry");
// Scroll outer4 and wait for the expiry. It should NOT get expired because
// inner4 is still layerized
yield scrollWheelOver(document.getElementById('outer4').contentDocument.documentElement, true, testDriver);
yield scrollWheelOver(document.getElementById("outer4").contentDocument.documentElement, true, testDriver);
yield waitForAllPaints(function() {
flushApzRepaints(testDriver);
});
// Wait for the expiry to elapse
yield setTimeout(testDriver, DISPLAYPORT_EXPIRY);
yield waitForAllPaints(asyncWrapper(testDriver));
ok(isLayerized('inner4'), "inner4 is still layerized because it never expired");
ok(isLayerized('outer4'), "outer4 is still layerized because inner4 is still layerized");
ok(isLayerized("inner4"), "inner4 is still layerized because it never expired");
ok(isLayerized("outer4"), "outer4 is still layerized because inner4 is still layerized");
}
if (isApzEnabled()) {

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

@ -39,7 +39,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1453425
function* test(testDriver) {
var utils = SpecialPowers.DOMWindowUtils;
var elm = document.querySelector('#frame');
var elm = document.querySelector("#frame");
// Set a zero-margin displayport to ensure that the element is async-scrollable
utils.setDisplayPortMarginsForElement(0, 0, 0, 0, elm, 0);
elm.scrollTop = 0;
@ -54,14 +54,14 @@ function* test(testDriver) {
elm.scrollBy(0, 100);
// We are not using `scroll-behavior`
is(elm.scrollTop, 100, 'the main thread scroll should be instant');
is(elm.scrollTop, 100, "the main thread scroll should be instant");
// Dispatch a wheel event to have APZ scroll by (0, 8). Wait for the wheel
// event to ensure that the APZ has processed the scroll.
yield synthesizeNativeWheelAndWaitForWheelEvent(elm, 40, 40, 0, -8, testDriver);
// APZ should be handling the wheel scroll
is(elm.scrollTop, 100, 'the wheel scroll should be handled by APZ');
is(elm.scrollTop, 100, "the wheel scroll should be handled by APZ");
// Restore control of the refresh driver, allowing the main thread to send a
// layer transaction containing the (0, 100) scroll.

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

@ -487,8 +487,8 @@ p {
</div>
<script clss="testbody" type="text/javascript">
function ScrollTops() {
this.outerScrollTop = document.getElementById('iframe-body').scrollTop;
this.innerScrollTop = document.getElementById('subframe').scrollTop;
this.outerScrollTop = document.getElementById("iframe-body").scrollTop;
this.innerScrollTop = document.getElementById("subframe").scrollTop;
}
var DefaultEvent = {
@ -498,9 +498,9 @@ var DefaultEvent = {
};
function test() {
var subframe = document.getElementById('subframe');
var subframe = document.getElementById("subframe");
var oldpos = new ScrollTops();
sendWheelAndPaint(subframe, 10, 10, DefaultEvent, function () {
sendWheelAndPaint(subframe, 10, 10, DefaultEvent, function() {
var newpos = new ScrollTops();
ok(oldpos.outerScrollTop == newpos.outerScrollTop, "viewport should not have scrolled");
ok(oldpos.innerScrollTop != newpos.innerScrollTop, "subframe should have scrolled");
@ -509,8 +509,8 @@ function test() {
}
function doOuterScroll(subframe, oldpos) {
var outer = document.getElementById('iframe-body');
sendWheelAndPaint(outer, 20, 5, DefaultEvent, function () {
var outer = document.getElementById("iframe-body");
sendWheelAndPaint(outer, 20, 5, DefaultEvent, function() {
var newpos = new ScrollTops();
ok(oldpos.outerScrollTop != newpos.outerScrollTop, "viewport should have scrolled");
ok(oldpos.innerScrollTop == newpos.innerScrollTop, "subframe should not have scrolled");
@ -519,7 +519,7 @@ function doOuterScroll(subframe, oldpos) {
}
function doInnerScrollAgain(subframe, oldpos) {
sendWheelAndPaint(subframe, 10, 10, DefaultEvent, function () {
sendWheelAndPaint(subframe, 10, 10, DefaultEvent, function() {
var newpos = new ScrollTops();
ok(oldpos.outerScrollTop == newpos.outerScrollTop, "viewport should not have scrolled");
ok(oldpos.innerScrollTop != newpos.innerScrollTop, "subframe should have scrolled");
@ -529,9 +529,9 @@ function doInnerScrollAgain(subframe, oldpos) {
SimpleTest.waitForExplicitFinish();
pushPrefs([['general.smoothScroll', false],
['mousewheel.transaction.timeout', 0],
['mousewheel.transaction.ignoremovedelay', 0]])
pushPrefs([["general.smoothScroll", false],
["mousewheel.transaction.timeout", 0],
["mousewheel.transaction.ignoremovedelay", 0]])
.then(waitUntilApzStable)
.then(test);

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

@ -17,9 +17,9 @@
</div>
<script class="testbody" type="text/javascript">
function test() {
var container = document.getElementById('container');
var outer = document.getElementById('outer');
var inner = document.getElementById('inner');
var container = document.getElementById("container");
var outer = document.getElementById("outer");
var inner = document.getElementById("inner");
var outerScrollTop = outer.scrollTop;
var containerScrollTop = container.scrollTop;
var event = {
@ -29,7 +29,7 @@ function test() {
lineOrPageDeltaX: 0,
lineOrPageDeltaY: 10,
};
sendWheelAndPaint(inner, 20, 30, event, function () {
sendWheelAndPaint(inner, 20, 30, event, function() {
ok(container.scrollTop == containerScrollTop, "container scrollframe should not have scrolled");
ok(outer.scrollTop > outerScrollTop, "nested scrollframe should have scrolled");
SimpleTest.finish();
@ -38,8 +38,8 @@ function test() {
SimpleTest.waitForExplicitFinish();
pushPrefs([['general.smoothScroll', false],
['mousewheel.transaction.timeout', 1000000]])
pushPrefs([["general.smoothScroll", false],
["mousewheel.transaction.timeout", 1000000]])
.then(waitUntilApzStable)
.then(test);

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

@ -69,13 +69,13 @@ var DefaultEvent = {
var ScrollbarWidth = 0;
function test() {
var subframe = document.getElementById('subframe');
var subframe = document.getElementById("subframe");
var oldClientWidth = subframe.clientWidth;
subframe.style.overflow = 'auto';
subframe.style.overflow = "auto";
subframe.getBoundingClientRect();
waitForAllPaintsFlushed(function () {
waitForAllPaintsFlushed(function() {
ScrollbarWidth = oldClientWidth - subframe.clientWidth;
if (!ScrollbarWidth) {
// Probably we have overlay scrollbars - abort the test.
@ -98,7 +98,7 @@ function testScrolling(subframe) {
var oldScrollTop = subframe.scrollTop;
sendWheelAndPaint(subframe, posX, posY, DefaultEvent, function () {
sendWheelAndPaint(subframe, posX, posY, DefaultEvent, function() {
ok(subframe.scrollTop > oldScrollTop, "subframe should have scrolled");
SimpleTest.finish();
});
@ -106,9 +106,9 @@ function testScrolling(subframe) {
SimpleTest.waitForExplicitFinish();
pushPrefs([['general.smoothScroll', false],
['mousewheel.transaction.timeout', 0],
['mousewheel.transaction.ignoremovedelay', 0]])
pushPrefs([["general.smoothScroll", false],
["mousewheel.transaction.timeout", 0],
["mousewheel.transaction.ignoremovedelay", 0]])
.then(waitUntilApzStable)
.then(test);

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

@ -62,11 +62,11 @@
}
SpecialPowers.pushPrefEnv({
"set" : [
[testPref, true]
]
"set": [
[testPref, true],
],
}, startTest);
}
};
</script>
</head>

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

@ -39,12 +39,12 @@ function takeSnapshots(e) {
var success = false;
// Get the position of the 'content' div relative to the screen
var rect = rectRelativeToScreen(document.getElementById('content'));
var rect = rectRelativeToScreen(document.getElementById("content"));
for (var i = 0; i < 10; i++) {
SpecialPowers.DOMWindowUtils.advanceTimeAndRefresh(16);
var snapshot = getSnapshot(rect);
//dump("Took snapshot " + snapshot + "\n"); // this might help with debugging
// dump("Took snapshot " + snapshot + "\n"); // this might help with debugging
if (lastSnapshot && lastSnapshot != snapshot) {
ok(true, "Found some different pixels in snapshot " + i + " compared to previous");
@ -64,15 +64,15 @@ function takeSnapshots(e) {
}
function* test(testDriver) {
var box = document.getElementById('box');
var box = document.getElementById("box");
// Ensure the div is layerized by scrolling it
yield moveMouseAndScrollWheelOver(box, 10, 10, testDriver);
box.addEventListener('touchstart', function(e) {
box.addEventListener("touchstart", function(e) {
ok(false, "This should never be run");
});
box.addEventListener('wheel', takeSnapshots, { capture: false, passive: true });
box.addEventListener("wheel", takeSnapshots, { capture: false, passive: true });
// Let the event regions and layerization propagate to the APZ
yield waitForAllPaints(function() {

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

@ -61,7 +61,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1013412
var rotation = 0;
var rotationAdjusted = false;
var incrementForMode = function (mode) {
var incrementForMode = function(mode) {
switch (mode) {
case WheelEvent.DOM_DELTA_PIXEL: return 1;
case WheelEvent.DOM_DELTA_LINE: return 15;
@ -70,7 +70,7 @@ var incrementForMode = function (mode) {
return 0;
};
document.getElementById("scrollbox").addEventListener("wheel", function (e) {
document.getElementById("scrollbox").addEventListener("wheel", function(e) {
rotation += e.deltaY * incrementForMode(e.deltaMode) * 0.2;
document.getElementById("circle").style.transform = "rotate(" + rotation + "deg)";
rotationAdjusted = true;
@ -78,11 +78,10 @@ document.getElementById("scrollbox").addEventListener("wheel", function (e) {
});
function* test(testDriver) {
var content = document.getElementById('content');
for (i = 0; i < 300; i++) { // enough iterations that we would scroll to the bottom of 'content'
var content = document.getElementById("content");
for (let i = 0; i < 300; i++) { // enough iterations that we would scroll to the bottom of 'content'
yield synthesizeNativeWheelAndWaitForWheelEvent(content, 100, 150, 0, -5, testDriver);
}
var scrollbox = document.getElementById('scrollbox');
is(content.scrollTop > 0, true, "We should have scrolled down somewhat");
is(content.scrollTop < content.scrollTopMax, true, "We should not have scrolled to the bottom of the scrollframe");
is(rotationAdjusted, true, "The rotation should have been adjusted");

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

@ -46,9 +46,9 @@ function scrollWheelOver(element, deltaY, testDriver) {
}
function* test(testDriver) {
var outer = document.getElementById('outer-frame');
var inner = document.getElementById('inner-frame');
var innerContent = document.getElementById('inner-content');
var outer = document.getElementById("outer-frame");
var inner = document.getElementById("inner-frame");
var innerContent = document.getElementById("inner-content");
// Register a wheel event listener that records the target of
// the last wheel event, so that we can make assertions about it.

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

@ -36,9 +36,9 @@ function parseDisplayList(lines) {
var line = lines[i];
var layerObject = {
line: line,
line,
children: [],
}
};
if (!root) {
root = layerObject;
}
@ -70,24 +70,22 @@ function parseDisplayList(lines) {
// the content node name doesn't have a prefix, this makes the parsing easier
rest = "content" + rest;
var fields = {};
var nesting = 0;
var startIndex;
var lastSpace = -1;
var lastFieldStart = -1;
for (var j = 0; j < rest.length; j++) {
if (rest.charAt(j) == '(') {
if (rest.charAt(j) == "(") {
nesting++;
if (nesting == 1) {
startIndex = j;
}
} else if (rest.charAt(j) == ')') {
} else if (rest.charAt(j) == ")") {
nesting--;
if (nesting == 0) {
var name = rest.substring(lastSpace + 1, startIndex);
var value = rest.substring(startIndex + 1, j);
var rectMatches = value.match("^(.*?),(.*?),(.*?),(.*?)$")
var rectMatches = value.match("^(.*?),(.*?),(.*?),(.*?)$");
if (rectMatches) {
layerObject[name] = [
parseFloat(rectMatches[1]),
@ -99,17 +97,17 @@ function parseDisplayList(lines) {
layerObject[name] = value;
}
}
} else if (nesting == 0 && rest.charAt(j) == ' ') {
} else if (nesting == 0 && rest.charAt(j) == " ") {
lastSpace = j;
}
}
//dump("FIELDS: " + JSON.stringify(fields) + "\n");
// dump("FIELDS: " + JSON.stringify(fields) + "\n");
}
return root;
}
function trim(s){
return ( s || '' ).replace( /^\s+|\s+$/g, '' );
function trim(s) {
return ( s || "" ).replace( /^\s+|\s+$/g, "" );
}
function getDataURI(str) {
@ -141,7 +139,10 @@ function getDataURI(str) {
var ctxt = canvas.getContext("2d");
var out = ctxt.createImageData(w, h);
buffer = LZ4_uncompressChunk(bytes, decoded);
// This is actually undefined throughout the tree and it isn't clear what it
// should be. Since this is only development code, leave it alone for now.
// eslint-disable-next-line no-undef
LZ4_uncompressChunk(bytes, decoded);
for (var x = 0; x < w; x++) {
for (var y = 0; y < h; y++) {
@ -220,7 +221,7 @@ function parseLayers(layersDumpLines) {
str = trim(str);
// Something like '< (x=0, y=0, w=2842, h=158); (x=0, y=1718, w=2842, h=500); >'
if (str.charAt(0) != '<' || str.charAt(str.length - 1) != '>') {
if (str.charAt(0) != "<" || str.charAt(str.length - 1) != ">") {
return null;
}
@ -252,11 +253,11 @@ function parseLayers(layersDumpLines) {
var tileMatches = line.match("(\\s*)Tile \\(x=(.*), y=(.*)\\): (.*)");
if (tileMatches) {
var indentation = Math.floor(matches[1].length / 2);
let indentation = Math.floor(matches[1].length / 2);
var x = tileMatches[2];
var y = tileMatches[3];
var dataUri = tileMatches[4];
var parent = objectAtIndentation[indentation - 1];
let parent = objectAtIndentation[indentation - 1];
var tiles = parent.tiles || {};
tiles[x] = tiles[x] || {};
@ -269,8 +270,8 @@ function parseLayers(layersDumpLines) {
var surfaceMatches = line.match("(\\s*)Surface: (.*)");
if (surfaceMatches) {
var indentation = Math.floor(matches[1].length / 2);
var parent = objectAtIndentation[indentation - 1] || objectAtIndentation[indentation - 2];
let indentation = Math.floor(matches[1].length / 2);
let parent = objectAtIndentation[indentation - 1] || objectAtIndentation[indentation - 2];
var surfaceURI = surfaceMatches[2];
if (parent.surfaceURI != null) {
@ -280,7 +281,7 @@ function parseLayers(layersDumpLines) {
// Look for the buffer-rect offset
var contentHostLine = layersDumpLines[i - 2].name || layersDumpLines[i - 2];
var matches = contentHostLine.match(LAYERS_LINE_REGEX);
let matches = contentHostLine.match(LAYERS_LINE_REGEX);
if (matches) {
var contentHostRest = matches[4];
parent.contentHostProp = {};
@ -291,14 +292,14 @@ function parseLayers(layersDumpLines) {
}
var layerObject = {
line: line,
line,
children: [],
}
};
if (!root) {
root = layerObject;
}
var matches = line.match(LAYERS_LINE_REGEX);
let matches = line.match(LAYERS_LINE_REGEX);
if (!matches) {
continue; // Something like a texturehost dump. Safe to ignore
}
@ -335,13 +336,13 @@ function parseLayers(layersDumpLines) {
var fields = [];
var nesting = 0;
var startIndex;
for (var j = 0; j < rest.length; j++) {
if (rest.charAt(j) == '[') {
for (let j = 0; j < rest.length; j++) {
if (rest.charAt(j) == "[") {
nesting++;
if (nesting == 1) {
startIndex = j;
}
} else if (rest.charAt(j) == ']') {
} else if (rest.charAt(j) == "]") {
nesting--;
if (nesting == 0) {
fields.push(rest.substring(startIndex + 1, j));
@ -349,25 +350,25 @@ function parseLayers(layersDumpLines) {
}
}
for (var j = 0; j < fields.length; j++) {
for (let j = 0; j < fields.length; j++) {
// Something like 'valid=< (x=0, y=0, w=1920, h=2218); >' or 'opaqueContent'
var field = fields[j];
//dump("FIELD: " + field + "\n");
// dump("FIELD: " + field + "\n");
var parts = field.split("=", 2);
var fieldName = parts[0];
var rest = field.substring(fieldName.length + 1);
rest = field.substring(fieldName.length + 1);
if (parts.length == 1) {
layerObject[fieldName] = "true";
layerObject[fieldName].type = "bool";
continue;
}
var float = parseFloat_cleo(rest);
var float = parseFloat_cleo(rest);
if (float) {
layerObject[fieldName] = float;
layerObject[fieldName].type = "float";
continue;
}
var region = parseRegion(rest);
var region = parseRegion(rest);
if (region) {
layerObject[fieldName] = region;
layerObject[fieldName].type = "region";
@ -391,7 +392,7 @@ function parseLayers(layersDumpLines) {
layerObject[fieldName].type = "color";
continue;
}
if (rest[0] == '{' && rest[rest.length - 1] == '}') {
if (rest[0] == "{" && rest[rest.length - 1] == "}") {
var object = {};
parseProperties(rest.substring(1, rest.length - 2).trim(), object);
layerObject[fieldName] = object;
@ -405,34 +406,34 @@ function parseLayers(layersDumpLines) {
}
parseProperties(rest, layerObject);
if (!layerObject['shadow-transform']) {
if (!layerObject["shadow-transform"]) {
// No shadow transform = identify
layerObject['shadow-transform'] = [[1, 0], [0, 1], [0, 0]];
layerObject["shadow-transform"] = [[1, 0], [0, 1], [0, 0]];
}
// Compute screenTransformX/screenTransformY
// TODO Fully support transforms
if (layerObject['shadow-transform'] && layerObject['transform']) {
layerObject['screen-transform'] = [layerObject['shadow-transform'][2][0], layerObject['shadow-transform'][2][1]];
if (layerObject["shadow-transform"] && layerObject.transform) {
layerObject["screen-transform"] = [layerObject["shadow-transform"][2][0], layerObject["shadow-transform"][2][1]];
var currIndentation = indentation - 1;
while (currIndentation >= 0) {
var transform = objectAtIndentation[currIndentation]['shadow-transform'] || objectAtIndentation[currIndentation]['transform'];
var transform = objectAtIndentation[currIndentation]["shadow-transform"] || objectAtIndentation[currIndentation].transform;
if (transform) {
layerObject['screen-transform'][0] += transform[2][0];
layerObject['screen-transform'][1] += transform[2][1];
layerObject["screen-transform"][0] += transform[2][0];
layerObject["screen-transform"][1] += transform[2][1];
}
currIndentation--;
}
}
//dump("Fields: " + JSON.stringify(fields) + "\n");
// dump("Fields: " + JSON.stringify(fields) + "\n");
}
root.compositeTime = layersDumpLines.compositeTime;
//dump("OBJECTS: " + JSON.stringify(root) + "\n");
// dump("OBJECTS: " + JSON.stringify(root) + "\n");
return root;
}
function populateLayers(root, displayList, pane, previewParent, hasSeenRoot, contentScale, rootPreviewParent) {
contentScale = contentScale || 1;
rootPreviewParent = rootPreviewParent || previewParent;
@ -446,7 +447,7 @@ function populateLayers(root, displayList, pane, previewParent, hasSeenRoot, con
}
for (var i = 0; i < displayList.children.length; i++) {
var subDisplayItems = getDisplayItemForLayer(displayList.children[i]);
for (var j = 0; j < subDisplayItems.length; j++) {
for (let j = 0; j < subDisplayItems.length; j++) {
items.push(subDisplayItems[j]);
}
}
@ -458,12 +459,12 @@ function populateLayers(root, displayList, pane, previewParent, hasSeenRoot, con
style: {
whiteSpace: "pre",
},
onmouseover: function() {
onmouseover() {
if (this.layerViewport) {
this.layerViewport.classList.add("layerHover");
}
},
onmouseout: function() {
onmouseout() {
if (this.layerViewport) {
this.layerViewport.classList.remove("layerHover");
}
@ -478,23 +479,23 @@ function populateLayers(root, displayList, pane, previewParent, hasSeenRoot, con
marginRight: "4px",
cursor: "pointer",
},
onclick: function() {
onclick() {
if (this.layerViewport) {
if (this.layerViewport.style.visibility == "hidden") {
this.layerViewport.style.visibility = "";
this.src = "show.png"
this.src = "show.png";
} else {
this.layerViewport.style.visibility = "hidden";
this.src = "hide.png"
this.src = "hide.png";
}
}
}
},
});
elem.insertBefore(icon, elem.firstChild);
pane.appendChild(elem);
if (root["shadow-visible"] || root["visible"]) {
var visibleRegion = root["shadow-visible"] || root["visible"];
if (root["shadow-visible"] || root.visible) {
var visibleRegion = root["shadow-visible"] || root.visible;
var layerViewport = createElement("div", {
id: root.address + "_viewport",
style: {
@ -505,15 +506,15 @@ function populateLayers(root, displayList, pane, previewParent, hasSeenRoot, con
elem.layerViewport = layerViewport;
icon.layerViewport = layerViewport;
var layerViewportMatrix = [1, 0, 0, 1, 0, 0];
if (root["shadow-clip"] || root["clip"]) {
var clip = root["shadow-clip"] || root["clip"]
if (root["shadow-clip"] || root.clip) {
var clip = root["shadow-clip"] || root.clip;
var clipElem = createElement("div", {
id: root.address + "_clip",
style: {
left: clip[0]+"px",
top: clip[1]+"px",
width: clip[2]+"px",
height: clip[3]+"px",
left: clip[0] + "px",
top: clip[1] + "px",
width: clip[2] + "px",
height: clip[3] + "px",
position: "absolute",
overflow: "hidden",
pointerEvents: "none",
@ -521,10 +522,10 @@ function populateLayers(root, displayList, pane, previewParent, hasSeenRoot, con
});
layerViewportMatrix[4] += -clip[0];
layerViewportMatrix[5] += -clip[1];
layerViewport.style.transform = "translate(-" + clip[0] + "px, -" + clip[1] + "px" + ")";
layerViewport.style.transform = "translate(-" + clip[0] + "px, -" + clip[1] + "px)";
}
if (root["shadow-transform"] || root["transform"]) {
var matrix = root["shadow-transform"] || root["transform"];
if (root["shadow-transform"] || root.transform) {
var matrix = root["shadow-transform"] || root.transform;
layerViewportMatrix[0] = matrix[0][0];
layerViewportMatrix[1] = matrix[0][1];
layerViewportMatrix[2] = matrix[1][0];
@ -535,7 +536,7 @@ function populateLayers(root, displayList, pane, previewParent, hasSeenRoot, con
layerViewport.style.transform = "matrix(" + layerViewportMatrix[0] + "," + layerViewportMatrix[1] + "," + layerViewportMatrix[2] + "," + layerViewportMatrix[3] + "," + layerViewportMatrix[4] + "," + layerViewportMatrix[5] + ")";
if (!hasSeenRoot) {
hasSeenRoot = true;
layerViewport.style.transform = "scale(" + 1/contentScale + "," + 1/contentScale + ")";
layerViewport.style.transform = "scale(" + 1 / contentScale + "," + 1 / contentScale + ")";
}
if (clipElem) {
previewParent.appendChild(clipElem);
@ -544,8 +545,8 @@ function populateLayers(root, displayList, pane, previewParent, hasSeenRoot, con
previewParent.appendChild(layerViewport);
}
previewParent = layerViewport;
for (var i = 0; i < visibleRegion.length; i++) {
var rect2d = visibleRegion[i];
for (let i = 0; i < visibleRegion.length; i++) {
let rect2d = visibleRegion[i];
var layerPreview = createElement("div", {
id: root.address + "_visible_part" + i + "-" + visibleRegion.length,
className: "layerPreview",
@ -597,9 +598,9 @@ function populateLayers(root, displayList, pane, previewParent, hasSeenRoot, con
hasImg = true;
var offsetX = 0;
var offsetY = 0;
if (root.contentHostProp && root.contentHostProp['buffer-rect']) {
offsetX = root.contentHostProp['buffer-rect'][0];
offsetY = root.contentHostProp['buffer-rect'][1];
if (root.contentHostProp && root.contentHostProp["buffer-rect"]) {
offsetX = root.contentHostProp["buffer-rect"][0];
offsetY = root.contentHostProp["buffer-rect"][1];
}
var surfaceImgElem = createElement("img", {
src: getDataURI(root.surfaceURI),
@ -616,20 +617,20 @@ function populateLayers(root, displayList, pane, previewParent, hasSeenRoot, con
hasImg = true;
layerPreview.style.background = "rgba(" + root.color.r + ", " + root.color.g + ", " + root.color.b + ", " + root.color.a + ")";
}
if (hasImg || true) {
layerPreview.mouseoverElem = elem;
layerPreview.onmouseenter = function() {
this.mouseoverElem.onmouseover();
}
};
layerPreview.onmouseout = function() {
this.mouseoverElem.onmouseout();
}
};
}
}
var layerDisplayItems = getDisplayItemForLayer(displayList);
for (var i = 0; i < layerDisplayItems.length; i++) {
for (let i = 0; i < layerDisplayItems.length; i++) {
var displayItem = layerDisplayItems[i];
var displayElem = createElement("div", {
className: "layerObjectDescription",
@ -637,9 +638,9 @@ function populateLayers(root, displayList, pane, previewParent, hasSeenRoot, con
style: {
whiteSpace: "pre",
},
displayItem: displayItem,
layerViewport: layerViewport,
onmouseover: function() {
displayItem,
layerViewport,
onmouseover() {
if (this.diPreview) {
this.diPreview.classList.add("displayHover");
@ -666,20 +667,19 @@ function populateLayers(root, displayList, pane, previewParent, hasSeenRoot, con
}
var box = this.diPreview.getBoundingClientRect();
var pageBox = document.body.getBoundingClientRect();
this.diPreview.tooltip = createElement("div", {
className: "csstooltip",
innerHTML: description,
style: {
top: Math.min(box.bottom, document.documentElement.clientHeight - 150) + "px",
left: box.left + "px",
}
},
});
document.body.appendChild(this.diPreview.tooltip);
}
},
onmouseout: function() {
onmouseout() {
if (this.diPreview) {
this.diPreview.classList.remove("displayHover");
document.body.removeChild(this.diPreview.tooltip);
@ -687,38 +687,38 @@ function populateLayers(root, displayList, pane, previewParent, hasSeenRoot, con
},
});
var icon = createElement("img", {
icon = createElement("img", {
style: {
width: "12px",
height: "12px",
marginLeft: "4px",
marginRight: "4px",
}
},
});
displayElem.insertBefore(icon, displayElem.firstChild);
pane.appendChild(displayElem);
// bounds doesn't adjust for within the layer. It's not a bad fallback but
// will have the wrong offset
var rect2d = displayItem.layerBounds || displayItem.bounds;
let rect2d = displayItem.layerBounds || displayItem.bounds;
if (rect2d) { // This doesn't place them corectly
var appUnitsToPixels = 60 / contentScale;
diPreview = createElement("div", {
let diPreview = createElement("div", {
id: "displayitem_" + displayItem.content + "_" + displayItem.address,
className: "layerPreview",
style: {
position: "absolute",
left: rect2d[0]/appUnitsToPixels + "px",
top: rect2d[1]/appUnitsToPixels + "px",
width: rect2d[2]/appUnitsToPixels + "px",
height: rect2d[3]/appUnitsToPixels + "px",
left: rect2d[0] / appUnitsToPixels + "px",
top: rect2d[1] / appUnitsToPixels + "px",
width: rect2d[2] / appUnitsToPixels + "px",
height: rect2d[3] / appUnitsToPixels + "px",
border: "solid 1px gray",
pointerEvents: "auto",
},
displayElem: displayElem,
onmouseover: function() {
displayElem,
onmouseover() {
this.displayElem.onmouseover();
},
onmouseout: function() {
onmouseout() {
this.displayElem.onmouseout();
},
});
@ -736,10 +736,8 @@ function populateLayers(root, displayList, pane, previewParent, hasSeenRoot, con
// This function takes a stdout snippet and finds the frames
function parseMultiLineDump(log) {
var lines = log.split("\n");
var container = createElement("div", {
style: {
style: {
height: "100%",
position: "relative",
},
@ -750,7 +748,7 @@ function parseMultiLineDump(log) {
var layersRegex = "(" + layerManagerFirstLine + nextLineStartWithSpace + ")";
var startLine = "Painting --- after optimization:\n";
var endLine = "Painting --- layer tree:"
var endLine = "Painting --- layer tree:";
var displayListRegex = "(" + startLine + "(.*\n)*?" + endLine + ")";
var regex = new RegExp(layersRegex + "|" + displayListRegex, "gm");
@ -759,7 +757,7 @@ function parseMultiLineDump(log) {
window.matches = matches;
var matchList = createElement("span", {
style: {
style: {
height: "95%",
width: "10%",
position: "relative",
@ -771,7 +769,7 @@ function parseMultiLineDump(log) {
});
container.appendChild(matchList);
var contents = createElement("span", {
style: {
style: {
height: "95%",
width: "88%",
display: "inline-block",
@ -787,7 +785,7 @@ function parseMultiLineDump(log) {
if (currMatch.indexOf(startLine) == 0) {
// Display list match
var matchLines = matches[i].split("\n")
var matchLines = matches[i].split("\n");
lastDisplayList = parseDisplayList(matchLines);
} else {
// Layer tree match:
@ -800,12 +798,12 @@ function parseMultiLineDump(log) {
},
href: "#",
textContent: "LayerTree " + (frameID++),
onclick: function() {
onclick() {
contents.innerHTML = "";
var matchLines = matches[i].split("\n")
var matchLines = matches[i].split("\n");
var dumpDiv = parseDump(matchLines, displayList);
contents.appendChild(dumpDiv);
}
},
});
matchList.appendChild(currFrameDiv);
}
@ -816,7 +814,7 @@ function parseMultiLineDump(log) {
function parseDump(log, displayList, compositeTitle, compositeTime) {
compositeTitle |= "";
compositeTime |= 0
compositeTime |= 0;
var container = createElement("div", {
style: {
@ -874,11 +872,3 @@ function parseDump(log, displayList, compositeTitle, compositeTime) {
populateLayers(root, displayList, layerListPane, previewDiv);
return container;
}
function tab_showLayersDump(layersDumpLines, compositeTitle, compositeTime) {
var container = parseDump(layersDumpLines, compositeTitle, compositeTime);
gTabWidget.addTab("LayerTree", container);
gTabWidget.selectTab("LayerTree");
}

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

@ -14,8 +14,8 @@ add_task(async function test_windowlessBrowserTroubleshootCrash() {
Services.obs.removeObserver(listener, "content-document-global-created");
resolve();
}
}
}
},
};
Services.obs.addObserver(listener, "content-document-global-created");
});
let triggeringPrincipal = Services.scriptSecurityManager.createNullPrincipal({});

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

@ -14,11 +14,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1274663
<script>
var importObj = {};
var Cc = SpecialPowers.Cc;
var Ci = SpecialPowers.Ci;
var sysInfo = Cc["@mozilla.org/system-info;1"].getService(Ci.nsIPropertyBag2);
var xr = Cc["@mozilla.org/xre/app-info;1"].getService(Ci.nsIXULRuntime);
var windows = SpecialPowers.Services.ww.getWindowEnumerator();
var windowutils;
@ -78,7 +74,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1274663
SimpleTest.waitForExplicitFinish();
window.addEventListener("MozAfterPaint", function paintHandle(e) {
runCanvasTest();
window.removeEventListener("MozAfterPaint", paintHandle, false);
window.removeEventListener("MozAfterPaint", paintHandle);
});
function runCanvasTest() {

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

@ -12,7 +12,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=627498
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=627498">Mozilla Bug 627498</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script type="application/javascript">
@ -29,7 +29,7 @@ function runTest() {
var Ci = SpecialPowers.Ci;
var sysInfo = Cc["@mozilla.org/system-info;1"].getService(Ci.nsIPropertyBag2);
var xr = Cc["@mozilla.org/xre/app-info;1"].getService(Ci.nsIXULRuntime);
var xr = SpecialPowers.Services.appinfo;
var windows = SpecialPowers.Services.ww.getWindowEnumerator();
var windowutils;
@ -59,8 +59,7 @@ function runTest() {
}
var osName = sysInfo.getProperty("name");
switch(osName)
{
switch (osName) {
case "Darwin": // Mac OS X.
// We only enable OpenGL layers on machines that don't support QuickDraw
// plugins. x86-64 architecture is a good proxy for this plugin support.

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

@ -12,7 +12,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=509244
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=509244">Mozilla Bug 509244</a>
<p id="display">A</p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script type="application/javascript">
@ -31,13 +31,11 @@ text.style.fontFamily = "sans-serif";
flush();
// flush cache
var os = SpecialPowers.Cc["@mozilla.org/observer-service;1"]
.getService(SpecialPowers.Ci.nsIObserverService);
os.notifyObservers(null, "memory-pressure", "heap-minimize");
SpecialPowers.Services.obs.notifyObservers(null, "memory-pressure", "heap-minimize");
// reuse font that was flushed from cache
text.style.fontFamily = "monospace";
flush();
flush();
ok(true, "not crashed");

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше