From 1ecc94b187a94859fb347cd5f585d721e7d6e8be Mon Sep 17 00:00:00 2001 From: John-Mark Bell Date: Sun, 15 Jul 2012 01:39:25 +0100 Subject: Use case insensitive string comparisions for nodes --- render/box_construct.c | 16 +++++++++------- render/html.c | 14 ++++++++------ 2 files changed, 17 insertions(+), 13 deletions(-) (limited to 'render') diff --git a/render/box_construct.c b/render/box_construct.c index 0044f6e21..b968e0e4f 100644 --- a/render/box_construct.c +++ b/render/box_construct.c @@ -1939,7 +1939,7 @@ bool box_object(BOX_SPECIAL_PARAMS) return false; } - if (strcmp(dom_string_data(name), "param") != 0) { + if (strcasecmp(dom_string_data(name), "param") != 0) { /* The first non-param child is the start of * the alt html. Therefore, we should break * out of this loop. */ @@ -2192,9 +2192,11 @@ bool box_create_frameset(struct content_html_frames *f, dom_node *n, } if (type != DOM_ELEMENT_NODE || - (strcmp(dom_string_data(name), + (strcasecmp( + dom_string_data(name), "frame") != 0 && - strcmp(dom_string_data(name), + strcasecmp( + dom_string_data(name), "frameset") != 0)) { err = dom_node_get_next_sibling(c, &next); @@ -2225,7 +2227,7 @@ bool box_create_frameset(struct content_html_frames *f, dom_node *n, return false; } - if (strcmp(dom_string_data(s), "frameset") == 0) { + if (strcasecmp(dom_string_data(s), "frameset") == 0) { dom_string_unref(s); frame->border = 0; if (box_create_frameset(frame, c, @@ -2699,14 +2701,14 @@ bool box_select(BOX_SPECIAL_PARAMS) return false; } - if (strcmp(dom_string_data(name), "option") == 0) { + if (strcasecmp(dom_string_data(name), "option") == 0) { dom_string_unref(name); if (box_select_add_option(gadget, c) == false) { dom_node_unref(c); goto no_memory; } - } else if (strcmp(dom_string_data(name), "optgroup") == 0) { + } else if (strcasecmp(dom_string_data(name), "optgroup") == 0) { dom_string_unref(name); err = dom_node_get_first_child(c, &c2); @@ -2725,7 +2727,7 @@ bool box_select(BOX_SPECIAL_PARAMS) return false; } - if (strcmp(dom_string_data(c2_name), + if (strcasecmp(dom_string_data(c2_name), "option") == 0) { dom_string_unref(c2_name); diff --git a/render/html.c b/render/html.c index 946555f6e..8c5c76b8e 100644 --- a/render/html.c +++ b/render/html.c @@ -997,7 +997,8 @@ static bool html_meta_refresh(html_content *c, dom_node *head) } /* Recurse into noscript elements */ - if (strcmp(dom_string_data(name), "noscript") == 0) { + if (strcasecmp(dom_string_data(name), + "noscript") == 0) { if (html_meta_refresh(c, n) == false) { /* Some error occurred */ dom_node_unref(n); @@ -1007,7 +1008,8 @@ static bool html_meta_refresh(html_content *c, dom_node *head) dom_node_unref(n); return true; } - } else if (strcmp(dom_string_data(name), "meta") == 0) { + } else if (strcasecmp(dom_string_data(name), + "meta") == 0) { if (html_meta_refresh_process_element(c, n) == false) { /* Some error occurred */ @@ -1436,7 +1438,7 @@ html_process_style_element(html_content *c, /* type='text/css', or not present (invalid but common) */ exc = dom_element_get_attribute(style, html_dom_string_type, &val); if (exc == DOM_NO_ERR && val != NULL) { - if (strcmp(dom_string_data(val), "text/css") != 0) { + if (strcasecmp(dom_string_data(val), "text/css") != 0) { dom_string_unref(val); return true; } @@ -1683,14 +1685,14 @@ html_process_stylesheet(dom_node *node, dom_string *name, void *vctx) hlcache_child_context child; /* deal with style nodes */ - if (strcmp(dom_string_data(name), "style") == 0) { + if (strcasecmp(dom_string_data(name), "style") == 0) { if (!html_process_style_element(ctx->c, &ctx->count, node)) return false; return true; } /* if it is not a link node skip it */ - if (strcmp(dom_string_data(name), "LINK") != 0) { + if (strcasecmp(dom_string_data(name), "link") != 0) { return true; } @@ -1713,7 +1715,7 @@ html_process_stylesheet(dom_node *node, dom_string *name, void *vctx) /* type='text/css' or not present */ exc = dom_element_get_attribute(node, html_dom_string_type, &type_attr); if (exc == DOM_NO_ERR && type_attr != NULL) { - if (strcmp(dom_string_data(type_attr), "text/css") != 0) { + if (strcasecmp(dom_string_data(type_attr), "text/css") != 0) { dom_string_unref(type_attr); return true; } -- cgit v1.2.3