Commit 75f2ae34 authored by Gabriel Ivăncescu's avatar Gabriel Ivăncescu Committed by Alexandre Julliard

mshtml: Unlink document nodes and fragments using the dispex.

parent 71f0ea7e
...@@ -5843,26 +5843,12 @@ static HRESULT HTMLDocumentNode_clone(HTMLDOMNode *iface, nsIDOMNode *nsnode, HT ...@@ -5843,26 +5843,12 @@ static HRESULT HTMLDocumentNode_clone(HTMLDOMNode *iface, nsIDOMNode *nsnode, HT
return E_NOTIMPL; 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 = { static const NodeImplVtbl HTMLDocumentNodeImplVtbl = {
.clsid = &CLSID_HTMLDocument, .clsid = &CLSID_HTMLDocument,
.qi = HTMLDocumentNode_QI, .qi = HTMLDocumentNode_QI,
.destructor = HTMLDocumentNode_destructor, .destructor = HTMLDocumentNode_destructor,
.cpc_entries = HTMLDocumentNode_cpc, .cpc_entries = HTMLDocumentNode_cpc,
.clone = HTMLDocumentNode_clone, .clone = HTMLDocumentNode_clone,
.unlink = HTMLDocumentNode_unlink
}; };
static HRESULT HTMLDocumentFragment_clone(HTMLDOMNode *iface, nsIDOMNode *nsnode, HTMLDOMNode **ret) static HRESULT HTMLDocumentFragment_clone(HTMLDOMNode *iface, nsIDOMNode *nsnode, HTMLDOMNode **ret)
...@@ -5879,11 +5865,23 @@ static HRESULT HTMLDocumentFragment_clone(HTMLDOMNode *iface, nsIDOMNode *nsnode ...@@ -5879,11 +5865,23 @@ static HRESULT HTMLDocumentFragment_clone(HTMLDOMNode *iface, nsIDOMNode *nsnode
return S_OK; 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); detach_document_node(This);
/* document fragments own reference to inner window */ /* document fragments own reference to inner window */
...@@ -5892,11 +5890,6 @@ static void HTMLDocumentFragment_unlink(HTMLDOMNode *iface) ...@@ -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) static HRESULT HTMLDocumentNode_get_name(DispatchEx *dispex, DISPID id, BSTR *name)
{ {
HTMLDocumentNode *This = impl_from_DispatchEx(dispex); HTMLDocumentNode *This = impl_from_DispatchEx(dispex);
...@@ -6071,7 +6064,7 @@ static const event_target_vtbl_t HTMLDocumentNode_event_target_vtbl = { ...@@ -6071,7 +6064,7 @@ static const event_target_vtbl_t HTMLDocumentNode_event_target_vtbl = {
.query_interface = HTMLDOMNode_query_interface, .query_interface = HTMLDOMNode_query_interface,
.destructor = HTMLDOMNode_destructor, .destructor = HTMLDOMNode_destructor,
.traverse = HTMLDOMNode_traverse, .traverse = HTMLDOMNode_traverse,
.unlink = HTMLDOMNode_unlink, .unlink = HTMLDocumentNode_unlink,
.get_name = HTMLDocumentNode_get_name, .get_name = HTMLDocumentNode_get_name,
.invoke = HTMLDocumentNode_invoke, .invoke = HTMLDocumentNode_invoke,
.next_dispid = HTMLDocumentNode_next_dispid, .next_dispid = HTMLDocumentNode_next_dispid,
...@@ -6090,7 +6083,6 @@ static const NodeImplVtbl HTMLDocumentFragmentImplVtbl = { ...@@ -6090,7 +6083,6 @@ static const NodeImplVtbl HTMLDocumentFragmentImplVtbl = {
.destructor = HTMLDocumentNode_destructor, .destructor = HTMLDocumentNode_destructor,
.cpc_entries = HTMLDocumentNode_cpc, .cpc_entries = HTMLDocumentNode_cpc,
.clone = HTMLDocumentFragment_clone, .clone = HTMLDocumentFragment_clone,
.unlink = HTMLDocumentFragment_unlink
}; };
static const tid_t HTMLDocumentNode_iface_tids[] = { static const tid_t HTMLDocumentNode_iface_tids[] = {
......
...@@ -1414,8 +1414,6 @@ void HTMLDOMNode_traverse(DispatchEx *dispex, nsCycleCollectionTraversalCallback ...@@ -1414,8 +1414,6 @@ void HTMLDOMNode_traverse(DispatchEx *dispex, nsCycleCollectionTraversalCallback
{ {
HTMLDOMNode *This = HTMLDOMNode_from_DispatchEx(dispex); HTMLDOMNode *This = HTMLDOMNode_from_DispatchEx(dispex);
if(This->vtbl->traverse)
This->vtbl->traverse(This, cb);
if(This->nsnode) if(This->nsnode)
note_cc_edge((nsISupports*)This->nsnode, "nsnode", cb); note_cc_edge((nsISupports*)This->nsnode, "nsnode", cb);
if(This->doc && &This->doc->node != This) if(This->doc && &This->doc->node != This)
...@@ -1426,9 +1424,6 @@ void HTMLDOMNode_unlink(DispatchEx *dispex) ...@@ -1426,9 +1424,6 @@ void HTMLDOMNode_unlink(DispatchEx *dispex)
{ {
HTMLDOMNode *This = HTMLDOMNode_from_DispatchEx(dispex); HTMLDOMNode *This = HTMLDOMNode_from_DispatchEx(dispex);
if(This->vtbl->unlink)
This->vtbl->unlink(This);
release_event_target(&This->event_target); release_event_target(&This->event_target);
unlink_ref(&This->nsnode); unlink_ref(&This->nsnode);
......
...@@ -828,8 +828,6 @@ typedef struct { ...@@ -828,8 +828,6 @@ typedef struct {
HRESULT (*get_name)(HTMLDOMNode*,DISPID,BSTR*); HRESULT (*get_name)(HTMLDOMNode*,DISPID,BSTR*);
HRESULT (*invoke)(HTMLDOMNode*,DISPID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,IServiceProvider*); HRESULT (*invoke)(HTMLDOMNode*,DISPID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,IServiceProvider*);
HRESULT (*bind_to_tree)(HTMLDOMNode*); HRESULT (*bind_to_tree)(HTMLDOMNode*);
void (*traverse)(HTMLDOMNode*,nsCycleCollectionTraversalCallback*);
void (*unlink)(HTMLDOMNode*);
BOOL (*is_text_edit)(HTMLDOMNode*); BOOL (*is_text_edit)(HTMLDOMNode*);
BOOL (*is_settable)(HTMLDOMNode*,DISPID); BOOL (*is_settable)(HTMLDOMNode*,DISPID);
} NodeImplVtbl; } NodeImplVtbl;
......
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