aboutsummaryrefslogtreecommitdiffhomepage
path: root/experimental/svg/model/SkSVGAttributeParser.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'experimental/svg/model/SkSVGAttributeParser.cpp')
-rw-r--r--experimental/svg/model/SkSVGAttributeParser.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/experimental/svg/model/SkSVGAttributeParser.cpp b/experimental/svg/model/SkSVGAttributeParser.cpp
index f8eef8cfa7..aee15b394e 100644
--- a/experimental/svg/model/SkSVGAttributeParser.cpp
+++ b/experimental/svg/model/SkSVGAttributeParser.cpp
@@ -593,3 +593,27 @@ bool SkSVGAttributeParser::parseFillRule(SkSVGFillRule* fillRule) {
return parsedValue && this->parseEOSToken();
}
+
+// https://www.w3.org/TR/SVG/painting.html#VisibilityProperty
+bool SkSVGAttributeParser::parseVisibility(SkSVGVisibility* visibility) {
+ static const struct {
+ SkSVGVisibility::Type fType;
+ const char* fName;
+ } gVisibilityInfo[] = {
+ { SkSVGVisibility::Type::kVisible , "visible" },
+ { SkSVGVisibility::Type::kHidden , "hidden" },
+ { SkSVGVisibility::Type::kCollapse, "collapse" },
+ { SkSVGVisibility::Type::kInherit , "inherit" },
+ };
+
+ bool parsedValue = false;
+ for (const auto& parseInfo : gVisibilityInfo) {
+ if (this->parseExpectedStringToken(parseInfo.fName)) {
+ *visibility = SkSVGVisibility(parseInfo.fType);
+ parsedValue = true;
+ break;
+ }
+ }
+
+ return parsedValue && this->parseEOSToken();
+}