Index: third_party/WebKit/Source/core/imagebitmap/ImageBitmapFactories.cpp |
diff --git a/third_party/WebKit/Source/core/imagebitmap/ImageBitmapFactories.cpp b/third_party/WebKit/Source/core/imagebitmap/ImageBitmapFactories.cpp |
index 3c2a1a763b01584173f6a23739180fdea6a088f2..e1e7bfb7bdb62690b03a8188dde804f550ed6661 100644 |
--- a/third_party/WebKit/Source/core/imagebitmap/ImageBitmapFactories.cpp |
+++ b/third_party/WebKit/Source/core/imagebitmap/ImageBitmapFactories.cpp |
@@ -45,6 +45,7 @@ |
#include "core/html/ImageData.h" |
#include "core/imagebitmap/ImageBitmapOptions.h" |
#include "core/offscreencanvas/OffscreenCanvas.h" |
+#include "core/svg/SVGImageElement.h" |
#include "core/svg/graphics/SVGImage.h" |
#include "core/workers/WorkerGlobalScope.h" |
#include "platform/CrossThreadFunctional.h" |
@@ -63,9 +64,16 @@ static inline ImageBitmapSource* ToImageBitmapSourceInternal( |
ExceptionState& exception_state, |
const ImageBitmapOptions& options, |
bool has_crop_rect) { |
+ HTMLAndSVGImageElementSource* image_element = nullptr; |
if (value.isHTMLImageElement()) { |
- HTMLImageElement* image_element = value.getAsHTMLImageElement(); |
- if (!image_element || !image_element->CachedImage()) { |
+ if (!(image_element = value.getAsHTMLImageElement())) |
+ return nullptr; |
+ } else if (value.isSVGImageElement()) { |
+ if (!(image_element = value.getAsSVGImageElement())) |
+ return nullptr; |
+ } |
+ if (image_element) { |
+ if (!image_element->CachedImage()) { |
exception_state.ThrowDOMException( |
kInvalidStateError, |
"No image can be retrieved from the provided element."); |