Jacek Caban : mshtml: Added IHTMLIFrameElement:: height property implementation.

Alexandre Julliard julliard at winehq.org
Tue Oct 23 13:37:19 CDT 2012


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

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Tue Oct 23 13:41:33 2012 +0200

mshtml: Added IHTMLIFrameElement::height property implementation.

---

 dlls/mshtml/htmliframe.c |   33 +++++++++++++++++++++++++++---
 dlls/mshtml/tests/dom.c  |   49 ++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 78 insertions(+), 4 deletions(-)

diff --git a/dlls/mshtml/htmliframe.c b/dlls/mshtml/htmliframe.c
index 0e7b218..c1f1264 100644
--- a/dlls/mshtml/htmliframe.c
+++ b/dlls/mshtml/htmliframe.c
@@ -217,15 +217,40 @@ static HRESULT WINAPI HTMLIFrameElement2_Invoke(IHTMLIFrameElement2 *iface, DISP
 static HRESULT WINAPI HTMLIFrameElement2_put_height(IHTMLIFrameElement2 *iface, VARIANT v)
 {
     HTMLIFrame *This = impl_from_IHTMLIFrameElement2(iface);
-    FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
-    return E_NOTIMPL;
+    nsAString nsstr;
+    nsresult nsres;
+
+    TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
+
+    if(V_VT(&v) != VT_BSTR) {
+        FIXME("Unsupported %s\n", debugstr_variant(&v));
+        return E_NOTIMPL;
+    }
+
+    nsAString_InitDepend(&nsstr, V_BSTR(&v));
+    nsres = nsIDOMHTMLIFrameElement_SetHeight(This->framebase.nsiframe, &nsstr);
+    nsAString_Finish(&nsstr);
+    if(NS_FAILED(nsres)) {
+        ERR("SetHeight failed: %08x\n", nsres);
+        return E_FAIL;
+    }
+
+    return S_OK;
 }
 
 static HRESULT WINAPI HTMLIFrameElement2_get_height(IHTMLIFrameElement2 *iface, VARIANT *p)
 {
     HTMLIFrame *This = impl_from_IHTMLIFrameElement2(iface);
-    FIXME("(%p)->(%p)\n", This, p);
-    return E_NOTIMPL;
+    nsAString nsstr;
+    nsresult nsres;
+
+    TRACE("(%p)->(%p)\n", This, p);
+
+    nsAString_Init(&nsstr, NULL);
+    nsres = nsIDOMHTMLIFrameElement_GetHeight(This->framebase.nsiframe, &nsstr);
+
+    V_VT(p) = VT_BSTR;
+    return return_nsstr(nsres, &nsstr, &V_BSTR(p));
 }
 
 static HRESULT WINAPI HTMLIFrameElement2_put_width(IHTMLIFrameElement2 *iface, VARIANT v)
diff --git a/dlls/mshtml/tests/dom.c b/dlls/mshtml/tests/dom.c
index ef036da..3c1b0e2 100644
--- a/dlls/mshtml/tests/dom.c
+++ b/dlls/mshtml/tests/dom.c
@@ -878,6 +878,17 @@ static IHTMLLinkElement *_get_link_iface(unsigned line, IUnknown *unk)
     return ret;
 }
 
+#define get_iframe2_iface(u) _get_iframe2_iface(__LINE__,u)
+static IHTMLIFrameElement2 *_get_iframe2_iface(unsigned line, IUnknown *unk)
+{
+    IHTMLIFrameElement2 *ret;
+    HRESULT hres;
+
+    hres = IUnknown_QueryInterface(unk, &IID_IHTMLIFrameElement2, (void**)&ret);
+    ok_(__FILE__,line) (hres == S_OK, "Could not get IHTMLIFrameElement: %08x\n", hres);
+    return ret;
+}
+
 #define test_node_name(u,n) _test_node_name(__LINE__,u,n)
 static void _test_node_name(unsigned line, IUnknown *unk, const char *exname)
 {
@@ -5239,6 +5250,39 @@ static void test_frame_doc(IUnknown *frame_elem, BOOL iframe)
     IHTMLDocument2_Release(window_doc);
 }
 
+#define test_iframe_height(a,b) _test_iframe_height(__LINE__,a,b)
+static void _test_iframe_height(unsigned line, IHTMLElement *elem, const char *exval)
+{
+    IHTMLIFrameElement2 *iframe = _get_iframe2_iface(line, (IUnknown*)elem);
+    VARIANT v;
+    HRESULT hres;
+
+    hres = IHTMLIFrameElement2_get_height(iframe, &v);
+    ok_(__FILE__,line)(hres == S_OK, "get_height failed: %08x\n", hres);
+    ok_(__FILE__,line)(V_VT(&v) == VT_BSTR, "V_VT(height) = %d\n", V_VT(&v));
+    if(exval)
+        ok_(__FILE__,line)(!strcmp_wa(V_BSTR(&v), exval), "height = %s, expected %s\n", wine_dbgstr_w(V_BSTR(&v)), exval);
+    else
+        ok_(__FILE__,line)(!V_BSTR(&v), "height = %s, expected NULL\n", wine_dbgstr_w(V_BSTR(&v)));
+    VariantClear(&v);
+    IHTMLIFrameElement2_Release(iframe);
+}
+
+#define set_iframe_height(a,b) _set_iframe_height(__LINE__,a,b)
+static void _set_iframe_height(unsigned line, IHTMLElement *elem, const char *val)
+{
+    IHTMLIFrameElement2 *iframe = _get_iframe2_iface(line, (IUnknown*)elem);
+    VARIANT v;
+    HRESULT hres;
+
+    V_VT(&v) = VT_BSTR;
+    V_BSTR(&v) = a2bstr(val);
+    hres = IHTMLIFrameElement2_put_height(iframe, v);
+    ok_(__FILE__,line)(hres == S_OK, "put_height failed: %08x\n", hres);
+    VariantClear(&v);
+    IHTMLIFrameElement2_Release(iframe);
+}
+
 static void test_iframe_elem(IHTMLElement *elem)
 {
     IHTMLDocument2 *content_doc, *owner_doc;
@@ -5281,6 +5325,11 @@ static void test_iframe_elem(IHTMLElement *elem)
         win_skip("IHTMLIFrameElement3 not supported\n");
     }
 
+    test_iframe_height(elem, NULL);
+    set_iframe_height(elem, "100px");
+    set_iframe_height(elem, "50%");
+    test_iframe_height(elem, "50%");
+
     str = a2bstr("text/html");
     V_VT(&errv) = VT_ERROR;
     disp = NULL;




More information about the wine-cvs mailing list