mshtml: Store HTMLElement struct instead of pointer in HTMLSelectElement.

This commit is contained in:
Jacek Caban 2007-09-15 16:07:01 +02:00 committed by Alexandre Julliard
parent 8a8af7b483
commit 835b814e9f
3 changed files with 15 additions and 13 deletions

View File

@ -1300,6 +1300,8 @@ HTMLElement *HTMLElement_Create(nsIDOMNode *nsnode)
ret = HTMLBodyElement_Create(nselem);
else if(!strcmpW(class_name, wszINPUT))
ret = HTMLInputElement_Create(nselem);
if(!strcmpW(class_name, wszSELECT))
ret = HTMLSelectElement_Create(nselem);
else {
ret = mshtml_alloc(sizeof(HTMLElement));
@ -1307,9 +1309,7 @@ HTMLElement *HTMLElement_Create(nsIDOMNode *nsnode)
ret->destructor = NULL;
ret->nselem = nselem;
if(!strcmpW(class_name, wszSELECT))
HTMLSelectElement_Create(ret);
else if(!strcmpW(class_name, wszTEXTAREA))
if(!strcmpW(class_name, wszTEXTAREA))
HTMLTextAreaElement_Create(ret);
}

View File

@ -36,9 +36,10 @@
WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
typedef struct {
HTMLElement element;
const IHTMLSelectElementVtbl *lpHTMLSelectElementVtbl;
HTMLElement *element;
nsIDOMHTMLSelectElement *nsselect;
} HTMLSelectElement;
@ -70,7 +71,7 @@ static HRESULT WINAPI HTMLSelectElement_QueryInterface(IHTMLSelectElement *iface
return S_OK;
}
hres = HTMLElement_QI(This->element, riid, ppv);
hres = HTMLElement_QI(&This->element, riid, ppv);
if(FAILED(hres))
WARN("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppv);
@ -83,7 +84,7 @@ static ULONG WINAPI HTMLSelectElement_AddRef(IHTMLSelectElement *iface)
TRACE("(%p)\n", This);
return IHTMLDocument2_AddRef(HTMLDOC(This->element->node.doc));
return IHTMLDocument2_AddRef(HTMLDOC(This->element.node.doc));
}
static ULONG WINAPI HTMLSelectElement_Release(IHTMLSelectElement *iface)
@ -92,7 +93,7 @@ static ULONG WINAPI HTMLSelectElement_Release(IHTMLSelectElement *iface)
TRACE("(%p)\n", This);
return IHTMLDocument2_Release(HTMLDOC(This->element->node.doc));
return IHTMLDocument2_Release(HTMLDOC(This->element.node.doc));
}
static HRESULT WINAPI HTMLSelectElement_GetTypeInfoCount(IHTMLSelectElement *iface, UINT *pctinfo)
@ -386,19 +387,20 @@ static const IHTMLSelectElementVtbl HTMLSelectElementVtbl = {
HTMLSelectElement_tags
};
void HTMLSelectElement_Create(HTMLElement *element)
HTMLElement *HTMLSelectElement_Create(nsIDOMHTMLElement *nselem)
{
HTMLSelectElement *ret = mshtml_alloc(sizeof(HTMLSelectElement));
nsresult nsres;
ret->lpHTMLSelectElementVtbl = &HTMLSelectElementVtbl;
ret->element = element;
nsres = nsIDOMHTMLElement_QueryInterface(element->nselem, &IID_nsIDOMHTMLSelectElement,
nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLSelectElement,
(void**)&ret->nsselect);
if(NS_FAILED(nsres))
ERR("Could not get nsIDOMHTMLSelectElement interfce: %08x\n", nsres);
element->impl = (IUnknown*)HTMLSELECT(ret);
element->destructor = HTMLSelectElement_destructor;
ret->element.impl = (IUnknown*)HTMLSELECT(ret);
ret->element.destructor = HTMLSelectElement_destructor;
return &ret->element;
}

View File

@ -419,7 +419,7 @@ HTMLElement *HTMLElement_Create(nsIDOMNode*);
HTMLElement *HTMLAnchorElement_Create(nsIDOMHTMLElement*);
HTMLElement *HTMLBodyElement_Create(nsIDOMHTMLElement*);
HTMLElement *HTMLInputElement_Create(nsIDOMHTMLElement*);
void HTMLSelectElement_Create(HTMLElement*);
HTMLElement *HTMLSelectElement_Create(nsIDOMHTMLElement*);
void HTMLTextAreaElement_Create(HTMLElement*);
void HTMLElement2_Init(HTMLElement*);