mshtml: Added IHTMLElement2::get_scrollTop implementation.

This commit is contained in:
Jacek Caban 2008-07-28 22:02:17 +02:00 committed by Alexandre Julliard
parent e1a553e328
commit 4d89c62eab
2 changed files with 36 additions and 2 deletions

View File

@ -787,8 +787,26 @@ static HRESULT WINAPI HTMLElement2_put_scrollTop(IHTMLElement2 *iface, long v)
static HRESULT WINAPI HTMLElement2_get_scrollTop(IHTMLElement2 *iface, long *p)
{
HTMLElement *This = HTMLELEM2_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 = nsIDOMElement_QueryInterface(This->nselem, &IID_nsIDOMNSHTMLElement, (void**)&nselem);
if(NS_SUCCEEDED(nsres)) {
nsres = nsIDOMNSHTMLElement_GetScrollTop(nselem, &top);
nsIDOMNSHTMLElement_Release(nselem);
if(NS_FAILED(nsres))
ERR("GetScrollTop failed: %08x\n", nsres);
}else {
ERR("Could not get nsIDOMNSHTMLElement interface: %08x\n", nsres);
}
*p = top;
TRACE("*p = %ld\n", *p);
return S_OK;
}
static HRESULT WINAPI HTMLElement2_put_scrollLeft(IHTMLElement2 *iface, long v)

View File

@ -1014,6 +1014,20 @@ static long _elem_get_scroll_width(unsigned line, IUnknown *unk)
return l;
}
#define elem_get_scroll_top(u) _elem_get_scroll_top(__LINE__,u)
static long _elem_get_scroll_top(unsigned line, IUnknown *unk)
{
IHTMLElement2 *elem = _get_elem2_iface(line, unk);
long l = -1;
HRESULT hres;
hres = IHTMLElement2_get_scrollTop(elem, &l);
ok_(__FILE__,line) (hres == S_OK, "get_scrollTop failed: %08x\n", hres);
IHTMLElement2_Release(elem);
return l;
}
#define test_img_set_src(u,s) _test_img_set_src(__LINE__,u,s)
static void _test_img_set_src(unsigned line, IUnknown *unk, const char *src)
{
@ -1992,6 +2006,8 @@ static void test_default_body(IHTMLBodyElement *body)
ok(l != -1, "scrollHeight == -1\n");
l = elem_get_scroll_width((IUnknown*)body);
ok(l != -1, "scrollWidth == -1\n");
l = elem_get_scroll_top((IUnknown*)body);
ok(!l, "scrollWidth = %ld\n", l);
}
static void test_window(IHTMLDocument2 *doc)