Commit 6d158cf1 authored by Michael Stefaniuc's avatar Michael Stefaniuc Committed by Alexandre Julliard

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

parent 00324ea8
......@@ -35,12 +35,15 @@ WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
typedef struct {
HTMLElement element;
const IHTMLSelectElementVtbl *lpHTMLSelectElementVtbl;
IHTMLSelectElement IHTMLSelectElement_iface;
nsIDOMHTMLSelectElement *nsselect;
} HTMLSelectElement;
#define HTMLSELECT(x) ((IHTMLSelectElement*) &(x)->lpHTMLSelectElementVtbl)
static inline HTMLSelectElement *impl_from_IHTMLSelectElement(IHTMLSelectElement *iface)
{
return CONTAINING_RECORD(iface, HTMLSelectElement, IHTMLSelectElement_iface);
}
static HRESULT htmlselect_item(HTMLSelectElement *This, int i, IDispatch **ret)
{
......@@ -78,33 +81,31 @@ static HRESULT htmlselect_item(HTMLSelectElement *This, int i, IDispatch **ret)
return S_OK;
}
#define HTMLSELECT_THIS(iface) DEFINE_THIS(HTMLSelectElement, HTMLSelectElement, iface)
static HRESULT WINAPI HTMLSelectElement_QueryInterface(IHTMLSelectElement *iface,
REFIID riid, void **ppv)
{
HTMLSelectElement *This = HTMLSELECT_THIS(iface);
HTMLSelectElement *This = impl_from_IHTMLSelectElement(iface);
return IHTMLDOMNode_QueryInterface(HTMLDOMNODE(&This->element.node), riid, ppv);
}
static ULONG WINAPI HTMLSelectElement_AddRef(IHTMLSelectElement *iface)
{
HTMLSelectElement *This = HTMLSELECT_THIS(iface);
HTMLSelectElement *This = impl_from_IHTMLSelectElement(iface);
return IHTMLDOMNode_AddRef(HTMLDOMNODE(&This->element.node));
}
static ULONG WINAPI HTMLSelectElement_Release(IHTMLSelectElement *iface)
{
HTMLSelectElement *This = HTMLSELECT_THIS(iface);
HTMLSelectElement *This = impl_from_IHTMLSelectElement(iface);
return IHTMLDOMNode_Release(HTMLDOMNODE(&This->element.node));
}
static HRESULT WINAPI HTMLSelectElement_GetTypeInfoCount(IHTMLSelectElement *iface, UINT *pctinfo)
{
HTMLSelectElement *This = HTMLSELECT_THIS(iface);
HTMLSelectElement *This = impl_from_IHTMLSelectElement(iface);
return IDispatchEx_GetTypeInfoCount(DISPATCHEX(&This->element.node.dispex), pctinfo);
}
......@@ -112,7 +113,7 @@ static HRESULT WINAPI HTMLSelectElement_GetTypeInfoCount(IHTMLSelectElement *ifa
static HRESULT WINAPI HTMLSelectElement_GetTypeInfo(IHTMLSelectElement *iface, UINT iTInfo,
LCID lcid, ITypeInfo **ppTInfo)
{
HTMLSelectElement *This = HTMLSELECT_THIS(iface);
HTMLSelectElement *This = impl_from_IHTMLSelectElement(iface);
return IDispatchEx_GetTypeInfo(DISPATCHEX(&This->element.node.dispex), iTInfo, lcid, ppTInfo);
}
......@@ -121,7 +122,7 @@ static HRESULT WINAPI HTMLSelectElement_GetIDsOfNames(IHTMLSelectElement *iface,
LPOLESTR *rgszNames, UINT cNames,
LCID lcid, DISPID *rgDispId)
{
HTMLSelectElement *This = HTMLSELECT_THIS(iface);
HTMLSelectElement *This = impl_from_IHTMLSelectElement(iface);
return IDispatchEx_GetIDsOfNames(DISPATCHEX(&This->element.node.dispex), riid, rgszNames, cNames, lcid, rgDispId);
}
......@@ -130,7 +131,7 @@ static HRESULT WINAPI HTMLSelectElement_Invoke(IHTMLSelectElement *iface, DISPID
REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
{
HTMLSelectElement *This = HTMLSELECT_THIS(iface);
HTMLSelectElement *This = impl_from_IHTMLSelectElement(iface);
return IDispatchEx_Invoke(DISPATCHEX(&This->element.node.dispex), dispIdMember, riid, lcid,
wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
......@@ -138,42 +139,42 @@ static HRESULT WINAPI HTMLSelectElement_Invoke(IHTMLSelectElement *iface, DISPID
static HRESULT WINAPI HTMLSelectElement_put_size(IHTMLSelectElement *iface, LONG v)
{
HTMLSelectElement *This = HTMLSELECT_THIS(iface);
HTMLSelectElement *This = impl_from_IHTMLSelectElement(iface);
FIXME("(%p)->(%d)\n", This, v);
return E_NOTIMPL;
}
static HRESULT WINAPI HTMLSelectElement_get_size(IHTMLSelectElement *iface, LONG *p)
{
HTMLSelectElement *This = HTMLSELECT_THIS(iface);
HTMLSelectElement *This = impl_from_IHTMLSelectElement(iface);
FIXME("(%p)->(%p)\n", This, p);
return E_NOTIMPL;
}
static HRESULT WINAPI HTMLSelectElement_put_multiple(IHTMLSelectElement *iface, VARIANT_BOOL v)
{
HTMLSelectElement *This = HTMLSELECT_THIS(iface);
HTMLSelectElement *This = impl_from_IHTMLSelectElement(iface);
FIXME("(%p)->(%x)\n", This, v);
return E_NOTIMPL;
}
static HRESULT WINAPI HTMLSelectElement_get_multiple(IHTMLSelectElement *iface, VARIANT_BOOL *p)
{
HTMLSelectElement *This = HTMLSELECT_THIS(iface);
HTMLSelectElement *This = impl_from_IHTMLSelectElement(iface);
FIXME("(%p)->(%p)\n", This, p);
return E_NOTIMPL;
}
static HRESULT WINAPI HTMLSelectElement_put_name(IHTMLSelectElement *iface, BSTR v)
{
HTMLSelectElement *This = HTMLSELECT_THIS(iface);
HTMLSelectElement *This = impl_from_IHTMLSelectElement(iface);
FIXME("(%p)->(%s)\n", This, debugstr_w(v));
return E_NOTIMPL;
}
static HRESULT WINAPI HTMLSelectElement_get_name(IHTMLSelectElement *iface, BSTR *p)
{
HTMLSelectElement *This = HTMLSELECT_THIS(iface);
HTMLSelectElement *This = impl_from_IHTMLSelectElement(iface);
nsAString name_str;
const PRUnichar *name = NULL;
nsresult nsres;
......@@ -205,18 +206,18 @@ static HRESULT WINAPI HTMLSelectElement_get_name(IHTMLSelectElement *iface, BSTR
static HRESULT WINAPI HTMLSelectElement_get_options(IHTMLSelectElement *iface, IDispatch **p)
{
HTMLSelectElement *This = HTMLSELECT_THIS(iface);
HTMLSelectElement *This = impl_from_IHTMLSelectElement(iface);
TRACE("(%p)->(%p)\n", This, p);
*p = (IDispatch*)HTMLSELECT(This);
*p = (IDispatch*)&This->IHTMLSelectElement_iface;
IDispatch_AddRef(*p);
return S_OK;
}
static HRESULT WINAPI HTMLSelectElement_put_onchange(IHTMLSelectElement *iface, VARIANT v)
{
HTMLSelectElement *This = HTMLSELECT_THIS(iface);
HTMLSelectElement *This = impl_from_IHTMLSelectElement(iface);
TRACE("(%p)->()\n", This);
......@@ -225,14 +226,14 @@ static HRESULT WINAPI HTMLSelectElement_put_onchange(IHTMLSelectElement *iface,
static HRESULT WINAPI HTMLSelectElement_get_onchange(IHTMLSelectElement *iface, VARIANT *p)
{
HTMLSelectElement *This = HTMLSELECT_THIS(iface);
HTMLSelectElement *This = impl_from_IHTMLSelectElement(iface);
FIXME("(%p)->(%p)\n", This, p);
return E_NOTIMPL;
}
static HRESULT WINAPI HTMLSelectElement_put_selectedIndex(IHTMLSelectElement *iface, LONG v)
{
HTMLSelectElement *This = HTMLSELECT_THIS(iface);
HTMLSelectElement *This = impl_from_IHTMLSelectElement(iface);
nsresult nsres;
TRACE("(%p)->(%d)\n", This, v);
......@@ -246,7 +247,7 @@ static HRESULT WINAPI HTMLSelectElement_put_selectedIndex(IHTMLSelectElement *if
static HRESULT WINAPI HTMLSelectElement_get_selectedIndex(IHTMLSelectElement *iface, LONG *p)
{
HTMLSelectElement *This = HTMLSELECT_THIS(iface);
HTMLSelectElement *This = impl_from_IHTMLSelectElement(iface);
PRInt32 idx = 0;
nsresult nsres;
......@@ -262,7 +263,7 @@ static HRESULT WINAPI HTMLSelectElement_get_selectedIndex(IHTMLSelectElement *if
static HRESULT WINAPI HTMLSelectElement_get_type(IHTMLSelectElement *iface, BSTR *p)
{
HTMLSelectElement *This = HTMLSELECT_THIS(iface);
HTMLSelectElement *This = impl_from_IHTMLSelectElement(iface);
const PRUnichar *type;
nsAString type_str;
nsresult nsres;
......@@ -287,7 +288,7 @@ static HRESULT WINAPI HTMLSelectElement_get_type(IHTMLSelectElement *iface, BSTR
static HRESULT WINAPI HTMLSelectElement_put_value(IHTMLSelectElement *iface, BSTR v)
{
HTMLSelectElement *This = HTMLSELECT_THIS(iface);
HTMLSelectElement *This = impl_from_IHTMLSelectElement(iface);
nsAString value_str;
nsresult nsres;
......@@ -304,7 +305,7 @@ static HRESULT WINAPI HTMLSelectElement_put_value(IHTMLSelectElement *iface, BST
static HRESULT WINAPI HTMLSelectElement_get_value(IHTMLSelectElement *iface, BSTR *p)
{
HTMLSelectElement *This = HTMLSELECT_THIS(iface);
HTMLSelectElement *This = impl_from_IHTMLSelectElement(iface);
nsAString value_str;
const PRUnichar *value = NULL;
nsresult nsres;
......@@ -329,7 +330,7 @@ static HRESULT WINAPI HTMLSelectElement_get_value(IHTMLSelectElement *iface, BST
static HRESULT WINAPI HTMLSelectElement_put_disabled(IHTMLSelectElement *iface, VARIANT_BOOL v)
{
HTMLSelectElement *This = HTMLSELECT_THIS(iface);
HTMLSelectElement *This = impl_from_IHTMLSelectElement(iface);
nsresult nsres;
TRACE("(%p)->(%x)\n", This, v);
......@@ -345,7 +346,7 @@ static HRESULT WINAPI HTMLSelectElement_put_disabled(IHTMLSelectElement *iface,
static HRESULT WINAPI HTMLSelectElement_get_disabled(IHTMLSelectElement *iface, VARIANT_BOOL *p)
{
HTMLSelectElement *This = HTMLSELECT_THIS(iface);
HTMLSelectElement *This = impl_from_IHTMLSelectElement(iface);
PRBool disabled = FALSE;
nsresult nsres;
......@@ -363,7 +364,7 @@ static HRESULT WINAPI HTMLSelectElement_get_disabled(IHTMLSelectElement *iface,
static HRESULT WINAPI HTMLSelectElement_get_form(IHTMLSelectElement *iface, IHTMLFormElement **p)
{
HTMLSelectElement *This = HTMLSELECT_THIS(iface);
HTMLSelectElement *This = impl_from_IHTMLSelectElement(iface);
FIXME("(%p)->(%p)\n", This, p);
return E_NOTIMPL;
}
......@@ -371,7 +372,7 @@ static HRESULT WINAPI HTMLSelectElement_get_form(IHTMLSelectElement *iface, IHTM
static HRESULT WINAPI HTMLSelectElement_add(IHTMLSelectElement *iface, IHTMLElement *element,
VARIANT before)
{
HTMLSelectElement *This = HTMLSELECT_THIS(iface);
HTMLSelectElement *This = impl_from_IHTMLSelectElement(iface);
IHTMLDOMNode *node, *tmp;
HRESULT hres;
......@@ -396,14 +397,14 @@ static HRESULT WINAPI HTMLSelectElement_add(IHTMLSelectElement *iface, IHTMLElem
static HRESULT WINAPI HTMLSelectElement_remove(IHTMLSelectElement *iface, LONG index)
{
HTMLSelectElement *This = HTMLSELECT_THIS(iface);
HTMLSelectElement *This = impl_from_IHTMLSelectElement(iface);
FIXME("(%p)->(%d)\n", This, index);
return E_NOTIMPL;
}
static HRESULT WINAPI HTMLSelectElement_put_length(IHTMLSelectElement *iface, LONG v)
{
HTMLSelectElement *This = HTMLSELECT_THIS(iface);
HTMLSelectElement *This = impl_from_IHTMLSelectElement(iface);
nsresult nsres;
TRACE("(%p)->(%d)\n", This, v);
......@@ -417,7 +418,7 @@ static HRESULT WINAPI HTMLSelectElement_put_length(IHTMLSelectElement *iface, LO
static HRESULT WINAPI HTMLSelectElement_get_length(IHTMLSelectElement *iface, LONG *p)
{
HTMLSelectElement *This = HTMLSELECT_THIS(iface);
HTMLSelectElement *This = impl_from_IHTMLSelectElement(iface);
PRUint32 length = 0;
nsresult nsres;
......@@ -435,7 +436,7 @@ static HRESULT WINAPI HTMLSelectElement_get_length(IHTMLSelectElement *iface, LO
static HRESULT WINAPI HTMLSelectElement_get__newEnum(IHTMLSelectElement *iface, IUnknown **p)
{
HTMLSelectElement *This = HTMLSELECT_THIS(iface);
HTMLSelectElement *This = impl_from_IHTMLSelectElement(iface);
FIXME("(%p)->(%p)\n", This, p);
return E_NOTIMPL;
}
......@@ -443,7 +444,7 @@ static HRESULT WINAPI HTMLSelectElement_get__newEnum(IHTMLSelectElement *iface,
static HRESULT WINAPI HTMLSelectElement_item(IHTMLSelectElement *iface, VARIANT name,
VARIANT index, IDispatch **pdisp)
{
HTMLSelectElement *This = HTMLSELECT_THIS(iface);
HTMLSelectElement *This = impl_from_IHTMLSelectElement(iface);
TRACE("(%p)->(%s %s %p)\n", This, debugstr_variant(&name), debugstr_variant(&index), pdisp);
......@@ -464,13 +465,11 @@ static HRESULT WINAPI HTMLSelectElement_item(IHTMLSelectElement *iface, VARIANT
static HRESULT WINAPI HTMLSelectElement_tags(IHTMLSelectElement *iface, VARIANT tagName,
IDispatch **pdisp)
{
HTMLSelectElement *This = HTMLSELECT_THIS(iface);
HTMLSelectElement *This = impl_from_IHTMLSelectElement(iface);
FIXME("(%p)->(v %p)\n", This, pdisp);
return E_NOTIMPL;
}
#undef HTMLSELECT_THIS
static const IHTMLSelectElementVtbl HTMLSelectElementVtbl = {
HTMLSelectElement_QueryInterface,
HTMLSelectElement_AddRef,
......@@ -515,13 +514,13 @@ static HRESULT HTMLSelectElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
if(IsEqualGUID(&IID_IUnknown, riid)) {
TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
*ppv = HTMLSELECT(This);
*ppv = &This->IHTMLSelectElement_iface;
}else if(IsEqualGUID(&IID_IDispatch, riid)) {
TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv);
*ppv = HTMLSELECT(This);
*ppv = &This->IHTMLSelectElement_iface;
}else if(IsEqualGUID(&IID_IHTMLSelectElement, riid)) {
TRACE("(%p)->(IID_IHTMLSelectElement %p)\n", This, ppv);
*ppv = HTMLSELECT(This);
*ppv = &This->IHTMLSelectElement_iface;
}
if(*ppv) {
......@@ -544,13 +543,13 @@ static void HTMLSelectElement_destructor(HTMLDOMNode *iface)
static HRESULT HTMLSelectElementImpl_put_disabled(HTMLDOMNode *iface, VARIANT_BOOL v)
{
HTMLSelectElement *This = HTMLSELECT_NODE_THIS(iface);
return IHTMLSelectElement_put_disabled(HTMLSELECT(This), v);
return IHTMLSelectElement_put_disabled(&This->IHTMLSelectElement_iface, v);
}
static HRESULT HTMLSelectElementImpl_get_disabled(HTMLDOMNode *iface, VARIANT_BOOL *p)
{
HTMLSelectElement *This = HTMLSELECT_NODE_THIS(iface);
return IHTMLSelectElement_get_disabled(HTMLSELECT(This), p);
return IHTMLSelectElement_get_disabled(&This->IHTMLSelectElement_iface, p);
}
#define DISPID_OPTIONCOL_0 MSHTML_DISPID_CUSTOM_MIN
......@@ -645,7 +644,7 @@ HRESULT HTMLSelectElement_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nsele
if(!ret)
return E_OUTOFMEMORY;
ret->lpHTMLSelectElementVtbl = &HTMLSelectElementVtbl;
ret->IHTMLSelectElement_iface.lpVtbl = &HTMLSelectElementVtbl;
ret->element.node.vtbl = &HTMLSelectElementImplVtbl;
nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLSelectElement,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment