mshtml: Use an iface instead of a vtbl pointer in HTMLBodyElement.
Michael Stefaniuc
mstefani at redhat.de
Mon Dec 6 09:44:18 CST 2010
---
dlls/mshtml/htmlbody.c | 103 ++++++++++++++++++++++++------------------------
1 files changed, 51 insertions(+), 52 deletions(-)
diff --git a/dlls/mshtml/htmlbody.c b/dlls/mshtml/htmlbody.c
index 2dcc9ed..ecf73fd 100644
--- a/dlls/mshtml/htmlbody.c
+++ b/dlls/mshtml/htmlbody.c
@@ -35,15 +35,13 @@ WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
typedef struct {
HTMLTextContainer textcont;
- const IHTMLBodyElementVtbl *lpHTMLBodyElementVtbl;
+ IHTMLBodyElement IHTMLBodyElement_iface;
ConnectionPoint cp_propnotif;
nsIDOMHTMLBodyElement *nsbody;
} HTMLBodyElement;
-#define HTMLBODY(x) (&(x)->lpHTMLBodyElementVtbl)
-
static const WCHAR aquaW[] = {'a','q','u','a',0};
static const WCHAR blackW[] = {'b','l','a','c','k',0};
static const WCHAR blueW[] = {'b','l','u','e',0};
@@ -195,40 +193,43 @@ static void nscolor_to_variant(const nsAString *nsstr, VARIANT *p)
}
}
-#define HTMLBODY_THIS(iface) DEFINE_THIS(HTMLBodyElement, HTMLBodyElement, iface)
+static inline HTMLBodyElement *impl_from_IHTMLBodyElement(IHTMLBodyElement *iface)
+{
+ return CONTAINING_RECORD(iface, HTMLBodyElement, IHTMLBodyElement_iface);
+}
static HRESULT WINAPI HTMLBodyElement_QueryInterface(IHTMLBodyElement *iface,
REFIID riid, void **ppv)
{
- HTMLBodyElement *This = HTMLBODY_THIS(iface);
+ HTMLBodyElement *This = impl_from_IHTMLBodyElement(iface);
return IHTMLDOMNode_QueryInterface(HTMLDOMNODE(&This->textcont.element.node), riid, ppv);
}
static ULONG WINAPI HTMLBodyElement_AddRef(IHTMLBodyElement *iface)
{
- HTMLBodyElement *This = HTMLBODY_THIS(iface);
+ HTMLBodyElement *This = impl_from_IHTMLBodyElement(iface);
return IHTMLDOMNode_AddRef(HTMLDOMNODE(&This->textcont.element.node));
}
static ULONG WINAPI HTMLBodyElement_Release(IHTMLBodyElement *iface)
{
- HTMLBodyElement *This = HTMLBODY_THIS(iface);
+ HTMLBodyElement *This = impl_from_IHTMLBodyElement(iface);
return IHTMLDOMNode_Release(HTMLDOMNODE(&This->textcont.element.node));
}
static HRESULT WINAPI HTMLBodyElement_GetTypeInfoCount(IHTMLBodyElement *iface, UINT *pctinfo)
{
- HTMLBodyElement *This = HTMLBODY_THIS(iface);
+ HTMLBodyElement *This = impl_from_IHTMLBodyElement(iface);
return IDispatchEx_GetTypeInfoCount(DISPATCHEX(&This->textcont.element.node.dispex), pctinfo);
}
static HRESULT WINAPI HTMLBodyElement_GetTypeInfo(IHTMLBodyElement *iface, UINT iTInfo,
LCID lcid, ITypeInfo **ppTInfo)
{
- HTMLBodyElement *This = HTMLBODY_THIS(iface);
+ HTMLBodyElement *This = impl_from_IHTMLBodyElement(iface);
return IDispatchEx_GetTypeInfo(DISPATCHEX(&This->textcont.element.node.dispex), iTInfo, lcid, ppTInfo);
}
@@ -236,7 +237,7 @@ static HRESULT WINAPI HTMLBodyElement_GetIDsOfNames(IHTMLBodyElement *iface, REF
LPOLESTR *rgszNames, UINT cNames,
LCID lcid, DISPID *rgDispId)
{
- HTMLBodyElement *This = HTMLBODY_THIS(iface);
+ HTMLBodyElement *This = impl_from_IHTMLBodyElement(iface);
return IDispatchEx_GetIDsOfNames(DISPATCHEX(&This->textcont.element.node.dispex), riid, rgszNames, cNames, lcid, rgDispId);
}
@@ -244,14 +245,14 @@ static HRESULT WINAPI HTMLBodyElement_Invoke(IHTMLBodyElement *iface, DISPID dis
REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
{
- HTMLBodyElement *This = HTMLBODY_THIS(iface);
+ HTMLBodyElement *This = impl_from_IHTMLBodyElement(iface);
return IDispatchEx_Invoke(DISPATCHEX(&This->textcont.element.node.dispex), dispIdMember, riid, lcid,
wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
}
static HRESULT WINAPI HTMLBodyElement_put_background(IHTMLBodyElement *iface, BSTR v)
{
- HTMLBodyElement *This = HTMLBODY_THIS(iface);
+ HTMLBodyElement *This = impl_from_IHTMLBodyElement(iface);
nsAString nsstr;
nsresult nsres;
@@ -268,7 +269,7 @@ static HRESULT WINAPI HTMLBodyElement_put_background(IHTMLBodyElement *iface, BS
static HRESULT WINAPI HTMLBodyElement_get_background(IHTMLBodyElement *iface, BSTR *p)
{
- HTMLBodyElement *This = HTMLBODY_THIS(iface);
+ HTMLBodyElement *This = impl_from_IHTMLBodyElement(iface);
nsAString background_str;
nsresult nsres;
@@ -294,91 +295,91 @@ static HRESULT WINAPI HTMLBodyElement_get_background(IHTMLBodyElement *iface, BS
static HRESULT WINAPI HTMLBodyElement_put_bgProperties(IHTMLBodyElement *iface, BSTR v)
{
- HTMLBodyElement *This = HTMLBODY_THIS(iface);
+ HTMLBodyElement *This = impl_from_IHTMLBodyElement(iface);
FIXME("(%p)->(%s)\n", This, debugstr_w(v));
return E_NOTIMPL;
}
static HRESULT WINAPI HTMLBodyElement_get_bgProperties(IHTMLBodyElement *iface, BSTR *p)
{
- HTMLBodyElement *This = HTMLBODY_THIS(iface);
+ HTMLBodyElement *This = impl_from_IHTMLBodyElement(iface);
FIXME("(%p)->(%p)\n", This, p);
return E_NOTIMPL;
}
static HRESULT WINAPI HTMLBodyElement_put_leftMargin(IHTMLBodyElement *iface, VARIANT v)
{
- HTMLBodyElement *This = HTMLBODY_THIS(iface);
+ HTMLBodyElement *This = impl_from_IHTMLBodyElement(iface);
FIXME("(%p)->()\n", This);
return E_NOTIMPL;
}
static HRESULT WINAPI HTMLBodyElement_get_leftMargin(IHTMLBodyElement *iface, VARIANT *p)
{
- HTMLBodyElement *This = HTMLBODY_THIS(iface);
+ HTMLBodyElement *This = impl_from_IHTMLBodyElement(iface);
FIXME("(%p)->(%p)\n", This, p);
return E_NOTIMPL;
}
static HRESULT WINAPI HTMLBodyElement_put_topMargin(IHTMLBodyElement *iface, VARIANT v)
{
- HTMLBodyElement *This = HTMLBODY_THIS(iface);
+ HTMLBodyElement *This = impl_from_IHTMLBodyElement(iface);
FIXME("(%p)->()\n", This);
return E_NOTIMPL;
}
static HRESULT WINAPI HTMLBodyElement_get_topMargin(IHTMLBodyElement *iface, VARIANT *p)
{
- HTMLBodyElement *This = HTMLBODY_THIS(iface);
+ HTMLBodyElement *This = impl_from_IHTMLBodyElement(iface);
FIXME("(%p)->(%p)\n", This, p);
return E_NOTIMPL;
}
static HRESULT WINAPI HTMLBodyElement_put_rightMargin(IHTMLBodyElement *iface, VARIANT v)
{
- HTMLBodyElement *This = HTMLBODY_THIS(iface);
+ HTMLBodyElement *This = impl_from_IHTMLBodyElement(iface);
FIXME("(%p)->()\n", This);
return E_NOTIMPL;
}
static HRESULT WINAPI HTMLBodyElement_get_rightMargin(IHTMLBodyElement *iface, VARIANT *p)
{
- HTMLBodyElement *This = HTMLBODY_THIS(iface);
+ HTMLBodyElement *This = impl_from_IHTMLBodyElement(iface);
FIXME("(%p)->(%p)\n", This, p);
return E_NOTIMPL;
}
static HRESULT WINAPI HTMLBodyElement_put_bottomMargin(IHTMLBodyElement *iface, VARIANT v)
{
- HTMLBodyElement *This = HTMLBODY_THIS(iface);
+ HTMLBodyElement *This = impl_from_IHTMLBodyElement(iface);
FIXME("(%p)->()\n", This);
return E_NOTIMPL;
}
static HRESULT WINAPI HTMLBodyElement_get_bottomMargin(IHTMLBodyElement *iface, VARIANT *p)
{
- HTMLBodyElement *This = HTMLBODY_THIS(iface);
+ HTMLBodyElement *This = impl_from_IHTMLBodyElement(iface);
FIXME("(%p)->(%p)\n", This, p);
return E_NOTIMPL;
}
static HRESULT WINAPI HTMLBodyElement_put_noWrap(IHTMLBodyElement *iface, VARIANT_BOOL v)
{
- HTMLBodyElement *This = HTMLBODY_THIS(iface);
+ HTMLBodyElement *This = impl_from_IHTMLBodyElement(iface);
FIXME("(%p)->(%x)\n", This, v);
return E_NOTIMPL;
}
static HRESULT WINAPI HTMLBodyElement_get_noWrap(IHTMLBodyElement *iface, VARIANT_BOOL *p)
{
- HTMLBodyElement *This = HTMLBODY_THIS(iface);
+ HTMLBodyElement *This = impl_from_IHTMLBodyElement(iface);
FIXME("(%p)->(%p)\n", This, p);
return E_NOTIMPL;
}
static HRESULT WINAPI HTMLBodyElement_put_bgColor(IHTMLBodyElement *iface, VARIANT v)
{
- HTMLBodyElement *This = HTMLBODY_THIS(iface);
+ HTMLBodyElement *This = impl_from_IHTMLBodyElement(iface);
nsAString strColor;
nsresult nsres;
@@ -397,7 +398,7 @@ static HRESULT WINAPI HTMLBodyElement_put_bgColor(IHTMLBodyElement *iface, VARIA
static HRESULT WINAPI HTMLBodyElement_get_bgColor(IHTMLBodyElement *iface, VARIANT *p)
{
- HTMLBodyElement *This = HTMLBODY_THIS(iface);
+ HTMLBodyElement *This = impl_from_IHTMLBodyElement(iface);
nsAString strColor;
nsresult nsres;
HRESULT hres;
@@ -423,7 +424,7 @@ static HRESULT WINAPI HTMLBodyElement_get_bgColor(IHTMLBodyElement *iface, VARIA
static HRESULT WINAPI HTMLBodyElement_put_text(IHTMLBodyElement *iface, VARIANT v)
{
- HTMLBodyElement *This = HTMLBODY_THIS(iface);
+ HTMLBodyElement *This = impl_from_IHTMLBodyElement(iface);
nsAString text;
nsresult nsres;
@@ -444,7 +445,7 @@ static HRESULT WINAPI HTMLBodyElement_put_text(IHTMLBodyElement *iface, VARIANT
static HRESULT WINAPI HTMLBodyElement_get_text(IHTMLBodyElement *iface, VARIANT *p)
{
- HTMLBodyElement *This = HTMLBODY_THIS(iface);
+ HTMLBodyElement *This = impl_from_IHTMLBodyElement(iface);
nsAString text;
nsresult nsres;
HRESULT hres;
@@ -471,7 +472,7 @@ static HRESULT WINAPI HTMLBodyElement_get_text(IHTMLBodyElement *iface, VARIANT
static HRESULT WINAPI HTMLBodyElement_put_link(IHTMLBodyElement *iface, VARIANT v)
{
- HTMLBodyElement *This = HTMLBODY_THIS(iface);
+ HTMLBodyElement *This = impl_from_IHTMLBodyElement(iface);
nsAString link_str;
nsresult nsres;
@@ -490,7 +491,7 @@ static HRESULT WINAPI HTMLBodyElement_put_link(IHTMLBodyElement *iface, VARIANT
static HRESULT WINAPI HTMLBodyElement_get_link(IHTMLBodyElement *iface, VARIANT *p)
{
- HTMLBodyElement *This = HTMLBODY_THIS(iface);
+ HTMLBodyElement *This = impl_from_IHTMLBodyElement(iface);
nsAString link_str;
nsresult nsres;
@@ -509,7 +510,7 @@ static HRESULT WINAPI HTMLBodyElement_get_link(IHTMLBodyElement *iface, VARIANT
static HRESULT WINAPI HTMLBodyElement_put_vLink(IHTMLBodyElement *iface, VARIANT v)
{
- HTMLBodyElement *This = HTMLBODY_THIS(iface);
+ HTMLBodyElement *This = impl_from_IHTMLBodyElement(iface);
nsAString vlink_str;
nsresult nsres;
@@ -528,7 +529,7 @@ static HRESULT WINAPI HTMLBodyElement_put_vLink(IHTMLBodyElement *iface, VARIANT
static HRESULT WINAPI HTMLBodyElement_get_vLink(IHTMLBodyElement *iface, VARIANT *p)
{
- HTMLBodyElement *This = HTMLBODY_THIS(iface);
+ HTMLBodyElement *This = impl_from_IHTMLBodyElement(iface);
nsAString vlink_str;
nsresult nsres;
@@ -547,7 +548,7 @@ static HRESULT WINAPI HTMLBodyElement_get_vLink(IHTMLBodyElement *iface, VARIANT
static HRESULT WINAPI HTMLBodyElement_put_aLink(IHTMLBodyElement *iface, VARIANT v)
{
- HTMLBodyElement *This = HTMLBODY_THIS(iface);
+ HTMLBodyElement *This = impl_from_IHTMLBodyElement(iface);
nsAString alink_str;
nsresult nsres;
@@ -566,7 +567,7 @@ static HRESULT WINAPI HTMLBodyElement_put_aLink(IHTMLBodyElement *iface, VARIANT
static HRESULT WINAPI HTMLBodyElement_get_aLink(IHTMLBodyElement *iface, VARIANT *p)
{
- HTMLBodyElement *This = HTMLBODY_THIS(iface);
+ HTMLBodyElement *This = impl_from_IHTMLBodyElement(iface);
nsAString alink_str;
nsresult nsres;
@@ -585,77 +586,77 @@ static HRESULT WINAPI HTMLBodyElement_get_aLink(IHTMLBodyElement *iface, VARIANT
static HRESULT WINAPI HTMLBodyElement_put_onload(IHTMLBodyElement *iface, VARIANT v)
{
- HTMLBodyElement *This = HTMLBODY_THIS(iface);
+ HTMLBodyElement *This = impl_from_IHTMLBodyElement(iface);
FIXME("(%p)->()\n", This);
return E_NOTIMPL;
}
static HRESULT WINAPI HTMLBodyElement_get_onload(IHTMLBodyElement *iface, VARIANT *p)
{
- HTMLBodyElement *This = HTMLBODY_THIS(iface);
+ HTMLBodyElement *This = impl_from_IHTMLBodyElement(iface);
FIXME("(%p)->(%p)\n", This, p);
return E_NOTIMPL;
}
static HRESULT WINAPI HTMLBodyElement_put_onunload(IHTMLBodyElement *iface, VARIANT v)
{
- HTMLBodyElement *This = HTMLBODY_THIS(iface);
+ HTMLBodyElement *This = impl_from_IHTMLBodyElement(iface);
FIXME("(%p)->()\n", This);
return E_NOTIMPL;
}
static HRESULT WINAPI HTMLBodyElement_get_onunload(IHTMLBodyElement *iface, VARIANT *p)
{
- HTMLBodyElement *This = HTMLBODY_THIS(iface);
+ HTMLBodyElement *This = impl_from_IHTMLBodyElement(iface);
FIXME("(%p)->(%p)\n", This, p);
return E_NOTIMPL;
}
static HRESULT WINAPI HTMLBodyElement_put_scroll(IHTMLBodyElement *iface, BSTR v)
{
- HTMLBodyElement *This = HTMLBODY_THIS(iface);
+ HTMLBodyElement *This = impl_from_IHTMLBodyElement(iface);
FIXME("(%p)->(%s)\n", This, debugstr_w(v));
return E_NOTIMPL;
}
static HRESULT WINAPI HTMLBodyElement_get_scroll(IHTMLBodyElement *iface, BSTR *p)
{
- HTMLBodyElement *This = HTMLBODY_THIS(iface);
+ HTMLBodyElement *This = impl_from_IHTMLBodyElement(iface);
FIXME("(%p)->(%p)\n", This, p);
return E_NOTIMPL;
}
static HRESULT WINAPI HTMLBodyElement_put_onselect(IHTMLBodyElement *iface, VARIANT v)
{
- HTMLBodyElement *This = HTMLBODY_THIS(iface);
+ HTMLBodyElement *This = impl_from_IHTMLBodyElement(iface);
FIXME("(%p)->()\n", This);
return E_NOTIMPL;
}
static HRESULT WINAPI HTMLBodyElement_get_onselect(IHTMLBodyElement *iface, VARIANT *p)
{
- HTMLBodyElement *This = HTMLBODY_THIS(iface);
+ HTMLBodyElement *This = impl_from_IHTMLBodyElement(iface);
FIXME("(%p)->(%p)\n", This, p);
return E_NOTIMPL;
}
static HRESULT WINAPI HTMLBodyElement_put_onbeforeunload(IHTMLBodyElement *iface, VARIANT v)
{
- HTMLBodyElement *This = HTMLBODY_THIS(iface);
+ HTMLBodyElement *This = impl_from_IHTMLBodyElement(iface);
FIXME("(%p)->()\n", This);
return E_NOTIMPL;
}
static HRESULT WINAPI HTMLBodyElement_get_onbeforeunload(IHTMLBodyElement *iface, VARIANT *p)
{
- HTMLBodyElement *This = HTMLBODY_THIS(iface);
+ HTMLBodyElement *This = impl_from_IHTMLBodyElement(iface);
FIXME("(%p)->(%p)\n", This, p);
return E_NOTIMPL;
}
static HRESULT WINAPI HTMLBodyElement_createTextRange(IHTMLBodyElement *iface, IHTMLTxtRange **range)
{
- HTMLBodyElement *This = HTMLBODY_THIS(iface);
+ HTMLBodyElement *This = impl_from_IHTMLBodyElement(iface);
nsIDOMDocumentRange *nsdocrange;
nsIDOMRange *nsrange = NULL;
nsresult nsres;
@@ -692,8 +693,6 @@ static HRESULT WINAPI HTMLBodyElement_createTextRange(IHTMLBodyElement *iface, I
return hres;
}
-#undef HTMLBODY_THIS
-
static const IHTMLBodyElementVtbl HTMLBodyElementVtbl = {
HTMLBodyElement_QueryInterface,
HTMLBodyElement_AddRef,
@@ -749,13 +748,13 @@ static HRESULT HTMLBodyElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
if(IsEqualGUID(&IID_IUnknown, riid)) {
TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
- *ppv = HTMLBODY(This);
+ *ppv = &This->IHTMLBodyElement_iface;
}else if(IsEqualGUID(&IID_IDispatch, riid)) {
TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv);
- *ppv = HTMLBODY(This);
+ *ppv = &This->IHTMLBodyElement_iface;
}else if(IsEqualGUID(&IID_IHTMLBodyElement, riid)) {
TRACE("(%p)->(IID_IHTMLBodyElement %p)\n", This, ppv);
- *ppv = HTMLBODY(This);
+ *ppv = &This->IHTMLBodyElement_iface;
}else if(IsEqualGUID(&IID_IHTMLTextContainer, riid)) {
TRACE("(%p)->(IID_IHTMLTextContainer %p)\n", &This->textcont, ppv);
*ppv = HTMLTEXTCONT(&This->textcont);
@@ -821,7 +820,7 @@ HRESULT HTMLBodyElement_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem,
if(!ret)
return E_OUTOFMEMORY;
- ret->lpHTMLBodyElementVtbl = &HTMLBodyElementVtbl;
+ ret->IHTMLBodyElement_iface.lpVtbl = &HTMLBodyElementVtbl;
ret->textcont.element.node.vtbl = &HTMLBodyElementImplVtbl;
nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLBodyElement, (void**)&ret->nsbody);
--
1.7.2.3
More information about the wine-patches
mailing list