mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 997014 - Part 6: Remove duplicate code for retreiving a snapshot from a canvas in CanvasRenderingContext2D. r=roc
This commit is contained in:
parent
efb62922b5
commit
c86a13d275
@ -3216,33 +3216,6 @@ CanvasRenderingContext2D::DrawImage(const HTMLImageOrCanvasOrVideoElement& image
|
||||
if (image.IsHTMLCanvasElement()) {
|
||||
HTMLCanvasElement* canvas = &image.GetAsHTMLCanvasElement();
|
||||
element = canvas;
|
||||
nsIntSize size = canvas->GetSize();
|
||||
if (size.width == 0 || size.height == 0) {
|
||||
error.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
|
||||
return;
|
||||
}
|
||||
|
||||
// Special case for Canvas, which could be an Azure canvas!
|
||||
nsICanvasRenderingContextInternal *srcCanvas = canvas->GetContextAtIndex(0);
|
||||
if (srcCanvas == this) {
|
||||
// Self-copy.
|
||||
srcSurf = mTarget->Snapshot();
|
||||
imgSize = gfxIntSize(mWidth, mHeight);
|
||||
} else if (srcCanvas) {
|
||||
// This might not be an Azure canvas!
|
||||
srcSurf = srcCanvas->GetSurfaceSnapshot();
|
||||
|
||||
if (srcSurf) {
|
||||
if (mCanvasElement) {
|
||||
// Do security check here.
|
||||
CanvasUtils::DoDrawImageSecurityCheck(mCanvasElement,
|
||||
element->NodePrincipal(),
|
||||
canvas->IsWriteOnly(),
|
||||
false);
|
||||
}
|
||||
imgSize = gfxIntSize(srcSurf->GetSize().width, srcSurf->GetSize().height);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (image.IsHTMLImageElement()) {
|
||||
HTMLImageElement* img = &image.GetAsHTMLImageElement();
|
||||
|
Loading…
Reference in New Issue
Block a user