svg_loader SvgLoader: Add 'href' attribute for parser
authorJunsuChoi <jsuya.choi@samsung.com>
Fri, 30 Jul 2021 02:47:04 +0000 (11:47 +0900)
committerJunsuChoi <jsuya.choi@samsung.com>
Mon, 2 Aug 2021 03:25:14 +0000 (12:25 +0900)
"xlink:href" will be deprecated.
https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/xlink:href

src/loaders/svg/tvgSvgLoader.cpp

index 5e0c6d8..052035d 100644 (file)
@@ -1809,7 +1809,7 @@ static bool _attrParseUseNode(void* data, const char* key, const char* value)
     SvgNode *defs, *nodeFrom, *node = loader->svgParse->node;
     string* id;
 
-    if (!strcmp(key, "xlink:href")) {
+    if (!strcmp(key, "href") || !strcmp(key, "xlink:href")) {
         id = _idFromHref(value);
         defs = _getDefsNode(node);
         nodeFrom = _findChildById(defs, id->c_str());
@@ -2016,7 +2016,7 @@ static bool _attrParseRadialGradientNode(void* data, const char* key, const char
         grad->id = _copyId(value);
     } else if (!strcmp(key, "spreadMethod")) {
         grad->spread = _parseSpreadValue(value);
-    } else if (!strcmp(key, "xlink:href")) {
+    } else if (!strcmp(key, "href") || !strcmp(key, "xlink:href")) {
         grad->ref = _idFromHref(value);
     } else if (!strcmp(key, "gradientUnits") && !strcmp(value, "userSpaceOnUse")) {
         grad->userSpace = true;
@@ -2202,7 +2202,7 @@ static bool _attrParseLinearGradientNode(void* data, const char* key, const char
         grad->id = _copyId(value);
     } else if (!strcmp(key, "spreadMethod")) {
         grad->spread = _parseSpreadValue(value);
-    } else if (!strcmp(key, "xlink:href")) {
+    } else if (!strcmp(key, "href") || !strcmp(key, "xlink:href")) {
         grad->ref = _idFromHref(value);
     } else if (!strcmp(key, "gradientUnits") && !strcmp(value, "userSpaceOnUse")) {
         grad->userSpace = true;