diff --git a/dlls/mshtml/htmlelem.c b/dlls/mshtml/htmlelem.c index 9be29647981..7c20c2caaf5 100644 --- a/dlls/mshtml/htmlelem.c +++ b/dlls/mshtml/htmlelem.c @@ -712,8 +712,27 @@ static HRESULT WINAPI HTMLElement_get_offsetLeft(IHTMLElement *iface, long *p) static HRESULT WINAPI HTMLElement_get_offsetTop(IHTMLElement *iface, long *p) { HTMLElement *This = HTMLELEM_THIS(iface); - FIXME("(%p)->(%p)\n", This, p); - return E_NOTIMPL; + nsIDOMNSHTMLElement *nselem; + PRInt32 top = 0; + nsresult nsres; + + 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_GetOffsetTop(nselem, &top); + nsIDOMNSHTMLElement_Release(nselem); + if(NS_FAILED(nsres)) { + ERR("GetOffsetTop failed: %08x\n", nsres); + return E_FAIL; + } + + *p = top; + return S_OK; } static HRESULT WINAPI HTMLElement_get_offsetWidth(IHTMLElement *iface, long *p) @@ -1414,6 +1433,7 @@ static const tid_t HTMLElement_iface_tids[] = { IHTMLElement2_tid, 0 }; + static dispex_static_data_t HTMLElement_dispex = { NULL, DispHTMLUnknownElement_tid, diff --git a/dlls/mshtml/tests/dom.c b/dlls/mshtml/tests/dom.c index 5a3101b5301..a1b2e665403 100644 --- a/dlls/mshtml/tests/dom.c +++ b/dlls/mshtml/tests/dom.c @@ -475,6 +475,19 @@ static void _test_elem_attr(unsigned line, IHTMLElement *elem, LPCWSTR name, LPC VariantClear(&value); } +#define test_elem_offset(u) _test_elem_offset(__LINE__,u) +static void _test_elem_offset(unsigned line, IUnknown *unk) +{ + IHTMLElement *elem = _get_elem_iface(line, unk); + long l; + HRESULT hres; + + hres = IHTMLElement_get_offsetTop(elem, &l); + ok_(__FILE__,line) (hres == S_OK, "get_offsetTop failed: %08x\n", hres); + + IHTMLElement_Release(elem); +} + static void test_doc_elem(IHTMLDocument2 *doc) { IHTMLElement *elem; @@ -2044,6 +2057,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); node = get_first_child((IUnknown*)select); ok(node != NULL, "node == NULL\n");