[Editor] Use a getter and not a function for the _checkIfSVGFitsInCanvas (bug 1846727)
It's a followup of #16780.
This commit is contained in:
parent
0725b6299f
commit
fcfb2457bc
@ -75,7 +75,7 @@ class ImageManager {
|
|||||||
|
|
||||||
#cache = null;
|
#cache = null;
|
||||||
|
|
||||||
static _checkIfSVGFitsInCanvas() {
|
static get _isSVGFittingCanvas() {
|
||||||
// By default, Firefox doesn't rescale without preserving the aspect ratio
|
// By default, Firefox doesn't rescale without preserving the aspect ratio
|
||||||
// when drawing an SVG image on a canvas, see https://bugzilla.mozilla.org/1547776.
|
// when drawing an SVG image on a canvas, see https://bugzilla.mozilla.org/1547776.
|
||||||
// The "workaround" is to append "svgView(preserveAspectRatio(none))" to the
|
// The "workaround" is to append "svgView(preserveAspectRatio(none))" to the
|
||||||
@ -91,7 +91,7 @@ class ImageManager {
|
|||||||
return new Uint32Array(ctx.getImageData(0, 0, 1, 1).data.buffer)[0] === 0;
|
return new Uint32Array(ctx.getImageData(0, 0, 1, 1).data.buffer)[0] === 0;
|
||||||
});
|
});
|
||||||
|
|
||||||
return shadow(this, "_checkIfSVGFitsInCanvas", promise);
|
return shadow(this, "_isSVGFittingCanvas", promise);
|
||||||
}
|
}
|
||||||
|
|
||||||
async #get(key, rawData) {
|
async #get(key, rawData) {
|
||||||
@ -128,8 +128,7 @@ class ImageManager {
|
|||||||
if (image.type === "image/svg+xml") {
|
if (image.type === "image/svg+xml") {
|
||||||
// Unfortunately, createImageBitmap doesn't work with SVG images.
|
// Unfortunately, createImageBitmap doesn't work with SVG images.
|
||||||
// (see https://bugzilla.mozilla.org/1841972).
|
// (see https://bugzilla.mozilla.org/1841972).
|
||||||
const mustRemoveAspectRatioPromise =
|
const mustRemoveAspectRatioPromise = ImageManager._isSVGFittingCanvas;
|
||||||
ImageManager._checkIfSVGFitsInCanvas();
|
|
||||||
const fileReader = new FileReader();
|
const fileReader = new FileReader();
|
||||||
const imageElement = new Image();
|
const imageElement = new Image();
|
||||||
const imagePromise = new Promise((resolve, reject) => {
|
const imagePromise = new Promise((resolve, reject) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user