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

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

Issue 2202053002: [SVGDom/experimental] Initial SVGLength support (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: review Created 4 years, 4 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') | experimental/svg/model/SkSVGShape.h » ('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 aeccc7082b8e27036195ce9e5bb11b09a5c9a958..42bd280a5e1f7418fab5cb6de2bc6b164e1142ad 100644
--- a/experimental/svg/model/SkSVGSVG.cpp
+++ b/experimental/svg/model/SkSVGSVG.cpp
@@ -6,5 +6,49 @@
*/
#include "SkSVGSVG.h"
+#include "SkSVGValue.h"
SkSVGSVG::SkSVGSVG() : INHERITED(SkSVGTag::kSvg) { }
+
+void SkSVGSVG::setX(const SkSVGLength& x) {
+ fX = x;
+}
+
+void SkSVGSVG::setY(const SkSVGLength& y) {
+ fY = y;
+}
+
+void SkSVGSVG::setWidth(const SkSVGLength& w) {
+ fWidth = w;
+}
+
+void SkSVGSVG::setHeight(const SkSVGLength& h) {
+ fHeight = h;
+}
+
+void SkSVGSVG::onSetAttribute(SkSVGAttribute attr, const SkSVGValue& v) {
+ switch (attr) {
+ case SkSVGAttribute::kX:
+ if (const auto* x = v.as<SkSVGLengthValue>()) {
+ this->setX(*x);
+ }
+ break;
+ case SkSVGAttribute::kY:
+ if (const auto* y = v.as<SkSVGLengthValue>()) {
+ this->setY(*y);
+ }
+ break;
+ case SkSVGAttribute::kWidth:
+ if (const auto* w = v.as<SkSVGLengthValue>()) {
+ this->setWidth(*w);
+ }
+ break;
+ case SkSVGAttribute::kHeight:
+ if (const auto* h = v.as<SkSVGLengthValue>()) {
+ this->setHeight(*h);
+ }
+ break;
+ default:
+ this->INHERITED::onSetAttribute(attr, v);
+ }
+}
« no previous file with comments | « experimental/svg/model/SkSVGSVG.h ('k') | experimental/svg/model/SkSVGShape.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698