mshtml: Store HTMLElement struct instead of pointer in HTMLAnchorElement.
This commit is contained in:
parent
754569f608
commit
f68e24a6dc
|
@ -36,9 +36,9 @@
|
|||
WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
|
||||
|
||||
typedef struct {
|
||||
const IHTMLAnchorElementVtbl *lpHTMLAnchorElementVtbl;
|
||||
HTMLElement element;
|
||||
|
||||
HTMLElement *element;
|
||||
const IHTMLAnchorElementVtbl *lpHTMLAnchorElementVtbl;
|
||||
} HTMLAnchorElement;
|
||||
|
||||
#define HTMLANCHOR(x) ((IHTMLAnchorElement*) &(x)->lpHTMLAnchorElementVtbl)
|
||||
|
@ -69,7 +69,7 @@ static HRESULT WINAPI HTMLAnchorElement_QueryInterface(IHTMLAnchorElement *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);
|
||||
|
||||
|
@ -82,7 +82,7 @@ static ULONG WINAPI HTMLAnchorElement_AddRef(IHTMLAnchorElement *iface)
|
|||
|
||||
TRACE("(%p)\n", This);
|
||||
|
||||
return IHTMLDocument2_AddRef(HTMLDOC(This->element->node.doc));
|
||||
return IHTMLDocument2_AddRef(HTMLDOC(This->element.node.doc));
|
||||
}
|
||||
|
||||
static ULONG WINAPI HTMLAnchorElement_Release(IHTMLAnchorElement *iface)
|
||||
|
@ -91,7 +91,7 @@ static ULONG WINAPI HTMLAnchorElement_Release(IHTMLAnchorElement *iface)
|
|||
|
||||
TRACE("(%p)\n", This);
|
||||
|
||||
return IHTMLDocument2_Release(HTMLDOC(This->element->node.doc));
|
||||
return IHTMLDocument2_Release(HTMLDOC(This->element.node.doc));
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLAnchorElement_GetTypeInfoCount(IHTMLAnchorElement *iface, UINT *pctinfo)
|
||||
|
@ -473,13 +473,14 @@ static const IHTMLAnchorElementVtbl HTMLAnchorElementVtbl = {
|
|||
HTMLAnchorElement_blur
|
||||
};
|
||||
|
||||
void HTMLAnchorElement_Create(HTMLElement *element)
|
||||
HTMLElement *HTMLAnchorElement_Create(nsIDOMHTMLElement *nselem)
|
||||
{
|
||||
HTMLAnchorElement *ret = mshtml_alloc(sizeof(HTMLAnchorElement));
|
||||
|
||||
ret->lpHTMLAnchorElementVtbl = &HTMLAnchorElementVtbl;
|
||||
ret->element = element;
|
||||
|
||||
element->impl = (IUnknown*)HTMLANCHOR(ret);
|
||||
element->destructor = HTMLAnchorElement_destructor;
|
||||
ret->element.impl = (IUnknown*)HTMLANCHOR(ret);
|
||||
ret->element.destructor = HTMLAnchorElement_destructor;
|
||||
|
||||
return &ret->element;
|
||||
}
|
||||
|
|
|
@ -1273,6 +1273,7 @@ HRESULT HTMLElement_QI(HTMLElement *This, REFIID riid, void **ppv)
|
|||
|
||||
HTMLElement *HTMLElement_Create(nsIDOMNode *nsnode)
|
||||
{
|
||||
nsIDOMHTMLElement *nselem;
|
||||
HTMLElement *ret;
|
||||
nsAString class_name_str;
|
||||
const PRUnichar *class_name;
|
||||
|
@ -1284,39 +1285,45 @@ HTMLElement *HTMLElement_Create(nsIDOMNode *nsnode)
|
|||
static const WCHAR wszSELECT[] = {'S','E','L','E','C','T',0};
|
||||
static const WCHAR wszTEXTAREA[] = {'T','E','X','T','A','R','E','A',0};
|
||||
|
||||
ret = mshtml_alloc(sizeof(HTMLElement));
|
||||
ret->lpHTMLElementVtbl = &HTMLElementVtbl;
|
||||
ret->impl = NULL;
|
||||
ret->destructor = NULL;
|
||||
|
||||
ret->node.node_type = NT_HTMLELEM;
|
||||
ret->node.impl.elem = HTMLELEM(ret);
|
||||
ret->node.destructor = HTMLElement_destructor;
|
||||
|
||||
HTMLElement2_Init(ret);
|
||||
|
||||
nsres = nsIDOMNode_QueryInterface(nsnode, &IID_nsIDOMHTMLElement, (void**)&ret->nselem);
|
||||
nsres = nsIDOMNode_QueryInterface(nsnode, &IID_nsIDOMHTMLElement, (void**)&nselem);
|
||||
if(NS_FAILED(nsres))
|
||||
return NULL;
|
||||
|
||||
nsAString_Init(&class_name_str, NULL);
|
||||
nsIDOMHTMLElement_GetTagName(ret->nselem, &class_name_str);
|
||||
nsIDOMHTMLElement_GetTagName(nselem, &class_name_str);
|
||||
|
||||
nsAString_GetData(&class_name_str, &class_name, NULL);
|
||||
|
||||
if(!strcmpW(class_name, wszA))
|
||||
HTMLAnchorElement_Create(ret);
|
||||
else if(!strcmpW(class_name, wszBODY))
|
||||
HTMLBodyElement_Create(ret);
|
||||
else if(!strcmpW(class_name, wszINPUT))
|
||||
HTMLInputElement_Create(ret);
|
||||
else if(!strcmpW(class_name, wszSELECT))
|
||||
HTMLSelectElement_Create(ret);
|
||||
else if(!strcmpW(class_name, wszTEXTAREA))
|
||||
HTMLTextAreaElement_Create(ret);
|
||||
ret = HTMLAnchorElement_Create(nselem);
|
||||
else {
|
||||
ret = mshtml_alloc(sizeof(HTMLElement));
|
||||
|
||||
ret->impl = NULL;
|
||||
ret->destructor = NULL;
|
||||
ret->nselem = nselem;
|
||||
|
||||
if(!strcmpW(class_name, wszBODY))
|
||||
HTMLBodyElement_Create(ret);
|
||||
else if(!strcmpW(class_name, wszINPUT))
|
||||
HTMLInputElement_Create(ret);
|
||||
else if(!strcmpW(class_name, wszSELECT))
|
||||
HTMLSelectElement_Create(ret);
|
||||
else if(!strcmpW(class_name, wszTEXTAREA))
|
||||
HTMLTextAreaElement_Create(ret);
|
||||
}
|
||||
|
||||
nsAString_Finish(&class_name_str);
|
||||
|
||||
ret->lpHTMLElementVtbl = &HTMLElementVtbl;
|
||||
ret->nselem = nselem;
|
||||
|
||||
HTMLElement2_Init(ret);
|
||||
|
||||
ret->node.node_type = NT_HTMLELEM;
|
||||
ret->node.impl.elem = HTMLELEM(ret);
|
||||
ret->node.destructor = HTMLElement_destructor;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
@ -416,7 +416,7 @@ void detach_selection(HTMLDocument*);
|
|||
void detach_ranges(HTMLDocument*);
|
||||
|
||||
HTMLElement *HTMLElement_Create(nsIDOMNode*);
|
||||
void HTMLAnchorElement_Create(HTMLElement*);
|
||||
HTMLElement *HTMLAnchorElement_Create(nsIDOMHTMLElement*);
|
||||
void HTMLBodyElement_Create(HTMLElement*);
|
||||
void HTMLInputElement_Create(HTMLElement*);
|
||||
void HTMLSelectElement_Create(HTMLElement*);
|
||||
|
|
Loading…
Reference in New Issue