Fix failure to print when pages contain zero-sized <canvas> element.
parent
ba11f2bc41
commit
7ad2d62b8f
|
@ -552,6 +552,11 @@ HTMLCanvasElement::CopyInnerTo(Element* aDest)
|
|||
HTMLCanvasElement* dest = static_cast<HTMLCanvasElement*>(aDest);
|
||||
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;
|
||||
dest->GetContext(NS_LITERAL_STRING("2d"), getter_AddRefs(cxt));
|
||||
RefPtr<CanvasRenderingContext2D> context2d =
|
||||
|
@ -565,6 +570,7 @@ HTMLCanvasElement::CopyInnerTo(Element* aDest)
|
|||
rv = err.StealNSResult();
|
||||
}
|
||||
}
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue