mshtml: Added IHTMLElement2::get_scrollHeight implementation.

This commit is contained in:
Jacek Caban 2008-07-28 22:01:07 +02:00 committed by Alexandre Julliard
parent 72d201b037
commit 7e34579423
2 changed files with 47 additions and 2 deletions

View File

@ -713,8 +713,26 @@ static HRESULT WINAPI HTMLElement2_createControlRange(IHTMLElement2 *iface, IDis
static HRESULT WINAPI HTMLElement2_get_scrollHeight(IHTMLElement2 *iface, long *p)
{
HTMLElement *This = HTMLELEM2_THIS(iface);
FIXME("(%p)->(%p)\n", This, p);
return E_NOTIMPL;
nsIDOMNSHTMLElement *nselem;
PRInt32 height = 0;
nsresult nsres;
TRACE("(%p)->(%p)\n", This, p);
nsres = nsIDOMElement_QueryInterface(This->nselem, &IID_nsIDOMNSHTMLElement, (void**)&nselem);
if(NS_SUCCEEDED(nsres)) {
nsres = nsIDOMNSHTMLElement_GetScrollHeight(nselem, &height);
nsIDOMNSHTMLElement_Release(nselem);
if(NS_FAILED(nsres))
ERR("GetScrollHeight failed: %08x\n", nsres);
}else {
ERR("Could not get nsIDOMNSHTMLElement interface: %08x\n", nsres);
}
*p = height;
TRACE("*p = %ld\n", *p);
return S_OK;
}
static HRESULT WINAPI HTMLElement2_get_scrollWidth(IHTMLElement2 *iface, long *p)

View File

@ -968,6 +968,29 @@ static long _get_node_type(unsigned line, IUnknown *unk)
return type;
}
#define elem_get_scroll_height(u) _elem_get_scroll_height(__LINE__,u)
static long _elem_get_scroll_height(unsigned line, IUnknown *unk)
{
IHTMLElement2 *elem = _get_elem2_iface(line, unk);
IHTMLTextContainer *txtcont;
long l = -1, l2 = -1;
HRESULT hres;
hres = IHTMLElement2_get_scrollHeight(elem, &l);
ok_(__FILE__,line) (hres == S_OK, "get_scrollHeight failed: %08x\n", hres);
IHTMLElement2_Release(elem);
hres = IUnknown_QueryInterface(unk, &IID_IHTMLTextContainer, (void**)&txtcont);
ok_(__FILE__,line) (hres == S_OK, "Could not get IHTMLTextContainer: %08x\n", hres);
hres = IHTMLTextContainer_get_scrollHeight(txtcont, &l2);
IHTMLTextContainer_Release(txtcont);
ok_(__FILE__,line) (hres == S_OK, "IHTMLTextContainer::get_scrollHeight failed: %ld\n", l2);
ok_(__FILE__,line) (l == l2, "unexpected height %ld, expected %ld\n", l2, l);
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)
{
@ -1927,6 +1950,7 @@ static void test_default_selection(IHTMLDocument2 *doc)
static void test_default_body(IHTMLBodyElement *body)
{
long l;
BSTR bstr;
HRESULT hres;
@ -1934,6 +1958,9 @@ static void test_default_body(IHTMLBodyElement *body)
hres = IHTMLBodyElement_get_background(body, &bstr);
ok(hres == S_OK, "get_background failed: %08x\n", hres);
ok(bstr == NULL, "bstr != NULL\n");
l = elem_get_scroll_height((IUnknown*)body);
ok(l != -1, "scrollHeight == -1\n");
}
static void test_window(IHTMLDocument2 *doc)