зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1515942 - Enable ESLint for gfx/ (manual fixes). r=kats
Differential Revision: https://phabricator.services.mozilla.com/D15206 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
4388f2968a
Коммит
ce668e4afd
|
@ -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",
|
||||
}
|
||||
}]
|
||||
};
|
||||
|
|
|
@ -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() {
|
||||
|
@ -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);
|
||||
|
|
|
@ -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) {
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -335,6 +338,7 @@ 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");
|
||||
|
@ -481,7 +485,7 @@ function runContinuation(testFunction) {
|
|||
// The snapshot is returned in the form of a data URL.
|
||||
function getSnapshot(rect) {
|
||||
function parentProcessSnapshot() {
|
||||
addMessageListener("snapshot", function(rect) {
|
||||
addMessageListener("snapshot", function(parentRect) {
|
||||
ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||
var topWin = Services.wm.getMostRecentWindow("navigator:browser");
|
||||
if (!topWin) {
|
||||
|
@ -489,16 +493,18 @@ function getSnapshot(rect) {
|
|||
}
|
||||
|
||||
// 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();
|
||||
});
|
||||
}
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
function* test(testDriver) {
|
||||
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
|
||||
|
|
|
@ -30,6 +30,7 @@ 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() {
|
||||
|
@ -181,7 +182,7 @@ function* test(testDriver) {
|
|||
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);
|
||||
}
|
||||
|
@ -200,7 +201,7 @@ function* test(testDriver) {
|
|||
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");
|
||||
|
||||
|
|
|
@ -79,10 +79,9 @@ 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'
|
||||
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");
|
||||
|
|
|
@ -70,11 +70,9 @@ 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) == "(") {
|
||||
nesting++;
|
||||
|
@ -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++) {
|
||||
|
@ -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 = {};
|
||||
|
@ -298,7 +299,7 @@ function parseLayers(layersDumpLines) {
|
|||
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,7 +336,7 @@ function parseLayers(layersDumpLines) {
|
|||
var fields = [];
|
||||
var nesting = 0;
|
||||
var startIndex;
|
||||
for (var j = 0; j < rest.length; j++) {
|
||||
for (let j = 0; j < rest.length; j++) {
|
||||
if (rest.charAt(j) == "[") {
|
||||
nesting++;
|
||||
if (nesting == 1) {
|
||||
|
@ -349,13 +350,13 @@ 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");
|
||||
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";
|
||||
|
@ -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]);
|
||||
}
|
||||
}
|
||||
|
@ -521,7 +522,7 @@ 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;
|
||||
|
@ -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",
|
||||
|
@ -629,7 +630,7 @@ function populateLayers(root, displayList, pane, previewParent, hasSeenRoot, con
|
|||
}
|
||||
|
||||
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",
|
||||
|
@ -666,7 +667,6 @@ 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,
|
||||
|
@ -687,7 +687,7 @@ function populateLayers(root, displayList, pane, previewParent, hasSeenRoot, con
|
|||
},
|
||||
});
|
||||
|
||||
var icon = createElement("img", {
|
||||
icon = createElement("img", {
|
||||
style: {
|
||||
width: "12px",
|
||||
height: "12px",
|
||||
|
@ -699,10 +699,10 @@ function populateLayers(root, displayList, pane, previewParent, hasSeenRoot, con
|
|||
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: {
|
||||
|
@ -736,8 +736,6 @@ 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: {
|
||||
height: "100%",
|
||||
|
@ -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,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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -31,9 +31,7 @@ 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";
|
||||
|
|
|
@ -25,6 +25,7 @@ const simpleTestFiles = [
|
|||
"MockObjects.js",
|
||||
"SimpleTest.js",
|
||||
"WindowSnapshot.js",
|
||||
"paint_listener.js",
|
||||
];
|
||||
const simpleTestPath = "testing/mochitest/tests/SimpleTest";
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче