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

Unified Diff: experimental/svg/model/SkSVGSVG.cpp

Issue 2345533002: [SVGDom] Expose intrinsic size info (Closed)
Patch Set: private intrinsicSize() Created 4 years, 3 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
« no previous file with comments | « experimental/svg/model/SkSVGSVG.h ('k') | samplecode/SampleSVGFile.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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));
+}
« no previous file with comments | « experimental/svg/model/SkSVGSVG.h ('k') | samplecode/SampleSVGFile.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698