Jacek Caban : mshtml: Added IHTMLTextAreaElement:: readOnly property implementation.

Alexandre Julliard julliard at winehq.org
Tue May 11 12:09:40 CDT 2010


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

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Tue May 11 17:58:40 2010 +0200

mshtml: Added IHTMLTextAreaElement::readOnly property implementation.

---

 dlls/mshtml/htmltextarea.c |   28 ++++++++++++++++++++++++----
 dlls/mshtml/tests/dom.c    |   29 +++++++++++++++++++++++++++++
 2 files changed, 53 insertions(+), 4 deletions(-)

diff --git a/dlls/mshtml/htmltextarea.c b/dlls/mshtml/htmltextarea.c
index afa9c8f..dd33c72 100644
--- a/dlls/mshtml/htmltextarea.c
+++ b/dlls/mshtml/htmltextarea.c
@@ -265,15 +265,35 @@ static HRESULT WINAPI HTMLTextAreaElement_get_onselect(IHTMLTextAreaElement *ifa
 static HRESULT WINAPI HTMLTextAreaElement_put_readOnly(IHTMLTextAreaElement *iface, VARIANT_BOOL v)
 {
     HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
-    FIXME("(%p)->(%x)\n", This, v);
-    return E_NOTIMPL;
+    nsresult nsres;
+
+    TRACE("(%p)->(%x)\n", This, v);
+
+    nsres = nsIDOMHTMLTextAreaElement_SetReadOnly(This->nstextarea, v != VARIANT_FALSE);
+    if(NS_FAILED(nsres)) {
+        ERR("SetReadOnly failed: %08x\n", nsres);
+        return E_FAIL;
+    }
+
+    return S_OK;
 }
 
 static HRESULT WINAPI HTMLTextAreaElement_get_readOnly(IHTMLTextAreaElement *iface, VARIANT_BOOL *p)
 {
     HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
-    FIXME("(%p)->(%p)\n", This, p);
-    return E_NOTIMPL;
+    PRBool b;
+    nsresult nsres;
+
+    TRACE("(%p)->(%p)\n", This, p);
+
+    nsres = nsIDOMHTMLTextAreaElement_GetReadOnly(This->nstextarea, &b);
+    if(NS_FAILED(nsres)) {
+        ERR("GetReadOnly failed: %08x\n", nsres);
+        return E_FAIL;
+    }
+
+    *p = b ? VARIANT_TRUE : VARIANT_FALSE;
+    return S_OK;
 }
 
 static HRESULT WINAPI HTMLTextAreaElement_put_rows(IHTMLTextAreaElement *iface, LONG v)
diff --git a/dlls/mshtml/tests/dom.c b/dlls/mshtml/tests/dom.c
index c344509..7be4fe7 100644
--- a/dlls/mshtml/tests/dom.c
+++ b/dlls/mshtml/tests/dom.c
@@ -1199,6 +1199,32 @@ static void _test_textarea_put_value(unsigned line, IUnknown *unk, const char *v
     _test_textarea_value(line, unk, value);
 }
 
+#define test_textarea_readonly(t,v) _test_textarea_readonly(__LINE__,t,v)
+static void _test_textarea_readonly(unsigned line, IUnknown *unk, VARIANT_BOOL ex)
+{
+    IHTMLTextAreaElement *textarea = _get_textarea_iface(line, unk);
+    VARIANT_BOOL b = 0x100;
+    HRESULT hres;
+
+    hres = IHTMLTextAreaElement_get_readOnly(textarea, &b);
+    IHTMLTextAreaElement_Release(textarea);
+    ok_(__FILE__,line)(hres == S_OK, "get_readOnly failed: %08x\n", hres);
+    ok_(__FILE__,line)(b == ex, "readOnly = %x, expected %x\n", b, ex);
+}
+
+#define test_textarea_put_readonly(t,v) _test_textarea_put_readonly(__LINE__,t,v)
+static void _test_textarea_put_readonly(unsigned line, IUnknown *unk, VARIANT_BOOL b)
+{
+    IHTMLTextAreaElement *textarea = _get_textarea_iface(line, unk);
+    HRESULT hres;
+
+    hres = IHTMLTextAreaElement_put_readOnly(textarea, b);
+    IHTMLTextAreaElement_Release(textarea);
+    ok_(__FILE__,line)(hres == S_OK, "put_readOnly failed: %08x\n", hres);
+
+    _test_textarea_readonly(line, unk, b);
+}
+
 #define test_comment_text(c,t) _test_comment_text(__LINE__,c,t)
 static void _test_comment_text(unsigned line, IUnknown *unk, const char *extext)
 {
@@ -6183,6 +6209,9 @@ static void test_elems2(IHTMLDocument2 *doc)
     if(elem) {
         test_textarea_value((IUnknown*)elem, NULL);
         test_textarea_put_value((IUnknown*)elem, "test");
+        test_textarea_readonly((IUnknown*)elem, VARIANT_FALSE);
+        test_textarea_put_readonly((IUnknown*)elem, VARIANT_TRUE);
+        test_textarea_put_readonly((IUnknown*)elem, VARIANT_FALSE);
         IHTMLElement_Release(elem);
     }
 




More information about the wine-cvs mailing list