Bug 1528108 - Drop support for PageThumbUtils.createCanvas with null window r=Standard8

Differential Revision: https://phabricator.services.mozilla.com/D22892

--HG--
extra : moz-landing-system : lando
This commit is contained in:
monmanuela 2019-03-15 09:26:29 +00:00
parent 54d67a13d1
commit 1d874536ba
3 changed files with 8 additions and 9 deletions

View File

@ -148,7 +148,7 @@ function PreviewController(win, tab) {
this.tab.addEventListener("TabAttrModified", this);
XPCOMUtils.defineLazyGetter(this, "canvasPreview", function() {
let canvas = PageThumbs.createCanvas();
let canvas = PageThumbs.createCanvas(this.win);
canvas.mozOpaque = true;
return canvas;
});
@ -270,7 +270,7 @@ PreviewController.prototype = {
let winWidth = this.win.width;
let winHeight = this.win.height;
let composite = PageThumbs.createCanvas();
let composite = PageThumbs.createCanvas(this.win);
// Use transparency, Aero glass is drawn black without it.
composite.mozOpaque = false;

View File

@ -21,17 +21,16 @@ var PageThumbUtils = {
HTML_NAMESPACE: "http://www.w3.org/1999/xhtml",
/**
* Creates a new canvas element in the context of aWindow, or if aWindow
* is undefined, in the context of hiddenDOMWindow.
* Creates a new canvas element in the context of aWindow.
*
* @param aWindow (optional) The document of this window will be used to
* create the canvas. If not given, the hidden window will be used.
* @param aWindow The document of this window will be used to
* create the canvas.
* @param aWidth (optional) width of the canvas to create
* @param aHeight (optional) height of the canvas to create
* @return The newly created canvas.
*/
createCanvas(aWindow, aWidth = 0, aHeight = 0) {
let doc = (aWindow || Services.appShell.hiddenDOMWindow).document;
let doc = aWindow.document;
let canvas = doc.createElementNS(this.HTML_NAMESPACE, "canvas");
canvas.mozOpaque = true;
canvas.imageSmoothingEnabled = true;

View File

@ -163,7 +163,7 @@ var PageThumbs = {
}
return new Promise(resolve => {
let canvas = this.createCanvas(aBrowser.contentWindow);
let canvas = this.createCanvas(aBrowser.ownerGlobal);
this.captureToCanvas(aBrowser, canvas, () => {
canvas.toBlob(blob => {
resolve(blob, this.contentType);
@ -261,7 +261,7 @@ var PageThumbs = {
return;
}
// The content is a local page, grab a thumbnail sync.
PageThumbUtils.createSnapshotThumbnail(aBrowser.contentWindow,
PageThumbUtils.createSnapshotThumbnail(aBrowser.ownerGlobal,
aCanvas,
aArgs);