mshtml: Added IHTMLElement::get_offsetTop implementation.

This commit is contained in:
Jacek Caban 2008-06-25 19:28:05 -05:00 committed by Alexandre Julliard
parent 61201984a6
commit f2617512f0
2 changed files with 36 additions and 2 deletions

View File

@ -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,

View File

@ -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");