[PATCH 03/10] mshtml: COM cleanup for the IHTMLElement3 iface.

Michael Stefaniuc mstefani at redhat.de
Wed Dec 29 18:30:37 CST 2010


---
 dlls/mshtml/htmlelem.c       |    2 +-
 dlls/mshtml/htmlelem3.c      |  109 +++++++++++++++++++++---------------------
 dlls/mshtml/mshtml_private.h |    3 +-
 3 files changed, 57 insertions(+), 57 deletions(-)

diff --git a/dlls/mshtml/htmlelem.c b/dlls/mshtml/htmlelem.c
index cdbac44..e9cb94b 100644
--- a/dlls/mshtml/htmlelem.c
+++ b/dlls/mshtml/htmlelem.c
@@ -1616,7 +1616,7 @@ HRESULT HTMLElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
         *ppv = &This->IHTMLElement2_iface;
     }else if(IsEqualGUID(&IID_IHTMLElement3, riid)) {
         TRACE("(%p)->(IID_IHTMLElement3 %p)\n", This, ppv);
-        *ppv = HTMLELEM3(This);
+        *ppv = &This->IHTMLElement3_iface;
     }else if(IsEqualGUID(&IID_IConnectionPointContainer, riid)) {
         TRACE("(%p)->(IID_IConnectionPointContainer %p)\n", This, ppv);
         *ppv = CONPTCONT(&This->cp_container);
diff --git a/dlls/mshtml/htmlelem3.c b/dlls/mshtml/htmlelem3.c
index 686c730..beaafee 100644
--- a/dlls/mshtml/htmlelem3.c
+++ b/dlls/mshtml/htmlelem3.c
@@ -33,37 +33,40 @@
 
 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
 
-#define HTMLELEM3_THIS(iface) DEFINE_THIS(HTMLElement, HTMLElement3, iface)
+static inline HTMLElement *impl_from_IHTMLElement3(IHTMLElement3 *iface)
+{
+    return CONTAINING_RECORD(iface, HTMLElement, IHTMLElement3_iface);
+}
 
 static HRESULT WINAPI HTMLElement3_QueryInterface(IHTMLElement3 *iface,
                                                   REFIID riid, void **ppv)
 {
-    HTMLElement *This = HTMLELEM3_THIS(iface);
+    HTMLElement *This = impl_from_IHTMLElement3(iface);
     return IHTMLElement_QueryInterface(&This->IHTMLElement_iface, riid, ppv);
 }
 
 static ULONG WINAPI HTMLElement3_AddRef(IHTMLElement3 *iface)
 {
-    HTMLElement *This = HTMLELEM3_THIS(iface);
+    HTMLElement *This = impl_from_IHTMLElement3(iface);
     return IHTMLElement_AddRef(&This->IHTMLElement_iface);
 }
 
 static ULONG WINAPI HTMLElement3_Release(IHTMLElement3 *iface)
 {
-    HTMLElement *This = HTMLELEM3_THIS(iface);
+    HTMLElement *This = impl_from_IHTMLElement3(iface);
     return IHTMLElement_Release(&This->IHTMLElement_iface);
 }
 
 static HRESULT WINAPI HTMLElement3_GetTypeInfoCount(IHTMLElement3 *iface, UINT *pctinfo)
 {
-    HTMLElement *This = HTMLELEM3_THIS(iface);
+    HTMLElement *This = impl_from_IHTMLElement3(iface);
     return IDispatchEx_GetTypeInfoCount(DISPATCHEX(&This->node.dispex), pctinfo);
 }
 
 static HRESULT WINAPI HTMLElement3_GetTypeInfo(IHTMLElement3 *iface, UINT iTInfo,
                                                LCID lcid, ITypeInfo **ppTInfo)
 {
-    HTMLElement *This = HTMLELEM3_THIS(iface);
+    HTMLElement *This = impl_from_IHTMLElement3(iface);
     return IDispatchEx_GetTypeInfo(DISPATCHEX(&This->node.dispex), iTInfo, lcid, ppTInfo);
 }
 
@@ -71,7 +74,7 @@ static HRESULT WINAPI HTMLElement3_GetIDsOfNames(IHTMLElement3 *iface, REFIID ri
                                                 LPOLESTR *rgszNames, UINT cNames,
                                                 LCID lcid, DISPID *rgDispId)
 {
-    HTMLElement *This = HTMLELEM3_THIS(iface);
+    HTMLElement *This = impl_from_IHTMLElement3(iface);
     return IDispatchEx_GetIDsOfNames(DISPATCHEX(&This->node.dispex), riid, rgszNames, cNames, lcid, rgDispId);
 }
 
@@ -79,126 +82,126 @@ static HRESULT WINAPI HTMLElement3_Invoke(IHTMLElement3 *iface, DISPID dispIdMem
                             REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
                             VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
 {
-    HTMLElement *This = HTMLELEM3_THIS(iface);
+    HTMLElement *This = impl_from_IHTMLElement3(iface);
     return IDispatchEx_Invoke(DISPATCHEX(&This->node.dispex), dispIdMember, riid, lcid,
             wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
 }
 
 static HRESULT WINAPI HTMLElement3_mergeAttributes(IHTMLElement3 *iface, IHTMLElement *mergeThis, VARIANT *pvarFlags)
 {
-    HTMLElement *This = HTMLELEM3_THIS(iface);
+    HTMLElement *This = impl_from_IHTMLElement3(iface);
     FIXME("(%p)->(%p %p)\n", This, mergeThis, pvarFlags);
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI HTMLElement3_get_isMultiLine(IHTMLElement3 *iface, VARIANT_BOOL *p)
 {
-    HTMLElement *This = HTMLELEM3_THIS(iface);
+    HTMLElement *This = impl_from_IHTMLElement3(iface);
     FIXME("(%p)->(%p)\n", This, p);
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI HTMLElement3_get_canHaveHTML(IHTMLElement3 *iface, VARIANT_BOOL *p)
 {
-    HTMLElement *This = HTMLELEM3_THIS(iface);
+    HTMLElement *This = impl_from_IHTMLElement3(iface);
     FIXME("(%p)->(%p)\n", This, p);
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI HTMLElement3_put_onlayoutcomplete(IHTMLElement3 *iface, VARIANT v)
 {
-    HTMLElement *This = HTMLELEM3_THIS(iface);
+    HTMLElement *This = impl_from_IHTMLElement3(iface);
     FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI HTMLElement3_get_onlayoutcomplete(IHTMLElement3 *iface, VARIANT *p)
 {
-    HTMLElement *This = HTMLELEM3_THIS(iface);
+    HTMLElement *This = impl_from_IHTMLElement3(iface);
     FIXME("(%p)->(%p)\n", This, p);
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI HTMLElement3_put_onpage(IHTMLElement3 *iface, VARIANT v)
 {
-    HTMLElement *This = HTMLELEM3_THIS(iface);
+    HTMLElement *This = impl_from_IHTMLElement3(iface);
     FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI HTMLElement3_get_onpage(IHTMLElement3 *iface, VARIANT *p)
 {
-    HTMLElement *This = HTMLELEM3_THIS(iface);
+    HTMLElement *This = impl_from_IHTMLElement3(iface);
     FIXME("(%p)->(%p)\n", This, p);
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI HTMLElement3_put_inflateBlock(IHTMLElement3 *iface, VARIANT_BOOL v)
 {
-    HTMLElement *This = HTMLELEM3_THIS(iface);
+    HTMLElement *This = impl_from_IHTMLElement3(iface);
     FIXME("(%p)->(%x)\n", This, v);
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI HTMLElement3_get_inflateBlock(IHTMLElement3 *iface, VARIANT_BOOL *p)
 {
-    HTMLElement *This = HTMLELEM3_THIS(iface);
+    HTMLElement *This = impl_from_IHTMLElement3(iface);
     FIXME("(%p)->(%p)\n", This, p);
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI HTMLElement3_put_onbeforedeactivate(IHTMLElement3 *iface, VARIANT v)
 {
-    HTMLElement *This = HTMLELEM3_THIS(iface);
+    HTMLElement *This = impl_from_IHTMLElement3(iface);
     FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI HTMLElement3_get_onbeforedeactivate(IHTMLElement3 *iface, VARIANT *p)
 {
-    HTMLElement *This = HTMLELEM3_THIS(iface);
+    HTMLElement *This = impl_from_IHTMLElement3(iface);
     FIXME("(%p)->(%p)\n", This, p);
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI HTMLElement3_setActive(IHTMLElement3 *iface)
 {
-    HTMLElement *This = HTMLELEM3_THIS(iface);
+    HTMLElement *This = impl_from_IHTMLElement3(iface);
     FIXME("(%p)\n", This);
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI HTMLElement3_put_contentEditable(IHTMLElement3 *iface, BSTR v)
 {
-    HTMLElement *This = HTMLELEM3_THIS(iface);
+    HTMLElement *This = impl_from_IHTMLElement3(iface);
     FIXME("(%p)->(%s)\n", This, debugstr_w(v));
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI HTMLElement3_get_contentEditable(IHTMLElement3 *iface, BSTR *p)
 {
-    HTMLElement *This = HTMLELEM3_THIS(iface);
+    HTMLElement *This = impl_from_IHTMLElement3(iface);
     FIXME("(%p)->(%p)\n", This, p);
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI HTMLElement3_get_isContentEditable(IHTMLElement3 *iface, VARIANT_BOOL *p)
 {
-    HTMLElement *This = HTMLELEM3_THIS(iface);
+    HTMLElement *This = impl_from_IHTMLElement3(iface);
     FIXME("(%p)->(%p)\n", This, p);
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI HTMLElement3_put_hideFocus(IHTMLElement3 *iface, VARIANT_BOOL v)
 {
-    HTMLElement *This = HTMLELEM3_THIS(iface);
+    HTMLElement *This = impl_from_IHTMLElement3(iface);
     FIXME("(%p)->(%x)\n", This, v);
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI HTMLElement3_get_hideFocus(IHTMLElement3 *iface, VARIANT_BOOL *p)
 {
-    HTMLElement *This = HTMLELEM3_THIS(iface);
+    HTMLElement *This = impl_from_IHTMLElement3(iface);
     FIXME("(%p)->(%p)\n", This, p);
     return E_NOTIMPL;
 }
@@ -207,7 +210,7 @@ static const WCHAR disabledW[] = {'d','i','s','a','b','l','e','d',0};
 
 static HRESULT WINAPI HTMLElement3_put_disabled(IHTMLElement3 *iface, VARIANT_BOOL v)
 {
-    HTMLElement *This = HTMLELEM3_THIS(iface);
+    HTMLElement *This = impl_from_IHTMLElement3(iface);
     VARIANT *var;
     HRESULT hres;
 
@@ -228,7 +231,7 @@ static HRESULT WINAPI HTMLElement3_put_disabled(IHTMLElement3 *iface, VARIANT_BO
 
 static HRESULT WINAPI HTMLElement3_get_disabled(IHTMLElement3 *iface, VARIANT_BOOL *p)
 {
-    HTMLElement *This = HTMLELEM3_THIS(iface);
+    HTMLElement *This = impl_from_IHTMLElement3(iface);
     VARIANT *var;
     HRESULT hres;
 
@@ -256,35 +259,35 @@ static HRESULT WINAPI HTMLElement3_get_disabled(IHTMLElement3 *iface, VARIANT_BO
 
 static HRESULT WINAPI HTMLElement3_get_isDisabled(IHTMLElement3 *iface, VARIANT_BOOL *p)
 {
-    HTMLElement *This = HTMLELEM3_THIS(iface);
+    HTMLElement *This = impl_from_IHTMLElement3(iface);
     FIXME("(%p)->(%p)\n", This, p);
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI HTMLElement3_put_onmove(IHTMLElement3 *iface, VARIANT v)
 {
-    HTMLElement *This = HTMLELEM3_THIS(iface);
+    HTMLElement *This = impl_from_IHTMLElement3(iface);
     FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI HTMLElement3_get_onmove(IHTMLElement3 *iface, VARIANT *p)
 {
-    HTMLElement *This = HTMLELEM3_THIS(iface);
+    HTMLElement *This = impl_from_IHTMLElement3(iface);
     FIXME("(%p)->(%p)\n", This, p);
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI HTMLElement3_put_oncontrolselect(IHTMLElement3 *iface, VARIANT v)
 {
-    HTMLElement *This = HTMLELEM3_THIS(iface);
+    HTMLElement *This = impl_from_IHTMLElement3(iface);
     FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI HTMLElement3_get_oncontrolselect(IHTMLElement3 *iface, VARIANT *p)
 {
-    HTMLElement *This = HTMLELEM3_THIS(iface);
+    HTMLElement *This = impl_from_IHTMLElement3(iface);
     FIXME("(%p)->(%p)\n", This, p);
     return E_NOTIMPL;
 }
@@ -292,7 +295,7 @@ static HRESULT WINAPI HTMLElement3_get_oncontrolselect(IHTMLElement3 *iface, VAR
 static HRESULT WINAPI HTMLElement3_fireEvent(IHTMLElement3 *iface, BSTR bstrEventName,
         VARIANT *pvarEventObject, VARIANT_BOOL *pfCancelled)
 {
-    HTMLElement *This = HTMLELEM3_THIS(iface);
+    HTMLElement *This = impl_from_IHTMLElement3(iface);
 
     TRACE("(%p)->(%s %s %p)\n", This, debugstr_w(bstrEventName), debugstr_variant(pvarEventObject),
           pfCancelled);
@@ -302,132 +305,130 @@ static HRESULT WINAPI HTMLElement3_fireEvent(IHTMLElement3 *iface, BSTR bstrEven
 
 static HRESULT WINAPI HTMLElement3_put_onresizestart(IHTMLElement3 *iface, VARIANT v)
 {
-    HTMLElement *This = HTMLELEM3_THIS(iface);
+    HTMLElement *This = impl_from_IHTMLElement3(iface);
     FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI HTMLElement3_get_onresizestart(IHTMLElement3 *iface, VARIANT *p)
 {
-    HTMLElement *This = HTMLELEM3_THIS(iface);
+    HTMLElement *This = impl_from_IHTMLElement3(iface);
     FIXME("(%p)->(%p)\n", This, p);
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI HTMLElement3_put_onresizeend(IHTMLElement3 *iface, VARIANT v)
 {
-    HTMLElement *This = HTMLELEM3_THIS(iface);
+    HTMLElement *This = impl_from_IHTMLElement3(iface);
     FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI HTMLElement3_get_onresizeend(IHTMLElement3 *iface, VARIANT *p)
 {
-    HTMLElement *This = HTMLELEM3_THIS(iface);
+    HTMLElement *This = impl_from_IHTMLElement3(iface);
     FIXME("(%p)->(%p)\n", This, p);
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI HTMLElement3_put_onmovestart(IHTMLElement3 *iface, VARIANT v)
 {
-    HTMLElement *This = HTMLELEM3_THIS(iface);
+    HTMLElement *This = impl_from_IHTMLElement3(iface);
     FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI HTMLElement3_get_onmovestart(IHTMLElement3 *iface, VARIANT *p)
 {
-    HTMLElement *This = HTMLELEM3_THIS(iface);
+    HTMLElement *This = impl_from_IHTMLElement3(iface);
     FIXME("(%p)->(%p)\n", This, p);
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI HTMLElement3_put_onmoveend(IHTMLElement3 *iface, VARIANT v)
 {
-    HTMLElement *This = HTMLELEM3_THIS(iface);
+    HTMLElement *This = impl_from_IHTMLElement3(iface);
     FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI HTMLElement3_get_onmoveend(IHTMLElement3 *iface, VARIANT *p)
 {
-    HTMLElement *This = HTMLELEM3_THIS(iface);
+    HTMLElement *This = impl_from_IHTMLElement3(iface);
     FIXME("(%p)->(%p)\n", This, p);
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI HTMLElement3_put_onmousecenter(IHTMLElement3 *iface, VARIANT v)
 {
-    HTMLElement *This = HTMLELEM3_THIS(iface);
+    HTMLElement *This = impl_from_IHTMLElement3(iface);
     FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI HTMLElement3_get_onmousecenter(IHTMLElement3 *iface, VARIANT *p)
 {
-    HTMLElement *This = HTMLELEM3_THIS(iface);
+    HTMLElement *This = impl_from_IHTMLElement3(iface);
     FIXME("(%p)->(%p)\n", This, p);
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI HTMLElement3_put_onmouseleave(IHTMLElement3 *iface, VARIANT v)
 {
-    HTMLElement *This = HTMLELEM3_THIS(iface);
+    HTMLElement *This = impl_from_IHTMLElement3(iface);
     FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI HTMLElement3_get_onmouseleave(IHTMLElement3 *iface, VARIANT *p)
 {
-    HTMLElement *This = HTMLELEM3_THIS(iface);
+    HTMLElement *This = impl_from_IHTMLElement3(iface);
     FIXME("(%p)->(%p)\n", This, p);
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI HTMLElement3_put_onactivate(IHTMLElement3 *iface, VARIANT v)
 {
-    HTMLElement *This = HTMLELEM3_THIS(iface);
+    HTMLElement *This = impl_from_IHTMLElement3(iface);
     FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI HTMLElement3_get_onactivate(IHTMLElement3 *iface, VARIANT *p)
 {
-    HTMLElement *This = HTMLELEM3_THIS(iface);
+    HTMLElement *This = impl_from_IHTMLElement3(iface);
     FIXME("(%p)->(%p)\n", This, p);
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI HTMLElement3_put_ondeactivate(IHTMLElement3 *iface, VARIANT v)
 {
-    HTMLElement *This = HTMLELEM3_THIS(iface);
+    HTMLElement *This = impl_from_IHTMLElement3(iface);
     FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI HTMLElement3_get_ondeactivate(IHTMLElement3 *iface, VARIANT *p)
 {
-    HTMLElement *This = HTMLELEM3_THIS(iface);
+    HTMLElement *This = impl_from_IHTMLElement3(iface);
     FIXME("(%p)->(%p)\n", This, p);
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI HTMLElement3_dragDrop(IHTMLElement3 *iface, VARIANT_BOOL *pfRet)
 {
-    HTMLElement *This = HTMLELEM3_THIS(iface);
+    HTMLElement *This = impl_from_IHTMLElement3(iface);
     FIXME("(%p)->(%p)\n", This, pfRet);
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI HTMLElement3_get_glyphMode(IHTMLElement3 *iface, LONG *p)
 {
-    HTMLElement *This = HTMLELEM3_THIS(iface);
+    HTMLElement *This = impl_from_IHTMLElement3(iface);
     FIXME("(%p)->(%p)\n", This, p);
     return E_NOTIMPL;
 }
 
-#undef HTMLELEM2_THIS
-
 static const IHTMLElement3Vtbl HTMLElement3Vtbl = {
     HTMLElement3_QueryInterface,
     HTMLElement3_AddRef,
@@ -483,5 +484,5 @@ static const IHTMLElement3Vtbl HTMLElement3Vtbl = {
 
 void HTMLElement3_Init(HTMLElement *This)
 {
-    This->lpHTMLElement3Vtbl = &HTMLElement3Vtbl;
+    This->IHTMLElement3_iface.lpVtbl = &HTMLElement3Vtbl;
 }
diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h
index 543a89e..8d52bfc 100644
--- a/dlls/mshtml/mshtml_private.h
+++ b/dlls/mshtml/mshtml_private.h
@@ -551,7 +551,7 @@ typedef struct {
 
     IHTMLElement  IHTMLElement_iface;
     IHTMLElement2 IHTMLElement2_iface;
-    const IHTMLElement3Vtbl  *lpHTMLElement3Vtbl;
+    IHTMLElement3 IHTMLElement3_iface;
 
     nsIDOMHTMLElement *nselem;
 } HTMLElement;
@@ -642,7 +642,6 @@ struct HTMLDocumentNode {
 #define STATUSCLB(x)     ((IBindStatusCallback*)          &(x)->lpBindStatusCallbackVtbl)
 #define BINDINFO(x)      ((IInternetBindInfo*)            &(x)->lpInternetBindInfoVtbl);
 
-#define HTMLELEM3(x)     ((IHTMLElement3*)                &(x)->lpHTMLElement3Vtbl)
 #define HTMLDOMNODE(x)   ((IHTMLDOMNode*)                 &(x)->lpHTMLDOMNodeVtbl)
 #define HTMLDOMNODE2(x)  ((IHTMLDOMNode2*)                &(x)->lpHTMLDOMNode2Vtbl)
 
-- 
1.7.3.4



More information about the wine-patches mailing list