Zhenbo Li : mshtml: Added IHTMLFormElement:: target property implementation.

Alexandre Julliard julliard at wine.codeweavers.com
Tue Jul 22 14:12:21 CDT 2014


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

Author: Zhenbo Li <litimetal at gmail.com>
Date:   Mon Jul 21 22:51:11 2014 +0800

mshtml: Added IHTMLFormElement::target property implementation.

---

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

diff --git a/dlls/mshtml/htmlform.c b/dlls/mshtml/htmlform.c
index 86af350..10b2df4 100644
--- a/dlls/mshtml/htmlform.c
+++ b/dlls/mshtml/htmlform.c
@@ -286,15 +286,36 @@ static HRESULT WINAPI HTMLFormElement_get_elements(IHTMLFormElement *iface, IDis
 static HRESULT WINAPI HTMLFormElement_put_target(IHTMLFormElement *iface, BSTR v)
 {
     HTMLFormElement *This = impl_from_IHTMLFormElement(iface);
-    FIXME("(%p)->(%s)\n", This, wine_dbgstr_w(v));
-    return E_NOTIMPL;
+    nsAString str;
+    nsresult nsres;
+
+    TRACE("(%p)->(%s)\n", This, wine_dbgstr_w(v));
+
+    nsAString_InitDepend(&str, v);
+
+    nsres = nsIDOMHTMLFormElement_SetTarget(This->nsform, &str);
+
+    nsAString_Finish(&str);
+    if (NS_FAILED(nsres)) {
+        ERR("Set Target(%s) failed: %08x\n", wine_dbgstr_w(v), nsres);
+        return E_FAIL;
+    }
+
+    return S_OK;
 }
 
 static HRESULT WINAPI HTMLFormElement_get_target(IHTMLFormElement *iface, BSTR *p)
 {
     HTMLFormElement *This = impl_from_IHTMLFormElement(iface);
-    FIXME("(%p)->(%p)\n", This, p);
-    return E_NOTIMPL;
+    nsAString str;
+    nsresult nsres;
+
+    TRACE("(%p)->(%p)\n", This, p);
+
+    nsAString_Init(&str, NULL);
+    nsres = nsIDOMHTMLFormElement_GetTarget(This->nsform, &str);
+
+    return return_nsstr(nsres, &str, p);
 }
 
 static HRESULT WINAPI HTMLFormElement_put_name(IHTMLFormElement *iface, BSTR v)
diff --git a/dlls/mshtml/tests/dom.c b/dlls/mshtml/tests/dom.c
index 487c25c..533d7b7 100644
--- a/dlls/mshtml/tests/dom.c
+++ b/dlls/mshtml/tests/dom.c
@@ -3775,6 +3775,27 @@ static void _test_form_reset(unsigned line, IUnknown *unk)
 
     IHTMLFormElement_Release(form);
 }
+
+static void test_form_target(IUnknown *unk)
+{
+    IHTMLFormElement *form = get_form_iface(unk);
+    HRESULT hres;
+    BSTR str;
+    static const char target[] = "_blank";
+
+    str = a2bstr(target);
+    hres = IHTMLFormElement_put_target(form, str);
+    ok(hres == S_OK, "put_target(%s) failed: %08x\n", target, hres);
+    SysFreeString(str);
+
+    hres = IHTMLFormElement_get_target(form, &str);
+    ok(hres == S_OK, "get_target failed: %08x\n", hres);
+    ok(!strcmp_wa(str, target), "Expected %s, got %s\n", target, wine_dbgstr_w(str));
+    SysFreeString(str);
+
+    IHTMLFormElement_Release(form);
+}
+
 #define test_meta_name(a,b) _test_meta_name(__LINE__,a,b)
 static void _test_meta_name(unsigned line, IUnknown *unk, const char *exname)
 {
@@ -7342,6 +7363,7 @@ static void test_elems2(IHTMLDocument2 *doc)
         test_form_encoding((IUnknown*)elem, "multipart/form-data");
         test_form_elements((IUnknown*)elem);
         test_form_reset((IUnknown*)elem);
+        test_form_target((IUnknown*)elem);
         IHTMLElement_Release(elem);
     }
 




More information about the wine-cvs mailing list