mshtml: COM cleanup for the ICustomDoc iface.
This commit is contained in:
parent
7cd11df831
commit
f2c4a12261
|
@ -2054,18 +2054,21 @@ HRESULT create_document_fragment(nsIDOMNode *nsnode, HTMLDocumentNode *doc_node,
|
||||||
* ICustomDoc implementation
|
* 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)
|
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))
|
if(htmldoc_qi(&This->basedoc, riid, ppv))
|
||||||
return *ppv ? S_OK : E_NOINTERFACE;
|
return *ppv ? S_OK : E_NOINTERFACE;
|
||||||
|
|
||||||
if(IsEqualGUID(&IID_ICustomDoc, riid)) {
|
if(IsEqualGUID(&IID_ICustomDoc, riid)) {
|
||||||
TRACE("(%p)->(IID_ICustomDoc %p)\n", This, ppv);
|
TRACE("(%p)->(IID_ICustomDoc %p)\n", This, ppv);
|
||||||
*ppv = CUSTOMDOC(This);
|
*ppv = &This->ICustomDoc_iface;
|
||||||
}else if(dispex_query_interface(&This->dispex, riid, ppv)) {
|
}else if(dispex_query_interface(&This->dispex, riid, ppv)) {
|
||||||
return *ppv ? S_OK : E_NOINTERFACE;
|
return *ppv ? S_OK : E_NOINTERFACE;
|
||||||
}else {
|
}else {
|
||||||
|
@ -2080,7 +2083,7 @@ static HRESULT WINAPI CustomDoc_QueryInterface(ICustomDoc *iface, REFIID riid, v
|
||||||
|
|
||||||
static ULONG WINAPI CustomDoc_AddRef(ICustomDoc *iface)
|
static ULONG WINAPI CustomDoc_AddRef(ICustomDoc *iface)
|
||||||
{
|
{
|
||||||
HTMLDocumentObj *This = CUSTOMDOC_THIS(iface);
|
HTMLDocumentObj *This = impl_from_ICustomDoc(iface);
|
||||||
ULONG ref = InterlockedIncrement(&This->ref);
|
ULONG ref = InterlockedIncrement(&This->ref);
|
||||||
|
|
||||||
TRACE("(%p) ref = %u\n", 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)
|
static ULONG WINAPI CustomDoc_Release(ICustomDoc *iface)
|
||||||
{
|
{
|
||||||
HTMLDocumentObj *This = CUSTOMDOC_THIS(iface);
|
HTMLDocumentObj *This = impl_from_ICustomDoc(iface);
|
||||||
ULONG ref = InterlockedDecrement(&This->ref);
|
ULONG ref = InterlockedDecrement(&This->ref);
|
||||||
|
|
||||||
TRACE("(%p) ref = %u\n", This, ref);
|
TRACE("(%p) ref = %u\n", This, ref);
|
||||||
|
@ -2112,7 +2115,7 @@ static ULONG WINAPI CustomDoc_Release(ICustomDoc *iface)
|
||||||
if(This->client)
|
if(This->client)
|
||||||
IOleObject_SetClientSite(&This->basedoc.IOleObject_iface, NULL);
|
IOleObject_SetClientSite(&This->basedoc.IOleObject_iface, NULL);
|
||||||
if(This->hostui)
|
if(This->hostui)
|
||||||
ICustomDoc_SetUIHandler(CUSTOMDOC(This), NULL);
|
ICustomDoc_SetUIHandler(&This->ICustomDoc_iface, NULL);
|
||||||
if(This->in_place_active)
|
if(This->in_place_active)
|
||||||
IOleInPlaceObjectWindowless_InPlaceDeactivate(&This->basedoc.IOleInPlaceObjectWindowless_iface);
|
IOleInPlaceObjectWindowless_InPlaceDeactivate(&This->basedoc.IOleInPlaceObjectWindowless_iface);
|
||||||
if(This->ipsite)
|
if(This->ipsite)
|
||||||
|
@ -2139,7 +2142,7 @@ static ULONG WINAPI CustomDoc_Release(ICustomDoc *iface)
|
||||||
|
|
||||||
static HRESULT WINAPI CustomDoc_SetUIHandler(ICustomDoc *iface, IDocHostUIHandler *pUIHandler)
|
static HRESULT WINAPI CustomDoc_SetUIHandler(ICustomDoc *iface, IDocHostUIHandler *pUIHandler)
|
||||||
{
|
{
|
||||||
HTMLDocumentObj *This = CUSTOMDOC_THIS(iface);
|
HTMLDocumentObj *This = impl_from_ICustomDoc(iface);
|
||||||
IOleCommandTarget *cmdtrg;
|
IOleCommandTarget *cmdtrg;
|
||||||
HRESULT hres;
|
HRESULT hres;
|
||||||
|
|
||||||
|
@ -2167,8 +2170,6 @@ static HRESULT WINAPI CustomDoc_SetUIHandler(ICustomDoc *iface, IDocHostUIHandle
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
#undef CUSTOMDOC_THIS
|
|
||||||
|
|
||||||
static const ICustomDocVtbl CustomDocVtbl = {
|
static const ICustomDocVtbl CustomDocVtbl = {
|
||||||
CustomDoc_QueryInterface,
|
CustomDoc_QueryInterface,
|
||||||
CustomDoc_AddRef,
|
CustomDoc_AddRef,
|
||||||
|
@ -2203,10 +2204,10 @@ HRESULT HTMLDocument_Create(IUnknown *pUnkOuter, REFIID riid, void** ppvObject)
|
||||||
if(!doc)
|
if(!doc)
|
||||||
return E_OUTOFMEMORY;
|
return E_OUTOFMEMORY;
|
||||||
|
|
||||||
init_dispex(&doc->dispex, (IUnknown*)CUSTOMDOC(doc), &HTMLDocumentObj_dispex);
|
init_dispex(&doc->dispex, (IUnknown*)&doc->ICustomDoc_iface, &HTMLDocumentObj_dispex);
|
||||||
init_doc(&doc->basedoc, (IUnknown*)CUSTOMDOC(doc), &doc->dispex.IDispatchEx_iface);
|
init_doc(&doc->basedoc, (IUnknown*)&doc->ICustomDoc_iface, &doc->dispex.IDispatchEx_iface);
|
||||||
|
|
||||||
doc->lpCustomDocVtbl = &CustomDocVtbl;
|
doc->ICustomDoc_iface.lpVtbl = &CustomDocVtbl;
|
||||||
doc->ref = 1;
|
doc->ref = 1;
|
||||||
doc->basedoc.doc_obj = doc;
|
doc->basedoc.doc_obj = doc;
|
||||||
|
|
||||||
|
|
|
@ -406,7 +406,7 @@ static inline ULONG htmldoc_release(HTMLDocument *This)
|
||||||
struct HTMLDocumentObj {
|
struct HTMLDocumentObj {
|
||||||
HTMLDocument basedoc;
|
HTMLDocument basedoc;
|
||||||
DispatchEx dispex;
|
DispatchEx dispex;
|
||||||
const ICustomDocVtbl *lpCustomDocVtbl;
|
ICustomDoc ICustomDoc_iface;
|
||||||
|
|
||||||
LONG ref;
|
LONG ref;
|
||||||
|
|
||||||
|
@ -624,8 +624,6 @@ struct HTMLDocumentNode {
|
||||||
struct list plugin_hosts;
|
struct list plugin_hosts;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define CUSTOMDOC(x) ((ICustomDoc*) &(x)->lpCustomDocVtbl)
|
|
||||||
|
|
||||||
#define NSEVENTLIST(x) ((nsIDOMEventListener*) &(x)->lpDOMEventListenerVtbl)
|
#define NSEVENTLIST(x) ((nsIDOMEventListener*) &(x)->lpDOMEventListenerVtbl)
|
||||||
|
|
||||||
#define HTTPNEG(x) ((IHttpNegotiate2*) &(x)->lpHttpNegotiate2Vtbl)
|
#define HTTPNEG(x) ((IHttpNegotiate2*) &(x)->lpHttpNegotiate2Vtbl)
|
||||||
|
|
Loading…
Reference in New Issue