mirror of
https://github.com/netsurf-browser/netsurf
synced 2024-12-21 11:42:56 +03:00
Simplify special element handling in node inserted callback.
This commit is contained in:
parent
b58176c65e
commit
b002ba7357
@ -629,7 +629,6 @@ dom_default_action_DOMNodeInserted_cb(struct dom_event *evt, void *pw)
|
|||||||
{
|
{
|
||||||
dom_event_target *node;
|
dom_event_target *node;
|
||||||
dom_node_type type;
|
dom_node_type type;
|
||||||
dom_string *name;
|
|
||||||
dom_exception exc;
|
dom_exception exc;
|
||||||
html_content *htmlc = pw;
|
html_content *htmlc = pw;
|
||||||
|
|
||||||
@ -638,38 +637,39 @@ dom_default_action_DOMNodeInserted_cb(struct dom_event *evt, void *pw)
|
|||||||
exc = dom_node_get_node_type(node, &type);
|
exc = dom_node_get_node_type(node, &type);
|
||||||
if ((exc == DOM_NO_ERR) && (type == DOM_ELEMENT_NODE)) {
|
if ((exc == DOM_NO_ERR) && (type == DOM_ELEMENT_NODE)) {
|
||||||
/* an element node has been inserted */
|
/* an element node has been inserted */
|
||||||
exc = dom_node_get_node_name(node, &name);
|
dom_html_element_type tag_type;
|
||||||
if ((exc == DOM_NO_ERR) && (name != NULL)) {
|
|
||||||
|
|
||||||
if (dom_string_caseless_isequal(name,
|
exc = dom_html_element_get_tag_type(node, &tag_type);
|
||||||
corestring_dom_link)) {
|
if (exc != DOM_NO_ERR) {
|
||||||
/* Handle stylesheet loading */
|
tag_type = DOM_HTML_ELEMENT_TYPE__UNKNOWN;
|
||||||
html_css_process_link(htmlc,
|
}
|
||||||
(dom_node *)node);
|
|
||||||
/* Generic link handling */
|
|
||||||
html_process_link(htmlc,
|
|
||||||
(dom_node *)node);
|
|
||||||
|
|
||||||
} else if (dom_string_caseless_lwc_isequal(name,
|
switch (tag_type) {
|
||||||
corestring_lwc_meta) &&
|
case DOM_HTML_ELEMENT_TYPE_LINK:
|
||||||
htmlc->refresh == false) {
|
/* Handle stylesheet loading */
|
||||||
html_meta_refresh_process_element(htmlc,
|
html_css_process_link(htmlc, (dom_node *)node);
|
||||||
(dom_node *)node);
|
/* Generic link handling */
|
||||||
} else if (dom_string_caseless_lwc_isequal(
|
html_process_link(htmlc, (dom_node *)node);
|
||||||
name, corestring_lwc_base)) {
|
break;
|
||||||
html_process_base(htmlc,
|
case DOM_HTML_ELEMENT_TYPE_META:
|
||||||
(dom_node *)node);
|
if (htmlc->refresh)
|
||||||
} else if (dom_string_caseless_lwc_isequal(
|
break;
|
||||||
name, corestring_lwc_title) &&
|
html_meta_refresh_process_element(htmlc,
|
||||||
htmlc->title == NULL) {
|
(dom_node *)node);
|
||||||
htmlc->title = dom_node_ref(node);
|
break;
|
||||||
} else if (dom_string_caseless_lwc_isequal(
|
case DOM_HTML_ELEMENT_TYPE_TITLE:
|
||||||
name, corestring_lwc_img)) {
|
if (htmlc->title != NULL)
|
||||||
html_process_img(htmlc,
|
break;
|
||||||
(dom_node *) node);
|
htmlc->title = dom_node_ref(node);
|
||||||
}
|
break;
|
||||||
|
case DOM_HTML_ELEMENT_TYPE_BASE:
|
||||||
dom_string_unref(name);
|
html_process_base(htmlc, (dom_node *)node);
|
||||||
|
break;
|
||||||
|
case DOM_HTML_ELEMENT_TYPE_IMG:
|
||||||
|
html_process_img(htmlc, (dom_node *) node);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
if (htmlc->enable_scripting) {
|
if (htmlc->enable_scripting) {
|
||||||
/* ensure javascript context is available */
|
/* ensure javascript context is available */
|
||||||
|
Loading…
Reference in New Issue
Block a user