mshtml: Use get_element helper in IHTMLElement::get_offsetParent implementation.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2018-02-19 14:50:21 +01:00 committed by Alexandre Julliard
parent b304616f8a
commit d5a190b052
1 changed files with 9 additions and 12 deletions

View File

@ -1408,6 +1408,7 @@ static HRESULT WINAPI HTMLElement_get_offsetParent(IHTMLElement *iface, IHTMLEle
{ {
HTMLElement *This = impl_from_IHTMLElement(iface); HTMLElement *This = impl_from_IHTMLElement(iface);
nsIDOMElement *nsparent; nsIDOMElement *nsparent;
HTMLElement *parent;
nsresult nsres; nsresult nsres;
HRESULT hres; HRESULT hres;
@ -1424,22 +1425,18 @@ static HRESULT WINAPI HTMLElement_get_offsetParent(IHTMLElement *iface, IHTMLEle
return E_FAIL; return E_FAIL;
} }
if(nsparent) { if(!nsparent) {
HTMLDOMNode *node;
hres = get_node((nsIDOMNode*)nsparent, TRUE, &node);
nsIDOMElement_Release(nsparent);
if(FAILED(hres))
return hres;
hres = IHTMLDOMNode_QueryInterface(&node->IHTMLDOMNode_iface, &IID_IHTMLElement, (void**)p);
node_release(node);
}else {
*p = NULL; *p = NULL;
hres = S_OK; hres = S_OK;
} }
return hres; hres = get_element(nsparent, &parent);
nsIDOMElement_Release(nsparent);
if(FAILED(hres))
return hres;
*p = &parent->IHTMLElement_iface;
return S_OK;
} }
static HRESULT WINAPI HTMLElement_put_innerHTML(IHTMLElement *iface, BSTR v) static HRESULT WINAPI HTMLElement_put_innerHTML(IHTMLElement *iface, BSTR v)