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