Commit 05f6885f authored by Gabriel Ivăncescu's avatar Gabriel Ivăncescu Committed by Alexandre Julliard

mshtml: Share reference with the node for Gecko DOM Documents.

This simplifies the code and CC graph, like it's done for e.g. elements. Signed-off-by: 's avatarGabriel Ivăncescu <gabrielopcode@gmail.com>
parent c6c266a4
......@@ -5860,26 +5860,15 @@ static HRESULT HTMLDocumentNode_clone(HTMLDOMNode *iface, nsIDOMNode *nsnode, HT
return E_NOTIMPL;
}
static void HTMLDocumentNode_traverse(HTMLDOMNode *iface, nsCycleCollectionTraversalCallback *cb)
{
HTMLDocumentNode *This = impl_from_HTMLDOMNode(iface);
if(This->dom_document)
note_cc_edge((nsISupports*)This->dom_document, "This->dom_document", cb);
}
static void HTMLDocumentNode_unlink(HTMLDOMNode *iface)
{
HTMLDocumentNode *This = impl_from_HTMLDOMNode(iface);
if(This->dom_document) {
nsIDOMDocument *dom_document = This->dom_document;
release_document_mutation(This);
detach_document_node(This);
This->dom_document = NULL;
This->html_document = NULL;
nsIDOMDocument_Release(dom_document);
This->window = NULL;
}
}
......@@ -5902,7 +5891,7 @@ static const NodeImplVtbl HTMLDocumentNodeImplVtbl = {
NULL,
NULL,
NULL,
HTMLDocumentNode_traverse,
NULL,
HTMLDocumentNode_unlink
};
......@@ -6272,10 +6261,11 @@ HRESULT create_document_node(nsIDOMDocument *nsdoc, GeckoBrowser *browser, HTMLI
if(!doc_obj->window || (window && is_main_content_window(window->base.outer_window)))
doc->cp_container.forward_container = &doc_obj->cp_container;
if(NS_SUCCEEDED(nsIDOMDocument_QueryInterface(nsdoc, &IID_nsIDOMHTMLDocument, (void**)&doc->html_document)))
/* Share reference with HTMLDOMNode */
if(NS_SUCCEEDED(nsIDOMDocument_QueryInterface(nsdoc, &IID_nsIDOMHTMLDocument, (void**)&doc->html_document))) {
doc->dom_document = (nsIDOMDocument*)doc->html_document;
else {
nsIDOMDocument_AddRef(nsdoc);
nsIDOMHTMLDocument_Release(doc->html_document);
}else {
doc->dom_document = nsdoc;
doc->html_document = NULL;
}
......
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