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

Alexandre Julliard julliard at winehq.org
Tue Jan 4 09:47:28 CST 2011


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

Author: Michael Stefaniuc <mstefani at redhat.de>
Date:   Tue Jan  4 02:05:27 2011 +0100

mshtml: COM cleanup for the IHTMLStyle4 iface.

---

 dlls/mshtml/htmlstyle.c  |    2 +-
 dlls/mshtml/htmlstyle.h  |    4 +---
 dlls/mshtml/htmlstyle3.c |   29 ++++++++++++++++-------------
 3 files changed, 18 insertions(+), 17 deletions(-)

diff --git a/dlls/mshtml/htmlstyle.c b/dlls/mshtml/htmlstyle.c
index ac82efe..7ca763f 100644
--- a/dlls/mshtml/htmlstyle.c
+++ b/dlls/mshtml/htmlstyle.c
@@ -579,7 +579,7 @@ static HRESULT WINAPI HTMLStyle_QueryInterface(IHTMLStyle *iface, REFIID riid, v
         *ppv = &This->IHTMLStyle3_iface;
     }else if(IsEqualGUID(&IID_IHTMLStyle4, riid)) {
         TRACE("(%p)->(IID_IHTMLStyle4 %p)\n", This, ppv);
-        *ppv = HTMLSTYLE4(This);
+        *ppv = &This->IHTMLStyle4_iface;
     }else if(dispex_query_interface(&This->dispex, riid, ppv)) {
         return *ppv ? S_OK : E_NOINTERFACE;
     }
diff --git a/dlls/mshtml/htmlstyle.h b/dlls/mshtml/htmlstyle.h
index ba20d28..044718b 100644
--- a/dlls/mshtml/htmlstyle.h
+++ b/dlls/mshtml/htmlstyle.h
@@ -21,15 +21,13 @@ struct HTMLStyle {
     IHTMLStyle  IHTMLStyle_iface;
     IHTMLStyle2 IHTMLStyle2_iface;
     IHTMLStyle3 IHTMLStyle3_iface;
-    const IHTMLStyle4Vtbl   *lpHTMLStyle4Vtbl;
+    IHTMLStyle4 IHTMLStyle4_iface;
 
     LONG ref;
 
     nsIDOMCSSStyleDeclaration *nsstyle;
 };
 
-#define HTMLSTYLE4(x)    ((IHTMLStyle4*)                  &(x)->lpHTMLStyle4Vtbl)
-
 /* NOTE: Make sure to keep in sync with style_tbl in htmlstyle.c */
 typedef enum {
     STYLEID_BACKGROUND,
diff --git a/dlls/mshtml/htmlstyle3.c b/dlls/mshtml/htmlstyle3.c
index 3d8906e..a946cb0 100644
--- a/dlls/mshtml/htmlstyle3.c
+++ b/dlls/mshtml/htmlstyle3.c
@@ -355,39 +355,42 @@ static const IHTMLStyle3Vtbl HTMLStyle3Vtbl = {
 /*
  * IHTMLStyle4 Interface
  */
-#define HTMLSTYLE4_THIS(iface) DEFINE_THIS(HTMLStyle, HTMLStyle4, iface)
+static inline HTMLStyle *impl_from_IHTMLStyle4(IHTMLStyle4 *iface)
+{
+    return CONTAINING_RECORD(iface, HTMLStyle, IHTMLStyle4_iface);
+}
 
 static HRESULT WINAPI HTMLStyle4_QueryInterface(IHTMLStyle4 *iface, REFIID riid, void **ppv)
 {
-    HTMLStyle *This = HTMLSTYLE4_THIS(iface);
+    HTMLStyle *This = impl_from_IHTMLStyle4(iface);
 
     return IHTMLStyle_QueryInterface(&This->IHTMLStyle_iface, riid, ppv);
 }
 
 static ULONG WINAPI HTMLStyle4_AddRef(IHTMLStyle4 *iface)
 {
-    HTMLStyle *This = HTMLSTYLE4_THIS(iface);
+    HTMLStyle *This = impl_from_IHTMLStyle4(iface);
 
     return IHTMLStyle_AddRef(&This->IHTMLStyle_iface);
 }
 
 static ULONG WINAPI HTMLStyle4_Release(IHTMLStyle4 *iface)
 {
-    HTMLStyle *This = HTMLSTYLE4_THIS(iface);
+    HTMLStyle *This = impl_from_IHTMLStyle4(iface);
 
     return IHTMLStyle_Release(&This->IHTMLStyle_iface);
 }
 
 static HRESULT WINAPI HTMLStyle4_GetTypeInfoCount(IHTMLStyle4 *iface, UINT *pctinfo)
 {
-    HTMLStyle *This = HTMLSTYLE4_THIS(iface);
+    HTMLStyle *This = impl_from_IHTMLStyle4(iface);
     return IDispatchEx_GetTypeInfoCount(&This->dispex.IDispatchEx_iface, pctinfo);
 }
 
 static HRESULT WINAPI HTMLStyle4_GetTypeInfo(IHTMLStyle4 *iface, UINT iTInfo,
                                               LCID lcid, ITypeInfo **ppTInfo)
 {
-    HTMLStyle *This = HTMLSTYLE4_THIS(iface);
+    HTMLStyle *This = impl_from_IHTMLStyle4(iface);
     return IDispatchEx_GetTypeInfo(&This->dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
 }
 
@@ -395,7 +398,7 @@ static HRESULT WINAPI HTMLStyle4_GetIDsOfNames(IHTMLStyle4 *iface, REFIID riid,
                                                 LPOLESTR *rgszNames, UINT cNames,
                                                 LCID lcid, DISPID *rgDispId)
 {
-    HTMLStyle *This = HTMLSTYLE4_THIS(iface);
+    HTMLStyle *This = impl_from_IHTMLStyle4(iface);
     return IDispatchEx_GetIDsOfNames(&This->dispex.IDispatchEx_iface, riid, rgszNames, cNames,
             lcid, rgDispId);
 }
@@ -404,28 +407,28 @@ static HRESULT WINAPI HTMLStyle4_Invoke(IHTMLStyle4 *iface, DISPID dispIdMember,
                             REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
                             VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
 {
-    HTMLStyle *This = HTMLSTYLE4_THIS(iface);
+    HTMLStyle *This = impl_from_IHTMLStyle4(iface);
     return IDispatchEx_Invoke(&This->dispex.IDispatchEx_iface, dispIdMember, riid, lcid,
             wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
 }
 
 static HRESULT WINAPI HTMLStyle4_put_textOverflow(IHTMLStyle4 *iface, BSTR v)
 {
-    HTMLStyle *This = HTMLSTYLE4_THIS(iface);
+    HTMLStyle *This = impl_from_IHTMLStyle4(iface);
     FIXME("(%p)->(%s)\n", This, debugstr_w(v));
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI HTMLStyle4_get_textOverflow(IHTMLStyle4 *iface, BSTR *p)
 {
-    HTMLStyle *This = HTMLSTYLE4_THIS(iface);
+    HTMLStyle *This = impl_from_IHTMLStyle4(iface);
     FIXME("(%p)->(%p)\n", This, p);
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI HTMLStyle4_put_minHeight(IHTMLStyle4 *iface, VARIANT v)
 {
-    HTMLStyle *This = HTMLSTYLE4_THIS(iface);
+    HTMLStyle *This = impl_from_IHTMLStyle4(iface);
 
     TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
 
@@ -434,7 +437,7 @@ static HRESULT WINAPI HTMLStyle4_put_minHeight(IHTMLStyle4 *iface, VARIANT v)
 
 static HRESULT WINAPI HTMLStyle4_get_minHeight(IHTMLStyle4 *iface, VARIANT *p)
 {
-    HTMLStyle *This = HTMLSTYLE4_THIS(iface);
+    HTMLStyle *This = impl_from_IHTMLStyle4(iface);
 
     TRACE("(%p)->(%p)\n", This, p);
 
@@ -458,5 +461,5 @@ static const IHTMLStyle4Vtbl HTMLStyle4Vtbl = {
 void HTMLStyle3_Init(HTMLStyle *This)
 {
     This->IHTMLStyle3_iface.lpVtbl = &HTMLStyle3Vtbl;
-    This->lpHTMLStyle4Vtbl = &HTMLStyle4Vtbl;
+    This->IHTMLStyle4_iface.lpVtbl = &HTMLStyle4Vtbl;
 }




More information about the wine-cvs mailing list