Jacek Caban : mshtml: Use variant_to_nsstr in IHTMLIFrameElement2::put_height.

Alexandre Julliard julliard at winehq.org
Fri Jun 26 17:00:53 CDT 2020


Module: wine
Branch: master
Commit: 190762cbaa3ef1aa96d39d1c509efe18050f5160
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=190762cbaa3ef1aa96d39d1c509efe18050f5160

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Fri Jun 26 18:36:44 2020 +0200

mshtml: Use variant_to_nsstr in IHTMLIFrameElement2::put_height.

Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/mshtml/htmlframe.c |  9 ++++-----
 dlls/mshtml/tests/dom.c | 12 +++++++++++-
 2 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/dlls/mshtml/htmlframe.c b/dlls/mshtml/htmlframe.c
index c52836b951..0c07f0c677 100644
--- a/dlls/mshtml/htmlframe.c
+++ b/dlls/mshtml/htmlframe.c
@@ -1240,15 +1240,14 @@ static HRESULT WINAPI HTMLIFrameElement2_put_height(IHTMLIFrameElement2 *iface,
     HTMLIFrame *This = impl_from_IHTMLIFrameElement2(iface);
     nsAString nsstr;
     nsresult nsres;
+    HRESULT hres;
 
     TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
 
-    if(V_VT(&v) != VT_BSTR) {
-        FIXME("Unsupported %s\n", debugstr_variant(&v));
-        return E_NOTIMPL;
-    }
+    hres = variant_to_nsstr(&v, FALSE, &nsstr);
+    if(FAILED(hres))
+        return hres;
 
-    nsAString_InitDepend(&nsstr, V_BSTR(&v));
     nsres = nsIDOMHTMLIFrameElement_SetHeight(This->framebase.nsiframe, &nsstr);
     nsAString_Finish(&nsstr);
     if(NS_FAILED(nsres)) {
diff --git a/dlls/mshtml/tests/dom.c b/dlls/mshtml/tests/dom.c
index ff33ff76ef..5ef27ede89 100644
--- a/dlls/mshtml/tests/dom.c
+++ b/dlls/mshtml/tests/dom.c
@@ -8205,12 +8205,13 @@ static void _set_iframe_width(unsigned line, IHTMLElement *elem, const WCHAR *va
 static void test_iframe_elem(IHTMLElement *elem)
 {
     IHTMLDocument2 *content_doc, *owner_doc;
+    IHTMLIFrameElement2 *iframe2;
     IHTMLIFrameElement3 *iframe3;
     IHTMLElementCollection *col;
     IHTMLWindow2 *content_window;
     IHTMLElement *body;
     IDispatch *disp;
-    VARIANT errv;
+    VARIANT errv, v;
     BSTR str;
     HRESULT hres;
 
@@ -8244,11 +8245,19 @@ static void test_iframe_elem(IHTMLElement *elem)
         win_skip("IHTMLIFrameElement3 not supported\n");
     }
 
+    iframe2 = get_iframe2_iface((IUnknown*)elem);
+
     test_iframe_height(elem, NULL);
     set_iframe_height(elem, L"100px");
     set_iframe_height(elem, L"50%");
     test_iframe_height(elem, L"50%");
 
+    V_VT(&v) = VT_I4;
+    V_I4(&v) = 100;
+    hres = IHTMLIFrameElement2_put_height(iframe2, v);
+    ok(hres == S_OK, "put_height failed: %08x\n", hres);
+    test_iframe_height(elem, L"100");
+
     test_iframe_width(elem, NULL);
     set_iframe_width(elem, L"150px");
     set_iframe_width(elem, L"70%");
@@ -8279,6 +8288,7 @@ static void test_iframe_elem(IHTMLElement *elem)
     test_elem_attr(body, L"i4val", L"4");
     test_elem_attr(body, L"r8val", L"3.14");
     IHTMLElement_Release(body);
+    IHTMLIFrameElement2_Release(iframe2);
 
     hres = IHTMLDocument2_close(content_doc);
     ok(hres == S_OK, "close failed: %08x\n", hres);




More information about the wine-cvs mailing list