Chromium Code Reviews| Index: experimental/svg/model/SkSVGAttributeParser.cpp |
| diff --git a/experimental/svg/model/SkSVGAttributeParser.cpp b/experimental/svg/model/SkSVGAttributeParser.cpp |
| index 75e5d12f38558868bc2b15dfa426b15c84d1740f..6b523b1b31c2cc4bf57b735c52cd9d6e5e7098eb 100644 |
| --- a/experimental/svg/model/SkSVGAttributeParser.cpp |
| +++ b/experimental/svg/model/SkSVGAttributeParser.cpp |
| @@ -149,12 +149,12 @@ bool SkSVGAttributeParser::parseHexColorToken(SkColor* c) { |
| } |
| // https://www.w3.org/TR/SVG/types.html#DataTypeColor |
| -bool SkSVGAttributeParser::parseColor(SkSVGColor* color) { |
| +bool SkSVGAttributeParser::parseColor(SkSVGColorType* color) { |
| SkColor c; |
| // TODO: rgb(...) |
| if (this->parseHexColorToken(&c) || this->parseNamedColorToken(&c)) { |
| - *color = SkSVGColor(c); |
| + *color = SkSVGColorType(c); |
| return true; |
| } |
| @@ -162,13 +162,13 @@ bool SkSVGAttributeParser::parseColor(SkSVGColor* color) { |
| } |
| // https://www.w3.org/TR/SVG/types.html#DataTypeNumber |
| -bool SkSVGAttributeParser::parseNumber(SkSVGNumber* number) { |
| +bool SkSVGAttributeParser::parseNumber(SkSVGNumberType* number) { |
| // consume WS |
| this->parseWSToken(); |
| SkScalar s; |
| if (this->parseScalarToken(&s)) { |
| - *number = SkSVGNumber(s); |
| + *number = SkSVGNumberType(s); |
| // consume trailing separators |
| this->parseSepToken(); |
| return true; |
| @@ -192,3 +192,19 @@ bool SkSVGAttributeParser::parseLength(SkSVGLength* length) { |
| return false; |
| } |
| + |
| +// https://www.w3.org/TR/SVG/coords.html#ViewBoxAttribute |
| +bool SkSVGAttributeParser::parseViewBox(SkSVGViewBoxType* vb) { |
| + SkScalar x, y, w, h; |
| + this->parseWSToken(); |
| + if (this->parseScalarToken(&x) && this->parseSepToken() && |
| + this->parseScalarToken(&y) && this->parseSepToken() && |
| + this->parseScalarToken(&w) && this->parseSepToken() && |
| + this->parseScalarToken(&h)) { |
| + |
| + *vb = SkSVGViewBoxType(SkRect::MakeXYWH(x, y, w, h)); |
| + // consume trailing whitespace |
| + this->parseWSToken(); |
| + } |
|
robertphillips
2016/08/08 13:55:28
What happens on a partial parse that ends in an EO
f(malita)
2016/08/08 17:13:29
Fixed.
|
| + return this->parseEOSToken(); |
| +} |