[svg] Fix multiple transforms specified
The transform attribute can accept a comma-wsp separated list of transformations. Relevant test is coords-transformattr-01-f. Change-Id: I22dd4b65dc4922d9f5b0ca168cd1fc38fca30ec8 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/283777 Reviewed-by: Florin Malita <fmalita@chromium.org> Commit-Queue: Tyler Denniston <tdenniston@google.com>
This commit is contained in:
parent
7a9c9d66f1
commit
2d65b73337
@ -56,6 +56,12 @@ inline bool SkSVGAttributeParser::parseWSToken() {
|
||||
return this->advanceWhile(is_ws);
|
||||
}
|
||||
|
||||
inline bool SkSVGAttributeParser::parseCommaWspToken() {
|
||||
// comma-wsp:
|
||||
// (wsp+ comma? wsp*) | (comma wsp*)
|
||||
return this->parseWSToken() || this->parseExpectedStringToken(",");
|
||||
}
|
||||
|
||||
inline bool SkSVGAttributeParser::parseExpectedStringToken(const char* expected) {
|
||||
const char* c = fCurPos;
|
||||
|
||||
@ -435,6 +441,8 @@ bool SkSVGAttributeParser::parseTransform(SkSVGTransformType* t) {
|
||||
|
||||
matrix.preConcat(m);
|
||||
parsed = true;
|
||||
|
||||
this->parseCommaWspToken();
|
||||
}
|
||||
|
||||
this->parseWSToken();
|
||||
@ -581,14 +589,6 @@ bool SkSVGAttributeParser::parseStopColor(SkSVGStopColor* stopColor) {
|
||||
bool SkSVGAttributeParser::parsePoints(SkSVGPointsType* points) {
|
||||
SkTDArray<SkPoint> pts;
|
||||
|
||||
// comma-wsp:
|
||||
// (wsp+ comma? wsp*) | (comma wsp*)
|
||||
const auto parseCommaWsp = [this]() -> bool {
|
||||
const bool wsp = this->parseWSToken();
|
||||
const bool comma = this->parseExpectedStringToken(",");
|
||||
return wsp || comma;
|
||||
};
|
||||
|
||||
// Skip initial wsp.
|
||||
// list-of-points:
|
||||
// wsp* coordinate-pairs? wsp*
|
||||
@ -600,7 +600,7 @@ bool SkSVGAttributeParser::parsePoints(SkSVGPointsType* points) {
|
||||
// coordinate-pairs:
|
||||
// coordinate-pair
|
||||
// | coordinate-pair comma-wsp coordinate-pairs
|
||||
if (parsedValue && !parseCommaWsp()) {
|
||||
if (parsedValue && !this->parseCommaWspToken()) {
|
||||
break;
|
||||
}
|
||||
|
||||
@ -613,7 +613,7 @@ bool SkSVGAttributeParser::parsePoints(SkSVGPointsType* points) {
|
||||
// coordinate-pair:
|
||||
// coordinate comma-wsp coordinate
|
||||
// | coordinate negative-coordinate
|
||||
if (!parseCommaWsp() && !this->parseEOSToken() && *fCurPos != '-') {
|
||||
if (!this->parseCommaWspToken() && !this->parseEOSToken() && *fCurPos != '-') {
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -43,6 +43,7 @@ private:
|
||||
bool parseWSToken();
|
||||
bool parseEOSToken();
|
||||
bool parseSepToken();
|
||||
bool parseCommaWspToken();
|
||||
bool parseExpectedStringToken(const char*);
|
||||
bool parseScalarToken(SkScalar*);
|
||||
bool parseHexToken(uint32_t*);
|
||||
|
Loading…
Reference in New Issue
Block a user