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

Unified Diff: third_party/WebKit/Source/modules/imagebitmap/ImageBitmapRenderingContext.cpp

Issue 2459233002: Consolidate implementation of ImageBitmapRenderingContext (Closed)
Patch Set: fix a layout test failure Created 4 years, 1 month 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
Index: third_party/WebKit/Source/modules/imagebitmap/ImageBitmapRenderingContext.cpp
diff --git a/third_party/WebKit/Source/modules/imagebitmap/ImageBitmapRenderingContext.cpp b/third_party/WebKit/Source/modules/imagebitmap/ImageBitmapRenderingContext.cpp
index 83227e68047d8112b0a028632c1852916ea0ce21..f73c6f8756e1cdce3c7499d270b833d1a088e5aa 100644
--- a/third_party/WebKit/Source/modules/imagebitmap/ImageBitmapRenderingContext.cpp
+++ b/third_party/WebKit/Source/modules/imagebitmap/ImageBitmapRenderingContext.cpp
@@ -27,12 +27,19 @@ void ImageBitmapRenderingContext::setCanvasGetContextResult(
}
void ImageBitmapRenderingContext::transferFromImageBitmap(
- ImageBitmap* imageBitmap) {
+ ImageBitmap* imageBitmap,
+ ExceptionState& exceptionState) {
if (!imageBitmap) {
m_image.release();
return;
}
+ if (imageBitmap->isNeutered()) {
+ exceptionState.throwDOMException(InvalidStateError,
+ "The input ImageBitmap has been detached");
+ return;
+ }
+
m_image = imageBitmap->bitmapImage();
if (!m_image)
return;
@@ -53,6 +60,7 @@ void ImageBitmapRenderingContext::transferFromImageBitmap(
}
canvas()->didDraw(
FloatRect(FloatPoint(), FloatSize(m_image->width(), m_image->height())));
+ imageBitmap->close();
}
bool ImageBitmapRenderingContext::paint(GraphicsContext& gc, const IntRect& r) {

Powered by Google App Engine
This is Rietveld 408576698