Commit c2ac0f50 authored by Zhenbo Li's avatar Zhenbo Li Committed by Alexandre Julliard

mshtml: Added IHTMLInputElement::readOnly property.

parent 6079c561
...@@ -412,15 +412,33 @@ static HRESULT WINAPI HTMLInputElement_get_defaultValue(IHTMLInputElement *iface ...@@ -412,15 +412,33 @@ static HRESULT WINAPI HTMLInputElement_get_defaultValue(IHTMLInputElement *iface
static HRESULT WINAPI HTMLInputElement_put_readOnly(IHTMLInputElement *iface, VARIANT_BOOL v) static HRESULT WINAPI HTMLInputElement_put_readOnly(IHTMLInputElement *iface, VARIANT_BOOL v)
{ {
HTMLInputElement *This = impl_from_IHTMLInputElement(iface); HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
FIXME("(%p)->(%x)\n", This, v); nsresult nsres;
return E_NOTIMPL;
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) static HRESULT WINAPI HTMLInputElement_get_readOnly(IHTMLInputElement *iface, VARIANT_BOOL *p)
{ {
HTMLInputElement *This = impl_from_IHTMLInputElement(iface); HTMLInputElement *This = impl_from_IHTMLInputElement(iface);
FIXME("(%p)->(%p)\n", This, p); nsresult nsres;
return E_NOTIMPL; 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) static HRESULT WINAPI HTMLInputElement_createTextRange(IHTMLInputElement *iface, IHTMLTxtRange **range)
......
...@@ -3362,6 +3362,20 @@ static void _test_input_get_size(unsigned line, IHTMLInputElement *input, LONG e ...@@ -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); 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) #define test_elem_class(u,c) _test_elem_class(__LINE__,u,c)
static void _test_elem_class(unsigned line, IUnknown *unk, const char *exclass) static void _test_elem_class(unsigned line, IUnknown *unk, const char *exclass)
{ {
...@@ -7012,6 +7026,9 @@ static void test_elems(IHTMLDocument2 *doc) ...@@ -7012,6 +7026,9 @@ static void test_elems(IHTMLDocument2 *doc)
test_input_set_size(input, 0, CTL_E_INVALIDPROPERTYVALUE); test_input_set_size(input, 0, CTL_E_INVALIDPROPERTYVALUE);
test_input_get_size(input, 15); test_input_get_size(input, 15);
test_input_readOnly(input, VARIANT_TRUE);
test_input_readOnly(input, VARIANT_FALSE);
IHTMLInputElement_Release(input); IHTMLInputElement_Release(input);
IHTMLElement_Release(elem); IHTMLElement_Release(elem);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment