Commit cf35bbd2 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

mshtml: Share nsIDOMText reference with nsIDOMNode.

parent d9efd6a4
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#include <stdarg.h> #include <stdarg.h>
#include <assert.h>
#define COBJMACROS #define COBJMACROS
...@@ -178,16 +179,6 @@ static HRESULT HTMLDOMTextNode_QI(HTMLDOMNode *iface, REFIID riid, void **ppv) ...@@ -178,16 +179,6 @@ static HRESULT HTMLDOMTextNode_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
return S_OK; return S_OK;
} }
static void HTMLDOMTextNode_destructor(HTMLDOMNode *iface)
{
HTMLDOMTextNode *This = impl_from_HTMLDOMNode(iface);
if(This->nstext)
IHTMLDOMTextNode_Release(This->nstext);
HTMLDOMNode_destructor(&This->node);
}
static HRESULT HTMLDOMTextNode_clone(HTMLDOMNode *iface, nsIDOMNode *nsnode, HTMLDOMNode **ret) static HRESULT HTMLDOMTextNode_clone(HTMLDOMNode *iface, nsIDOMNode *nsnode, HTMLDOMNode **ret)
{ {
HTMLDOMTextNode *This = impl_from_HTMLDOMNode(iface); HTMLDOMTextNode *This = impl_from_HTMLDOMNode(iface);
...@@ -197,7 +188,7 @@ static HRESULT HTMLDOMTextNode_clone(HTMLDOMNode *iface, nsIDOMNode *nsnode, HTM ...@@ -197,7 +188,7 @@ static HRESULT HTMLDOMTextNode_clone(HTMLDOMNode *iface, nsIDOMNode *nsnode, HTM
static const NodeImplVtbl HTMLDOMTextNodeImplVtbl = { static const NodeImplVtbl HTMLDOMTextNodeImplVtbl = {
HTMLDOMTextNode_QI, HTMLDOMTextNode_QI,
HTMLDOMTextNode_destructor, HTMLDOMNode_destructor,
HTMLDOMTextNode_clone HTMLDOMTextNode_clone
}; };
...@@ -226,17 +217,17 @@ HRESULT HTMLDOMTextNode_Create(HTMLDocumentNode *doc, nsIDOMNode *nsnode, HTMLDO ...@@ -226,17 +217,17 @@ HRESULT HTMLDOMTextNode_Create(HTMLDocumentNode *doc, nsIDOMNode *nsnode, HTMLDO
ret->node.vtbl = &HTMLDOMTextNodeImplVtbl; ret->node.vtbl = &HTMLDOMTextNodeImplVtbl;
ret->IHTMLDOMTextNode_iface.lpVtbl = &HTMLDOMTextNodeVtbl; ret->IHTMLDOMTextNode_iface.lpVtbl = &HTMLDOMTextNodeVtbl;
nsres = nsIDOMNode_QueryInterface(nsnode, &IID_nsIDOMText, (void**)&ret->nstext);
if(NS_FAILED(nsres)) {
ERR("Could not get nsIDOMText iface: %08x\n", nsres);
heap_free(ret);
return E_FAIL;
}
init_dispex(&ret->node.dispex, (IUnknown*)&ret->IHTMLDOMTextNode_iface, init_dispex(&ret->node.dispex, (IUnknown*)&ret->IHTMLDOMTextNode_iface,
&HTMLDOMTextNode_dispex); &HTMLDOMTextNode_dispex);
HTMLDOMNode_Init(doc, &ret->node, nsnode); HTMLDOMNode_Init(doc, &ret->node, nsnode);
nsres = nsIDOMNode_QueryInterface(nsnode, &IID_nsIDOMText, (void**)&ret->nstext);
assert(nsres == NS_OK && (nsIDOMNode*)ret->nstext == ret->node.nsnode);
/* Share reference with nsnode */
nsIDOMNode_Release(ret->node.nsnode);
*node = &ret->node; *node = &ret->node;
return S_OK; return S_OK;
} }
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