]> gitweb.michael.orlitzky.com - libsvgtiny.git/commitdiff
src/svgtiny.c: remove parent == NULL hack
authorMichael Orlitzky <michael@orlitzky.com>
Sat, 7 Jun 2025 15:53:44 +0000 (11:53 -0400)
committerMichael Orlitzky <michael@orlitzky.com>
Mon, 9 Jun 2025 01:13:07 +0000 (21:13 -0400)
Now that we're providing some (unused!) default user-agent properties,
this code path is apparently no longer reached. Never look a gift
horse in the mouth, is an insane saying. But everything works great
without the NULL check, so let's remove it.

src/svgtiny.c

index f2fb5b4b4fd365ca7401364114ed3e3167e18d59..f5ed89b0b01e0d30b0b2bc2db293f8dd8dc21ed8 100644 (file)
@@ -441,30 +441,6 @@ static css_select_results *svgtiny_parse_styles(dom_element *node,
                dom_string_unref(attr);
        }
 
-       struct dom_element *parent;
-       dom_element_parent_node(node, &parent);
-       if (parent == NULL) {
-               /* This is the root <svg> node, skip it.
-               *
-               * While initialising its selection state, libcss sets its
-               * node_data->bloom pointer using css__get_parent_bloom().
-               * But if there is no parent, that function returns,
-               *
-               *   static css_bloom empty_bloom[CSS_BLOOM_SIZE];
-               *
-               * A problem later arises because when libcss FINALISES its
-               * selection state, it frees node_data->bloom! That obviously
-               * won't work then node has no parent, i.e. if it's the root
-               * <svg> element.
-               */
-               css_stylesheet_destroy(inline_sheet);
-               return NULL;
-       }
-       else {
-               /* We only needed to know if it was NULL */
-               dom_node_unref(parent);
-       }
-
        code = svgtiny_select_style(state, node, inline_sheet, &styles);
        css_stylesheet_destroy(inline_sheet);
        if (code != CSS_OK) {