Chromium Code Reviews| 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 1e2a4d913e4257302da47d10620e9cddfa12c8b6..e73370f43a5bde09da714b42086c81e40c02e955 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() const |
| +{ |
| + 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); |
|
Justin Novosad
2016/04/14 20:45:14
Is this call at all expensive? I am concerned that
davve
2016/04/15 07:24:31
I don't think it's particularly expensive. But at
davve
2016/04/15 09:31:18
Now being able to read the spec text, it says "...
xidachen
2016/04/15 12:24:04
Thanks David. I am going with
return !concreteObj
|
| + |
| + if (intrinsicSizingInfo.hasWidth && intrinsicSizingInfo.hasHeight) |
| + return true; |
| + return false; |
| +} |
| + |
| FloatSize SVGImage::concreteObjectSize(const FloatSize& defaultObjectSize) const |
| { |
| SVGSVGElement* svg = svgRootElement(m_page.get()); |