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

Unified Diff: third_party/WebKit/Source/core/html/HTMLImageElement.cpp

Issue 1890613002: Support createImageBitmap from a SVG image (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nits Created 4 years, 8 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/core/html/HTMLImageElement.cpp
diff --git a/third_party/WebKit/Source/core/html/HTMLImageElement.cpp b/third_party/WebKit/Source/core/html/HTMLImageElement.cpp
index f389f1c896feb67db1e795a1258b107e610022bf..44ca9670c7dbe11f427a6b4e190b5ae58edbdbcc 100644
--- a/third_party/WebKit/Source/core/html/HTMLImageElement.cpp
+++ b/third_party/WebKit/Source/core/html/HTMLImageElement.cpp
@@ -690,8 +690,11 @@ ScriptPromise HTMLImageElement::createImageBitmap(ScriptState* scriptState, Even
return ScriptPromise();
}
if (cachedImage()->getImage()->isSVGImage()) {
- exceptionState.throwDOMException(InvalidStateError, "The image element contains an SVG image, which is unsupported.");
- return ScriptPromise();
+ SVGImage* image = toSVGImage(cachedImage()->getImage());
+ if (!image->hasIntrinsicDimensions()) {
+ exceptionState.throwDOMException(InvalidStateError, "The image element contains an SVG image without intrinsic dimensions.");
+ return ScriptPromise();
+ }
}
if (!sw || !sh) {
exceptionState.throwDOMException(IndexSizeError, String::format("The source %s provided is 0.", sw ? "height" : "width"));

Powered by Google App Engine
This is Rietveld 408576698