Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1068)

Unified Diff: Source/core/html/HTMLCanvasElement.cpp

Issue 633093002: Returns nullptr in getImageSourceForCanvas when imageSnapshot is null (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/HTMLCanvasElement.cpp
diff --git a/Source/core/html/HTMLCanvasElement.cpp b/Source/core/html/HTMLCanvasElement.cpp
index 3f9fd63726d9d5c185275d830d6666f4ceed8038..e49d7dbe402094ed32006e20203bd845d75dcc7c 100644
--- a/Source/core/html/HTMLCanvasElement.cpp
+++ b/Source/core/html/HTMLCanvasElement.cpp
@@ -738,11 +738,19 @@ PassRefPtr<Image> HTMLCanvasElement::getSourceImageForCanvas(SourceImageMode mod
// can't create SkImage from WebGLImageBufferSurface (contains only SkBitmap)
return m_imageBuffer->copyImage(DontCopyBackingStore, Unscaled);
- } else {
+ }
+
+ RefPtr<SkImage> image = m_imageBuffer->newImageSnapshot();
+ if (image) {
*status = NormalSourceImageStatus;
+
+ return StaticBitmapImage::create(image.release());
}
- return StaticBitmapImage::create(m_imageBuffer->newImageSnapshot());
+
+ *status = InvalidSourceImageStatus;
+
+ return nullptr;
}
bool HTMLCanvasElement::wouldTaintOrigin(SecurityOrigin*) const
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698