Commit cfb89754 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

mshtml: Handle COMMENT_NODE like ELEMENT_NODE in element collection.

parent af529308
...@@ -65,6 +65,15 @@ static void elem_vector_normalize(elem_vector *buf) ...@@ -65,6 +65,15 @@ static void elem_vector_normalize(elem_vector *buf)
buf->size = buf->len; buf->size = buf->len;
} }
static BOOL is_elem_node(nsIDOMNode *node)
{
PRUint16 type=0;
nsIDOMNode_GetNodeType(node, &type);
return type == ELEMENT_NODE || type == COMMENT_NODE;
}
#define HTMLELEM_THIS(iface) DEFINE_THIS(HTMLElement, HTMLElement, iface) #define HTMLELEM_THIS(iface) DEFINE_THIS(HTMLElement, HTMLElement, iface)
#define HTMLELEM_NODE_THIS(iface) DEFINE_THIS2(HTMLElement, node, iface) #define HTMLELEM_NODE_THIS(iface) DEFINE_THIS2(HTMLElement, node, iface)
...@@ -1081,7 +1090,6 @@ static void create_child_list(HTMLDocument *doc, HTMLElement *elem, elem_vector ...@@ -1081,7 +1090,6 @@ static void create_child_list(HTMLDocument *doc, HTMLElement *elem, elem_vector
nsIDOMNodeList *nsnode_list; nsIDOMNodeList *nsnode_list;
nsIDOMNode *iter; nsIDOMNode *iter;
PRUint32 list_len = 0, i; PRUint32 list_len = 0, i;
PRUint16 node_type;
nsresult nsres; nsresult nsres;
nsres = nsIDOMNode_GetChildNodes(elem->node.nsnode, &nsnode_list); nsres = nsIDOMNode_GetChildNodes(elem->node.nsnode, &nsnode_list);
...@@ -1104,8 +1112,7 @@ static void create_child_list(HTMLDocument *doc, HTMLElement *elem, elem_vector ...@@ -1104,8 +1112,7 @@ static void create_child_list(HTMLDocument *doc, HTMLElement *elem, elem_vector
continue; continue;
} }
nsres = nsIDOMNode_GetNodeType(iter, &node_type); if(is_elem_node(iter))
if(NS_SUCCEEDED(nsres) && node_type == ELEMENT_NODE)
elem_vector_add(buf, HTMLELEM_NODE_THIS(get_node(doc, iter, TRUE))); elem_vector_add(buf, HTMLELEM_NODE_THIS(get_node(doc, iter, TRUE)));
} }
} }
...@@ -1128,7 +1135,6 @@ static void create_all_list(HTMLDocument *doc, HTMLDOMNode *elem, elem_vector *b ...@@ -1128,7 +1135,6 @@ static void create_all_list(HTMLDocument *doc, HTMLDOMNode *elem, elem_vector *b
nsIDOMNodeList *nsnode_list; nsIDOMNodeList *nsnode_list;
nsIDOMNode *iter; nsIDOMNode *iter;
PRUint32 list_len = 0, i; PRUint32 list_len = 0, i;
PRUint16 node_type;
nsresult nsres; nsresult nsres;
nsres = nsIDOMNode_GetChildNodes(elem->nsnode, &nsnode_list); nsres = nsIDOMNode_GetChildNodes(elem->nsnode, &nsnode_list);
...@@ -1148,8 +1154,7 @@ static void create_all_list(HTMLDocument *doc, HTMLDOMNode *elem, elem_vector *b ...@@ -1148,8 +1154,7 @@ static void create_all_list(HTMLDocument *doc, HTMLDOMNode *elem, elem_vector *b
continue; continue;
} }
nsres = nsIDOMNode_GetNodeType(iter, &node_type); if(is_elem_node(iter)) {
if(NS_SUCCEEDED(nsres) && node_type == ELEMENT_NODE) {
HTMLDOMNode *node = get_node(doc, iter, TRUE); HTMLDOMNode *node = get_node(doc, iter, TRUE);
elem_vector_add(buf, HTMLELEM_NODE_THIS(node)); elem_vector_add(buf, HTMLELEM_NODE_THIS(node));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment