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

Unified Diff: third_party/WebKit/Source/modules/canvas2d/BaseRenderingContext2D.cpp

Issue 2294383002: Make OffscreenCanvas a member of CanvasImageSource (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 4 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
Index: third_party/WebKit/Source/modules/canvas2d/BaseRenderingContext2D.cpp
diff --git a/third_party/WebKit/Source/modules/canvas2d/BaseRenderingContext2D.cpp b/third_party/WebKit/Source/modules/canvas2d/BaseRenderingContext2D.cpp
index 8f80b02040daa0f04f29f6c585c61e1dd5c5e908..c1c2227181b529b8306a0e872619ca7e671e66ec 100644
--- a/third_party/WebKit/Source/modules/canvas2d/BaseRenderingContext2D.cpp
+++ b/third_party/WebKit/Source/modules/canvas2d/BaseRenderingContext2D.cpp
@@ -13,6 +13,7 @@
#include "core/html/HTMLImageElement.h"
#include "core/html/HTMLVideoElement.h"
#include "core/html/ImageData.h"
+#include "core/offscreencanvas/OffscreenCanvas.h"
#include "modules/canvas2d/CanvasGradient.h"
#include "modules/canvas2d/CanvasPattern.h"
#include "modules/canvas2d/CanvasStyle.h"
@@ -878,6 +879,13 @@ static inline CanvasImageSource* toImageSourceInternal(const CanvasImageSourceUn
}
return value.getAsImageBitmap();
}
+ if (value.isOffscreenCanvas()) {
+ if (static_cast<OffscreenCanvas*>(value.getAsOffscreenCanvas())->isNeutered()) {
+ exceptionState.throwDOMException(InvalidStateError, String::format("The image source is detached"));
+ return nullptr;
+ }
+ return value.getAsOffscreenCanvas();
+ }
ASSERT_NOT_REACHED();
return nullptr;
}

Powered by Google App Engine
This is Rietveld 408576698