Michael Stefaniuc : mshtml: COM cleanup for the IOleControl iface.
Alexandre Julliard
julliard at winehq.org
Mon Dec 27 10:03:55 CST 2010
Module: wine
Branch: master
Commit: 6c7a78eca038d841fe19acdd2bd9a1cea244c1ef
URL: http://source.winehq.org/git/wine.git/?a=commit;h=6c7a78eca038d841fe19acdd2bd9a1cea244c1ef
Author: Michael Stefaniuc <mstefani at redhat.de>
Date: Mon Dec 27 01:46:09 2010 +0100
mshtml: COM cleanup for the IOleControl iface.
---
dlls/mshtml/htmldoc.c | 2 +-
dlls/mshtml/mshtml_private.h | 3 +--
dlls/mshtml/oleobj.c | 32 +++++++++++++++++---------------
3 files changed, 19 insertions(+), 18 deletions(-)
diff --git a/dlls/mshtml/htmldoc.c b/dlls/mshtml/htmldoc.c
index f1cdd4f..ff07d0d 100644
--- a/dlls/mshtml/htmldoc.c
+++ b/dlls/mshtml/htmldoc.c
@@ -1779,7 +1779,7 @@ static BOOL htmldoc_qi(HTMLDocument *This, REFIID riid, void **ppv)
*ppv = &This->IOleCommandTarget_iface;
}else if(IsEqualGUID(&IID_IOleControl, riid)) {
TRACE("(%p)->(IID_IOleControl, %p)\n", This, ppv);
- *ppv = CONTROL(This);
+ *ppv = &This->IOleControl_iface;
}else if(IsEqualGUID(&IID_IHlinkTarget, riid)) {
TRACE("(%p)->(IID_IHlinkTarget, %p)\n", This, ppv);
*ppv = HLNKTARGET(This);
diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h
index 7c99f36..b44dce4 100644
--- a/dlls/mshtml/mshtml_private.h
+++ b/dlls/mshtml/mshtml_private.h
@@ -359,7 +359,7 @@ struct HTMLDocument {
IOleInPlaceObjectWindowless IOleInPlaceObjectWindowless_iface;
IServiceProvider IServiceProvider_iface;
IOleCommandTarget IOleCommandTarget_iface;
- const IOleControlVtbl *lpOleControlVtbl;
+ IOleControl IOleControl_iface;
const IHlinkTargetVtbl *lpHlinkTargetVtbl;
IPersistStreamInit IPersistStreamInit_iface;
const IDispatchExVtbl *lpIDispatchExVtbl;
@@ -625,7 +625,6 @@ struct HTMLDocumentNode {
#define HTMLWINDOW2(x) ((IHTMLWindow2*) &(x)->lpHTMLWindow2Vtbl)
#define HTMLWINDOW3(x) ((IHTMLWindow3*) &(x)->lpHTMLWindow3Vtbl)
#define HTMLWINDOW4(x) ((IHTMLWindow4*) &(x)->lpHTMLWindow4Vtbl)
-#define CONTROL(x) ((IOleControl*) &(x)->lpOleControlVtbl)
#define HLNKTARGET(x) ((IHlinkTarget*) &(x)->lpHlinkTargetVtbl)
#define CONPTCONT(x) ((IConnectionPointContainer*) &(x)->lpConnectionPointContainerVtbl)
#define CUSTOMDOC(x) ((ICustomDoc*) &(x)->lpCustomDocVtbl)
diff --git a/dlls/mshtml/oleobj.c b/dlls/mshtml/oleobj.c
index 166af0c..2aa30f1 100644
--- a/dlls/mshtml/oleobj.c
+++ b/dlls/mshtml/oleobj.c
@@ -216,9 +216,10 @@ static HRESULT WINAPI OleObject_SetClientSite(IOleObject *iface, IOleClientSite
}
if(This->doc_obj->usermode == UNKNOWN_USERMODE)
- IOleControl_OnAmbientPropertyChange(CONTROL(This), DISPID_AMBIENT_USERMODE);
+ IOleControl_OnAmbientPropertyChange(&This->IOleControl_iface, DISPID_AMBIENT_USERMODE);
- IOleControl_OnAmbientPropertyChange(CONTROL(This), DISPID_AMBIENT_OFFLINEIFNOTCONNECTED);
+ IOleControl_OnAmbientPropertyChange(&This->IOleControl_iface,
+ DISPID_AMBIENT_OFFLINEIFNOTCONNECTED);
hres = get_client_disp_property(This->doc_obj->client, DISPID_AMBIENT_SILENT, &silent);
if(SUCCEEDED(hres)) {
@@ -228,8 +229,8 @@ static HRESULT WINAPI OleObject_SetClientSite(IOleObject *iface, IOleClientSite
FIXME("silent == true\n");
}
- IOleControl_OnAmbientPropertyChange(CONTROL(This), DISPID_AMBIENT_USERAGENT);
- IOleControl_OnAmbientPropertyChange(CONTROL(This), DISPID_AMBIENT_PALETTE);
+ IOleControl_OnAmbientPropertyChange(&This->IOleControl_iface, DISPID_AMBIENT_USERAGENT);
+ IOleControl_OnAmbientPropertyChange(&This->IOleControl_iface, DISPID_AMBIENT_PALETTE);
return S_OK;
}
@@ -573,36 +574,39 @@ static const IOleDocumentVtbl OleDocumentVtbl = {
* IOleControl implementation
*/
-#define CONTROL_THIS(iface) DEFINE_THIS(HTMLDocument, OleControl, iface)
+static inline HTMLDocument *impl_from_IOleControl(IOleControl *iface)
+{
+ return CONTAINING_RECORD(iface, HTMLDocument, IOleControl_iface);
+}
static HRESULT WINAPI OleControl_QueryInterface(IOleControl *iface, REFIID riid, void **ppv)
{
- HTMLDocument *This = CONTROL_THIS(iface);
+ HTMLDocument *This = impl_from_IOleControl(iface);
return htmldoc_query_interface(This, riid, ppv);
}
static ULONG WINAPI OleControl_AddRef(IOleControl *iface)
{
- HTMLDocument *This = CONTROL_THIS(iface);
+ HTMLDocument *This = impl_from_IOleControl(iface);
return htmldoc_addref(This);
}
static ULONG WINAPI OleControl_Release(IOleControl *iface)
{
- HTMLDocument *This = CONTROL_THIS(iface);
+ HTMLDocument *This = impl_from_IOleControl(iface);
return htmldoc_release(This);
}
static HRESULT WINAPI OleControl_GetControlInfo(IOleControl *iface, CONTROLINFO *pCI)
{
- HTMLDocument *This = CONTROL_THIS(iface);
+ HTMLDocument *This = impl_from_IOleControl(iface);
FIXME("(%p)->(%p)\n", This, pCI);
return E_NOTIMPL;
}
static HRESULT WINAPI OleControl_OnMnemonic(IOleControl *iface, MSG *pMsg)
{
- HTMLDocument *This = CONTROL_THIS(iface);
+ HTMLDocument *This = impl_from_IOleControl(iface);
FIXME("(%p)->(%p)\n", This, pMsg);
return E_NOTIMPL;
}
@@ -644,7 +648,7 @@ static HRESULT on_change_dlcontrol(HTMLDocument *This)
static HRESULT WINAPI OleControl_OnAmbientPropertyChange(IOleControl *iface, DISPID dispID)
{
- HTMLDocument *This = CONTROL_THIS(iface);
+ HTMLDocument *This = impl_from_IOleControl(iface);
IOleClientSite *client;
VARIANT res;
HRESULT hres;
@@ -734,13 +738,11 @@ static HRESULT WINAPI OleControl_OnAmbientPropertyChange(IOleControl *iface, DIS
static HRESULT WINAPI OleControl_FreezeEvents(IOleControl *iface, BOOL bFreeze)
{
- HTMLDocument *This = CONTROL_THIS(iface);
+ HTMLDocument *This = impl_from_IOleControl(iface);
FIXME("(%p)->(%x)\n", This, bFreeze);
return E_NOTIMPL;
}
-#undef CONTROL_THIS
-
static const IOleControlVtbl OleControlVtbl = {
OleControl_QueryInterface,
OleControl_AddRef,
@@ -873,7 +875,7 @@ void HTMLDocument_OleObj_Init(HTMLDocument *This)
{
This->IOleObject_iface.lpVtbl = &OleObjectVtbl;
This->IOleDocument_iface.lpVtbl = &OleDocumentVtbl;
- This->lpOleControlVtbl = &OleControlVtbl;
+ This->IOleControl_iface.lpVtbl = &OleControlVtbl;
This->lpObjectWithSiteVtbl = &ObjectWithSiteVtbl;
This->IOleContainer_iface.lpVtbl = &OleContainerVtbl;
}
More information about the wine-cvs
mailing list