mirror of
git://source.winehq.org/git/wine.git
synced 2024-11-05 18:01:34 +00:00
mshtml: Share nsimg reference with nsnode.
This commit is contained in:
parent
caada38f04
commit
8a9d3c845b
1 changed files with 8 additions and 18 deletions
|
@ -17,6 +17,7 @@
|
|||
*/
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <assert.h>
|
||||
|
||||
#define COBJMACROS
|
||||
|
||||
|
@ -621,16 +622,6 @@ static HRESULT HTMLImgElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
|
|||
return S_OK;
|
||||
}
|
||||
|
||||
static void HTMLImgElement_destructor(HTMLDOMNode *iface)
|
||||
{
|
||||
HTMLImgElement *This = impl_from_HTMLDOMNode(iface);
|
||||
|
||||
if(This->nsimg)
|
||||
nsIDOMHTMLImageElement_Release(This->nsimg);
|
||||
|
||||
HTMLElement_destructor(&This->element.node);
|
||||
}
|
||||
|
||||
static HRESULT HTMLImgElement_get_readystate(HTMLDOMNode *iface, BSTR *p)
|
||||
{
|
||||
HTMLImgElement *This = impl_from_HTMLDOMNode(iface);
|
||||
|
@ -640,7 +631,7 @@ static HRESULT HTMLImgElement_get_readystate(HTMLDOMNode *iface, BSTR *p)
|
|||
|
||||
static const NodeImplVtbl HTMLImgElementImplVtbl = {
|
||||
HTMLImgElement_QI,
|
||||
HTMLImgElement_destructor,
|
||||
HTMLElement_destructor,
|
||||
HTMLElement_clone,
|
||||
HTMLElement_get_attr_col,
|
||||
NULL,
|
||||
|
@ -676,15 +667,14 @@ HRESULT HTMLImgElement_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem,
|
|||
ret->IHTMLImgElement_iface.lpVtbl = &HTMLImgElementVtbl;
|
||||
ret->element.node.vtbl = &HTMLImgElementImplVtbl;
|
||||
|
||||
nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLImageElement, (void**)&ret->nsimg);
|
||||
if(NS_FAILED(nsres)) {
|
||||
ERR("Could not get nsIDOMHTMLImageElement: %08x\n", nsres);
|
||||
heap_free(ret);
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
HTMLElement_Init(&ret->element, doc, nselem, &HTMLImgElement_dispex);
|
||||
|
||||
nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLImageElement, (void**)&ret->nsimg);
|
||||
|
||||
/* Share nsimg reference with nsnode */
|
||||
assert(nsres == NS_OK && (nsIDOMNode*)ret->nsimg == ret->element.node.nsnode);
|
||||
nsIDOMNode_Release(ret->element.node.nsnode);
|
||||
|
||||
*elem = &ret->element;
|
||||
return S_OK;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue