From 78d743b98680dbef191454b33104d3d4ace199af Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Tue, 1 Mar 2011 11:33:03 +0100 Subject: [PATCH] mshtml: Added IHTMLFormElement::get_elements implementation. --- dlls/mshtml/htmlform.c | 8 ++++++-- dlls/mshtml/tests/dom.c | 21 ++++++++++++++++++++- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/dlls/mshtml/htmlform.c b/dlls/mshtml/htmlform.c index e53dbc07707..d9c2bce40d6 100644 --- a/dlls/mshtml/htmlform.c +++ b/dlls/mshtml/htmlform.c @@ -274,8 +274,12 @@ static HRESULT WINAPI HTMLFormElement_get_method(IHTMLFormElement *iface, BSTR * static HRESULT WINAPI HTMLFormElement_get_elements(IHTMLFormElement *iface, IDispatch **p) { HTMLFormElement *This = impl_from_IHTMLFormElement(iface); - FIXME("(%p)->(%p)\n", This, p); - return E_NOTIMPL; + + TRACE("(%p)->(%p)\n", This, p); + + *p = (IDispatch*)&This->IHTMLFormElement_iface; + IDispatch_AddRef(*p); + return S_OK; } static HRESULT WINAPI HTMLFormElement_put_target(IHTMLFormElement *iface, BSTR v) diff --git a/dlls/mshtml/tests/dom.c b/dlls/mshtml/tests/dom.c index b8e9f761919..432a3b83711 100644 --- a/dlls/mshtml/tests/dom.c +++ b/dlls/mshtml/tests/dom.c @@ -2809,6 +2809,23 @@ static void _test_form_put_encoding(unsigned line, IUnknown *unk, HRESULT exp_hr _test_form_encoding(line, unk, encoding); } +#define test_form_elements(a) _test_form_elements(__LINE__,a) +static void _test_form_elements(unsigned line, IUnknown *unk) +{ + IHTMLFormElement *form = _get_form_iface(line, unk); + IDispatch *disp; + HRESULT hres; + + disp = NULL; + hres = IHTMLFormElement_get_elements(form, &disp); + ok_(__FILE__,line)(hres == S_OK, "get_elements failed: %08x\n", hres); + ok_(__FILE__,line)(disp != NULL, "disp = NULL\n"); + ok_(__FILE__,line)(iface_cmp((IUnknown*)form, (IUnknown*)disp), "disp != form\n"); + + IDispatch_Release(disp); + IHTMLFormElement_Release(form); +} + #define get_elem_doc(e) _get_elem_doc(__LINE__,e) static IHTMLDocument2 *_get_elem_doc(unsigned line, IUnknown *unk) { @@ -6652,6 +6669,7 @@ static void test_elems(IHTMLDocument2 *doc) ok(elem != NULL, "elem == NULL\n"); if(elem) { test_form_length((IUnknown*)elem, 0); + test_form_elements((IUnknown*)elem); IHTMLElement_Release(elem); } @@ -6802,7 +6820,7 @@ static void test_elems2(IHTMLDocument2 *doc) } test_elem_set_innerhtml((IUnknown*)div, - "
"); + "
"); elem = get_elem_by_id(doc, "form", TRUE); if(elem) { test_form_length((IUnknown*)elem, 2); @@ -6820,6 +6838,7 @@ static void test_elems2(IHTMLDocument2 *doc) test_form_put_encoding((IUnknown*)elem, S_OK, "multipart/form-data"); test_form_put_encoding((IUnknown*)elem, E_INVALIDARG, "image/png"); test_form_encoding((IUnknown*)elem, "multipart/form-data"); + test_form_elements((IUnknown*)elem); IHTMLElement_Release(elem); }