Commit b701be3c authored by Alistair Leslie-Hughes's avatar Alistair Leslie-Hughes Committed by Alexandre Julliard

mshtml: Implement IHTMLDOMNode previousSibling.

parent 96a8417a
...@@ -782,8 +782,26 @@ static HRESULT WINAPI HTMLDOMNode_get_lastChild(IHTMLDOMNode *iface, IHTMLDOMNod ...@@ -782,8 +782,26 @@ static HRESULT WINAPI HTMLDOMNode_get_lastChild(IHTMLDOMNode *iface, IHTMLDOMNod
static HRESULT WINAPI HTMLDOMNode_get_previousSibling(IHTMLDOMNode *iface, IHTMLDOMNode **p) static HRESULT WINAPI HTMLDOMNode_get_previousSibling(IHTMLDOMNode *iface, IHTMLDOMNode **p)
{ {
HTMLDOMNode *This = impl_from_IHTMLDOMNode(iface); HTMLDOMNode *This = impl_from_IHTMLDOMNode(iface);
FIXME("(%p)->(%p)\n", This, p); nsIDOMNode *nschild = NULL;
return E_NOTIMPL; 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) static HRESULT WINAPI HTMLDOMNode_get_nextSibling(IHTMLDOMNode *iface, IHTMLDOMNode **p)
......
...@@ -1989,6 +1989,20 @@ static IHTMLDOMNode *_node_get_next(unsigned line, IUnknown *unk) ...@@ -1989,6 +1989,20 @@ static IHTMLDOMNode *_node_get_next(unsigned line, IUnknown *unk)
return next; 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) #define test_elem_get_parent(u) _test_elem_get_parent(__LINE__,u)
static IHTMLElement *_test_elem_get_parent(unsigned line, IUnknown *unk) static IHTMLElement *_test_elem_get_parent(unsigned line, IUnknown *unk)
{ {
...@@ -6681,9 +6695,16 @@ static void test_elems(IHTMLDocument2 *doc) ...@@ -6681,9 +6695,16 @@ static void test_elems(IHTMLDocument2 *doc)
node = get_child_item(child_col, 0); node = get_child_item(child_col, 0);
ok(node != NULL, "node == NULL\n"); ok(node != NULL, "node == NULL\n");
if(node) { if(node) {
IHTMLDOMNode *prev;
type = get_node_type((IUnknown*)node); type = get_node_type((IUnknown*)node);
ok(type == 3, "type=%d\n", type); ok(type == 3, "type=%d\n", type);
node2 = node_get_next((IUnknown*)node); 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); IHTMLDOMNode_Release(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