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

Unified Diff: third_party/WebKit/Source/core/svg/graphics/SVGImage.cpp

Issue 1890613002: Support createImageBitmap from a SVG image (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address comments, update layout tests results 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/svg/graphics/SVGImage.cpp
diff --git a/third_party/WebKit/Source/core/svg/graphics/SVGImage.cpp b/third_party/WebKit/Source/core/svg/graphics/SVGImage.cpp
index bf916658585ccc7a05988b08e658f67208bfb4e9..1444304d763108d40e9b1b14a962dd0335173ff3 100644
--- a/third_party/WebKit/Source/core/svg/graphics/SVGImage.cpp
+++ b/third_party/WebKit/Source/core/svg/graphics/SVGImage.cpp
@@ -168,6 +168,24 @@ static float resolveHeightForRatio(float width, const FloatSize& intrinsicRatio)
return width * intrinsicRatio.height() / intrinsicRatio.width();
}
+bool SVGImage::hasIntrinsicSize()
+{
+ SVGSVGElement* svg = svgRootElement(m_page.get());
+ if (!svg)
+ return false;
+
+ LayoutSVGRoot* layoutObject = toLayoutSVGRoot(svg->layoutObject());
+ if (!layoutObject)
+ return false;
+
+ LayoutReplaced::IntrinsicSizingInfo intrinsicSizingInfo;
+ layoutObject->computeIntrinsicSizingInfo(intrinsicSizingInfo);
+
+ if (intrinsicSizingInfo.hasWidth && intrinsicSizingInfo.hasHeight)
+ return true;
+ return false;
+}
+
FloatSize SVGImage::concreteObjectSize(const FloatSize& defaultObjectSize) const
{
SVGSVGElement* svg = svgRootElement(m_page.get());

Powered by Google App Engine
This is Rietveld 408576698