mirror of
https://github.com/niklasvh/html2canvas.git
synced 2023-08-10 21:13:10 +03:00
fix: zero size iframe rendering (#1863)
This commit is contained in:
parent
61f4819e02
commit
81dcf7b6be
@ -15,8 +15,8 @@ export class IFrameElementContainer extends ElementContainer {
|
|||||||
constructor(iframe: HTMLIFrameElement) {
|
constructor(iframe: HTMLIFrameElement) {
|
||||||
super(iframe);
|
super(iframe);
|
||||||
this.src = iframe.src;
|
this.src = iframe.src;
|
||||||
this.width = parseInt(iframe.width, 10);
|
this.width = parseInt(iframe.width, 10) || 0;
|
||||||
this.height = parseInt(iframe.height, 10);
|
this.height = parseInt(iframe.height, 10) || 0;
|
||||||
this.backgroundColor = this.styles.backgroundColor;
|
this.backgroundColor = this.styles.backgroundColor;
|
||||||
try {
|
try {
|
||||||
if (
|
if (
|
||||||
|
@ -306,17 +306,19 @@ export class CanvasRenderer {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const canvas = await iframeRenderer.render(container.tree);
|
const canvas = await iframeRenderer.render(container.tree);
|
||||||
this.ctx.drawImage(
|
if (container.width && container.height) {
|
||||||
canvas,
|
this.ctx.drawImage(
|
||||||
0,
|
canvas,
|
||||||
0,
|
0,
|
||||||
container.width,
|
0,
|
||||||
container.width,
|
container.width,
|
||||||
container.bounds.left,
|
container.height,
|
||||||
container.bounds.top,
|
container.bounds.left,
|
||||||
container.bounds.width,
|
container.bounds.top,
|
||||||
container.bounds.height
|
container.bounds.width,
|
||||||
);
|
container.bounds.height
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (container instanceof InputElementContainer) {
|
if (container instanceof InputElementContainer) {
|
||||||
|
Loading…
Reference in New Issue
Block a user