Module: wine Branch: master Commit: 90029d342934a8d8fb0a6e868f93770d2ea14cdc URL: http://source.winehq.org/git/wine.git/?a=commit;h=90029d342934a8d8fb0a6e868f...
Author: Andrew Eikum aeikum@codeweavers.com Date: Tue Oct 20 16:05:03 2009 -0500
mshtml: Add DispatchEx support to HTMLImageElementFactory.
---
dlls/mshtml/dispex.c | 1 + dlls/mshtml/htmlimg.c | 20 ++++++++++++++++---- dlls/mshtml/mshtml_private.h | 2 ++ dlls/mshtml/tests/dom.c | 11 +++++++++++ 4 files changed, 30 insertions(+), 4 deletions(-)
diff --git a/dlls/mshtml/dispex.c b/dlls/mshtml/dispex.c index f277e23..34865c2 100644 --- a/dlls/mshtml/dispex.c +++ b/dlls/mshtml/dispex.c @@ -128,6 +128,7 @@ static REFIID tid_ids[] = { &IID_IHTMLFrameBase, &IID_IHTMLFrameBase2, &IID_IHTMLGenericElement, + &IID_IHTMLImageElementFactory, &IID_IHTMLImgElement, &IID_IHTMLInputElement, &IID_IHTMLLocation, diff --git a/dlls/mshtml/htmlimg.c b/dlls/mshtml/htmlimg.c index c7b03ea..cc999c0 100644 --- a/dlls/mshtml/htmlimg.c +++ b/dlls/mshtml/htmlimg.c @@ -624,13 +624,11 @@ static HRESULT WINAPI HTMLImageElementFactory_QueryInterface(IHTMLImageElementFa if(IsEqualGUID(&IID_IUnknown, riid)) { TRACE("(%p)->(IID_Unknown %p)\n", This, ppv); *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)) { TRACE("(%p)->(IID_IHTMLImageElementFactory %p)\n", This, ppv); *ppv = HTMLIMGFACTORY(This); - } + }else if(dispex_query_interface(&This->dispex, riid, ppv)) + return *ppv ? S_OK : E_NOINTERFACE;
if(*ppv) { IUnknown_AddRef((IUnknown*)*ppv); @@ -758,6 +756,18 @@ static const IHTMLImageElementFactoryVtbl HTMLImageElementFactoryVtbl = { 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 *ret; @@ -768,5 +778,7 @@ HTMLImageElementFactory *HTMLImageElementFactory_Create(HTMLWindow *window) ret->ref = 1; ret->window = window;
+ init_dispex(&ret->dispex, (IUnknown*)HTMLIMGFACTORY(ret), &HTMLImageElementFactory_dispex); + return ret; } diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index 5111eb7..299f968 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -104,6 +104,7 @@ typedef enum { IHTMLFrameBase_tid, IHTMLFrameBase2_tid, IHTMLGenericElement_tid, + IHTMLImageElementFactory_tid, IHTMLImgElement_tid, IHTMLInputElement_tid, IHTMLLocation_tid, @@ -182,6 +183,7 @@ typedef struct { } HTMLOptionElementFactory;
typedef struct { + DispatchEx dispex; const IHTMLImageElementFactoryVtbl *lpHTMLImageElementFactoryVtbl;
LONG ref; diff --git a/dlls/mshtml/tests/dom.c b/dlls/mshtml/tests/dom.c index 3bce128..ba85130 100644 --- a/dlls/mshtml/tests/dom.c +++ b/dlls/mshtml/tests/dom.c @@ -342,6 +342,14 @@ static const IID * const cstyle_iids[] = { NULL };
+static const IID * const img_factory_iids[] = { + &IID_IUnknown, + &IID_IDispatch, + &IID_IDispatchEx, + &IID_IHTMLImageElementFactory, + NULL +}; + typedef struct { const char *tag; REFIID *iids; @@ -1118,6 +1126,9 @@ static IHTMLImgElement *_create_img_elem(unsigned line, IHTMLDocument2 *doc, IHTMLWindow2_Release(window); 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){ snprintf(buf, 16, "%d", wdth); V_VT(&width) = VT_BSTR;