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

mshtml: Added IHTMLDOMNode::get_parentNode implementation.

parent 337f1b73
...@@ -386,8 +386,27 @@ static HRESULT WINAPI HTMLDOMNode_get_nodeType(IHTMLDOMNode *iface, long *p) ...@@ -386,8 +386,27 @@ static HRESULT WINAPI HTMLDOMNode_get_nodeType(IHTMLDOMNode *iface, long *p)
static HRESULT WINAPI HTMLDOMNode_get_parentNode(IHTMLDOMNode *iface, IHTMLDOMNode **p) static HRESULT WINAPI HTMLDOMNode_get_parentNode(IHTMLDOMNode *iface, IHTMLDOMNode **p)
{ {
HTMLDOMNode *This = HTMLDOMNODE_THIS(iface); HTMLDOMNode *This = HTMLDOMNODE_THIS(iface);
FIXME("(%p)->(%p)\n", This, p); HTMLDOMNode *node;
return E_NOTIMPL; nsIDOMNode *nsnode;
nsresult nsres;
TRACE("(%p)->(%p)\n", This, p);
nsres = nsIDOMNode_GetParentNode(This->nsnode, &nsnode);
if(NS_FAILED(nsres)) {
ERR("GetParentNode failed: %08x\n", nsres);
return E_FAIL;
}
if(!nsnode) {
*p = NULL;
return S_OK;
}
node = get_node(This->doc, nsnode, TRUE);
*p = HTMLDOMNODE(node);
IHTMLDOMNode_AddRef(*p);
return S_OK;
} }
static HRESULT WINAPI HTMLDOMNode_hasChildNodes(IHTMLDOMNode *iface, VARIANT_BOOL *fChildren) static HRESULT WINAPI HTMLDOMNode_hasChildNodes(IHTMLDOMNode *iface, VARIANT_BOOL *fChildren)
......
...@@ -900,6 +900,20 @@ static void _test_node_has_child(unsigned line, IUnknown *unk, VARIANT_BOOL exb) ...@@ -900,6 +900,20 @@ static void _test_node_has_child(unsigned line, IUnknown *unk, VARIANT_BOOL exb)
IHTMLDOMNode_Release(node); IHTMLDOMNode_Release(node);
} }
#define test_node_get_parent(u) _test_node_get_parent(__LINE__,u)
static IHTMLDOMNode *_test_node_get_parent(unsigned line, IUnknown *unk)
{
IHTMLDOMNode *node = _get_node_iface(line, unk);
IHTMLDOMNode *parent;
HRESULT hres;
hres = IHTMLDOMNode_get_parentNode(node, &parent);
IHTMLDOMNode_Release(node);
ok_(__FILE__,line) (hres == S_OK, "get_parentNode failed: %08x\n", hres);
return parent;
}
#define get_node_type(n) _get_node_type(__LINE__,n) #define get_node_type(n) _get_node_type(__LINE__,n)
static long _get_node_type(unsigned line, IUnknown *unk) static long _get_node_type(unsigned line, IUnknown *unk)
{ {
...@@ -2042,6 +2056,22 @@ static void test_elems(IHTMLDocument2 *doc) ...@@ -2042,6 +2056,22 @@ static void test_elems(IHTMLDocument2 *doc)
test_elem_set_class((IUnknown*)elem, NULL); test_elem_set_class((IUnknown*)elem, NULL);
test_elem_tabindex((IUnknown*)elem, 0); test_elem_tabindex((IUnknown*)elem, 0);
test_elem_set_tabindex((IUnknown*)elem, 1); test_elem_set_tabindex((IUnknown*)elem, 1);
node = test_node_get_parent((IUnknown*)elem);
ok(node != NULL, "node == NULL\n");
test_node_name((IUnknown*)node, "BODY");
node2 = test_node_get_parent((IUnknown*)node);
IHTMLDOMNode_Release(node);
ok(node2 != NULL, "node == NULL\n");
test_node_name((IUnknown*)node2, "HTML");
node = test_node_get_parent((IUnknown*)node2);
IHTMLDOMNode_Release(node2);
ok(node != NULL, "node == NULL\n");
test_node_name((IUnknown*)node, "#document");
node2 = test_node_get_parent((IUnknown*)node);
IHTMLDOMNode_Release(node);
ok(node2 == NULL, "node != NULL\n");
IHTMLElement_Release(elem); IHTMLElement_Release(elem);
} }
......
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