Jacek Caban : mshtml: Added IHTMLElement2::get_scrollHeight implementation.

Alexandre Julliard julliard at winehq.org
Tue Jul 29 07:16:13 CDT 2008


Module: wine
Branch: master
Commit: 7e345794235401ba42082a794033c90e7fad92df
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=7e345794235401ba42082a794033c90e7fad92df

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Mon Jul 28 22:01:07 2008 +0200

mshtml: Added IHTMLElement2::get_scrollHeight implementation.

---

 dlls/mshtml/htmlelem2.c |   22 ++++++++++++++++++++--
 dlls/mshtml/tests/dom.c |   27 +++++++++++++++++++++++++++
 2 files changed, 47 insertions(+), 2 deletions(-)

diff --git a/dlls/mshtml/htmlelem2.c b/dlls/mshtml/htmlelem2.c
index 5d0443e..8085442 100644
--- a/dlls/mshtml/htmlelem2.c
+++ b/dlls/mshtml/htmlelem2.c
@@ -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)
diff --git a/dlls/mshtml/tests/dom.c b/dlls/mshtml/tests/dom.c
index cb15187..f3e263e 100644
--- a/dlls/mshtml/tests/dom.c
+++ b/dlls/mshtml/tests/dom.c
@@ -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)




More information about the wine-cvs mailing list