diff --git a/dlls/mshtml/htmltextarea.c b/dlls/mshtml/htmltextarea.c index afa9c8fc7ab..dd33c72df21 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 c344509c20f..7be4fe79c97 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); }