Michael Stefaniuc : mshtml: COM cleanup for the IHTMLTextContainer iface.

Alexandre Julliard julliard at winehq.org
Mon Jan 3 10:58:03 CST 2011


Module: wine
Branch: master
Commit: 7cd11df83154c4b4fa3e53dbb7879cd780243981
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=7cd11df83154c4b4fa3e53dbb7879cd780243981

Author: Michael Stefaniuc <mstefani at redhat.de>
Date:   Mon Jan  3 01:08:23 2011 +0100

mshtml: COM cleanup for the IHTMLTextContainer iface.

---

 dlls/mshtml/htmlbody.c       |    2 +-
 dlls/mshtml/htmltextcont.c   |   41 +++++++++++++++++++++--------------------
 dlls/mshtml/mshtml_private.h |    4 +---
 3 files changed, 23 insertions(+), 24 deletions(-)

diff --git a/dlls/mshtml/htmlbody.c b/dlls/mshtml/htmlbody.c
index 3dbfd99..8789200 100644
--- a/dlls/mshtml/htmlbody.c
+++ b/dlls/mshtml/htmlbody.c
@@ -763,7 +763,7 @@ static HRESULT HTMLBodyElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
         *ppv = &This->IHTMLBodyElement_iface;
     }else if(IsEqualGUID(&IID_IHTMLTextContainer, riid)) {
         TRACE("(%p)->(IID_IHTMLTextContainer %p)\n", &This->textcont, ppv);
-        *ppv = HTMLTEXTCONT(&This->textcont);
+        *ppv = &This->textcont.IHTMLTextContainer_iface;
     }
 
     if(*ppv) {
diff --git a/dlls/mshtml/htmltextcont.c b/dlls/mshtml/htmltextcont.c
index d74f3cc..ad3c714 100644
--- a/dlls/mshtml/htmltextcont.c
+++ b/dlls/mshtml/htmltextcont.c
@@ -34,37 +34,40 @@
 
 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
 
-#define HTMLTEXTCONT_THIS(iface) DEFINE_THIS(HTMLTextContainer, HTMLTextContainer, iface)
+static inline HTMLTextContainer *impl_from_IHTMLTextContainer(IHTMLTextContainer *iface)
+{
+    return CONTAINING_RECORD(iface, HTMLTextContainer, IHTMLTextContainer_iface);
+}
 
 static HRESULT WINAPI HTMLTextContainer_QueryInterface(IHTMLTextContainer *iface,
                                                        REFIID riid, void **ppv)
 {
-    HTMLTextContainer *This = HTMLTEXTCONT_THIS(iface);
+    HTMLTextContainer *This = impl_from_IHTMLTextContainer(iface);
     return IHTMLElement_QueryInterface(&This->element.IHTMLElement_iface, riid, ppv);
 }
 
 static ULONG WINAPI HTMLTextContainer_AddRef(IHTMLTextContainer *iface)
 {
-    HTMLTextContainer *This = HTMLTEXTCONT_THIS(iface);
+    HTMLTextContainer *This = impl_from_IHTMLTextContainer(iface);
     return IHTMLElement_AddRef(&This->element.IHTMLElement_iface);
 }
 
 static ULONG WINAPI HTMLTextContainer_Release(IHTMLTextContainer *iface)
 {
-    HTMLTextContainer *This = HTMLTEXTCONT_THIS(iface);
+    HTMLTextContainer *This = impl_from_IHTMLTextContainer(iface);
     return IHTMLElement_Release(&This->element.IHTMLElement_iface);
 }
 
 static HRESULT WINAPI HTMLTextContainer_GetTypeInfoCount(IHTMLTextContainer *iface, UINT *pctinfo)
 {
-    HTMLTextContainer *This = HTMLTEXTCONT_THIS(iface);
+    HTMLTextContainer *This = impl_from_IHTMLTextContainer(iface);
     return IDispatchEx_GetTypeInfoCount(&This->element.node.dispex.IDispatchEx_iface, pctinfo);
 }
 
 static HRESULT WINAPI HTMLTextContainer_GetTypeInfo(IHTMLTextContainer *iface, UINT iTInfo,
                                               LCID lcid, ITypeInfo **ppTInfo)
 {
-    HTMLTextContainer *This = HTMLTEXTCONT_THIS(iface);
+    HTMLTextContainer *This = impl_from_IHTMLTextContainer(iface);
     return IDispatchEx_GetTypeInfo(&This->element.node.dispex.IDispatchEx_iface, iTInfo, lcid,
             ppTInfo);
 }
@@ -73,7 +76,7 @@ static HRESULT WINAPI HTMLTextContainer_GetIDsOfNames(IHTMLTextContainer *iface,
                                                 LPOLESTR *rgszNames, UINT cNames,
                                                 LCID lcid, DISPID *rgDispId)
 {
-    HTMLTextContainer *This = HTMLTEXTCONT_THIS(iface);
+    HTMLTextContainer *This = impl_from_IHTMLTextContainer(iface);
     return IDispatchEx_GetIDsOfNames(&This->element.node.dispex.IDispatchEx_iface, riid, rgszNames,
             cNames, lcid, rgDispId);
 }
@@ -82,7 +85,7 @@ static HRESULT WINAPI HTMLTextContainer_Invoke(IHTMLTextContainer *iface, DISPID
                             REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
                             VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
 {
-    HTMLTextContainer *This = HTMLTEXTCONT_THIS(iface);
+    HTMLTextContainer *This = impl_from_IHTMLTextContainer(iface);
     return IDispatchEx_Invoke(&This->element.node.dispex.IDispatchEx_iface, dispIdMember, riid,
             lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
 }
@@ -90,14 +93,14 @@ static HRESULT WINAPI HTMLTextContainer_Invoke(IHTMLTextContainer *iface, DISPID
 static HRESULT WINAPI HTMLTextContainer_createControlRange(IHTMLTextContainer *iface,
                                                            IDispatch **range)
 {
-    HTMLTextContainer *This = HTMLTEXTCONT_THIS(iface);
+    HTMLTextContainer *This = impl_from_IHTMLTextContainer(iface);
     FIXME("(%p)->(%p)\n", This, range);
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI HTMLTextContainer_get_scrollHeight(IHTMLTextContainer *iface, LONG *p)
 {
-    HTMLTextContainer *This = HTMLTEXTCONT_THIS(iface);
+    HTMLTextContainer *This = impl_from_IHTMLTextContainer(iface);
 
     TRACE("(%p)->(%p)\n", This, p);
 
@@ -106,7 +109,7 @@ static HRESULT WINAPI HTMLTextContainer_get_scrollHeight(IHTMLTextContainer *ifa
 
 static HRESULT WINAPI HTMLTextContainer_get_scrollWidth(IHTMLTextContainer *iface, LONG *p)
 {
-    HTMLTextContainer *This = HTMLTEXTCONT_THIS(iface);
+    HTMLTextContainer *This = impl_from_IHTMLTextContainer(iface);
 
     TRACE("(%p)->(%p)\n", This, p);
 
@@ -115,7 +118,7 @@ static HRESULT WINAPI HTMLTextContainer_get_scrollWidth(IHTMLTextContainer *ifac
 
 static HRESULT WINAPI HTMLTextContainer_put_scrollTop(IHTMLTextContainer *iface, LONG v)
 {
-    HTMLTextContainer *This = HTMLTEXTCONT_THIS(iface);
+    HTMLTextContainer *This = impl_from_IHTMLTextContainer(iface);
 
     TRACE("(%p)->(%d)\n", This, v);
 
@@ -124,7 +127,7 @@ static HRESULT WINAPI HTMLTextContainer_put_scrollTop(IHTMLTextContainer *iface,
 
 static HRESULT WINAPI HTMLTextContainer_get_scrollTop(IHTMLTextContainer *iface, LONG *p)
 {
-    HTMLTextContainer *This = HTMLTEXTCONT_THIS(iface);
+    HTMLTextContainer *This = impl_from_IHTMLTextContainer(iface);
 
     TRACE("(%p)->(%p)\n", This, p);
 
@@ -133,7 +136,7 @@ static HRESULT WINAPI HTMLTextContainer_get_scrollTop(IHTMLTextContainer *iface,
 
 static HRESULT WINAPI HTMLTextContainer_put_scrollLeft(IHTMLTextContainer *iface, LONG v)
 {
-    HTMLTextContainer *This = HTMLTEXTCONT_THIS(iface);
+    HTMLTextContainer *This = impl_from_IHTMLTextContainer(iface);
 
     TRACE("(%p)->(%d)\n", This, v);
 
@@ -142,7 +145,7 @@ static HRESULT WINAPI HTMLTextContainer_put_scrollLeft(IHTMLTextContainer *iface
 
 static HRESULT WINAPI HTMLTextContainer_get_scrollLeft(IHTMLTextContainer *iface, LONG *p)
 {
-    HTMLTextContainer *This = HTMLTEXTCONT_THIS(iface);
+    HTMLTextContainer *This = impl_from_IHTMLTextContainer(iface);
 
     TRACE("(%p)->(%p)\n", This, p);
 
@@ -151,20 +154,18 @@ static HRESULT WINAPI HTMLTextContainer_get_scrollLeft(IHTMLTextContainer *iface
 
 static HRESULT WINAPI HTMLTextContainer_put_onscroll(IHTMLTextContainer *iface, VARIANT v)
 {
-    HTMLTextContainer *This = HTMLTEXTCONT_THIS(iface);
+    HTMLTextContainer *This = impl_from_IHTMLTextContainer(iface);
     FIXME("(%p)->()\n", This);
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI HTMLTextContainer_get_onscroll(IHTMLTextContainer *iface, VARIANT *p)
 {
-    HTMLTextContainer *This = HTMLTEXTCONT_THIS(iface);
+    HTMLTextContainer *This = impl_from_IHTMLTextContainer(iface);
     FIXME("(%p)->(%p)\n", This, p);
     return E_NOTIMPL;
 }
 
-#undef HTMLTEXTCONT_THIS
-
 static const IHTMLTextContainerVtbl HTMLTextContainerVtbl = {
     HTMLTextContainer_QueryInterface,
     HTMLTextContainer_AddRef,
@@ -187,7 +188,7 @@ static const IHTMLTextContainerVtbl HTMLTextContainerVtbl = {
 void HTMLTextContainer_Init(HTMLTextContainer *This, HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem,
         dispex_static_data_t *dispex_data)
 {
-    This->lpHTMLTextContainerVtbl = &HTMLTextContainerVtbl;
+    This->IHTMLTextContainer_iface.lpVtbl = &HTMLTextContainerVtbl;
 
     HTMLElement_Init(&This->element, doc, nselem, dispex_data);
 
diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h
index df3b023..b7e377a 100644
--- a/dlls/mshtml/mshtml_private.h
+++ b/dlls/mshtml/mshtml_private.h
@@ -567,7 +567,7 @@ typedef struct {
 typedef struct {
     HTMLElement element;
 
-    const IHTMLTextContainerVtbl *lpHTMLTextContainerVtbl;
+    IHTMLTextContainer IHTMLTextContainer_iface;
 
     ConnectionPoint cp;
 } HTMLTextContainer;
@@ -632,8 +632,6 @@ struct HTMLDocumentNode {
 #define STATUSCLB(x)     ((IBindStatusCallback*)          &(x)->lpBindStatusCallbackVtbl)
 #define BINDINFO(x)      ((IInternetBindInfo*)            &(x)->lpInternetBindInfoVtbl);
 
-#define HTMLTEXTCONT(x)  ((IHTMLTextContainer*)           &(x)->lpHTMLTextContainerVtbl)
-
 #define HTMLLOCATION(x)    ((IHTMLLocation*)              &(x)->lpHTMLLocationVtbl)
 
 #define DEFINE_THIS(cls,ifc,iface) ((cls*)((BYTE*)(iface)-offsetof(cls,lp ## ifc ## Vtbl)))




More information about the wine-cvs mailing list