Merge pull request #12626 from mike-000/patch-9

Set canvas style to override problem 3rd party css
This commit is contained in:
Andreas Hocevar
2021-08-16 12:15:07 +02:00
committed by GitHub

View File

@@ -19,12 +19,16 @@ export function createCanvasContext2D(
opt_canvasPool,
opt_Context2DSettings
) {
const canvas =
opt_canvasPool && opt_canvasPool.length
? opt_canvasPool.shift()
: WORKER_OFFSCREEN_CANVAS
? new OffscreenCanvas(opt_width || 300, opt_height || 300)
: document.createElement('canvas');
/** @type {HTMLCanvasElement|OffscreenCanvas} */
let canvas;
if (opt_canvasPool && opt_canvasPool.length) {
canvas = opt_canvasPool.shift();
} else if (WORKER_OFFSCREEN_CANVAS) {
canvas = new OffscreenCanvas(opt_width || 300, opt_height || 300);
} else {
canvas = document.createElement('canvas');
canvas.style.all = 'initial';
}
if (opt_width) {
canvas.width = opt_width;
}