From 2c04cfdb4eec996aab93c4293baae571d993b45e Mon Sep 17 00:00:00 2001 From: Michael Stefaniuc Date: Mon, 6 Dec 2010 23:31:50 +0100 Subject: [PATCH] mshtml: Use an iface instead of a vtbl pointer in HTMLScriptElement. --- dlls/mshtml/htmlscript.c | 65 ++++++++++++++++++++-------------------- 1 file changed, 32 insertions(+), 33 deletions(-) diff --git a/dlls/mshtml/htmlscript.c b/dlls/mshtml/htmlscript.c index 63453ee4fb9..91e1d22cdef 100644 --- a/dlls/mshtml/htmlscript.c +++ b/dlls/mshtml/htmlscript.c @@ -34,47 +34,48 @@ WINE_DEFAULT_DEBUG_CHANNEL(mshtml); typedef struct { HTMLElement element; - const IHTMLScriptElementVtbl *lpHTMLScriptElementVtbl; + IHTMLScriptElement IHTMLScriptElement_iface; nsIDOMHTMLScriptElement *nsscript; } HTMLScriptElement; -#define HTMLSCRIPT(x) ((IHTMLScriptElement*) &(x)->lpHTMLScriptElementVtbl) - -#define HTMLSCRIPT_THIS(iface) DEFINE_THIS(HTMLScriptElement, HTMLScriptElement, iface) +static inline HTMLScriptElement *impl_from_IHTMLScriptElement(IHTMLScriptElement *iface) +{ + return CONTAINING_RECORD(iface, HTMLScriptElement, IHTMLScriptElement_iface); +} static HRESULT WINAPI HTMLScriptElement_QueryInterface(IHTMLScriptElement *iface, REFIID riid, void **ppv) { - HTMLScriptElement *This = HTMLSCRIPT_THIS(iface); + HTMLScriptElement *This = impl_from_IHTMLScriptElement(iface); return IHTMLDOMNode_QueryInterface(HTMLDOMNODE(&This->element.node), riid, ppv); } static ULONG WINAPI HTMLScriptElement_AddRef(IHTMLScriptElement *iface) { - HTMLScriptElement *This = HTMLSCRIPT_THIS(iface); + HTMLScriptElement *This = impl_from_IHTMLScriptElement(iface); return IHTMLDOMNode_AddRef(HTMLDOMNODE(&This->element.node)); } static ULONG WINAPI HTMLScriptElement_Release(IHTMLScriptElement *iface) { - HTMLScriptElement *This = HTMLSCRIPT_THIS(iface); + HTMLScriptElement *This = impl_from_IHTMLScriptElement(iface); return IHTMLDOMNode_Release(HTMLDOMNODE(&This->element.node)); } static HRESULT WINAPI HTMLScriptElement_GetTypeInfoCount(IHTMLScriptElement *iface, UINT *pctinfo) { - HTMLScriptElement *This = HTMLSCRIPT_THIS(iface); + HTMLScriptElement *This = impl_from_IHTMLScriptElement(iface); return IDispatchEx_GetTypeInfoCount(DISPATCHEX(&This->element.node.dispex), pctinfo); } static HRESULT WINAPI HTMLScriptElement_GetTypeInfo(IHTMLScriptElement *iface, UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo) { - HTMLScriptElement *This = HTMLSCRIPT_THIS(iface); + HTMLScriptElement *This = impl_from_IHTMLScriptElement(iface); return IDispatchEx_GetTypeInfo(DISPATCHEX(&This->element.node.dispex), iTInfo, lcid, ppTInfo); } @@ -82,7 +83,7 @@ static HRESULT WINAPI HTMLScriptElement_GetIDsOfNames(IHTMLScriptElement *iface, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId) { - HTMLScriptElement *This = HTMLSCRIPT_THIS(iface); + HTMLScriptElement *This = impl_from_IHTMLScriptElement(iface); return IDispatchEx_GetIDsOfNames(DISPATCHEX(&This->element.node.dispex), riid, rgszNames, cNames, lcid, rgDispId); } @@ -90,70 +91,70 @@ static HRESULT WINAPI HTMLScriptElement_Invoke(IHTMLScriptElement *iface, DISPID REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr) { - HTMLScriptElement *This = HTMLSCRIPT_THIS(iface); + HTMLScriptElement *This = impl_from_IHTMLScriptElement(iface); return IDispatchEx_Invoke(DISPATCHEX(&This->element.node.dispex), dispIdMember, riid, lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr); } static HRESULT WINAPI HTMLScriptElement_put_src(IHTMLScriptElement *iface, BSTR v) { - HTMLScriptElement *This = HTMLSCRIPT_THIS(iface); + HTMLScriptElement *This = impl_from_IHTMLScriptElement(iface); FIXME("(%p)->(%s)\n", This, debugstr_w(v)); return E_NOTIMPL; } static HRESULT WINAPI HTMLScriptElement_get_src(IHTMLScriptElement *iface, BSTR *p) { - HTMLScriptElement *This = HTMLSCRIPT_THIS(iface); + HTMLScriptElement *This = impl_from_IHTMLScriptElement(iface); FIXME("(%p)->(%p)\n", This, p); return E_NOTIMPL; } static HRESULT WINAPI HTMLScriptElement_put_htmlFor(IHTMLScriptElement *iface, BSTR v) { - HTMLScriptElement *This = HTMLSCRIPT_THIS(iface); + HTMLScriptElement *This = impl_from_IHTMLScriptElement(iface); FIXME("(%p)->(%s)\n", This, debugstr_w(v)); return E_NOTIMPL; } static HRESULT WINAPI HTMLScriptElement_get_htmlFor(IHTMLScriptElement *iface, BSTR *p) { - HTMLScriptElement *This = HTMLSCRIPT_THIS(iface); + HTMLScriptElement *This = impl_from_IHTMLScriptElement(iface); FIXME("(%p)->(%p)\n", This, p); return E_NOTIMPL; } static HRESULT WINAPI HTMLScriptElement_put_event(IHTMLScriptElement *iface, BSTR v) { - HTMLScriptElement *This = HTMLSCRIPT_THIS(iface); + HTMLScriptElement *This = impl_from_IHTMLScriptElement(iface); FIXME("(%p)->(%s)\n", This, debugstr_w(v)); return E_NOTIMPL; } static HRESULT WINAPI HTMLScriptElement_get_event(IHTMLScriptElement *iface, BSTR *p) { - HTMLScriptElement *This = HTMLSCRIPT_THIS(iface); + HTMLScriptElement *This = impl_from_IHTMLScriptElement(iface); FIXME("(%p)->(%p)\n", This, p); return E_NOTIMPL; } static HRESULT WINAPI HTMLScriptElement_put_text(IHTMLScriptElement *iface, BSTR v) { - HTMLScriptElement *This = HTMLSCRIPT_THIS(iface); + HTMLScriptElement *This = impl_from_IHTMLScriptElement(iface); FIXME("(%p)->(%s)\n", This, debugstr_w(v)); return E_NOTIMPL; } static HRESULT WINAPI HTMLScriptElement_get_text(IHTMLScriptElement *iface, BSTR *p) { - HTMLScriptElement *This = HTMLSCRIPT_THIS(iface); + HTMLScriptElement *This = impl_from_IHTMLScriptElement(iface); FIXME("(%p)->(%p)\n", This, p); return E_NOTIMPL; } static HRESULT WINAPI HTMLScriptElement_put_defer(IHTMLScriptElement *iface, VARIANT_BOOL v) { - HTMLScriptElement *This = HTMLSCRIPT_THIS(iface); + HTMLScriptElement *This = impl_from_IHTMLScriptElement(iface); HRESULT hr = S_OK; nsresult nsres; @@ -170,7 +171,7 @@ static HRESULT WINAPI HTMLScriptElement_put_defer(IHTMLScriptElement *iface, VAR static HRESULT WINAPI HTMLScriptElement_get_defer(IHTMLScriptElement *iface, VARIANT_BOOL *p) { - HTMLScriptElement *This = HTMLSCRIPT_THIS(iface); + HTMLScriptElement *This = impl_from_IHTMLScriptElement(iface); PRBool defer = FALSE; nsresult nsres; @@ -192,28 +193,28 @@ static HRESULT WINAPI HTMLScriptElement_get_defer(IHTMLScriptElement *iface, VAR static HRESULT WINAPI HTMLScriptElement_get_readyState(IHTMLScriptElement *iface, BSTR *p) { - HTMLScriptElement *This = HTMLSCRIPT_THIS(iface); + HTMLScriptElement *This = impl_from_IHTMLScriptElement(iface); FIXME("(%p)->(%p)\n", This, p); return E_NOTIMPL; } static HRESULT WINAPI HTMLScriptElement_put_onerror(IHTMLScriptElement *iface, VARIANT v) { - HTMLScriptElement *This = HTMLSCRIPT_THIS(iface); + HTMLScriptElement *This = impl_from_IHTMLScriptElement(iface); FIXME("(%p)->(v(%d))\n", This, V_VT(&v)); return E_NOTIMPL; } static HRESULT WINAPI HTMLScriptElement_get_onerror(IHTMLScriptElement *iface, VARIANT *p) { - HTMLScriptElement *This = HTMLSCRIPT_THIS(iface); + HTMLScriptElement *This = impl_from_IHTMLScriptElement(iface); FIXME("(%p)->(%p)\n", This, p); return E_NOTIMPL; } static HRESULT WINAPI HTMLScriptElement_put_type(IHTMLScriptElement *iface, BSTR v) { - HTMLScriptElement *This = HTMLSCRIPT_THIS(iface); + HTMLScriptElement *This = impl_from_IHTMLScriptElement(iface); nsAString nstype_str; nsresult nsres; @@ -230,7 +231,7 @@ static HRESULT WINAPI HTMLScriptElement_put_type(IHTMLScriptElement *iface, BSTR static HRESULT WINAPI HTMLScriptElement_get_type(IHTMLScriptElement *iface, BSTR *p) { - HTMLScriptElement *This = HTMLSCRIPT_THIS(iface); + HTMLScriptElement *This = impl_from_IHTMLScriptElement(iface); const PRUnichar *nstype; nsAString nstype_str; nsresult nsres; @@ -274,8 +275,6 @@ static const IHTMLScriptElementVtbl HTMLScriptElementVtbl = { HTMLScriptElement_get_type }; -#undef HTMLSCRIPT_THIS - #define HTMLSCRIPT_NODE_THIS(iface) DEFINE_THIS2(HTMLScriptElement, element.node, iface) static HRESULT HTMLScriptElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv) @@ -286,13 +285,13 @@ static HRESULT HTMLScriptElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv) if(IsEqualGUID(&IID_IUnknown, riid)) { TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv); - *ppv = HTMLSCRIPT(This); + *ppv = &This->IHTMLScriptElement_iface; }else if(IsEqualGUID(&IID_IDispatch, riid)) { TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv); - *ppv = HTMLSCRIPT(This); + *ppv = &This->IHTMLScriptElement_iface; }else if(IsEqualGUID(&IID_IHTMLScriptElement, riid)) { TRACE("(%p)->(IID_IHTMLScriptElement %p)\n", This, ppv); - *ppv = HTMLSCRIPT(This); + *ppv = &This->IHTMLScriptElement_iface; } if(*ppv) { @@ -313,7 +312,7 @@ static HRESULT HTMLScriptElement_get_readystate(HTMLDOMNode *iface, BSTR *p) { HTMLScriptElement *This = HTMLSCRIPT_NODE_THIS(iface); - return IHTMLScriptElement_get_readyState(HTMLSCRIPT(This), p); + return IHTMLScriptElement_get_readyState(&This->IHTMLScriptElement_iface, p); } #undef HTMLSCRIPT_NODE_THIS @@ -352,7 +351,7 @@ HRESULT HTMLScriptElement_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nsele if(!ret) return E_OUTOFMEMORY; - ret->lpHTMLScriptElementVtbl = &HTMLScriptElementVtbl; + ret->IHTMLScriptElement_iface.lpVtbl = &HTMLScriptElementVtbl; ret->element.node.vtbl = &HTMLScriptElementImplVtbl; nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLScriptElement, (void**)&ret->nsscript);