[PATCH 4/5] mshtml: COM cleanup for the IHTMLStyle3 iface.

Michael Stefaniuc mstefani at redhat.de
Mon Jan 3 19:03:57 CST 2011


---
 dlls/mshtml/htmlstyle.c  |    2 +-
 dlls/mshtml/htmlstyle.h  |    3 +-
 dlls/mshtml/htmlstyle3.c |   81 ++++++++++++++++++++++++----------------------
 3 files changed, 44 insertions(+), 42 deletions(-)

diff --git a/dlls/mshtml/htmlstyle.c b/dlls/mshtml/htmlstyle.c
index 065f807..ac82efe 100644
--- a/dlls/mshtml/htmlstyle.c
+++ b/dlls/mshtml/htmlstyle.c
@@ -576,7 +576,7 @@ static HRESULT WINAPI HTMLStyle_QueryInterface(IHTMLStyle *iface, REFIID riid, v
         *ppv = &This->IHTMLStyle2_iface;
     }else if(IsEqualGUID(&IID_IHTMLStyle3, riid)) {
         TRACE("(%p)->(IID_IHTMLStyle3 %p)\n", This, ppv);
-        *ppv = HTMLSTYLE3(This);
+        *ppv = &This->IHTMLStyle3_iface;
     }else if(IsEqualGUID(&IID_IHTMLStyle4, riid)) {
         TRACE("(%p)->(IID_IHTMLStyle4 %p)\n", This, ppv);
         *ppv = HTMLSTYLE4(This);
diff --git a/dlls/mshtml/htmlstyle.h b/dlls/mshtml/htmlstyle.h
index dd87e71..ba20d28 100644
--- a/dlls/mshtml/htmlstyle.h
+++ b/dlls/mshtml/htmlstyle.h
@@ -20,7 +20,7 @@ struct HTMLStyle {
     DispatchEx dispex;
     IHTMLStyle  IHTMLStyle_iface;
     IHTMLStyle2 IHTMLStyle2_iface;
-    const IHTMLStyle3Vtbl   *lpHTMLStyle3Vtbl;
+    IHTMLStyle3 IHTMLStyle3_iface;
     const IHTMLStyle4Vtbl   *lpHTMLStyle4Vtbl;
 
     LONG ref;
@@ -28,7 +28,6 @@ struct HTMLStyle {
     nsIDOMCSSStyleDeclaration *nsstyle;
 };
 
-#define HTMLSTYLE3(x)    ((IHTMLStyle3*)                  &(x)->lpHTMLStyle3Vtbl)
 #define HTMLSTYLE4(x)    ((IHTMLStyle4*)                  &(x)->lpHTMLStyle4Vtbl)
 
 /* NOTE: Make sure to keep in sync with style_tbl in htmlstyle.c */
diff --git a/dlls/mshtml/htmlstyle3.c b/dlls/mshtml/htmlstyle3.c
index 1a29c19..3d8906e 100644
--- a/dlls/mshtml/htmlstyle3.c
+++ b/dlls/mshtml/htmlstyle3.c
@@ -33,39 +33,42 @@
 
 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
 
-#define HTMLSTYLE3_THIS(iface) DEFINE_THIS(HTMLStyle, HTMLStyle3, iface)
+static inline HTMLStyle *impl_from_IHTMLStyle3(IHTMLStyle3 *iface)
+{
+    return CONTAINING_RECORD(iface, HTMLStyle, IHTMLStyle3_iface);
+}
 
 static HRESULT WINAPI HTMLStyle3_QueryInterface(IHTMLStyle3 *iface, REFIID riid, void **ppv)
 {
-    HTMLStyle *This = HTMLSTYLE3_THIS(iface);
+    HTMLStyle *This = impl_from_IHTMLStyle3(iface);
 
     return IHTMLStyle_QueryInterface(&This->IHTMLStyle_iface, riid, ppv);
 }
 
 static ULONG WINAPI HTMLStyle3_AddRef(IHTMLStyle3 *iface)
 {
-    HTMLStyle *This = HTMLSTYLE3_THIS(iface);
+    HTMLStyle *This = impl_from_IHTMLStyle3(iface);
 
     return IHTMLStyle_AddRef(&This->IHTMLStyle_iface);
 }
 
 static ULONG WINAPI HTMLStyle3_Release(IHTMLStyle3 *iface)
 {
-    HTMLStyle *This = HTMLSTYLE3_THIS(iface);
+    HTMLStyle *This = impl_from_IHTMLStyle3(iface);
 
     return IHTMLStyle_Release(&This->IHTMLStyle_iface);
 }
 
 static HRESULT WINAPI HTMLStyle3_GetTypeInfoCount(IHTMLStyle3 *iface, UINT *pctinfo)
 {
-    HTMLStyle *This = HTMLSTYLE3_THIS(iface);
+    HTMLStyle *This = impl_from_IHTMLStyle3(iface);
     return IDispatchEx_GetTypeInfoCount(&This->dispex.IDispatchEx_iface, pctinfo);
 }
 
 static HRESULT WINAPI HTMLStyle3_GetTypeInfo(IHTMLStyle3 *iface, UINT iTInfo,
                                               LCID lcid, ITypeInfo **ppTInfo)
 {
-    HTMLStyle *This = HTMLSTYLE3_THIS(iface);
+    HTMLStyle *This = impl_from_IHTMLStyle3(iface);
     return IDispatchEx_GetTypeInfo(&This->dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
 }
 
@@ -73,7 +76,7 @@ static HRESULT WINAPI HTMLStyle3_GetIDsOfNames(IHTMLStyle3 *iface, REFIID riid,
                                                 LPOLESTR *rgszNames, UINT cNames,
                                                 LCID lcid, DISPID *rgDispId)
 {
-    HTMLStyle *This = HTMLSTYLE3_THIS(iface);
+    HTMLStyle *This = impl_from_IHTMLStyle3(iface);
     return IDispatchEx_GetIDsOfNames(&This->dispex.IDispatchEx_iface, riid, rgszNames, cNames,
             lcid, rgDispId);
 }
@@ -82,28 +85,28 @@ static HRESULT WINAPI HTMLStyle3_Invoke(IHTMLStyle3 *iface, DISPID dispIdMember,
                             REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
                             VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
 {
-    HTMLStyle *This = HTMLSTYLE3_THIS(iface);
+    HTMLStyle *This = impl_from_IHTMLStyle3(iface);
     return IDispatchEx_Invoke(&This->dispex.IDispatchEx_iface, dispIdMember, riid, lcid,
             wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
 }
 
 static HRESULT WINAPI HTMLStyle3_put_layoutFlow(IHTMLStyle3 *iface, BSTR v)
 {
-    HTMLStyle *This = HTMLSTYLE3_THIS(iface);
+    HTMLStyle *This = impl_from_IHTMLStyle3(iface);
     FIXME("(%p)->(%s)\n", This, debugstr_w(v));
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI HTMLStyle3_get_layoutFlow(IHTMLStyle3 *iface, BSTR *p)
 {
-    HTMLStyle *This = HTMLSTYLE3_THIS(iface);
+    HTMLStyle *This = impl_from_IHTMLStyle3(iface);
     FIXME("(%p)->(%p)\n", This, p);
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI HTMLStyle3_put_zoom(IHTMLStyle3 *iface, VARIANT v)
 {
-    HTMLStyle *This = HTMLSTYLE3_THIS(iface);
+    HTMLStyle *This = impl_from_IHTMLStyle3(iface);
 
     TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
 
@@ -118,14 +121,14 @@ static HRESULT WINAPI HTMLStyle3_put_zoom(IHTMLStyle3 *iface, VARIANT v)
 
 static HRESULT WINAPI HTMLStyle3_get_zoom(IHTMLStyle3 *iface, VARIANT *p)
 {
-    HTMLStyle *This = HTMLSTYLE3_THIS(iface);
+    HTMLStyle *This = impl_from_IHTMLStyle3(iface);
     FIXME("(%p)->(%p)\n", This, p);
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI HTMLStyle3_put_wordWrap(IHTMLStyle3 *iface, BSTR v)
 {
-    HTMLStyle *This = HTMLSTYLE3_THIS(iface);
+    HTMLStyle *This = impl_from_IHTMLStyle3(iface);
 
     TRACE("(%p)->(%s)\n", This, debugstr_w(v));
 
@@ -134,7 +137,7 @@ static HRESULT WINAPI HTMLStyle3_put_wordWrap(IHTMLStyle3 *iface, BSTR v)
 
 static HRESULT WINAPI HTMLStyle3_get_wordWrap(IHTMLStyle3 *iface, BSTR *p)
 {
-    HTMLStyle *This = HTMLSTYLE3_THIS(iface);
+    HTMLStyle *This = impl_from_IHTMLStyle3(iface);
 
     TRACE("(%p)->(%p)\n", This, p);
 
@@ -143,168 +146,168 @@ static HRESULT WINAPI HTMLStyle3_get_wordWrap(IHTMLStyle3 *iface, BSTR *p)
 
 static HRESULT WINAPI HTMLStyle3_put_textUnderlinePosition(IHTMLStyle3 *iface, BSTR v)
 {
-    HTMLStyle *This = HTMLSTYLE3_THIS(iface);
+    HTMLStyle *This = impl_from_IHTMLStyle3(iface);
     FIXME("(%p)->(%s)\n", This, debugstr_w(v));
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI HTMLStyle3_get_textUnderlinePosition(IHTMLStyle3 *iface, BSTR *p)
 {
-    HTMLStyle *This = HTMLSTYLE3_THIS(iface);
+    HTMLStyle *This = impl_from_IHTMLStyle3(iface);
     FIXME("(%p)->(%p)\n", This, p);
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI HTMLStyle3_put_scrollbarBaseColor(IHTMLStyle3 *iface, VARIANT v)
 {
-    HTMLStyle *This = HTMLSTYLE3_THIS(iface);
+    HTMLStyle *This = impl_from_IHTMLStyle3(iface);
     FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI HTMLStyle3_get_scrollbarBaseColor(IHTMLStyle3 *iface, VARIANT *p)
 {
-    HTMLStyle *This = HTMLSTYLE3_THIS(iface);
+    HTMLStyle *This = impl_from_IHTMLStyle3(iface);
     FIXME("(%p)->(%p)\n", This, p);
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI HTMLStyle3_put_scrollbarFaceColor(IHTMLStyle3 *iface, VARIANT v)
 {
-    HTMLStyle *This = HTMLSTYLE3_THIS(iface);
+    HTMLStyle *This = impl_from_IHTMLStyle3(iface);
     FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI HTMLStyle3_get_scrollbarFaceColor(IHTMLStyle3 *iface, VARIANT *p)
 {
-    HTMLStyle *This = HTMLSTYLE3_THIS(iface);
+    HTMLStyle *This = impl_from_IHTMLStyle3(iface);
     FIXME("(%p)->(%p)\n", This, p);
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI HTMLStyle3_put_scrollbar3dLightColor(IHTMLStyle3 *iface, VARIANT v)
 {
-    HTMLStyle *This = HTMLSTYLE3_THIS(iface);
+    HTMLStyle *This = impl_from_IHTMLStyle3(iface);
     FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI HTMLStyle3_get_scrollbar3dLightColor(IHTMLStyle3 *iface, VARIANT *p)
 {
-    HTMLStyle *This = HTMLSTYLE3_THIS(iface);
+    HTMLStyle *This = impl_from_IHTMLStyle3(iface);
     FIXME("(%p)->(%p)\n", This, p);
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI HTMLStyle3_put_scrollbarShadowColor(IHTMLStyle3 *iface, VARIANT v)
 {
-    HTMLStyle *This = HTMLSTYLE3_THIS(iface);
+    HTMLStyle *This = impl_from_IHTMLStyle3(iface);
     FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI HTMLStyle3_get_scrollbarShadowColor(IHTMLStyle3 *iface, VARIANT *p)
 {
-    HTMLStyle *This = HTMLSTYLE3_THIS(iface);
+    HTMLStyle *This = impl_from_IHTMLStyle3(iface);
     FIXME("(%p)->(%p)\n", This, p);
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI HTMLStyle3_put_scrollbarHighlightColor(IHTMLStyle3 *iface, VARIANT v)
 {
-    HTMLStyle *This = HTMLSTYLE3_THIS(iface);
+    HTMLStyle *This = impl_from_IHTMLStyle3(iface);
     FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI HTMLStyle3_get_scrollbarHighlightColor(IHTMLStyle3 *iface, VARIANT *p)
 {
-    HTMLStyle *This = HTMLSTYLE3_THIS(iface);
+    HTMLStyle *This = impl_from_IHTMLStyle3(iface);
     FIXME("(%p)->(%p)\n", This, p);
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI HTMLStyle3_put_scrollbarDarkShadowColor(IHTMLStyle3 *iface, VARIANT v)
 {
-    HTMLStyle *This = HTMLSTYLE3_THIS(iface);
+    HTMLStyle *This = impl_from_IHTMLStyle3(iface);
     FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI HTMLStyle3_get_scrollbarDarkShadowColor(IHTMLStyle3 *iface, VARIANT *p)
 {
-    HTMLStyle *This = HTMLSTYLE3_THIS(iface);
+    HTMLStyle *This = impl_from_IHTMLStyle3(iface);
     FIXME("(%p)->(%p)\n", This, p);
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI HTMLStyle3_put_scrollbarArrowColor(IHTMLStyle3 *iface, VARIANT v)
 {
-    HTMLStyle *This = HTMLSTYLE3_THIS(iface);
+    HTMLStyle *This = impl_from_IHTMLStyle3(iface);
     FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI HTMLStyle3_get_scrollbarArrowColor(IHTMLStyle3 *iface, VARIANT *p)
 {
-    HTMLStyle *This = HTMLSTYLE3_THIS(iface);
+    HTMLStyle *This = impl_from_IHTMLStyle3(iface);
     FIXME("(%p)->(%p)\n", This, p);
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI HTMLStyle3_put_scrollbarTrackColor(IHTMLStyle3 *iface, VARIANT v)
 {
-    HTMLStyle *This = HTMLSTYLE3_THIS(iface);
+    HTMLStyle *This = impl_from_IHTMLStyle3(iface);
     FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI HTMLStyle3_get_scrollbarTrackColor(IHTMLStyle3 *iface, VARIANT *p)
 {
-    HTMLStyle *This = HTMLSTYLE3_THIS(iface);
+    HTMLStyle *This = impl_from_IHTMLStyle3(iface);
     FIXME("(%p)->(%p)\n", This, p);
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI HTMLStyle3_put_writingMode(IHTMLStyle3 *iface, BSTR v)
 {
-    HTMLStyle *This = HTMLSTYLE3_THIS(iface);
+    HTMLStyle *This = impl_from_IHTMLStyle3(iface);
     FIXME("(%p)->(%s)\n", This, debugstr_w(v));
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI HTMLStyle3_get_writingMode(IHTMLStyle3 *iface, BSTR *p)
 {
-    HTMLStyle *This = HTMLSTYLE3_THIS(iface);
+    HTMLStyle *This = impl_from_IHTMLStyle3(iface);
     FIXME("(%p)->(%p)\n", This, p);
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI HTMLStyle3_put_textAlignLast(IHTMLStyle3 *iface, BSTR v)
 {
-    HTMLStyle *This = HTMLSTYLE3_THIS(iface);
+    HTMLStyle *This = impl_from_IHTMLStyle3(iface);
     FIXME("(%p)->(%s)\n", This, debugstr_w(v));
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI HTMLStyle3_get_textAlignLast(IHTMLStyle3 *iface, BSTR *p)
 {
-    HTMLStyle *This = HTMLSTYLE3_THIS(iface);
+    HTMLStyle *This = impl_from_IHTMLStyle3(iface);
     FIXME("(%p)->(%p)\n", This, p);
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI HTMLStyle3_put_textKashidaSpace(IHTMLStyle3 *iface, VARIANT v)
 {
-    HTMLStyle *This = HTMLSTYLE3_THIS(iface);
+    HTMLStyle *This = impl_from_IHTMLStyle3(iface);
     FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI HTMLStyle3_get_textKashidaSpace(IHTMLStyle3 *iface, VARIANT *p)
 {
-    HTMLStyle *This = HTMLSTYLE3_THIS(iface);
+    HTMLStyle *This = impl_from_IHTMLStyle3(iface);
     FIXME("(%p)->(%p)\n", This, p);
     return E_NOTIMPL;
 }
@@ -454,6 +457,6 @@ static const IHTMLStyle4Vtbl HTMLStyle4Vtbl = {
 
 void HTMLStyle3_Init(HTMLStyle *This)
 {
-    This->lpHTMLStyle3Vtbl = &HTMLStyle3Vtbl;
+    This->IHTMLStyle3_iface.lpVtbl = &HTMLStyle3Vtbl;
     This->lpHTMLStyle4Vtbl = &HTMLStyle4Vtbl;
 }
-- 
1.7.3.4



More information about the wine-patches mailing list