svg_loader: removed unused code

While css styling applied one of conditions was
always false. It is now removed and the function
that was called is refactored
This commit is contained in:
Mira Grudzinska 2023-04-24 00:54:57 +02:00 committed by Hermet Park
parent 83ffe9f612
commit bf2b348343

View file

@ -155,12 +155,12 @@ SvgNode* cssFindStyleNode(const SvgNode* style, const char* title, SvgNodeType t
SvgNode* cssFindStyleNode(const SvgNode* style, const char* title) SvgNode* cssFindStyleNode(const SvgNode* style, const char* title)
{ {
if (!style) return nullptr; if (!style || !title) return nullptr;
auto child = style->child.data; auto child = style->child.data;
for (uint32_t i = 0; i < style->child.count; ++i, ++child) { for (uint32_t i = 0; i < style->child.count; ++i, ++child) {
if ((*child)->type == SvgNodeType::CssStyle) { if ((*child)->type == SvgNodeType::CssStyle) {
if ((title && (*child)->id && !strcmp((*child)->id, title))) return (*child); if ((*child)->id && !strcmp((*child)->id, title)) return (*child);
} }
} }
return nullptr; return nullptr;
@ -175,9 +175,6 @@ void cssUpdateStyle(SvgNode* doc, SvgNode* style)
if (auto cssNode = cssFindStyleNode(style, nullptr, (*child)->type)) { if (auto cssNode = cssFindStyleNode(style, nullptr, (*child)->type)) {
cssCopyStyleAttr(*child, cssNode); cssCopyStyleAttr(*child, cssNode);
} }
if (auto cssNode = cssFindStyleNode(style, nullptr)) {
cssCopyStyleAttr(*child, cssNode);
}
cssUpdateStyle(*child, style); cssUpdateStyle(*child, style);
} }
} }