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);
|
WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
const IHTMLAnchorElementVtbl *lpHTMLAnchorElementVtbl;
|
HTMLElement element;
|
||||||
|
|
||||||
HTMLElement *element;
|
const IHTMLAnchorElementVtbl *lpHTMLAnchorElementVtbl;
|
||||||
} HTMLAnchorElement;
|
} HTMLAnchorElement;
|
||||||
|
|
||||||
#define HTMLANCHOR(x) ((IHTMLAnchorElement*) &(x)->lpHTMLAnchorElementVtbl)
|
#define HTMLANCHOR(x) ((IHTMLAnchorElement*) &(x)->lpHTMLAnchorElementVtbl)
|
||||||
|
@ -69,7 +69,7 @@ static HRESULT WINAPI HTMLAnchorElement_QueryInterface(IHTMLAnchorElement *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);
|
||||||
|
|
||||||
|
@ -82,7 +82,7 @@ static ULONG WINAPI HTMLAnchorElement_AddRef(IHTMLAnchorElement *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 HTMLAnchorElement_Release(IHTMLAnchorElement *iface)
|
static ULONG WINAPI HTMLAnchorElement_Release(IHTMLAnchorElement *iface)
|
||||||
|
@ -91,7 +91,7 @@ static ULONG WINAPI HTMLAnchorElement_Release(IHTMLAnchorElement *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 HTMLAnchorElement_GetTypeInfoCount(IHTMLAnchorElement *iface, UINT *pctinfo)
|
static HRESULT WINAPI HTMLAnchorElement_GetTypeInfoCount(IHTMLAnchorElement *iface, UINT *pctinfo)
|
||||||
|
@ -473,13 +473,14 @@ static const IHTMLAnchorElementVtbl HTMLAnchorElementVtbl = {
|
||||||
HTMLAnchorElement_blur
|
HTMLAnchorElement_blur
|
||||||
};
|
};
|
||||||
|
|
||||||
void HTMLAnchorElement_Create(HTMLElement *element)
|
HTMLElement *HTMLAnchorElement_Create(nsIDOMHTMLElement *nselem)
|
||||||
{
|
{
|
||||||
HTMLAnchorElement *ret = mshtml_alloc(sizeof(HTMLAnchorElement));
|
HTMLAnchorElement *ret = mshtml_alloc(sizeof(HTMLAnchorElement));
|
||||||
|
|
||||||
ret->lpHTMLAnchorElementVtbl = &HTMLAnchorElementVtbl;
|
ret->lpHTMLAnchorElementVtbl = &HTMLAnchorElementVtbl;
|
||||||
ret->element = element;
|
|
||||||
|
|
||||||
element->impl = (IUnknown*)HTMLANCHOR(ret);
|
ret->element.impl = (IUnknown*)HTMLANCHOR(ret);
|
||||||
element->destructor = HTMLAnchorElement_destructor;
|
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)
|
HTMLElement *HTMLElement_Create(nsIDOMNode *nsnode)
|
||||||
{
|
{
|
||||||
|
nsIDOMHTMLElement *nselem;
|
||||||
HTMLElement *ret;
|
HTMLElement *ret;
|
||||||
nsAString class_name_str;
|
nsAString class_name_str;
|
||||||
const PRUnichar *class_name;
|
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 wszSELECT[] = {'S','E','L','E','C','T',0};
|
||||||
static const WCHAR wszTEXTAREA[] = {'T','E','X','T','A','R','E','A',0};
|
static const WCHAR wszTEXTAREA[] = {'T','E','X','T','A','R','E','A',0};
|
||||||
|
|
||||||
ret = mshtml_alloc(sizeof(HTMLElement));
|
nsres = nsIDOMNode_QueryInterface(nsnode, &IID_nsIDOMHTMLElement, (void**)&nselem);
|
||||||
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);
|
|
||||||
if(NS_FAILED(nsres))
|
if(NS_FAILED(nsres))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
nsAString_Init(&class_name_str, 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);
|
nsAString_GetData(&class_name_str, &class_name, NULL);
|
||||||
|
|
||||||
if(!strcmpW(class_name, wszA))
|
if(!strcmpW(class_name, wszA))
|
||||||
HTMLAnchorElement_Create(ret);
|
ret = HTMLAnchorElement_Create(nselem);
|
||||||
else if(!strcmpW(class_name, wszBODY))
|
else {
|
||||||
HTMLBodyElement_Create(ret);
|
ret = mshtml_alloc(sizeof(HTMLElement));
|
||||||
else if(!strcmpW(class_name, wszINPUT))
|
|
||||||
HTMLInputElement_Create(ret);
|
ret->impl = NULL;
|
||||||
else if(!strcmpW(class_name, wszSELECT))
|
ret->destructor = NULL;
|
||||||
HTMLSelectElement_Create(ret);
|
ret->nselem = nselem;
|
||||||
else if(!strcmpW(class_name, wszTEXTAREA))
|
|
||||||
HTMLTextAreaElement_Create(ret);
|
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);
|
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;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -416,7 +416,7 @@ void detach_selection(HTMLDocument*);
|
||||||
void detach_ranges(HTMLDocument*);
|
void detach_ranges(HTMLDocument*);
|
||||||
|
|
||||||
HTMLElement *HTMLElement_Create(nsIDOMNode*);
|
HTMLElement *HTMLElement_Create(nsIDOMNode*);
|
||||||
void HTMLAnchorElement_Create(HTMLElement*);
|
HTMLElement *HTMLAnchorElement_Create(nsIDOMHTMLElement*);
|
||||||
void HTMLBodyElement_Create(HTMLElement*);
|
void HTMLBodyElement_Create(HTMLElement*);
|
||||||
void HTMLInputElement_Create(HTMLElement*);
|
void HTMLInputElement_Create(HTMLElement*);
|
||||||
void HTMLSelectElement_Create(HTMLElement*);
|
void HTMLSelectElement_Create(HTMLElement*);
|
||||||
|
|
Loading…
Reference in New Issue