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

mshtml: Added IHTMLElement::get_parentElement implementation.

parent 48008766
...@@ -382,8 +382,21 @@ static HRESULT WINAPI HTMLElement_get_tagName(IHTMLElement *iface, BSTR *p) ...@@ -382,8 +382,21 @@ static HRESULT WINAPI HTMLElement_get_tagName(IHTMLElement *iface, BSTR *p)
static HRESULT WINAPI HTMLElement_get_parentElement(IHTMLElement *iface, IHTMLElement **p) static HRESULT WINAPI HTMLElement_get_parentElement(IHTMLElement *iface, IHTMLElement **p)
{ {
HTMLElement *This = HTMLELEM_THIS(iface); HTMLElement *This = HTMLELEM_THIS(iface);
FIXME("(%p)->(%p)\n", This, p); IHTMLDOMNode *node;
return E_NOTIMPL; HRESULT hres;
TRACE("(%p)->(%p)\n", This, p);
hres = IHTMLDOMNode_get_parentNode(HTMLDOMNODE(&This->node), &node);
if(FAILED(hres))
return hres;
hres = IHTMLDOMNode_QueryInterface(node, &IID_IHTMLElement, (void**)p);
IHTMLDOMNode_Release(node);
if(FAILED(hres))
*p = NULL;
return S_OK;
} }
static HRESULT WINAPI HTMLElement_get_style(IHTMLElement *iface, IHTMLStyle **p) static HRESULT WINAPI HTMLElement_get_style(IHTMLElement *iface, IHTMLStyle **p)
......
...@@ -971,6 +971,20 @@ static long _get_node_type(unsigned line, IUnknown *unk) ...@@ -971,6 +971,20 @@ static long _get_node_type(unsigned line, IUnknown *unk)
return type; return type;
} }
#define test_elem_get_parent(u) _test_elem_get_parent(__LINE__,u)
static IHTMLElement *_test_elem_get_parent(unsigned line, IUnknown *unk)
{
IHTMLElement *elem = _get_elem_iface(line, unk);
IHTMLElement *parent;
HRESULT hres;
hres = IHTMLElement_get_parentElement(elem, &parent);
IHTMLElement_Release(elem);
ok_(__FILE__,line) (hres == S_OK, "get_parentElement failed: %08x\n", hres);
return parent;
}
#define elem_get_scroll_height(u) _elem_get_scroll_height(__LINE__,u) #define elem_get_scroll_height(u) _elem_get_scroll_height(__LINE__,u)
static long _elem_get_scroll_height(unsigned line, IUnknown *unk) static long _elem_get_scroll_height(unsigned line, IUnknown *unk)
{ {
...@@ -2209,7 +2223,7 @@ static void test_elems(IHTMLDocument2 *doc) ...@@ -2209,7 +2223,7 @@ static void test_elems(IHTMLDocument2 *doc)
{ {
IHTMLElementCollection *col; IHTMLElementCollection *col;
IHTMLDOMChildrenCollection *child_col; IHTMLDOMChildrenCollection *child_col;
IHTMLElement *elem; IHTMLElement *elem, *elem2, *elem3;
IHTMLDOMNode *node, *node2; IHTMLDOMNode *node, *node2;
IDispatch *disp; IDispatch *disp;
long type; long type;
...@@ -2299,6 +2313,17 @@ static void test_elems(IHTMLDocument2 *doc) ...@@ -2299,6 +2313,17 @@ static void test_elems(IHTMLDocument2 *doc)
IHTMLDOMNode_Release(node); IHTMLDOMNode_Release(node);
ok(node2 == NULL, "node != NULL\n"); ok(node2 == NULL, "node != NULL\n");
elem2 = test_elem_get_parent((IUnknown*)elem);
ok(elem2 != NULL, "elem2 == NULL\n");
test_node_name((IUnknown*)elem2, "BODY");
elem3 = test_elem_get_parent((IUnknown*)elem2);
IHTMLElement_Release(elem2);
ok(elem3 != NULL, "elem3 == NULL\n");
test_node_name((IUnknown*)elem3, "HTML");
elem2 = test_elem_get_parent((IUnknown*)elem3);
IHTMLElement_Release(elem3);
ok(elem2 == NULL, "elem2 != NULL\n");
test_elem_getelembytag((IUnknown*)elem, ET_OPTION, 2); test_elem_getelembytag((IUnknown*)elem, ET_OPTION, 2);
test_elem_getelembytag((IUnknown*)elem, ET_SELECT, 0); test_elem_getelembytag((IUnknown*)elem, ET_SELECT, 0);
test_elem_getelembytag((IUnknown*)elem, ET_HTML, 0); test_elem_getelembytag((IUnknown*)elem, ET_HTML, 0);
......
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