Michael Stefaniuc : mshtml: Use an iface instead of a vtbl pointer in HTMLFrameElement.

Alexandre Julliard julliard at winehq.org
Tue Dec 7 10:59:27 CST 2010


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

Author: Michael Stefaniuc <mstefani at redhat.de>
Date:   Mon Dec  6 23:31:24 2010 +0100

mshtml: Use an iface instead of a vtbl pointer in HTMLFrameElement.

---

 dlls/mshtml/htmlframe.c |   43 +++++++++++++++++++++----------------------
 1 files changed, 21 insertions(+), 22 deletions(-)

diff --git a/dlls/mshtml/htmlframe.c b/dlls/mshtml/htmlframe.c
index 708831b..e2cb0a6 100644
--- a/dlls/mshtml/htmlframe.c
+++ b/dlls/mshtml/htmlframe.c
@@ -33,52 +33,53 @@ WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
 
 typedef struct {
     HTMLFrameBase framebase;
-    const IHTMLFrameElement3Vtbl  *lpIHTMLFrameElement3Vtbl;
+    IHTMLFrameElement3 IHTMLFrameElement3_iface;
 } HTMLFrameElement;
 
-#define HTMLFRAMEELEM3(x)   ((IHTMLFrameElement3*)  &(x)->lpIHTMLFrameElement3Vtbl)
-
-#define HTMLFRAME3_THIS(iface) DEFINE_THIS(HTMLFrameElement, IHTMLFrameElement3, iface)
+static inline HTMLFrameElement *impl_from_IHTMLFrameElement3(IHTMLFrameElement3 *iface)
+{
+    return CONTAINING_RECORD(iface, HTMLFrameElement, IHTMLFrameElement3_iface);
+}
 
 static HRESULT WINAPI HTMLFrameElement3_QueryInterface(IHTMLFrameElement3 *iface,
         REFIID riid, void **ppv)
 {
-    HTMLFrameElement *This = HTMLFRAME3_THIS(iface);
+    HTMLFrameElement *This = impl_from_IHTMLFrameElement3(iface);
 
     return IHTMLDOMNode_QueryInterface(HTMLDOMNODE(&This->framebase.element.node), riid, ppv);
 }
 
 static ULONG WINAPI HTMLFrameElement3_AddRef(IHTMLFrameElement3 *iface)
 {
-    HTMLFrameElement *This = HTMLFRAME3_THIS(iface);
+    HTMLFrameElement *This = impl_from_IHTMLFrameElement3(iface);
 
     return IHTMLDOMNode_AddRef(HTMLDOMNODE(&This->framebase.element.node));
 }
 
 static ULONG WINAPI HTMLFrameElement3_Release(IHTMLFrameElement3 *iface)
 {
-    HTMLFrameElement *This = HTMLFRAME3_THIS(iface);
+    HTMLFrameElement *This = impl_from_IHTMLFrameElement3(iface);
 
     return IHTMLDOMNode_Release(HTMLDOMNODE(&This->framebase.element.node));
 }
 
 static HRESULT WINAPI HTMLFrameElement3_GetTypeInfoCount(IHTMLFrameElement3 *iface, UINT *pctinfo)
 {
-    HTMLFrameElement *This = HTMLFRAME3_THIS(iface);
+    HTMLFrameElement *This = impl_from_IHTMLFrameElement3(iface);
     return IDispatchEx_GetTypeInfoCount(DISPATCHEX(&This->framebase.element.node.dispex), pctinfo);
 }
 
 static HRESULT WINAPI HTMLFrameElement3_GetTypeInfo(IHTMLFrameElement3 *iface, UINT iTInfo,
         LCID lcid, ITypeInfo **ppTInfo)
 {
-    HTMLFrameElement *This = HTMLFRAME3_THIS(iface);
+    HTMLFrameElement *This = impl_from_IHTMLFrameElement3(iface);
     return IDispatchEx_GetTypeInfo(DISPATCHEX(&This->framebase.element.node.dispex), iTInfo, lcid, ppTInfo);
 }
 
 static HRESULT WINAPI HTMLFrameElement3_GetIDsOfNames(IHTMLFrameElement3 *iface, REFIID riid,
         LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
 {
-    HTMLFrameElement *This = HTMLFRAME3_THIS(iface);
+    HTMLFrameElement *This = impl_from_IHTMLFrameElement3(iface);
     return IDispatchEx_GetIDsOfNames(DISPATCHEX(&This->framebase.element.node.dispex), riid, rgszNames, cNames, lcid, rgDispId);
 }
 
@@ -86,14 +87,14 @@ static HRESULT WINAPI HTMLFrameElement3_Invoke(IHTMLFrameElement3 *iface, DISPID
         REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
         VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
 {
-    HTMLFrameElement *This = HTMLFRAME3_THIS(iface);
+    HTMLFrameElement *This = impl_from_IHTMLFrameElement3(iface);
     return IDispatchEx_Invoke(DISPATCHEX(&This->framebase.element.node.dispex), dispIdMember, riid,
             lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
 }
 
 static HRESULT WINAPI HTMLFrameElement3_get_contentDocument(IHTMLFrameElement3 *iface, IDispatch **p)
 {
-    HTMLFrameElement *This = HTMLFRAME3_THIS(iface);
+    HTMLFrameElement *This = impl_from_IHTMLFrameElement3(iface);
     IHTMLDocument2 *doc;
     HRESULT hres;
 
@@ -114,48 +115,46 @@ static HRESULT WINAPI HTMLFrameElement3_get_contentDocument(IHTMLFrameElement3 *
 
 static HRESULT WINAPI HTMLFrameElement3_put_src(IHTMLFrameElement3 *iface, BSTR v)
 {
-    HTMLFrameElement *This = HTMLFRAME3_THIS(iface);
+    HTMLFrameElement *This = impl_from_IHTMLFrameElement3(iface);
     FIXME("(%p)->(%s)\n", This, debugstr_w(v));
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI HTMLFrameElement3_get_src(IHTMLFrameElement3 *iface, BSTR *p)
 {
-    HTMLFrameElement *This = HTMLFRAME3_THIS(iface);
+    HTMLFrameElement *This = impl_from_IHTMLFrameElement3(iface);
     FIXME("(%p)->(%p)\n", This, p);
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI HTMLFrameElement3_put_longDesc(IHTMLFrameElement3 *iface, BSTR v)
 {
-    HTMLFrameElement *This = HTMLFRAME3_THIS(iface);
+    HTMLFrameElement *This = impl_from_IHTMLFrameElement3(iface);
     FIXME("(%p)->(%s)\n", This, debugstr_w(v));
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI HTMLFrameElement3_get_longDesc(IHTMLFrameElement3 *iface, BSTR *p)
 {
-    HTMLFrameElement *This = HTMLFRAME3_THIS(iface);
+    HTMLFrameElement *This = impl_from_IHTMLFrameElement3(iface);
     FIXME("(%p)->(%p)\n", This, p);
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI HTMLFrameElement3_put_frameBorder(IHTMLFrameElement3 *iface, BSTR v)
 {
-    HTMLFrameElement *This = HTMLFRAME3_THIS(iface);
+    HTMLFrameElement *This = impl_from_IHTMLFrameElement3(iface);
     FIXME("(%p)->(%s)\n", This, debugstr_w(v));
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI HTMLFrameElement3_get_frameBorder(IHTMLFrameElement3 *iface, BSTR *p)
 {
-    HTMLFrameElement *This = HTMLFRAME3_THIS(iface);
+    HTMLFrameElement *This = impl_from_IHTMLFrameElement3(iface);
     FIXME("(%p)->(%p)\n", This, p);
     return E_NOTIMPL;
 }
 
-#undef HTMLFRAME3_THIS
-
 static const IHTMLFrameElement3Vtbl HTMLFrameElement3Vtbl = {
     HTMLFrameElement3_QueryInterface,
     HTMLFrameElement3_AddRef,
@@ -181,7 +180,7 @@ static HRESULT HTMLFrameElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
 
     if(IsEqualGUID(&IID_IHTMLFrameElement3, riid)) {
         TRACE("(%p)->(IID_IHTMLFrameElement3 %p)\n", This, ppv);
-        *ppv = HTMLFRAMEELEM3(This);
+        *ppv = &This->IHTMLFrameElement3_iface;
     }else {
         return HTMLFrameBase_QI(&This->framebase, riid, ppv);
     }
@@ -301,7 +300,7 @@ HRESULT HTMLFrameElement_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem
         return E_OUTOFMEMORY;
 
     ret->framebase.element.node.vtbl = &HTMLFrameElementImplVtbl;
-    ret->lpIHTMLFrameElement3Vtbl = &HTMLFrameElement3Vtbl;
+    ret->IHTMLFrameElement3_iface.lpVtbl = &HTMLFrameElement3Vtbl;
 
     HTMLFrameBase_Init(&ret->framebase, doc, nselem, &HTMLFrameElement_dispex);
 




More information about the wine-cvs mailing list