mshtml: Don't share nsstyle reference with nsnode.

This commit is contained in:
Jacek Caban 2014-09-24 16:05:32 +02:00 committed by Alexandre Julliard
parent 727c1ceb1e
commit 316417cc3d
1 changed files with 33 additions and 5 deletions

View File

@ -319,13 +319,44 @@ static void HTMLStyleElement_destructor(HTMLDOMNode *iface)
HTMLElement_destructor(iface); HTMLElement_destructor(iface);
} }
static void HTMLStyleElement_traverse(HTMLDOMNode *iface, nsCycleCollectionTraversalCallback *cb)
{
HTMLStyleElement *This = impl_from_HTMLDOMNode(iface);
if(This->nsstyle)
note_cc_edge((nsISupports*)This->nsstyle, "This->nsstyle", cb);
}
static void HTMLStyleElement_unlink(HTMLDOMNode *iface)
{
HTMLStyleElement *This = impl_from_HTMLDOMNode(iface);
if(This->nsstyle) {
nsIDOMHTMLStyleElement *nsstyle = This->nsstyle;
This->nsstyle = NULL;
nsIDOMHTMLStyleElement_Release(nsstyle);
}
}
static const NodeImplVtbl HTMLStyleElementImplVtbl = { static const NodeImplVtbl HTMLStyleElementImplVtbl = {
HTMLStyleElement_QI, HTMLStyleElement_QI,
HTMLStyleElement_destructor, HTMLStyleElement_destructor,
HTMLElement_cpc, HTMLElement_cpc,
HTMLElement_clone, HTMLElement_clone,
HTMLElement_handle_event, HTMLElement_handle_event,
HTMLElement_get_attr_col HTMLElement_get_attr_col,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
HTMLStyleElement_traverse,
HTMLStyleElement_unlink
}; };
static const tid_t HTMLStyleElement_iface_tids[] = { static const tid_t HTMLStyleElement_iface_tids[] = {
@ -355,10 +386,7 @@ HRESULT HTMLStyleElement_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem
HTMLElement_Init(&ret->element, doc, nselem, &HTMLStyleElement_dispex); HTMLElement_Init(&ret->element, doc, nselem, &HTMLStyleElement_dispex);
nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLStyleElement, (void**)&ret->nsstyle); nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLStyleElement, (void**)&ret->nsstyle);
assert(nsres == NS_OK);
/* Share nsstyle reference with nsnode */
assert(nsres == NS_OK && (nsIDOMNode*)ret->nsstyle == ret->element.node.nsnode);
nsIDOMNode_Release(ret->element.node.nsnode);
*elem = &ret->element; *elem = &ret->element;
return S_OK; return S_OK;