[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>
diff --git a/experimental/svg/model/SkSVGAttributeParser.cpp b/experimental/svg/model/SkSVGAttributeParser.cpp
index 15927ae..c23f9f1 100644
--- a/experimental/svg/model/SkSVGAttributeParser.cpp
+++ b/experimental/svg/model/SkSVGAttributeParser.cpp
@@ -56,6 +56,12 @@
     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 @@
 
         matrix.preConcat(m);
         parsed = true;
+
+        this->parseCommaWspToken();
     }
 
     this->parseWSToken();
@@ -581,14 +589,6 @@
 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 @@
         // coordinate-pairs:
         //     coordinate-pair
         //     | coordinate-pair comma-wsp coordinate-pairs
-        if (parsedValue && !parseCommaWsp()) {
+        if (parsedValue && !this->parseCommaWspToken()) {
             break;
         }
 
@@ -613,7 +613,7 @@
         // coordinate-pair:
         //     coordinate comma-wsp coordinate
         //     | coordinate negative-coordinate
-        if (!parseCommaWsp() && !this->parseEOSToken() && *fCurPos != '-') {
+        if (!this->parseCommaWspToken() && !this->parseEOSToken() && *fCurPos != '-') {
             break;
         }