mshtml: Implement IHTMLDOMNode previousSibling.

This commit is contained in:
Alistair Leslie-Hughes 2011-03-08 20:39:08 +11:00 committed by Alexandre Julliard
parent 96a8417a21
commit b701be3c9d
2 changed files with 41 additions and 2 deletions

View File

@ -782,8 +782,26 @@ static HRESULT WINAPI HTMLDOMNode_get_lastChild(IHTMLDOMNode *iface, IHTMLDOMNod
static HRESULT WINAPI HTMLDOMNode_get_previousSibling(IHTMLDOMNode *iface, IHTMLDOMNode **p)
{
HTMLDOMNode *This = impl_from_IHTMLDOMNode(iface);
FIXME("(%p)->(%p)\n", This, p);
return E_NOTIMPL;
nsIDOMNode *nschild = NULL;
HTMLDOMNode *node;
HRESULT hres;
TRACE("(%p)->(%p)\n", This, p);
nsIDOMNode_GetPreviousSibling(This->nsnode, &nschild);
if(!nschild) {
*p = NULL;
return S_OK;
}
hres = get_node(This->doc, nschild, TRUE, &node);
nsIDOMNode_Release(nschild);
if(FAILED(hres))
return hres;
*p = &node->IHTMLDOMNode_iface;
IHTMLDOMNode_AddRef(*p);
return S_OK;
}
static HRESULT WINAPI HTMLDOMNode_get_nextSibling(IHTMLDOMNode *iface, IHTMLDOMNode **p)

View File

@ -1989,6 +1989,20 @@ static IHTMLDOMNode *_node_get_next(unsigned line, IUnknown *unk)
return next;
}
#define node_get_prev(u) _node_get_prev(__LINE__,u)
static IHTMLDOMNode *_node_get_prev(unsigned line, IUnknown *unk)
{
IHTMLDOMNode *node = _get_node_iface(line, unk);
IHTMLDOMNode *prev;
HRESULT hres;
hres = IHTMLDOMNode_get_previousSibling(node, &prev);
IHTMLDOMNode_Release(node);
ok_(__FILE__,line) (hres == S_OK, "get_previousSibling failed: %08x\n", hres);
return prev;
}
#define test_elem_get_parent(u) _test_elem_get_parent(__LINE__,u)
static IHTMLElement *_test_elem_get_parent(unsigned line, IUnknown *unk)
{
@ -6681,9 +6695,16 @@ static void test_elems(IHTMLDocument2 *doc)
node = get_child_item(child_col, 0);
ok(node != NULL, "node == NULL\n");
if(node) {
IHTMLDOMNode *prev;
type = get_node_type((IUnknown*)node);
ok(type == 3, "type=%d\n", type);
node2 = node_get_next((IUnknown*)node);
prev = node_get_prev((IUnknown*)node2);
ok(iface_cmp((IUnknown*)node, (IUnknown*)prev), "node != prev\n");
IHTMLDOMNode_Release(prev);
IHTMLDOMNode_Release(node);
}