Commit 3bf7482d authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

mshtml: Added IHTMLElement::get_offsetParent implementation.

parent e644c2cd
......@@ -923,8 +923,41 @@ static HRESULT WINAPI HTMLElement_get_offsetHeight(IHTMLElement *iface, LONG *p)
static HRESULT WINAPI HTMLElement_get_offsetParent(IHTMLElement *iface, IHTMLElement **p)
{
HTMLElement *This = impl_from_IHTMLElement(iface);
FIXME("(%p)->(%p)\n", This, p);
return E_NOTIMPL;
nsIDOMNSHTMLElement *nselem;
nsIDOMElement *nsparent;
nsresult nsres;
HRESULT hres;
TRACE("(%p)->(%p)\n", This, p);
nsres = nsIDOMHTMLElement_QueryInterface(This->nselem, &IID_nsIDOMNSHTMLElement, (void**)&nselem);
if(NS_FAILED(nsres)) {
ERR("Could not get nsIDOMNSHTMLElement: %08x\n", nsres);
return E_FAIL;
}
nsres = nsIDOMNSHTMLElement_GetOffsetParent(nselem, &nsparent);
nsIDOMNSHTMLElement_Release(nselem);
if(NS_FAILED(nsres)) {
ERR("GetOffsetParent failed: %08x\n", nsres);
return E_FAIL;
}
if(nsparent) {
HTMLDOMNode *node;
hres = get_node(This->node.doc, (nsIDOMNode*)nsparent, TRUE, &node);
nsIDOMElement_Release(nsparent);
if(FAILED(hres))
return hres;
hres = IHTMLDOMNode_QueryInterface(&node->IHTMLDOMNode_iface, &IID_IHTMLElement, (void**)p);
}else {
*p = NULL;
hres = S_OK;
}
return hres;
}
static HRESULT WINAPI HTMLElement_put_innerHTML(IHTMLElement *iface, BSTR v)
......
......@@ -931,10 +931,11 @@ static void _test_elem_attr(unsigned line, IHTMLElement *elem, const char *name,
VariantClear(&value);
}
#define test_elem_offset(u) _test_elem_offset(__LINE__,u)
static void _test_elem_offset(unsigned line, IUnknown *unk)
#define test_elem_offset(a,b) _test_elem_offset(__LINE__,a,b)
static void _test_elem_offset(unsigned line, IUnknown *unk, const char *parent_tag)
{
IHTMLElement *elem = _get_elem_iface(line, unk);
IHTMLElement *off_parent;
LONG l;
HRESULT hres;
......@@ -950,6 +951,12 @@ static void _test_elem_offset(unsigned line, IUnknown *unk)
hres = IHTMLElement_get_offsetLeft(elem, &l);
ok_(__FILE__,line) (hres == S_OK, "get_offsetLeft failed: %08x\n", hres);
hres = IHTMLElement_get_offsetParent(elem, &off_parent);
ok_(__FILE__,line) (hres == S_OK, "get_offsetParent failed: %08x\n", hres);
_test_elem_tag(line, (IUnknown*)off_parent, parent_tag);
IHTMLElement_Release(off_parent);
IHTMLElement_Release(elem);
}
......@@ -6513,7 +6520,7 @@ static void test_elems(IHTMLDocument2 *doc)
test_elem_title((IUnknown*)select, NULL);
test_elem_set_title((IUnknown*)select, "Title");
test_elem_title((IUnknown*)select, "Title");
test_elem_offset((IUnknown*)select);
test_elem_offset((IUnknown*)select, "BODY");
test_elem_bounding_client_rect((IUnknown*)select);
node = get_first_child((IUnknown*)select);
......
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