Zhenbo Li : mshtml: Added IHTMLInputElement::size property implementation.

Alexandre Julliard julliard at wine.codeweavers.com
Mon Aug 18 16:08:49 CDT 2014


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

Author: Zhenbo Li <litimetal at gmail.com>
Date:   Mon Aug 18 17:03:06 2014 +0800

mshtml: Added IHTMLInputElement::size property implementation.

---

 dlls/mshtml/htmlinput.c | 31 +++++++++++++++++++++++++++----
 dlls/mshtml/tests/dom.c | 30 ++++++++++++++++++++++++++++++
 2 files changed, 57 insertions(+), 4 deletions(-)

diff --git a/dlls/mshtml/htmlinput.c b/dlls/mshtml/htmlinput.c
index f832b88..c356ac0 100644
--- a/dlls/mshtml/htmlinput.c
+++ b/dlls/mshtml/htmlinput.c
@@ -262,15 +262,38 @@ static HRESULT WINAPI HTMLInputElement_get_form(IHTMLInputElement *iface, IHTMLF
 static HRESULT WINAPI HTMLInputElement_put_size(IHTMLInputElement *iface, LONG v)
 {
     HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
-    FIXME("(%p)->(%d)\n", This, v);
-    return E_NOTIMPL;
+    UINT32 val = v;
+    nsresult nsres;
+
+    TRACE("(%p)->(%d)\n", This, v);
+    if (v <= 0)
+        return CTL_E_INVALIDPROPERTYVALUE;
+
+    nsres = nsIDOMHTMLInputElement_SetSize(This->nsinput, val);
+    if (NS_FAILED(nsres)) {
+        ERR("Set Size(%u) failed: %08x\n", val, nsres);
+        return E_FAIL;
+    }
+    return S_OK;
 }
 
 static HRESULT WINAPI HTMLInputElement_get_size(IHTMLInputElement *iface, LONG *p)
 {
     HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
-    FIXME("(%p)->(%p)\n", This, p);
-    return E_NOTIMPL;
+    UINT32 val;
+    nsresult nsres;
+
+    TRACE("(%p)->(%p)\n", This, p);
+    if (p == NULL)
+        return E_INVALIDARG;
+
+    nsres = nsIDOMHTMLInputElement_GetSize(This->nsinput, &val);
+    if (NS_FAILED(nsres)) {
+        ERR("Get Size failed: %08x\n", nsres);
+        return E_FAIL;
+    }
+    *p = val;
+    return S_OK;
 }
 
 static HRESULT WINAPI HTMLInputElement_put_maxLength(IHTMLInputElement *iface, LONG v)
diff --git a/dlls/mshtml/tests/dom.c b/dlls/mshtml/tests/dom.c
index 86a9aa3..ba0c582 100644
--- a/dlls/mshtml/tests/dom.c
+++ b/dlls/mshtml/tests/dom.c
@@ -3321,6 +3321,29 @@ static void _test_input_set_src(unsigned line, IHTMLInputElement *input, const c
     _test_input_src(line, input, src);
 }
 
+#define test_input_set_size(u,s,r) _test_input_set_size(__LINE__,u,s,r)
+static void _test_input_set_size(unsigned line, IHTMLInputElement *input, LONG size, HRESULT exret)
+{
+    HRESULT hres;
+
+    hres = IHTMLInputElement_put_size(input, size);
+    ok_(__FILE__,line) (hres == exret, "Expect ret = %08x, got: %08x\n", exret, hres);
+}
+
+#define test_input_get_size(u,s) _test_input_get_size(__LINE__,u,s)
+static void _test_input_get_size(unsigned line, IHTMLInputElement *input, LONG exsize)
+{
+    HRESULT hres;
+    LONG size;
+
+    hres = IHTMLInputElement_get_size(input, &size);
+    ok_(__FILE__,line) (hres == S_OK, "get_size failed: %08x\n", hres);
+    ok_(__FILE__,line) (size == exsize, "Expect %d, got %d\n", exsize, size);
+
+    hres = IHTMLInputElement_get_size(input, NULL);
+    ok_(__FILE__,line) (hres == E_INVALIDARG, "Expect ret E_INVALIDARG, got: %08x\n", hres);
+}
+
 #define test_elem_class(u,c) _test_elem_class(__LINE__,u,c)
 static void _test_elem_class(unsigned line, IUnknown *unk, const char *exclass)
 {
@@ -6964,6 +6987,13 @@ static void test_elems(IHTMLDocument2 *doc)
         test_input_src(input, NULL);
         test_input_set_src(input, "about:blank");
 
+        test_input_set_size(input, 15, S_OK);
+        test_input_get_size(input, 15);
+        test_input_set_size(input, -100, CTL_E_INVALIDPROPERTYVALUE);
+        test_input_get_size(input, 15);
+        test_input_set_size(input, 0, CTL_E_INVALIDPROPERTYVALUE);
+        test_input_get_size(input, 15);
+
         IHTMLInputElement_Release(input);
         IHTMLElement_Release(elem);
     }




More information about the wine-cvs mailing list