Module: wine Branch: master Commit: 05f6885f6231bb2aa0799528b9aa86d20818ff51 URL: https://gitlab.winehq.org/wine/wine/-/commit/05f6885f6231bb2aa0799528b9aa86d...
Author: Gabriel Ivăncescu gabrielopcode@gmail.com Date: Mon Mar 20 19:44:58 2023 +0200
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: Gabriel Ivăncescu gabrielopcode@gmail.com
---
dlls/mshtml/htmldoc.c | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-)
diff --git a/dlls/mshtml/htmldoc.c b/dlls/mshtml/htmldoc.c index f3a370848da..1669b4c518b 100644 --- a/dlls/mshtml/htmldoc.c +++ b/dlls/mshtml/htmldoc.c @@ -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; }