Module: wine Branch: master Commit: 75f2ae345325adca4c5035516ed5bd2bb8c115c3 URL: https://gitlab.winehq.org/wine/wine/-/commit/75f2ae345325adca4c5035516ed5bd2...
Author: Gabriel Ivăncescu gabrielopcode@gmail.com Date: Fri Sep 15 16:54:17 2023 +0300
mshtml: Unlink document nodes and fragments using the dispex.
Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com
---
dlls/mshtml/htmldoc.c | 40 ++++++++++++++++------------------------ dlls/mshtml/htmlnode.c | 5 ----- dlls/mshtml/mshtml_private.h | 2 -- 3 files changed, 16 insertions(+), 31 deletions(-)
diff --git a/dlls/mshtml/htmldoc.c b/dlls/mshtml/htmldoc.c index bff2452f4cd..f5c9bf8ed1a 100644 --- a/dlls/mshtml/htmldoc.c +++ b/dlls/mshtml/htmldoc.c @@ -5843,26 +5843,12 @@ static HRESULT HTMLDocumentNode_clone(HTMLDOMNode *iface, nsIDOMNode *nsnode, HT return E_NOTIMPL; }
-static void HTMLDocumentNode_unlink(HTMLDOMNode *iface) -{ - HTMLDocumentNode *This = impl_from_HTMLDOMNode(iface); - - if(This->dom_document) { - release_document_mutation(This); - detach_document_node(This); - This->dom_document = NULL; - This->html_document = NULL; - This->window = NULL; - } -} - static const NodeImplVtbl HTMLDocumentNodeImplVtbl = { .clsid = &CLSID_HTMLDocument, .qi = HTMLDocumentNode_QI, .destructor = HTMLDocumentNode_destructor, .cpc_entries = HTMLDocumentNode_cpc, .clone = HTMLDocumentNode_clone, - .unlink = HTMLDocumentNode_unlink };
static HRESULT HTMLDocumentFragment_clone(HTMLDOMNode *iface, nsIDOMNode *nsnode, HTMLDOMNode **ret) @@ -5879,11 +5865,23 @@ static HRESULT HTMLDocumentFragment_clone(HTMLDOMNode *iface, nsIDOMNode *nsnode return S_OK; }
-static void HTMLDocumentFragment_unlink(HTMLDOMNode *iface) +static inline HTMLDocumentNode *impl_from_DispatchEx(DispatchEx *iface) { - HTMLDocumentNode *This = impl_from_HTMLDOMNode(iface); + return CONTAINING_RECORD(iface, HTMLDocumentNode, node.event_target.dispex); +}
- if(This->window) { +static void HTMLDocumentNode_unlink(DispatchEx *dispex) +{ + HTMLDocumentNode *This = impl_from_DispatchEx(dispex); + HTMLDOMNode_unlink(dispex); + + if(This->dom_document) { + release_document_mutation(This); + detach_document_node(This); + This->dom_document = NULL; + This->html_document = NULL; + This->window = NULL; + }else if(This->window) { detach_document_node(This);
/* document fragments own reference to inner window */ @@ -5892,11 +5890,6 @@ static void HTMLDocumentFragment_unlink(HTMLDOMNode *iface) } }
-static inline HTMLDocumentNode *impl_from_DispatchEx(DispatchEx *iface) -{ - return CONTAINING_RECORD(iface, HTMLDocumentNode, node.event_target.dispex); -} - static HRESULT HTMLDocumentNode_get_name(DispatchEx *dispex, DISPID id, BSTR *name) { HTMLDocumentNode *This = impl_from_DispatchEx(dispex); @@ -6071,7 +6064,7 @@ static const event_target_vtbl_t HTMLDocumentNode_event_target_vtbl = { .query_interface = HTMLDOMNode_query_interface, .destructor = HTMLDOMNode_destructor, .traverse = HTMLDOMNode_traverse, - .unlink = HTMLDOMNode_unlink, + .unlink = HTMLDocumentNode_unlink, .get_name = HTMLDocumentNode_get_name, .invoke = HTMLDocumentNode_invoke, .next_dispid = HTMLDocumentNode_next_dispid, @@ -6090,7 +6083,6 @@ static const NodeImplVtbl HTMLDocumentFragmentImplVtbl = { .destructor = HTMLDocumentNode_destructor, .cpc_entries = HTMLDocumentNode_cpc, .clone = HTMLDocumentFragment_clone, - .unlink = HTMLDocumentFragment_unlink };
static const tid_t HTMLDocumentNode_iface_tids[] = { diff --git a/dlls/mshtml/htmlnode.c b/dlls/mshtml/htmlnode.c index 407142f828c..a2bec6126ba 100644 --- a/dlls/mshtml/htmlnode.c +++ b/dlls/mshtml/htmlnode.c @@ -1414,8 +1414,6 @@ void HTMLDOMNode_traverse(DispatchEx *dispex, nsCycleCollectionTraversalCallback { HTMLDOMNode *This = HTMLDOMNode_from_DispatchEx(dispex);
- if(This->vtbl->traverse) - This->vtbl->traverse(This, cb); if(This->nsnode) note_cc_edge((nsISupports*)This->nsnode, "nsnode", cb); if(This->doc && &This->doc->node != This) @@ -1426,9 +1424,6 @@ void HTMLDOMNode_unlink(DispatchEx *dispex) { HTMLDOMNode *This = HTMLDOMNode_from_DispatchEx(dispex);
- if(This->vtbl->unlink) - This->vtbl->unlink(This); - release_event_target(&This->event_target); unlink_ref(&This->nsnode);
diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index d185961acf6..41034f42636 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -828,8 +828,6 @@ typedef struct { HRESULT (*get_name)(HTMLDOMNode*,DISPID,BSTR*); HRESULT (*invoke)(HTMLDOMNode*,DISPID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,IServiceProvider*); HRESULT (*bind_to_tree)(HTMLDOMNode*); - void (*traverse)(HTMLDOMNode*,nsCycleCollectionTraversalCallback*); - void (*unlink)(HTMLDOMNode*); BOOL (*is_text_edit)(HTMLDOMNode*); BOOL (*is_settable)(HTMLDOMNode*,DISPID); } NodeImplVtbl;