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

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

Issue 2225623002: [SVGDom] Improve whitespace handling in style parsing (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: rebased 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 | « no previous file | experimental/svg/model/SkSVGDOM.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: experimental/svg/model/SkSVGAttributeParser.cpp
diff --git a/experimental/svg/model/SkSVGAttributeParser.cpp b/experimental/svg/model/SkSVGAttributeParser.cpp
index f973d385f5751906a40374c3b396ea4d3e97b2e2..7a2561cdf718f5b8c91cc52c219fc8d4b2a233fd 100644
--- a/experimental/svg/model/SkSVGAttributeParser.cpp
+++ b/experimental/svg/model/SkSVGAttributeParser.cpp
@@ -152,13 +152,20 @@ bool SkSVGAttributeParser::parseHexColorToken(SkColor* c) {
bool SkSVGAttributeParser::parseColor(SkSVGColorType* color) {
SkColor c;
+ // consume preceding whitespace
+ this->parseWSToken();
+
// TODO: rgb(...)
+ bool parsedValue = false;
if (this->parseHexColorToken(&c) || this->parseNamedColorToken(&c)) {
*color = SkSVGColorType(c);
- return true;
+ parsedValue = true;
+
+ // consume trailing whitespace
+ this->parseWSToken();
}
- return false;
+ return parsedValue && this->parseEOSToken();
}
// https://www.w3.org/TR/SVG/types.html#DataTypeNumber
« no previous file with comments | « no previous file | experimental/svg/model/SkSVGDOM.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698