mshtml: Added IHTMLDOMNode::nextSibling implementation.

This commit is contained in:
Jacek Caban 2009-10-29 02:37:44 +01:00 committed by Alexandre Julliard
parent d76720cc56
commit 11651f5731
2 changed files with 38 additions and 2 deletions

View File

@ -729,8 +729,19 @@ static HRESULT WINAPI HTMLDOMNode_get_previousSibling(IHTMLDOMNode *iface, IHTML
static HRESULT WINAPI HTMLDOMNode_get_nextSibling(IHTMLDOMNode *iface, IHTMLDOMNode **p)
{
HTMLDOMNode *This = HTMLDOMNODE_THIS(iface);
FIXME("(%p)->(%p)\n", This, p);
return E_NOTIMPL;
nsIDOMNode *nssibling = NULL;
TRACE("(%p)->(%p)\n", This, p);
nsIDOMNode_GetNextSibling(This->nsnode, &nssibling);
if(nssibling) {
*p = HTMLDOMNODE(get_node(This->doc, nssibling, TRUE));
IHTMLDOMNode_AddRef(*p);
}else {
*p = NULL;
}
return S_OK;
}
#undef HTMLDOMNODE_THIS

View File

@ -1609,6 +1609,20 @@ static IHTMLDOMNode *_test_node_get_parent(unsigned line, IUnknown *unk)
return parent;
}
#define node_get_next(u) _node_get_next(__LINE__,u)
static IHTMLDOMNode *_node_get_next(unsigned line, IUnknown *unk)
{
IHTMLDOMNode *node = _get_node_iface(line, unk);
IHTMLDOMNode *next;
HRESULT hres;
hres = IHTMLDOMNode_get_nextSibling(node, &next);
IHTMLDOMNode_Release(node);
ok_(__FILE__,line) (hres == S_OK, "get_nextSiblibg failed: %08x\n", hres);
return next;
}
#define test_elem_get_parent(u) _test_elem_get_parent(__LINE__,u)
static IHTMLElement *_test_elem_get_parent(unsigned line, IUnknown *unk)
{
@ -5248,11 +5262,13 @@ static void test_elems(IHTMLDocument2 *doc)
ok(hres == S_OK, "get_length failed: %08x\n", hres);
ok(length, "length=0\n");
node2 = NULL;
node = get_child_item(child_col, 0);
ok(node != NULL, "node == NULL\n");
if(node) {
type = get_node_type((IUnknown*)node);
ok(type == 3, "type=%d\n", type);
node2 = node_get_next((IUnknown*)node);
IHTMLDOMNode_Release(node);
}
@ -5263,6 +5279,8 @@ static void test_elems(IHTMLDocument2 *doc)
ok(type == 8, "type=%d\n", type);
test_elem_id((IUnknown*)node, NULL);
ok(iface_cmp((IUnknown*)node2, (IUnknown*)node), "node2 != node\n");
IHTMLDOMNode_Release(node2);
IHTMLDOMNode_Release(node);
}
@ -5343,6 +5361,13 @@ static void test_elems(IHTMLDocument2 *doc)
test_elem_innerhtml((IUnknown*)elem, "inner html");
test_elem_set_innerhtml((IUnknown*)elem, "");
test_elem_innerhtml((IUnknown*)elem, NULL);
node = node_get_next((IUnknown*)elem);
ok(!node, "node = %p\n", node);
elem2 = get_doc_elem_by_id(doc, "x");
node = node_get_next((IUnknown*)elem2);
IHTMLDOMNode_Release(node);
IHTMLElement_Release(elem2);
IHTMLElement_Release(elem);
IHTMLDocument3_Release(doc3);