Module: wine Branch: master Commit: c2ac0f506bbacb2a00cf918be4ac02ade56e3183 URL: http://source.winehq.org/git/wine.git/?a=commit;h=c2ac0f506bbacb2a00cf918be4...
Author: Zhenbo Li litimetal@gmail.com Date: Mon Aug 18 17:03:14 2014 +0800
mshtml: Added IHTMLInputElement::readOnly property.
---
dlls/mshtml/htmlinput.c | 26 ++++++++++++++++++++++---- dlls/mshtml/tests/dom.c | 17 +++++++++++++++++ 2 files changed, 39 insertions(+), 4 deletions(-)
diff --git a/dlls/mshtml/htmlinput.c b/dlls/mshtml/htmlinput.c index c356ac0..f25f437 100644 --- a/dlls/mshtml/htmlinput.c +++ b/dlls/mshtml/htmlinput.c @@ -412,15 +412,33 @@ static HRESULT WINAPI HTMLInputElement_get_defaultValue(IHTMLInputElement *iface static HRESULT WINAPI HTMLInputElement_put_readOnly(IHTMLInputElement *iface, VARIANT_BOOL v) { HTMLInputElement *This = impl_from_IHTMLInputElement(iface); - FIXME("(%p)->(%x)\n", This, v); - return E_NOTIMPL; + nsresult nsres; + + TRACE("(%p)->(%x)\n", This, v); + + nsres = nsIDOMHTMLInputElement_SetReadOnly(This->nsinput, v != VARIANT_FALSE); + if (NS_FAILED(nsres)) { + ERR("Set ReadOnly Failed: %08x\n", nsres); + return E_FAIL; + } + return S_OK; }
static HRESULT WINAPI HTMLInputElement_get_readOnly(IHTMLInputElement *iface, VARIANT_BOOL *p) { HTMLInputElement *This = impl_from_IHTMLInputElement(iface); - FIXME("(%p)->(%p)\n", This, p); - return E_NOTIMPL; + nsresult nsres; + cpp_bool b; + + TRACE("(%p)->(%p)\n", This, p); + + nsres = nsIDOMHTMLInputElement_GetReadOnly(This->nsinput, &b); + if (NS_FAILED(nsres)) { + ERR("Get ReadOnly Failed: %08x\n", nsres); + return E_FAIL; + } + *p = b ? VARIANT_TRUE : VARIANT_FALSE; + return S_OK; }
static HRESULT WINAPI HTMLInputElement_createTextRange(IHTMLInputElement *iface, IHTMLTxtRange **range) diff --git a/dlls/mshtml/tests/dom.c b/dlls/mshtml/tests/dom.c index 7cae345..f2b556b 100644 --- a/dlls/mshtml/tests/dom.c +++ b/dlls/mshtml/tests/dom.c @@ -3362,6 +3362,20 @@ static void _test_input_get_size(unsigned line, IHTMLInputElement *input, LONG e ok_(__FILE__,line) (hres == E_INVALIDARG, "Expect ret E_INVALIDARG, got: %08x\n", hres); }
+#define test_input_readOnly(u,b) _test_input_readOnly(__LINE__,u,b) +static void _test_input_readOnly(unsigned line, IHTMLInputElement *input, VARIANT_BOOL v) +{ + HRESULT hres; + VARIANT_BOOL b = 100; + + hres = IHTMLInputElement_put_readOnly(input, v); + ok_(__FILE__,line)(hres == S_OK, "put readOnly failed: %08x\n", hres); + + hres = IHTMLInputElement_get_readOnly(input, &b); + ok_(__FILE__,line)(hres == S_OK, "get readOnly failed: %08x\n", hres); + ok_(__FILE__,line)(v == b, "Expect %x, got %x\n", v, b); +} + #define test_elem_class(u,c) _test_elem_class(__LINE__,u,c) static void _test_elem_class(unsigned line, IUnknown *unk, const char *exclass) { @@ -7012,6 +7026,9 @@ static void test_elems(IHTMLDocument2 *doc) test_input_set_size(input, 0, CTL_E_INVALIDPROPERTYVALUE); test_input_get_size(input, 15);
+ test_input_readOnly(input, VARIANT_TRUE); + test_input_readOnly(input, VARIANT_FALSE); + IHTMLInputElement_Release(input); IHTMLElement_Release(elem); }