Commit 8a8af7b4 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

mshtml: Store HTMLElement struct instead of pointer in HTMLInputElement.

parent d17a1afe
...@@ -1298,6 +1298,8 @@ HTMLElement *HTMLElement_Create(nsIDOMNode *nsnode) ...@@ -1298,6 +1298,8 @@ HTMLElement *HTMLElement_Create(nsIDOMNode *nsnode)
ret = HTMLAnchorElement_Create(nselem); ret = HTMLAnchorElement_Create(nselem);
else if(!strcmpW(class_name, wszBODY)) else if(!strcmpW(class_name, wszBODY))
ret = HTMLBodyElement_Create(nselem); ret = HTMLBodyElement_Create(nselem);
else if(!strcmpW(class_name, wszINPUT))
ret = HTMLInputElement_Create(nselem);
else { else {
ret = mshtml_alloc(sizeof(HTMLElement)); ret = mshtml_alloc(sizeof(HTMLElement));
...@@ -1305,9 +1307,7 @@ HTMLElement *HTMLElement_Create(nsIDOMNode *nsnode) ...@@ -1305,9 +1307,7 @@ HTMLElement *HTMLElement_Create(nsIDOMNode *nsnode)
ret->destructor = NULL; ret->destructor = NULL;
ret->nselem = nselem; ret->nselem = nselem;
if(!strcmpW(class_name, wszINPUT)) if(!strcmpW(class_name, wszSELECT))
HTMLInputElement_Create(ret);
else if(!strcmpW(class_name, wszSELECT))
HTMLSelectElement_Create(ret); HTMLSelectElement_Create(ret);
else if(!strcmpW(class_name, wszTEXTAREA)) else if(!strcmpW(class_name, wszTEXTAREA))
HTMLTextAreaElement_Create(ret); HTMLTextAreaElement_Create(ret);
......
...@@ -36,9 +36,10 @@ ...@@ -36,9 +36,10 @@
WINE_DEFAULT_DEBUG_CHANNEL(mshtml); WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
typedef struct { typedef struct {
HTMLElement element;
const IHTMLInputElementVtbl *lpHTMLInputElementVtbl; const IHTMLInputElementVtbl *lpHTMLInputElementVtbl;
HTMLElement *element;
nsIDOMHTMLInputElement *nsinput; nsIDOMHTMLInputElement *nsinput;
} HTMLInputElement; } HTMLInputElement;
...@@ -70,7 +71,7 @@ static HRESULT WINAPI HTMLInputElement_QueryInterface(IHTMLInputElement *iface, ...@@ -70,7 +71,7 @@ static HRESULT WINAPI HTMLInputElement_QueryInterface(IHTMLInputElement *iface,
return S_OK; return S_OK;
} }
hres = HTMLElement_QI(This->element, riid, ppv); hres = HTMLElement_QI(&This->element, riid, ppv);
if(FAILED(hres)) if(FAILED(hres))
WARN("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppv); WARN("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppv);
...@@ -83,7 +84,7 @@ static ULONG WINAPI HTMLInputElement_AddRef(IHTMLInputElement *iface) ...@@ -83,7 +84,7 @@ static ULONG WINAPI HTMLInputElement_AddRef(IHTMLInputElement *iface)
TRACE("(%p)\n", This); TRACE("(%p)\n", This);
return IHTMLDocument2_AddRef(HTMLDOC(This->element->node.doc)); return IHTMLDocument2_AddRef(HTMLDOC(This->element.node.doc));
} }
static ULONG WINAPI HTMLInputElement_Release(IHTMLInputElement *iface) static ULONG WINAPI HTMLInputElement_Release(IHTMLInputElement *iface)
...@@ -92,7 +93,7 @@ static ULONG WINAPI HTMLInputElement_Release(IHTMLInputElement *iface) ...@@ -92,7 +93,7 @@ static ULONG WINAPI HTMLInputElement_Release(IHTMLInputElement *iface)
TRACE("(%p)\n", This); TRACE("(%p)\n", This);
return IHTMLDocument2_Release(HTMLDOC(This->element->node.doc)); return IHTMLDocument2_Release(HTMLDOC(This->element.node.doc));
} }
static HRESULT WINAPI HTMLInputElement_GetTypeInfoCount(IHTMLInputElement *iface, UINT *pctinfo) static HRESULT WINAPI HTMLInputElement_GetTypeInfoCount(IHTMLInputElement *iface, UINT *pctinfo)
...@@ -737,19 +738,20 @@ static const IHTMLInputElementVtbl HTMLInputElementVtbl = { ...@@ -737,19 +738,20 @@ static const IHTMLInputElementVtbl HTMLInputElementVtbl = {
HTMLInputElement_get_start HTMLInputElement_get_start
}; };
void HTMLInputElement_Create(HTMLElement *element) HTMLElement *HTMLInputElement_Create(nsIDOMHTMLElement *nselem)
{ {
HTMLInputElement *ret = mshtml_alloc(sizeof(HTMLInputElement)); HTMLInputElement *ret = mshtml_alloc(sizeof(HTMLInputElement));
nsresult nsres; nsresult nsres;
ret->lpHTMLInputElementVtbl = &HTMLInputElementVtbl; ret->lpHTMLInputElementVtbl = &HTMLInputElementVtbl;
ret->element = element;
nsres = nsIDOMHTMLElement_QueryInterface(element->nselem, &IID_nsIDOMHTMLInputElement, nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLInputElement,
(void**)&ret->nsinput); (void**)&ret->nsinput);
if(NS_FAILED(nsres)) if(NS_FAILED(nsres))
ERR("Could not get nsIDOMHTMLInputElement interface: %08x\n", nsres); ERR("Could not get nsIDOMHTMLInputElement interface: %08x\n", nsres);
element->impl = (IUnknown*)HTMLINPUT(ret); ret->element.impl = (IUnknown*)HTMLINPUT(ret);
element->destructor = HTMLInputElement_destructor; ret->element.destructor = HTMLInputElement_destructor;
return &ret->element;
} }
...@@ -418,7 +418,7 @@ void detach_ranges(HTMLDocument*); ...@@ -418,7 +418,7 @@ void detach_ranges(HTMLDocument*);
HTMLElement *HTMLElement_Create(nsIDOMNode*); HTMLElement *HTMLElement_Create(nsIDOMNode*);
HTMLElement *HTMLAnchorElement_Create(nsIDOMHTMLElement*); HTMLElement *HTMLAnchorElement_Create(nsIDOMHTMLElement*);
HTMLElement *HTMLBodyElement_Create(nsIDOMHTMLElement*); HTMLElement *HTMLBodyElement_Create(nsIDOMHTMLElement*);
void HTMLInputElement_Create(HTMLElement*); HTMLElement *HTMLInputElement_Create(nsIDOMHTMLElement*);
void HTMLSelectElement_Create(HTMLElement*); void HTMLSelectElement_Create(HTMLElement*);
void HTMLTextAreaElement_Create(HTMLElement*); void HTMLTextAreaElement_Create(HTMLElement*);
......
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