From d5a190b052d4f9c33a2236e8482af73fe9ad1eba Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Mon, 19 Feb 2018 14:50:21 +0100 Subject: [PATCH] mshtml: Use get_element helper in IHTMLElement::get_offsetParent implementation. Signed-off-by: Jacek Caban Signed-off-by: Alexandre Julliard --- dlls/mshtml/htmlelem.c | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/dlls/mshtml/htmlelem.c b/dlls/mshtml/htmlelem.c index 4789047a843..ca935d318c1 100644 --- a/dlls/mshtml/htmlelem.c +++ b/dlls/mshtml/htmlelem.c @@ -1408,6 +1408,7 @@ static HRESULT WINAPI HTMLElement_get_offsetParent(IHTMLElement *iface, IHTMLEle { HTMLElement *This = impl_from_IHTMLElement(iface); nsIDOMElement *nsparent; + HTMLElement *parent; nsresult nsres; HRESULT hres; @@ -1424,22 +1425,18 @@ static HRESULT WINAPI HTMLElement_get_offsetParent(IHTMLElement *iface, IHTMLEle return E_FAIL; } - 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 { + if(!nsparent) { *p = NULL; 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)