From d06d73c13660a794f97cd80f4fb2ac73c20b9a47 Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Mon, 12 May 2014 10:23:26 +0200 Subject: [PATCH] mshtml: Added IDispatchEx support to HTMLOptionElementFactory object. --- dlls/mshtml/htmloption.c | 36 +++++++++++++++++++++++++----------- dlls/mshtml/mshtml_private.h | 2 ++ dlls/mshtml/tests/dom.c | 2 ++ 3 files changed, 29 insertions(+), 11 deletions(-) diff --git a/dlls/mshtml/htmloption.c b/dlls/mshtml/htmloption.c index d64a91da331..4738eb5dc24 100644 --- a/dlls/mshtml/htmloption.c +++ b/dlls/mshtml/htmloption.c @@ -374,6 +374,8 @@ static HRESULT WINAPI HTMLOptionElementFactory_QueryInterface(IHTMLOptionElement *ppv = &This->IHTMLOptionElementFactory_iface; }else if(IsEqualGUID(&IID_IHTMLOptionElementFactory, riid)) { *ppv = &This->IHTMLOptionElementFactory_iface; + }else if(dispex_query_interface(&This->dispex, riid, ppv)) { + return *ppv ? S_OK : E_NOINTERFACE; }else { *ppv = NULL; WARN("(%p)->(%s %p)\n", This, debugstr_mshtml_guid(riid), ppv); @@ -401,8 +403,10 @@ static ULONG WINAPI HTMLOptionElementFactory_Release(IHTMLOptionElementFactory * TRACE("(%p) ref=%d\n", This, ref); - if(!ref) + if(!ref) { + release_dispex(&This->dispex); heap_free(This); + } return ref; } @@ -410,16 +414,14 @@ static ULONG WINAPI HTMLOptionElementFactory_Release(IHTMLOptionElementFactory * static HRESULT WINAPI HTMLOptionElementFactory_GetTypeInfoCount(IHTMLOptionElementFactory *iface, UINT *pctinfo) { HTMLOptionElementFactory *This = impl_from_IHTMLOptionElementFactory(iface); - FIXME("(%p)->(%p)\n", This, pctinfo); - return E_NOTIMPL; + return IDispatchEx_GetTypeInfoCount(&This->dispex.IDispatchEx_iface, pctinfo); } static HRESULT WINAPI HTMLOptionElementFactory_GetTypeInfo(IHTMLOptionElementFactory *iface, UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo) { HTMLOptionElementFactory *This = impl_from_IHTMLOptionElementFactory(iface); - FIXME("(%p)->(%u %u %p)\n", This, iTInfo, lcid, ppTInfo); - return E_NOTIMPL; + return IDispatchEx_GetTypeInfo(&This->dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo); } static HRESULT WINAPI HTMLOptionElementFactory_GetIDsOfNames(IHTMLOptionElementFactory *iface, REFIID riid, @@ -427,9 +429,7 @@ static HRESULT WINAPI HTMLOptionElementFactory_GetIDsOfNames(IHTMLOptionElementF LCID lcid, DISPID *rgDispId) { HTMLOptionElementFactory *This = impl_from_IHTMLOptionElementFactory(iface); - FIXME("(%p)->(%s %p %u %u %p)\n", This, debugstr_guid(riid), rgszNames, cNames, - lcid, rgDispId); - return E_NOTIMPL; + return IDispatchEx_GetIDsOfNames(&This->dispex.IDispatchEx_iface, riid, rgszNames, cNames, lcid, rgDispId); } static HRESULT WINAPI HTMLOptionElementFactory_Invoke(IHTMLOptionElementFactory *iface, DISPID dispIdMember, @@ -437,9 +437,8 @@ static HRESULT WINAPI HTMLOptionElementFactory_Invoke(IHTMLOptionElementFactory VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr) { HTMLOptionElementFactory *This = impl_from_IHTMLOptionElementFactory(iface); - FIXME("(%p)->(%d %s %d %d %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid), - lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr); - return E_NOTIMPL; + return IDispatchEx_Invoke(&This->dispex.IDispatchEx_iface, dispIdMember, riid, lcid, wFlags, pDispParams, + pVarResult, pExcepInfo, puArgErr); } static HRESULT WINAPI HTMLOptionElementFactory_create(IHTMLOptionElementFactory *iface, @@ -505,6 +504,18 @@ static const IHTMLOptionElementFactoryVtbl HTMLOptionElementFactoryVtbl = { HTMLOptionElementFactory_create }; +static const tid_t HTMLOptionElementFactory_iface_tids[] = { + IHTMLOptionElementFactory_tid, + 0 +}; + +static dispex_static_data_t HTMLOptionElementFactory_dispex = { + NULL, + IHTMLOptionElementFactory_tid, + NULL, + HTMLOptionElementFactory_iface_tids +}; + HRESULT HTMLOptionElementFactory_Create(HTMLInnerWindow *window, HTMLOptionElementFactory **ret_ptr) { HTMLOptionElementFactory *ret; @@ -517,6 +528,9 @@ HRESULT HTMLOptionElementFactory_Create(HTMLInnerWindow *window, HTMLOptionEleme ret->ref = 1; ret->window = window; + init_dispex(&ret->dispex, (IUnknown*)&ret->IHTMLOptionElementFactory_iface, + &HTMLOptionElementFactory_dispex); + *ret_ptr = ret; return S_OK; } diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index ccfec4a0682..068c18e7201 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -167,6 +167,7 @@ typedef struct event_target_t event_target_t; XIID(IHTMLObjectElement) \ XIID(IHTMLObjectElement2) \ XIID(IHTMLOptionElement) \ + XIID(IHTMLOptionElementFactory) \ XIID(IHTMLPluginsCollection) \ XIID(IHTMLRect) \ XIID(IHTMLScreen) \ @@ -318,6 +319,7 @@ typedef struct { } global_prop_t; typedef struct { + DispatchEx dispex; IHTMLOptionElementFactory IHTMLOptionElementFactory_iface; LONG ref; diff --git a/dlls/mshtml/tests/dom.c b/dlls/mshtml/tests/dom.c index 08c6c296849..8af98dd52bc 100644 --- a/dlls/mshtml/tests/dom.c +++ b/dlls/mshtml/tests/dom.c @@ -1741,6 +1741,8 @@ static IHTMLOptionElement *_create_option_elem(unsigned line, IHTMLDocument2 *do IHTMLWindow2_Release(window); ok_(__FILE__,line) (hres == S_OK, "get_Option failed: %08x\n", hres); + test_disp((IUnknown*)factory, &IID_IHTMLOptionElementFactory, "[object]"); + V_VT(&text) = VT_BSTR; V_BSTR(&text) = a2bstr(txt); V_VT(&value) = VT_BSTR;