mshtml: Fix NULL offset parent handling in IHTMLElement::get_offsetParent.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50875
Signed-off-by: Dmitry Kislyuk <dimaki@rocketmail.com>
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Dmitry Kislyuk 2021-03-29 13:21:43 +02:00 committed by Alexandre Julliard
parent 7b52ece404
commit 35d0fda0f0
2 changed files with 12 additions and 5 deletions

View File

@ -1628,7 +1628,7 @@ static HRESULT WINAPI HTMLElement_get_offsetParent(IHTMLElement *iface, IHTMLEle
if(!nsparent) {
*p = NULL;
hres = S_OK;
return S_OK;
}
hres = get_element(nsparent, &parent);

View File

@ -1299,11 +1299,14 @@ static void _test_elem_offset(unsigned line, IUnknown *unk, const WCHAR *parent_
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);
if(off_parent) {
_test_elem_tag(line, (IUnknown*)off_parent, parent_tag);
IHTMLElement_Release(off_parent);
}else {
ok_(__FILE__,line) (parent_tag == NULL, "Offset parent is NULL. %s expected\n", wine_dbgstr_w(parent_tag));
}
}
#define test_elem_source_index(a,b) _test_elem_source_index(__LINE__,a,b)
@ -8937,6 +8940,10 @@ static void test_elems(IHTMLDocument2 *doc)
IHTMLElement_Release(elem);
}
elem = doc_get_body(doc);
test_elem_offset((IUnknown*)elem, NULL);
IHTMLElement_Release(elem);
elem = get_elem_by_id(doc, L"sc", TRUE);
if(elem) {
IHTMLScriptElement *script;