From 4e913b9551746f432fc2c96ef8a708dcf9ad3323 Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Mon, 28 Apr 2008 11:57:25 +0200 Subject: [PATCH] mshtml: Added IHTMLInputElement::get_disabled implementation. --- dlls/mshtml/htmlinput.c | 10 ++++++++-- dlls/mshtml/tests/dom.c | 28 +++++++++++++++++++++++++++- 2 files changed, 35 insertions(+), 3 deletions(-) diff --git a/dlls/mshtml/htmlinput.c b/dlls/mshtml/htmlinput.c index e580bb6470..dd0a8b5840 100644 --- a/dlls/mshtml/htmlinput.c +++ b/dlls/mshtml/htmlinput.c @@ -223,8 +223,14 @@ static HRESULT WINAPI HTMLInputElement_put_disabled(IHTMLInputElement *iface, VA static HRESULT WINAPI HTMLInputElement_get_disabled(IHTMLInputElement *iface, VARIANT_BOOL *p) { HTMLInputElement *This = HTMLINPUT_THIS(iface); - FIXME("(%p)->(%p)\n", This, p); - return E_NOTIMPL; + PRBool disabled = FALSE; + + TRACE("(%p)->(%p)\n", This, p); + + nsIDOMHTMLInputElement_GetDisabled(This->nsinput, &disabled); + + *p = disabled ? VARIANT_TRUE : VARIANT_FALSE; + return S_OK; } static HRESULT WINAPI HTMLInputElement_get_form(IHTMLInputElement *iface, IHTMLFormElement **p) diff --git a/dlls/mshtml/tests/dom.c b/dlls/mshtml/tests/dom.c index 8c6f60fe9f..7d607d76f7 100644 --- a/dlls/mshtml/tests/dom.c +++ b/dlls/mshtml/tests/dom.c @@ -40,7 +40,8 @@ static const char range_test2_str[] = "abc
123

def"; static const char elem_test_str[] = "test" - "text testlink" + "text testlink" + "" "" "" "
" @@ -783,6 +784,17 @@ static long _get_node_type(unsigned line, IUnknown *unk) return type; } +#define test_input_get_disabled(i,b) _test_input_get_disabled(__LINE__,i,b) +static void _test_input_get_disabled(unsigned line, IHTMLInputElement *input, VARIANT_BOOL exb) +{ + VARIANT_BOOL disabled = 100; + HRESULT hres; + + hres = IHTMLInputElement_get_disabled(input, &disabled); + ok_(__FILE__,line) (hres == S_OK, "get_disabled failed: %08x\n", hres); + ok_(__FILE__,line) (disabled == exb, "disabled=%x, expected %x\n", disabled, exb); +} + static void test_elem_col_item(IHTMLElementCollection *col, LPCWSTR n, const elem_type_t *elem_types, long len) { @@ -1429,6 +1441,7 @@ static void test_elems(IHTMLDocument2 *doc) long type; HRESULT hres; + static const WCHAR inW[] = {'i','n',0}; static const WCHAR xW[] = {'x',0}; static const WCHAR sW[] = {'s',0}; static const WCHAR scW[] = {'s','c',0}; @@ -1528,6 +1541,19 @@ static void test_elems(IHTMLDocument2 *doc) IHTMLScriptElement_Release(script); } + elem = get_elem_by_id(doc, inW, TRUE); + if(elem) { + IHTMLInputElement *input; + + hres = IHTMLElement_QueryInterface(elem, &IID_IHTMLInputElement, (void**)&input); + ok(hres == S_OK, "Could not get IHTMLInputElement: %08x\n", hres); + + test_input_get_disabled(input, VARIANT_FALSE); + + IHTMLInputElement_Release(input); + IHTMLElement_Release(elem); + } + hres = IHTMLDocument2_get_body(doc, &elem); ok(hres == S_OK, "get_body failed: %08x\n", hres); -- 2.32.0.93.g670b81a890