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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « experimental/svg/model/SkSVGSVG.h ('k') | experimental/svg/model/SkSVGShape.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2016 Google Inc. 2 * Copyright 2016 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkSVGSVG.h" 8 #include "SkSVGSVG.h"
9 #include "SkSVGValue.h"
9 10
10 SkSVGSVG::SkSVGSVG() : INHERITED(SkSVGTag::kSvg) { } 11 SkSVGSVG::SkSVGSVG() : INHERITED(SkSVGTag::kSvg) { }
12
13 void SkSVGSVG::setX(const SkSVGLength& x) {
14 fX = x;
15 }
16
17 void SkSVGSVG::setY(const SkSVGLength& y) {
18 fY = y;
19 }
20
21 void SkSVGSVG::setWidth(const SkSVGLength& w) {
22 fWidth = w;
23 }
24
25 void SkSVGSVG::setHeight(const SkSVGLength& h) {
26 fHeight = h;
27 }
28
29 void SkSVGSVG::onSetAttribute(SkSVGAttribute attr, const SkSVGValue& v) {
30 switch (attr) {
31 case SkSVGAttribute::kX:
32 if (const auto* x = v.as<SkSVGLengthValue>()) {
33 this->setX(*x);
34 }
35 break;
36 case SkSVGAttribute::kY:
37 if (const auto* y = v.as<SkSVGLengthValue>()) {
38 this->setY(*y);
39 }
40 break;
41 case SkSVGAttribute::kWidth:
42 if (const auto* w = v.as<SkSVGLengthValue>()) {
43 this->setWidth(*w);
44 }
45 break;
46 case SkSVGAttribute::kHeight:
47 if (const auto* h = v.as<SkSVGLengthValue>()) {
48 this->setHeight(*h);
49 }
50 break;
51 default:
52 this->INHERITED::onSetAttribute(attr, v);
53 }
54 }
OLDNEW
« 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