Commit 1b09514c authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

mshtml: Initialize DispatchEx in HTMLDOMNode_Init.

parent 54483fc7
......@@ -217,7 +217,7 @@ HRESULT HTMLCommentElement_Create(HTMLDocumentNode *doc, nsIDOMNode *nsnode, HTM
ret->IHTMLCommentElement_iface.lpVtbl = &HTMLCommentElementVtbl;
HTMLElement_Init(&ret->element, doc, NULL, &HTMLCommentElement_dispex);
HTMLDOMNode_Init(doc, &ret->element.node, nsnode);
HTMLDOMNode_Init(doc, &ret->element.node, nsnode, &HTMLCommentElement_dispex);
*elem = &ret->element;
return S_OK;
......
......@@ -5025,8 +5025,6 @@ static HTMLDocumentNode *alloc_doc_node(HTMLDocumentObj *doc_obj, HTMLInnerWindo
doc->basedoc.window = window->base.outer_window;
doc->window = window;
init_dispex(&doc->node.event_target.dispex, (IUnknown*)&doc->node.IHTMLDOMNode_iface,
&HTMLDocumentNode_dispex);
init_doc(&doc->basedoc, (IUnknown*)&doc->node.IHTMLDOMNode_iface,
&doc->node.event_target.dispex.IDispatchEx_iface);
HTMLDocumentNode_SecMgr_Init(doc);
......@@ -5049,7 +5047,7 @@ HRESULT create_doc_from_nsdoc(nsIDOMHTMLDocument *nsdoc, HTMLDocumentObj *doc_ob
if(!doc_obj->basedoc.window || window->base.outer_window == doc_obj->basedoc.window)
doc->basedoc.cp_container.forward_container = &doc_obj->basedoc.cp_container;
HTMLDOMNode_Init(doc, &doc->node, (nsIDOMNode*)nsdoc);
HTMLDOMNode_Init(doc, &doc->node, (nsIDOMNode*)nsdoc, &HTMLDocumentNode_dispex);
nsIDOMHTMLDocument_AddRef(nsdoc);
doc->nsdoc = nsdoc;
......@@ -5074,7 +5072,7 @@ static HRESULT create_document_fragment(nsIDOMNode *nsnode, HTMLDocumentNode *do
IHTMLWindow2_AddRef(&doc_frag->window->base.IHTMLWindow2_iface);
HTMLDOMNode_Init(doc_node, &doc_frag->node, nsnode);
HTMLDOMNode_Init(doc_node, &doc_frag->node, nsnode, &HTMLDocumentNode_dispex);
doc_frag->node.vtbl = &HTMLDocumentFragmentImplVtbl;
doc_frag->node.cp_container = &doc_frag->basedoc.cp_container;
......
......@@ -5396,11 +5396,9 @@ void HTMLElement_Init(HTMLElement *This, HTMLDocumentNode *doc, nsIDOMHTMLElemen
if(dispex_data && !dispex_data->vtbl)
dispex_data->vtbl = &HTMLElement_dispex_vtbl;
init_dispex_with_compat_mode(&This->node.event_target.dispex, (IUnknown*)&This->IHTMLElement_iface,
dispex_data ? dispex_data : &HTMLElement_dispex, doc->document_mode);
if(nselem) {
HTMLDOMNode_Init(doc, &This->node, (nsIDOMNode*)nselem);
HTMLDOMNode_Init(doc, &This->node, (nsIDOMNode*)nselem, dispex_data ? dispex_data : &HTMLElement_dispex);
/* No AddRef, share reference with HTMLDOMNode */
assert((nsIDOMNode*)nselem == This->node.nsnode);
......
......@@ -1441,7 +1441,7 @@ static const NodeImplVtbl HTMLDOMNodeImplVtbl = {
HTMLDOMNode_clone
};
void HTMLDOMNode_Init(HTMLDocumentNode *doc, HTMLDOMNode *node, nsIDOMNode *nsnode)
void HTMLDOMNode_Init(HTMLDocumentNode *doc, HTMLDOMNode *node, nsIDOMNode *nsnode, dispex_static_data_t *dispex_data)
{
nsresult nsres;
......@@ -1450,6 +1450,8 @@ void HTMLDOMNode_Init(HTMLDocumentNode *doc, HTMLDOMNode *node, nsIDOMNode *nsno
node->IHTMLDOMNode3_iface.lpVtbl = &HTMLDOMNode3Vtbl;
ccref_init(&node->ccref, 1);
init_dispex_with_compat_mode(&node->event_target.dispex, (IUnknown*)&node->IHTMLDOMNode_iface,
dispex_data, doc->document_mode);
init_event_target(&node->event_target);
if(&doc->node != node)
......@@ -1463,6 +1465,17 @@ void HTMLDOMNode_Init(HTMLDocumentNode *doc, HTMLDOMNode *node, nsIDOMNode *nsno
assert(nsres == NS_OK);
}
static const tid_t HTMLDOMNode_iface_tids[] = {
IHTMLDOMNode_tid,
0
};
static dispex_static_data_t HTMLDOMNode_dispex = {
NULL,
IHTMLDOMNode_tid,
HTMLDOMNode_iface_tids,
HTMLDOMNode_init_dispex_info
};
static HRESULT create_node(HTMLDocumentNode *doc, nsIDOMNode *nsnode, HTMLDOMNode **ret)
{
UINT16 node_type;
......@@ -1500,12 +1513,14 @@ static HRESULT create_node(HTMLDocumentNode *doc, nsIDOMNode *nsnode, HTMLDOMNod
default: {
HTMLDOMNode *node;
FIXME("unimplemented node type %u\n", node_type);
node = heap_alloc_zero(sizeof(HTMLDOMNode));
if(!node)
return E_OUTOFMEMORY;
node->vtbl = &HTMLDOMNodeImplVtbl;
HTMLDOMNode_Init(doc, node, nsnode);
HTMLDOMNode_Init(doc, node, nsnode, &HTMLDOMNode_dispex);
*ret = node;
}
}
......
......@@ -378,10 +378,7 @@ HRESULT HTMLDOMTextNode_Create(HTMLDocumentNode *doc, nsIDOMNode *nsnode, HTMLDO
ret->IHTMLDOMTextNode_iface.lpVtbl = &HTMLDOMTextNodeVtbl;
ret->IHTMLDOMTextNode2_iface.lpVtbl = &HTMLDOMTextNode2Vtbl;
init_dispex_with_compat_mode(&ret->node.event_target.dispex, (IUnknown*)&ret->IHTMLDOMTextNode_iface,
&HTMLDOMTextNode_dispex, doc->document_mode);
HTMLDOMNode_Init(doc, &ret->node, nsnode);
HTMLDOMNode_Init(doc, &ret->node, nsnode, &HTMLDOMTextNode_dispex);
nsres = nsIDOMNode_QueryInterface(nsnode, &IID_nsIDOMText, (void**)&ret->nstext);
assert(nsres == NS_OK && (nsIDOMNode*)ret->nstext == ret->node.nsnode);
......
......@@ -1035,7 +1035,7 @@ HRESULT HTMLTextAreaElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElem
HRESULT HTMLTitleElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
HRESULT HTMLGenericElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
void HTMLDOMNode_Init(HTMLDocumentNode*,HTMLDOMNode*,nsIDOMNode*) DECLSPEC_HIDDEN;
void HTMLDOMNode_Init(HTMLDocumentNode*,HTMLDOMNode*,nsIDOMNode*,dispex_static_data_t*) DECLSPEC_HIDDEN;
void HTMLElement_Init(HTMLElement*,HTMLDocumentNode*,nsIDOMHTMLElement*,dispex_static_data_t*) DECLSPEC_HIDDEN;
void HTMLTextContainer_Init(HTMLTextContainer*,HTMLDocumentNode*,nsIDOMHTMLElement*,dispex_static_data_t*) DECLSPEC_HIDDEN;
void HTMLFrameBase_Init(HTMLFrameBase*,HTMLDocumentNode*,nsIDOMHTMLElement*,dispex_static_data_t*) DECLSPEC_HIDDEN;
......
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