mshtml: Add DispatchEx support to HTMLImageElementFactory.

This commit is contained in:
Andrew Eikum 2009-10-20 16:05:03 -05:00 committed by Alexandre Julliard
parent 9c53e8d935
commit 90029d3429
4 changed files with 30 additions and 4 deletions

View File

@ -128,6 +128,7 @@ static REFIID tid_ids[] = {
&IID_IHTMLFrameBase, &IID_IHTMLFrameBase,
&IID_IHTMLFrameBase2, &IID_IHTMLFrameBase2,
&IID_IHTMLGenericElement, &IID_IHTMLGenericElement,
&IID_IHTMLImageElementFactory,
&IID_IHTMLImgElement, &IID_IHTMLImgElement,
&IID_IHTMLInputElement, &IID_IHTMLInputElement,
&IID_IHTMLLocation, &IID_IHTMLLocation,

View File

@ -624,13 +624,11 @@ static HRESULT WINAPI HTMLImageElementFactory_QueryInterface(IHTMLImageElementFa
if(IsEqualGUID(&IID_IUnknown, riid)) { if(IsEqualGUID(&IID_IUnknown, riid)) {
TRACE("(%p)->(IID_Unknown %p)\n", This, ppv); TRACE("(%p)->(IID_Unknown %p)\n", This, ppv);
*ppv = HTMLIMGFACTORY(This); *ppv = HTMLIMGFACTORY(This);
}else if(IsEqualGUID(&IID_IDispatch, riid)) {
TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv);
*ppv = HTMLIMGFACTORY(This);
}else if(IsEqualGUID(&IID_IHTMLImageElementFactory, riid)) { }else if(IsEqualGUID(&IID_IHTMLImageElementFactory, riid)) {
TRACE("(%p)->(IID_IHTMLImageElementFactory %p)\n", This, ppv); TRACE("(%p)->(IID_IHTMLImageElementFactory %p)\n", This, ppv);
*ppv = HTMLIMGFACTORY(This); *ppv = HTMLIMGFACTORY(This);
} }else if(dispex_query_interface(&This->dispex, riid, ppv))
return *ppv ? S_OK : E_NOINTERFACE;
if(*ppv) { if(*ppv) {
IUnknown_AddRef((IUnknown*)*ppv); IUnknown_AddRef((IUnknown*)*ppv);
@ -758,6 +756,18 @@ static const IHTMLImageElementFactoryVtbl HTMLImageElementFactoryVtbl = {
HTMLImageElementFactory_create HTMLImageElementFactory_create
}; };
static const tid_t HTMLImageElementFactory_iface_tids[] = {
IHTMLImageElementFactory_tid,
0
};
static dispex_static_data_t HTMLImageElementFactory_dispex = {
NULL,
IHTMLImageElementFactory_tid,
NULL,
HTMLImageElementFactory_iface_tids
};
HTMLImageElementFactory *HTMLImageElementFactory_Create(HTMLWindow *window) HTMLImageElementFactory *HTMLImageElementFactory_Create(HTMLWindow *window)
{ {
HTMLImageElementFactory *ret; HTMLImageElementFactory *ret;
@ -768,5 +778,7 @@ HTMLImageElementFactory *HTMLImageElementFactory_Create(HTMLWindow *window)
ret->ref = 1; ret->ref = 1;
ret->window = window; ret->window = window;
init_dispex(&ret->dispex, (IUnknown*)HTMLIMGFACTORY(ret), &HTMLImageElementFactory_dispex);
return ret; return ret;
} }

View File

@ -104,6 +104,7 @@ typedef enum {
IHTMLFrameBase_tid, IHTMLFrameBase_tid,
IHTMLFrameBase2_tid, IHTMLFrameBase2_tid,
IHTMLGenericElement_tid, IHTMLGenericElement_tid,
IHTMLImageElementFactory_tid,
IHTMLImgElement_tid, IHTMLImgElement_tid,
IHTMLInputElement_tid, IHTMLInputElement_tid,
IHTMLLocation_tid, IHTMLLocation_tid,
@ -182,6 +183,7 @@ typedef struct {
} HTMLOptionElementFactory; } HTMLOptionElementFactory;
typedef struct { typedef struct {
DispatchEx dispex;
const IHTMLImageElementFactoryVtbl *lpHTMLImageElementFactoryVtbl; const IHTMLImageElementFactoryVtbl *lpHTMLImageElementFactoryVtbl;
LONG ref; LONG ref;

View File

@ -342,6 +342,14 @@ static const IID * const cstyle_iids[] = {
NULL NULL
}; };
static const IID * const img_factory_iids[] = {
&IID_IUnknown,
&IID_IDispatch,
&IID_IDispatchEx,
&IID_IHTMLImageElementFactory,
NULL
};
typedef struct { typedef struct {
const char *tag; const char *tag;
REFIID *iids; REFIID *iids;
@ -1118,6 +1126,9 @@ static IHTMLImgElement *_create_img_elem(unsigned line, IHTMLDocument2 *doc,
IHTMLWindow2_Release(window); IHTMLWindow2_Release(window);
ok_(__FILE__,line) (hres == S_OK, "get_Image failed: %08x\n", hres); ok_(__FILE__,line) (hres == S_OK, "get_Image failed: %08x\n", hres);
test_ifaces((IUnknown*)factory, img_factory_iids);
test_disp((IUnknown*)factory, &IID_IHTMLImageElementFactory, "[object]");
if(wdth >= 0){ if(wdth >= 0){
snprintf(buf, 16, "%d", wdth); snprintf(buf, 16, "%d", wdth);
V_VT(&width) = VT_BSTR; V_VT(&width) = VT_BSTR;