From b54a3a0314a4f5daca4dfe7c4078f1b579ec2f89 Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Wed, 18 Jun 2008 17:09:26 -0500 Subject: [PATCH] mshtml: Added IHTMLElement::get_clientHeight implementation. --- dlls/mshtml/htmlelem2.c | 18 ++++++++++++++++-- dlls/mshtml/tests/dom.c | 27 +++++++++++++++++++++++++++ 2 files changed, 43 insertions(+), 2 deletions(-) diff --git a/dlls/mshtml/htmlelem2.c b/dlls/mshtml/htmlelem2.c index d68d0f4ec8d..fa4457acd03 100644 --- a/dlls/mshtml/htmlelem2.c +++ b/dlls/mshtml/htmlelem2.c @@ -500,8 +500,22 @@ static HRESULT WINAPI HTMLElement2_removeFilter(IHTMLElement2 *iface, IUnknown * static HRESULT WINAPI HTMLElement2_get_clientHeight(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 = nsIDOMHTMLElement_QueryInterface(This->nselem, &IID_nsIDOMNSHTMLElement, (void**)&nselem); + if(NS_SUCCEEDED(nsres)) { + nsIDOMNSHTMLElement_GetClientHeight(nselem, &height); + nsIDOMNSHTMLElement_Release(nselem); + }else { + ERR("Could not get nsIDOMHTMLNSElement: %08x\n", nsres); + } + + *p = height; + return S_OK; } static HRESULT WINAPI HTMLElement2_get_clientWidth(IHTMLElement2 *iface, long *p) diff --git a/dlls/mshtml/tests/dom.c b/dlls/mshtml/tests/dom.c index 7269ad1b0e1..ac30c1225ab 100644 --- a/dlls/mshtml/tests/dom.c +++ b/dlls/mshtml/tests/dom.c @@ -376,6 +376,17 @@ static IHTMLElement *_get_elem_iface(unsigned line, IUnknown *unk) return elem; } +#define get_elem2_iface(u) _get_elem2_iface(__LINE__,u) +static IHTMLElement2 *_get_elem2_iface(unsigned line, IUnknown *unk) +{ + IHTMLElement2 *elem; + HRESULT hres; + + hres = IUnknown_QueryInterface(unk, &IID_IHTMLElement2, (void**)&elem); + ok_(__FILE__,line) (hres == S_OK, "Coule not get IHTMLElement2: %08x\n", hres); + return elem; +} + #define get_node_iface(u) _get_node_iface(__LINE__,u) static IHTMLDOMNode *_get_node_iface(unsigned line, IUnknown *unk) { @@ -940,6 +951,21 @@ static void _test_node_put_value_str(unsigned line, IUnknown *unk, const char *v VariantClear(&var); } +#define test_elem_client_size(u) _test_elem_client_size(__LINE__,u) +static void _test_elem_client_size(unsigned line, IUnknown *unk) +{ + IHTMLElement2 *elem = _get_elem2_iface(line, unk); + long l; + HRESULT hres; + + hres = IHTMLElement2_get_clientWidth(elem, &l); + ok_(__FILE__,line) (hres == S_OK, "get_clientWidth failed: %08x\n", hres); + hres = IHTMLElement2_get_clientHeight(elem, &l); + ok_(__FILE__,line) (hres == S_OK, "get_clientHeight failed: %08x\n", hres); + + IHTMLElement2_Release(elem); +} + static void test_elem_col_item(IHTMLElementCollection *col, LPCWSTR n, const elem_type_t *elem_types, long len) { @@ -1704,6 +1730,7 @@ static void test_elems(IHTMLDocument2 *doc) test_elem_id((IUnknown*)elem, "in"); test_elem_put_id((IUnknown*)elem, "newin"); test_input_get_disabled(input, VARIANT_FALSE); + test_elem_client_size((IUnknown*)elem); test_node_get_value_str((IUnknown*)elem, NULL); test_node_put_value_str((IUnknown*)elem, "test");