svg_loader: only the first css style node is interpreted 52/289752/1
authorMira Grudzinska <m.grudzinska@samsung.com>
Sun, 28 Aug 2022 22:06:52 +0000 (00:06 +0200)
committerMichal Szczecinski <mihashco89@gmail.com>
Tue, 14 Mar 2023 06:41:19 +0000 (07:41 +0100)
Since the css id selector is not supported in TVG, only the first
style node is taken into account.

Change-Id: I23775d42f03668372ccae770d9cb6164bebf2ee2

src/loaders/svg/tvgSvgLoader.cpp

index 42bfd4de70a91bb782e269e38e41ee32c68ec611..00c091112f94446d0c0557a9d82e2b55022da2d8 100644 (file)
@@ -2695,10 +2695,14 @@ static void _svgLoaderParserXmlOpen(SvgLoaderData* loader, const char* content,
             if (loader->stack.count > 0) parent = loader->stack.data[loader->stack.count - 1];
             else parent = loader->doc;
             if (!strcmp(tagName, "style")) {
-                node = method(loader, nullptr, attrs, attrsLength, simpleXmlParseAttributes);
-                loader->cssStyle = node;
-                loader->doc->node.doc.style = node;
-                loader->style = true;
+                // TODO: For now only the first style node is saved. After the css id selector
+                // is introduced this if condition shouldin't be necessary any more
+                if (!loader->cssStyle) {
+                    node = method(loader, nullptr, attrs, attrsLength, simpleXmlParseAttributes);
+                    loader->cssStyle = node;
+                    loader->doc->node.doc.style = node;
+                    loader->style = true;
+                }
             } else {
                 node = method(loader, parent, attrs, attrsLength, simpleXmlParseAttributes);
             }