mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-30 12:27:29 +09:00
Fix failure to print when pages contain zero-sized <canvas> element.
Fixes #1058
This commit is contained in:
parent
ad9ac70742
commit
852ce8292d
1 changed files with 17 additions and 11 deletions
|
|
@ -552,6 +552,11 @@ HTMLCanvasElement::CopyInnerTo(Element* aDest)
|
||||||
HTMLCanvasElement* dest = static_cast<HTMLCanvasElement*>(aDest);
|
HTMLCanvasElement* dest = static_cast<HTMLCanvasElement*>(aDest);
|
||||||
dest->mOriginalCanvas = this;
|
dest->mOriginalCanvas = this;
|
||||||
|
|
||||||
|
// We make sure that the canvas is not zero sized since that would cause
|
||||||
|
// the DrawImage call below to return an error, which would cause printing
|
||||||
|
// to fail.
|
||||||
|
nsIntSize size = GetWidthHeight();
|
||||||
|
if (size.height > 0 && size.width > 0) {
|
||||||
nsCOMPtr<nsISupports> cxt;
|
nsCOMPtr<nsISupports> cxt;
|
||||||
dest->GetContext(NS_LITERAL_STRING("2d"), getter_AddRefs(cxt));
|
dest->GetContext(NS_LITERAL_STRING("2d"), getter_AddRefs(cxt));
|
||||||
RefPtr<CanvasRenderingContext2D> context2d =
|
RefPtr<CanvasRenderingContext2D> context2d =
|
||||||
|
|
@ -565,6 +570,7 @@ HTMLCanvasElement::CopyInnerTo(Element* aDest)
|
||||||
rv = err.StealNSResult();
|
rv = err.StealNSResult();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue