Index: experimental/svg/model/SkSVGSVG.cpp |
diff --git a/experimental/svg/model/SkSVGSVG.cpp b/experimental/svg/model/SkSVGSVG.cpp |
index 13f18043c0525ff41e20e915fec94966f3159098..592992760a34761c66be20ae6a5adb15ee30a38d 100644 |
--- a/experimental/svg/model/SkSVGSVG.cpp |
+++ b/experimental/svg/model/SkSVGSVG.cpp |
@@ -95,3 +95,15 @@ void SkSVGSVG::onSetAttribute(SkSVGAttribute attr, const SkSVGValue& v) { |
this->INHERITED::onSetAttribute(attr, v); |
} |
} |
+ |
+// https://www.w3.org/TR/SVG/coords.html#IntrinsicSizing |
+SkSize SkSVGSVG::intrinsicSize(const SkSVGLengthContext& lctx) const { |
+ // Percentage values do not provide an intrinsic size. |
+ if (fWidth.unit() == SkSVGLength::Unit::kPercentage || |
+ fHeight.unit() == SkSVGLength::Unit::kPercentage) { |
+ return SkSize::Make(0, 0); |
+ } |
+ |
+ return SkSize::Make(lctx.resolve(fWidth, SkSVGLengthContext::LengthType::kHorizontal), |
+ lctx.resolve(fHeight, SkSVGLengthContext::LengthType::kVertical)); |
+} |