Module: wine Branch: master Commit: f2c4a122615c9404f72ced0c6eab730168de30cd URL: http://source.winehq.org/git/wine.git/?a=commit;h=f2c4a122615c9404f72ced0c6e...
Author: Michael Stefaniuc mstefani@redhat.de Date: Mon Jan 3 01:10:03 2011 +0100
mshtml: COM cleanup for the ICustomDoc iface.
---
dlls/mshtml/htmldoc.c | 25 +++++++++++++------------ dlls/mshtml/mshtml_private.h | 4 +--- 2 files changed, 14 insertions(+), 15 deletions(-)
diff --git a/dlls/mshtml/htmldoc.c b/dlls/mshtml/htmldoc.c index 259f0e9..12e0947 100644 --- a/dlls/mshtml/htmldoc.c +++ b/dlls/mshtml/htmldoc.c @@ -2054,18 +2054,21 @@ HRESULT create_document_fragment(nsIDOMNode *nsnode, HTMLDocumentNode *doc_node, * ICustomDoc implementation */
-#define CUSTOMDOC_THIS(iface) DEFINE_THIS(HTMLDocumentObj, CustomDoc, iface) +static inline HTMLDocumentObj *impl_from_ICustomDoc(ICustomDoc *iface) +{ + return CONTAINING_RECORD(iface, HTMLDocumentObj, ICustomDoc_iface); +}
static HRESULT WINAPI CustomDoc_QueryInterface(ICustomDoc *iface, REFIID riid, void **ppv) { - HTMLDocumentObj *This = CUSTOMDOC_THIS(iface); + HTMLDocumentObj *This = impl_from_ICustomDoc(iface);
if(htmldoc_qi(&This->basedoc, riid, ppv)) return *ppv ? S_OK : E_NOINTERFACE;
if(IsEqualGUID(&IID_ICustomDoc, riid)) { TRACE("(%p)->(IID_ICustomDoc %p)\n", This, ppv); - *ppv = CUSTOMDOC(This); + *ppv = &This->ICustomDoc_iface; }else if(dispex_query_interface(&This->dispex, riid, ppv)) { return *ppv ? S_OK : E_NOINTERFACE; }else { @@ -2080,7 +2083,7 @@ static HRESULT WINAPI CustomDoc_QueryInterface(ICustomDoc *iface, REFIID riid, v
static ULONG WINAPI CustomDoc_AddRef(ICustomDoc *iface) { - HTMLDocumentObj *This = CUSTOMDOC_THIS(iface); + HTMLDocumentObj *This = impl_from_ICustomDoc(iface); ULONG ref = InterlockedIncrement(&This->ref);
TRACE("(%p) ref = %u\n", This, ref); @@ -2090,7 +2093,7 @@ static ULONG WINAPI CustomDoc_AddRef(ICustomDoc *iface)
static ULONG WINAPI CustomDoc_Release(ICustomDoc *iface) { - HTMLDocumentObj *This = CUSTOMDOC_THIS(iface); + HTMLDocumentObj *This = impl_from_ICustomDoc(iface); ULONG ref = InterlockedDecrement(&This->ref);
TRACE("(%p) ref = %u\n", This, ref); @@ -2112,7 +2115,7 @@ static ULONG WINAPI CustomDoc_Release(ICustomDoc *iface) if(This->client) IOleObject_SetClientSite(&This->basedoc.IOleObject_iface, NULL); if(This->hostui) - ICustomDoc_SetUIHandler(CUSTOMDOC(This), NULL); + ICustomDoc_SetUIHandler(&This->ICustomDoc_iface, NULL); if(This->in_place_active) IOleInPlaceObjectWindowless_InPlaceDeactivate(&This->basedoc.IOleInPlaceObjectWindowless_iface); if(This->ipsite) @@ -2139,7 +2142,7 @@ static ULONG WINAPI CustomDoc_Release(ICustomDoc *iface)
static HRESULT WINAPI CustomDoc_SetUIHandler(ICustomDoc *iface, IDocHostUIHandler *pUIHandler) { - HTMLDocumentObj *This = CUSTOMDOC_THIS(iface); + HTMLDocumentObj *This = impl_from_ICustomDoc(iface); IOleCommandTarget *cmdtrg; HRESULT hres;
@@ -2167,8 +2170,6 @@ static HRESULT WINAPI CustomDoc_SetUIHandler(ICustomDoc *iface, IDocHostUIHandle return S_OK; }
-#undef CUSTOMDOC_THIS - static const ICustomDocVtbl CustomDocVtbl = { CustomDoc_QueryInterface, CustomDoc_AddRef, @@ -2203,10 +2204,10 @@ HRESULT HTMLDocument_Create(IUnknown *pUnkOuter, REFIID riid, void** ppvObject) if(!doc) return E_OUTOFMEMORY;
- init_dispex(&doc->dispex, (IUnknown*)CUSTOMDOC(doc), &HTMLDocumentObj_dispex); - init_doc(&doc->basedoc, (IUnknown*)CUSTOMDOC(doc), &doc->dispex.IDispatchEx_iface); + init_dispex(&doc->dispex, (IUnknown*)&doc->ICustomDoc_iface, &HTMLDocumentObj_dispex); + init_doc(&doc->basedoc, (IUnknown*)&doc->ICustomDoc_iface, &doc->dispex.IDispatchEx_iface);
- doc->lpCustomDocVtbl = &CustomDocVtbl; + doc->ICustomDoc_iface.lpVtbl = &CustomDocVtbl; doc->ref = 1; doc->basedoc.doc_obj = doc;
diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index b7e377a..ad3d2ae 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -406,7 +406,7 @@ static inline ULONG htmldoc_release(HTMLDocument *This) struct HTMLDocumentObj { HTMLDocument basedoc; DispatchEx dispex; - const ICustomDocVtbl *lpCustomDocVtbl; + ICustomDoc ICustomDoc_iface;
LONG ref;
@@ -624,8 +624,6 @@ struct HTMLDocumentNode { struct list plugin_hosts; };
-#define CUSTOMDOC(x) ((ICustomDoc*) &(x)->lpCustomDocVtbl) - #define NSEVENTLIST(x) ((nsIDOMEventListener*) &(x)->lpDOMEventListenerVtbl)
#define HTTPNEG(x) ((IHttpNegotiate2*) &(x)->lpHttpNegotiate2Vtbl)