mshtml: Store HTMLElement struct instead of pointer in HTMLTextAreaElement.

This commit is contained in:
Jacek Caban 2007-09-15 16:07:26 +02:00 committed by Alexandre Julliard
parent 835b814e9f
commit 99d061a041
3 changed files with 17 additions and 16 deletions

View File

@ -1274,7 +1274,7 @@ HRESULT HTMLElement_QI(HTMLElement *This, REFIID riid, void **ppv)
HTMLElement *HTMLElement_Create(nsIDOMNode *nsnode)
{
nsIDOMHTMLElement *nselem;
HTMLElement *ret;
HTMLElement *ret = NULL;
nsAString class_name_str;
const PRUnichar *class_name;
nsresult nsres;
@ -1302,15 +1302,14 @@ HTMLElement *HTMLElement_Create(nsIDOMNode *nsnode)
ret = HTMLInputElement_Create(nselem);
if(!strcmpW(class_name, wszSELECT))
ret = HTMLSelectElement_Create(nselem);
else {
else if(!strcmpW(class_name, wszTEXTAREA))
ret = HTMLTextAreaElement_Create(nselem);
if(!ret) {
ret = mshtml_alloc(sizeof(HTMLElement));
ret->impl = NULL;
ret->destructor = NULL;
ret->nselem = nselem;
if(!strcmpW(class_name, wszTEXTAREA))
HTMLTextAreaElement_Create(ret);
}
nsAString_Finish(&class_name_str);

View File

@ -36,9 +36,10 @@
WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
typedef struct {
HTMLElement element;
const IHTMLTextAreaElementVtbl *lpHTMLTextAreaElementVtbl;
HTMLElement *element;
nsIDOMHTMLTextAreaElement *nstextarea;
} HTMLTextAreaElement;
@ -70,7 +71,7 @@ static HRESULT WINAPI HTMLTextAreaElement_QueryInterface(IHTMLTextAreaElement *i
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 HTMLTextAreaElement_AddRef(IHTMLTextAreaElement *iface)
TRACE("(%p)\n", This);
return IHTMLDocument2_AddRef(HTMLDOC(This->element->node.doc));
return IHTMLDocument2_AddRef(HTMLDOC(This->element.node.doc));
}
static ULONG WINAPI HTMLTextAreaElement_Release(IHTMLTextAreaElement *iface)
@ -92,7 +93,7 @@ static ULONG WINAPI HTMLTextAreaElement_Release(IHTMLTextAreaElement *iface)
TRACE("(%p)\n", This);
return IHTMLDocument2_Release(HTMLDOC(This->element->node.doc));
return IHTMLDocument2_Release(HTMLDOC(This->element.node.doc));
}
static HRESULT WINAPI HTMLTextAreaElement_GetTypeInfoCount(IHTMLTextAreaElement *iface, UINT *pctinfo)
@ -395,19 +396,20 @@ static const IHTMLTextAreaElementVtbl HTMLTextAreaElementVtbl = {
HTMLTextAreaElement_createTextRange
};
void HTMLTextAreaElement_Create(HTMLElement *element)
HTMLElement *HTMLTextAreaElement_Create(nsIDOMHTMLElement *nselem)
{
HTMLTextAreaElement *ret = mshtml_alloc(sizeof(HTMLTextAreaElement));
nsresult nsres;
ret->lpHTMLTextAreaElementVtbl = &HTMLTextAreaElementVtbl;
ret->element = element;
nsres = nsIDOMHTMLElement_QueryInterface(element->nselem, &IID_nsIDOMHTMLTextAreaElement,
nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLTextAreaElement,
(void**)&ret->nstextarea);
if(NS_FAILED(nsres))
ERR("Could not get nsDOMHTMLInputElement: %08x\n", nsres);
element->impl = (IUnknown*)HTMLTXTAREA(ret);
element->destructor = HTMLTextAreaElement_destructor;
ret->element.impl = (IUnknown*)HTMLTXTAREA(ret);
ret->element.destructor = HTMLTextAreaElement_destructor;
return &ret->element;
}

View File

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