Commit af6c518e authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

mshtml: Use lazy allocation for connection points.

parent 1d05cd51
......@@ -48,16 +48,6 @@ static const char *debugstr_cp_guid(REFIID riid)
return debugstr_guid(riid);
}
void call_property_onchanged(ConnectionPoint *This, DISPID dispid)
{
DWORD i;
for(i=0; i<This->sinks_size; i++) {
if(This->sinks[i].propnotif)
IPropertyNotifySink_OnChanged(This->sinks[i].propnotif, dispid);
}
}
static inline ConnectionPoint *impl_from_IConnectionPoint(IConnectionPoint *iface)
{
return CONTAINING_RECORD(iface, ConnectionPoint, IConnectionPoint_iface);
......@@ -201,7 +191,7 @@ static const IConnectionPointVtbl ConnectionPointVtbl =
ConnectionPoint_EnumConnections
};
void ConnectionPoint_Init(ConnectionPoint *cp, ConnectionPointContainer *container, REFIID riid, cp_static_data_t *data)
static void ConnectionPoint_Init(ConnectionPoint *cp, ConnectionPointContainer *container, REFIID riid, cp_static_data_t *data)
{
cp->IConnectionPoint_iface.lpVtbl = &ConnectionPointVtbl;
cp->container = container;
......@@ -209,9 +199,6 @@ void ConnectionPoint_Init(ConnectionPoint *cp, ConnectionPointContainer *contain
cp->sinks_size = 0;
cp->iid = riid;
cp->data = data;
cp->next = container->cp_list;
container->cp_list = cp;
}
static void ConnectionPoint_Destroy(ConnectionPoint *This)
......@@ -226,6 +213,51 @@ static void ConnectionPoint_Destroy(ConnectionPoint *This)
heap_free(This->sinks);
}
static ConnectionPoint *get_cp(ConnectionPointContainer *container, REFIID riid, BOOL do_create)
{
const cpc_entry_t *iter;
unsigned idx, i;
for(iter = container->cp_entries; iter->riid; iter++) {
if(IsEqualGUID(iter->riid, riid))
break;
}
if(!iter->riid)
return NULL;
idx = iter - container->cp_entries;
if(!container->cps) {
if(!do_create)
return NULL;
while(iter->riid)
iter++;
container->cps = heap_alloc((iter - container->cp_entries) * sizeof(*container->cps));
if(!container->cps)
return NULL;
for(i=0; container->cp_entries[i].riid; i++)
ConnectionPoint_Init(container->cps+i, container, container->cp_entries[i].riid, container->cp_entries[i].desc);
}
return container->cps+idx;
}
void call_property_onchanged(ConnectionPointContainer *container, DISPID dispid)
{
ConnectionPoint *cp;
DWORD i;
cp = get_cp(container, &IID_IPropertyNotifySink, FALSE);
if(!cp)
return;
for(i=0; i<cp->sinks_size; i++) {
if(cp->sinks[i].propnotif)
IPropertyNotifySink_OnChanged(cp->sinks[i].propnotif, dispid);
}
}
static inline ConnectionPointContainer *impl_from_IConnectionPointContainer(IConnectionPointContainer *iface)
{
return CONTAINING_RECORD(iface, ConnectionPointContainer, IConnectionPointContainer_iface);
......@@ -262,7 +294,7 @@ static HRESULT WINAPI ConnectionPointContainer_FindConnectionPoint(IConnectionPo
REFIID riid, IConnectionPoint **ppCP)
{
ConnectionPointContainer *This = impl_from_IConnectionPointContainer(iface);
ConnectionPoint *iter;
ConnectionPoint *cp;
TRACE("(%p)->(%s %p)\n", This, debugstr_cp_guid(riid), ppCP);
......@@ -270,20 +302,16 @@ static HRESULT WINAPI ConnectionPointContainer_FindConnectionPoint(IConnectionPo
return IConnectionPointContainer_FindConnectionPoint(&This->forward_container->IConnectionPointContainer_iface,
riid, ppCP);
*ppCP = NULL;
for(iter = This->cp_list; iter; iter = iter->next) {
if(IsEqualGUID(iter->iid, riid))
*ppCP = &iter->IConnectionPoint_iface;
}
if(*ppCP) {
IConnectionPoint_AddRef(*ppCP);
return S_OK;
cp = get_cp(This, riid, TRUE);
if(!cp) {
FIXME("unsupported riid %s\n", debugstr_cp_guid(riid));
*ppCP = NULL;
return CONNECT_E_NOCONNECTION;
}
FIXME("unsupported riid %s\n", debugstr_cp_guid(riid));
return CONNECT_E_NOCONNECTION;
*ppCP = &cp->IConnectionPoint_iface;
IConnectionPoint_AddRef(*ppCP);
return S_OK;
}
static const IConnectionPointContainerVtbl ConnectionPointContainerVtbl = {
......@@ -294,19 +322,23 @@ static const IConnectionPointContainerVtbl ConnectionPointContainerVtbl = {
ConnectionPointContainer_FindConnectionPoint
};
void ConnectionPointContainer_Init(ConnectionPointContainer *This, IUnknown *outer)
void ConnectionPointContainer_Init(ConnectionPointContainer *This, IUnknown *outer, const cpc_entry_t *cp_entries)
{
This->IConnectionPointContainer_iface.lpVtbl = &ConnectionPointContainerVtbl;
This->cp_list = NULL;
This->cp_entries = cp_entries;
This->cps = NULL;
This->outer = outer;
This->forward_container = NULL;
}
void ConnectionPointContainer_Destroy(ConnectionPointContainer *This)
{
ConnectionPoint *iter = This->cp_list;
unsigned i;
while(iter) {
ConnectionPoint_Destroy(iter);
iter = iter->next;
}
if(!This->cps)
return;
for(i=0; This->cp_entries[i].riid; i++)
ConnectionPoint_Destroy(This->cps+i);
heap_free(This->cps);
}
......@@ -684,6 +684,7 @@ static HRESULT HTMLAnchorElement_handle_event(HTMLDOMNode *iface, eventid_t eid,
static const NodeImplVtbl HTMLAnchorElementImplVtbl = {
HTMLAnchorElement_QI,
HTMLElement_destructor,
HTMLElement_cpc,
HTMLElement_clone,
HTMLAnchorElement_handle_event,
HTMLElement_get_attr_col
......
......@@ -38,8 +38,6 @@ typedef struct {
IHTMLBodyElement IHTMLBodyElement_iface;
ConnectionPoint cp_propnotif;
nsIDOMHTMLBodyElement *nsbody;
} HTMLBodyElement;
......@@ -771,9 +769,17 @@ static event_target_t **HTMLBodyElement_get_event_target(HTMLDOMNode *iface)
: &This->textcont.element.node.event_target;
}
static const cpc_entry_t HTMLBodyElement_cpc[] = {
{&DIID_HTMLTextContainerEvents},
{&IID_IPropertyNotifySink},
HTMLELEMENT_CPC,
{NULL}
};
static const NodeImplVtbl HTMLBodyElementImplVtbl = {
HTMLBodyElement_QI,
HTMLBodyElement_destructor,
HTMLBodyElement_cpc,
HTMLElement_clone,
HTMLElement_handle_event,
HTMLElement_get_attr_col,
......@@ -817,8 +823,6 @@ HRESULT HTMLBodyElement_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem,
HTMLTextContainer_Init(&ret->textcont, doc, nselem, &HTMLBodyElement_dispex);
ConnectionPoint_Init(&ret->cp_propnotif, &ret->textcont.element.cp_container, &IID_IPropertyNotifySink, NULL);
*elem = &ret->textcont.element;
return S_OK;
}
......@@ -172,6 +172,7 @@ static void HTMLCommentElement_destructor(HTMLDOMNode *iface)
static const NodeImplVtbl HTMLCommentElementImplVtbl = {
HTMLCommentElement_QI,
HTMLCommentElement_destructor,
HTMLElement_cpc,
HTMLElement_clone,
HTMLElement_handle_event,
HTMLElement_get_attr_col
......
......@@ -2055,6 +2055,14 @@ static BOOL htmldoc_qi(HTMLDocument *This, REFIID riid, void **ppv)
static cp_static_data_t HTMLDocumentEvents_data = { HTMLDocumentEvents_tid, HTMLDocument_on_advise };
static const cpc_entry_t HTMLDocument_cpc[] = {
{&IID_IDispatch, &HTMLDocumentEvents_data},
{&IID_IPropertyNotifySink},
{&DIID_HTMLDocumentEvents, &HTMLDocumentEvents_data},
{&DIID_HTMLDocumentEvents2},
{NULL}
};
static void init_doc(HTMLDocument *doc, IUnknown *unk_impl, IDispatchEx *dispex)
{
doc->IHTMLDocument2_iface.lpVtbl = &HTMLDocumentVtbl;
......@@ -2076,11 +2084,7 @@ static void init_doc(HTMLDocument *doc, IUnknown *unk_impl, IDispatchEx *dispex)
HTMLDocument_Service_Init(doc);
HTMLDocument_Hlink_Init(doc);
ConnectionPointContainer_Init(&doc->cp_container, (IUnknown*)&doc->IHTMLDocument2_iface);
ConnectionPoint_Init(&doc->cp_dispatch, &doc->cp_container, &IID_IDispatch, &HTMLDocumentEvents_data);
ConnectionPoint_Init(&doc->cp_propnotif, &doc->cp_container, &IID_IPropertyNotifySink, NULL);
ConnectionPoint_Init(&doc->cp_htmldocevents, &doc->cp_container, &DIID_HTMLDocumentEvents, &HTMLDocumentEvents_data);
ConnectionPoint_Init(&doc->cp_htmldocevents2, &doc->cp_container, &DIID_HTMLDocumentEvents2, NULL);
ConnectionPointContainer_Init(&doc->cp_container, (IUnknown*)&doc->IHTMLDocument2_iface, HTMLDocument_cpc);
}
static void destroy_htmldoc(HTMLDocument *This)
......@@ -2192,6 +2196,7 @@ static void HTMLDocumentNode_unlink(HTMLDOMNode *iface)
static const NodeImplVtbl HTMLDocumentNodeImplVtbl = {
HTMLDocumentNode_QI,
HTMLDocumentNode_destructor,
HTMLDocument_cpc,
HTMLDocumentNode_clone,
NULL,
NULL,
......@@ -2280,6 +2285,7 @@ static const dispex_static_data_vtbl_t HTMLDocumentNode_dispex_vtbl = {
static const NodeImplVtbl HTMLDocumentFragmentImplVtbl = {
HTMLDocumentNode_QI,
HTMLDocumentNode_destructor,
HTMLDocument_cpc,
HTMLDocumentFragment_clone
};
......
......@@ -1679,9 +1679,15 @@ HRESULT HTMLElement_handle_event(HTMLDOMNode *iface, DWORD eid, nsIDOMEvent *eve
return S_OK;
}
const cpc_entry_t HTMLElement_cpc[] = {
HTMLELEMENT_CPC,
{NULL}
};
static const NodeImplVtbl HTMLElementImplVtbl = {
HTMLElement_QI,
HTMLElement_destructor,
HTMLElement_cpc,
HTMLElement_clone,
HTMLElement_handle_event,
HTMLElement_get_attr_col
......@@ -1838,7 +1844,8 @@ void HTMLElement_Init(HTMLElement *This, HTMLDocumentNode *doc, nsIDOMHTMLElemen
This->nselem = nselem;
}
ConnectionPointContainer_Init(&This->cp_container, (IUnknown*)&This->IHTMLElement_iface);
This->node.cp_container = &This->cp_container;
ConnectionPointContainer_Init(&This->cp_container, (IUnknown*)&This->IHTMLElement_iface, This->node.vtbl->cpc_entries);
}
HRESULT HTMLElement_Create(HTMLDocumentNode *doc, nsIDOMNode *nsnode, BOOL use_generic, HTMLElement **ret)
......@@ -1868,8 +1875,8 @@ HRESULT HTMLElement_Create(HTMLDocumentNode *doc, nsIDOMNode *nsnode, BOOL use_g
}else {
elem = heap_alloc_zero(sizeof(HTMLElement));
if(elem) {
HTMLElement_Init(elem, doc, nselem, &HTMLElement_dispex);
elem->node.vtbl = &HTMLElementImplVtbl;
HTMLElement_Init(elem, doc, nselem, &HTMLElement_dispex);
hres = S_OK;
}else {
hres = E_OUTOFMEMORY;
......
......@@ -254,6 +254,7 @@ static void HTMLEmbedElement_destructor(HTMLDOMNode *iface)
static const NodeImplVtbl HTMLEmbedElementImplVtbl = {
HTMLEmbedElement_QI,
HTMLEmbedElement_destructor,
HTMLElement_cpc,
HTMLElement_clone,
HTMLElement_handle_event,
HTMLElement_get_attr_col
......
......@@ -1001,44 +1001,44 @@ static void call_event_handlers(HTMLDocumentNode *doc, HTMLEventObj *event_obj,
* it's safe to call event handler by checking nsevent_listener, which is NULL for
* detached documents.
*/
if(cp_container && doc->nsevent_listener) {
if(cp_container && cp_container->forward_container)
cp_container = cp_container->forward_container;
if(cp_container && cp_container->cps && doc->nsevent_listener) {
ConnectionPoint *cp;
unsigned i, j;
if(cp_container->forward_container)
cp_container = cp_container->forward_container;
for(cp = cp_container->cp_list; cp; cp = cp->next) {
if(cp->sinks_size && is_cp_event(cp->data, event_info[eid].dispid)) {
unsigned int i;
for(j=0; cp_container->cp_entries[j].riid; j++) {
cp = cp_container->cps + j;
if(!cp->sinks_size || !is_cp_event(cp->data, event_info[eid].dispid))
continue;
for(i=0; doc->nsevent_listener && i < cp->sinks_size; i++) {
if(!cp->sinks[i].disp)
continue;
for(i=0; doc->nsevent_listener && i < cp->sinks_size; i++) {
if(!cp->sinks[i].disp)
continue;
V_VT(&v) = VT_EMPTY;
V_VT(&v) = VT_EMPTY;
TRACE("cp %s [%u] >>>\n", debugstr_w(event_info[eid].name), i);
hres = call_cp_func(cp->sinks[i].disp, event_info[eid].dispid, &v);
if(hres == S_OK) {
TRACE("cp %s [%u] <<<\n", debugstr_w(event_info[eid].name), i);
TRACE("cp %s [%u] >>>\n", debugstr_w(event_info[eid].name), i);
hres = call_cp_func(cp->sinks[i].disp, event_info[eid].dispid, &v);
if(hres == S_OK) {
TRACE("cp %s [%u] <<<\n", debugstr_w(event_info[eid].name), i);
if(cancelable) {
if(V_VT(&v) == VT_BOOL) {
if(!V_BOOL(&v))
event_obj->prevent_default = TRUE;
}else if(V_VT(&v) != VT_EMPTY) {
FIXME("unhandled result %s\n", debugstr_variant(&v));
}
if(cancelable) {
if(V_VT(&v) == VT_BOOL) {
if(!V_BOOL(&v))
event_obj->prevent_default = TRUE;
}else if(V_VT(&v) != VT_EMPTY) {
FIXME("unhandled result %s\n", debugstr_variant(&v));
}
VariantClear(&v);
}else {
WARN("cp %s [%u] <<< %08x\n", debugstr_w(event_info[eid].name), i, hres);
}
VariantClear(&v);
}else {
WARN("cp %s [%u] <<< %08x\n", debugstr_w(event_info[eid].name), i, hres);
}
if(!doc->nsevent_listener)
break;
}
if(!doc->nsevent_listener)
break;
}
}
}
......
......@@ -629,6 +629,7 @@ static HRESULT HTMLFormElement_invoke(HTMLDOMNode *iface,
static const NodeImplVtbl HTMLFormElementImplVtbl = {
HTMLFormElement_QI,
HTMLElement_destructor,
HTMLElement_cpc,
HTMLElement_clone,
HTMLElement_handle_event,
HTMLElement_get_attr_col,
......
......@@ -269,6 +269,7 @@ static HRESULT HTMLFrameElement_bind_to_tree(HTMLDOMNode *iface)
static const NodeImplVtbl HTMLFrameElementImplVtbl = {
HTMLFrameElement_QI,
HTMLFrameElement_destructor,
HTMLElement_cpc,
HTMLElement_clone,
HTMLElement_handle_event,
HTMLElement_get_attr_col,
......
......@@ -154,6 +154,7 @@ static void HTMLGenericElement_destructor(HTMLDOMNode *iface)
static const NodeImplVtbl HTMLGenericElementImplVtbl = {
HTMLGenericElement_QI,
HTMLGenericElement_destructor,
HTMLElement_cpc,
HTMLElement_clone,
HTMLElement_handle_event,
HTMLElement_get_attr_col
......
......@@ -155,6 +155,7 @@ static void HTMLTitleElement_destructor(HTMLDOMNode *iface)
static const NodeImplVtbl HTMLTitleElementImplVtbl = {
HTMLTitleElement_QI,
HTMLTitleElement_destructor,
HTMLElement_cpc,
HTMLElement_clone,
HTMLElement_handle_event,
HTMLElement_get_attr_col
......@@ -314,6 +315,7 @@ static void HTMLHeadElement_destructor(HTMLDOMNode *iface)
static const NodeImplVtbl HTMLHeadElementImplVtbl = {
HTMLHeadElement_QI,
HTMLHeadElement_destructor,
HTMLElement_cpc,
HTMLElement_clone,
HTMLElement_handle_event,
HTMLElement_get_attr_col
......
......@@ -542,6 +542,7 @@ static HRESULT HTMLIFrame_bind_to_tree(HTMLDOMNode *iface)
static const NodeImplVtbl HTMLIFrameImplVtbl = {
HTMLIFrame_QI,
HTMLIFrame_destructor,
HTMLElement_cpc,
HTMLElement_clone,
HTMLElement_handle_event,
HTMLElement_get_attr_col,
......
......@@ -647,6 +647,7 @@ static HRESULT HTMLImgElement_get_readystate(HTMLDOMNode *iface, BSTR *p)
static const NodeImplVtbl HTMLImgElementImplVtbl = {
HTMLImgElement_QI,
HTMLElement_destructor,
HTMLElement_cpc,
HTMLElement_clone,
HTMLElement_handle_event,
HTMLElement_get_attr_col,
......
......@@ -1194,6 +1194,7 @@ static HRESULT HTMLInputElementImpl_get_disabled(HTMLDOMNode *iface, VARIANT_BOO
static const NodeImplVtbl HTMLInputElementImplVtbl = {
HTMLInputElement_QI,
HTMLElement_destructor,
HTMLElement_cpc,
HTMLElement_clone,
HTMLElement_handle_event,
HTMLElement_get_attr_col,
......@@ -1377,6 +1378,7 @@ static HRESULT HTMLLabelElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
static const NodeImplVtbl HTMLLabelElementImplVtbl = {
HTMLLabelElement_QI,
HTMLElement_destructor,
HTMLElement_cpc,
HTMLElement_clone,
HTMLElement_handle_event,
HTMLElement_get_attr_col,
......@@ -1604,6 +1606,7 @@ static HRESULT HTMLButtonElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
static const NodeImplVtbl HTMLButtonElementImplVtbl = {
HTMLButtonElement_QI,
HTMLElement_destructor,
HTMLElement_cpc,
HTMLElement_clone,
HTMLElement_handle_event,
HTMLElement_get_attr_col,
......
......@@ -362,6 +362,7 @@ static HRESULT HTMLLinkElementImpl_get_disabled(HTMLDOMNode *iface, VARIANT_BOOL
static const NodeImplVtbl HTMLLinkElementImplVtbl = {
HTMLLinkElement_QI,
HTMLElement_destructor,
HTMLElement_cpc,
HTMLElement_clone,
HTMLElement_handle_event,
HTMLElement_get_attr_col,
......
......@@ -253,6 +253,7 @@ static void HTMLMetaElement_destructor(HTMLDOMNode *iface)
static const NodeImplVtbl HTMLMetaElementImplVtbl = {
HTMLMetaElement_QI,
HTMLMetaElement_destructor,
HTMLElement_cpc,
HTMLElement_clone,
HTMLElement_handle_event,
HTMLElement_get_attr_col
......
......@@ -1057,9 +1057,12 @@ static HRESULT HTMLDOMNode_clone(HTMLDOMNode *This, nsIDOMNode *nsnode, HTMLDOMN
return create_node(This->doc, nsnode, ret);
}
static const cpc_entry_t HTMLDOMNode_cpc[] = {{NULL}};
static const NodeImplVtbl HTMLDOMNodeImplVtbl = {
HTMLDOMNode_QI,
HTMLDOMNode_destructor,
HTMLDOMNode_cpc,
HTMLDOMNode_clone
};
......
......@@ -707,6 +707,7 @@ static HRESULT HTMLObjectElement_invoke(HTMLDOMNode *iface, DISPID id, LCID lcid
static const NodeImplVtbl HTMLObjectElementImplVtbl = {
HTMLObjectElement_QI,
HTMLObjectElement_destructor,
HTMLElement_cpc,
HTMLElement_clone,
HTMLElement_handle_event,
HTMLElement_get_attr_col,
......
......@@ -314,6 +314,7 @@ static HRESULT HTMLOptionElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
static const NodeImplVtbl HTMLOptionElementImplVtbl = {
HTMLOptionElement_QI,
HTMLElement_destructor,
HTMLElement_cpc,
HTMLElement_clone,
HTMLElement_handle_event,
HTMLElement_get_attr_col
......
......@@ -394,6 +394,7 @@ static HRESULT HTMLScriptElement_get_readystate(HTMLDOMNode *iface, BSTR *p)
static const NodeImplVtbl HTMLScriptElementImplVtbl = {
HTMLScriptElement_QI,
HTMLElement_destructor,
HTMLElement_cpc,
HTMLElement_clone,
HTMLElement_handle_event,
HTMLElement_get_attr_col,
......
......@@ -599,6 +599,7 @@ static HRESULT HTMLSelectElement_invoke(HTMLDOMNode *iface, DISPID id, LCID lcid
static const NodeImplVtbl HTMLSelectElementImplVtbl = {
HTMLSelectElement_QI,
HTMLElement_destructor,
HTMLElement_cpc,
HTMLElement_clone,
HTMLElement_handle_event,
HTMLElement_get_attr_col,
......
......@@ -322,6 +322,7 @@ static void HTMLStyleElement_destructor(HTMLDOMNode *iface)
static const NodeImplVtbl HTMLStyleElementImplVtbl = {
HTMLStyleElement_QI,
HTMLStyleElement_destructor,
HTMLElement_cpc,
HTMLElement_clone,
HTMLElement_handle_event,
HTMLElement_get_attr_col
......
......@@ -39,7 +39,6 @@ struct HTMLTable {
IHTMLTable2 IHTMLTable2_iface;
IHTMLTable3 IHTMLTable3_iface;
ConnectionPoint cp;
nsIDOMHTMLTableElement *nstable;
};
......@@ -742,9 +741,16 @@ static HRESULT HTMLTable_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
return HTMLElement_QI(&This->element.node, riid, ppv);
}
static const cpc_entry_t HTMLTable_cpc[] = {
{&DIID_HTMLTableEvents},
HTMLELEMENT_CPC,
{NULL}
};
static const NodeImplVtbl HTMLTableImplVtbl = {
HTMLTable_QI,
HTMLElement_destructor,
HTMLTable_cpc,
HTMLElement_clone,
HTMLElement_handle_event,
HTMLElement_get_attr_col
......@@ -783,8 +789,6 @@ HRESULT HTMLTable_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem, HTMLE
assert(nsres == NS_OK && (nsIDOMNode*)ret->nstable == ret->element.node.nsnode);
nsIDOMNode_Release(ret->element.node.nsnode);
ConnectionPoint_Init(&ret->cp, &ret->element.cp_container, &DIID_HTMLTableEvents, NULL);
*elem = &ret->element;
return S_OK;
}
......@@ -340,6 +340,7 @@ static void HTMLTableCell_destructor(HTMLDOMNode *iface)
static const NodeImplVtbl HTMLTableCellImplVtbl = {
HTMLTableCell_QI,
HTMLTableCell_destructor,
HTMLElement_cpc,
HTMLElement_clone,
HTMLElement_handle_event,
HTMLElement_get_attr_col
......
......@@ -291,6 +291,7 @@ static HRESULT HTMLTableRow_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
static const NodeImplVtbl HTMLTableRowImplVtbl = {
HTMLTableRow_QI,
HTMLElement_destructor,
HTMLElement_cpc,
HTMLElement_clone,
HTMLElement_handle_event,
HTMLElement_get_attr_col
......
......@@ -414,6 +414,7 @@ static HRESULT HTMLTextAreaElementImpl_get_disabled(HTMLDOMNode *iface, VARIANT_
static const NodeImplVtbl HTMLTextAreaElementImplVtbl = {
HTMLTextAreaElement_QI,
HTMLElement_destructor,
HTMLElement_cpc,
HTMLElement_clone,
HTMLElement_handle_event,
HTMLElement_get_attr_col,
......
......@@ -191,6 +191,4 @@ void HTMLTextContainer_Init(HTMLTextContainer *This, HTMLDocumentNode *doc, nsID
This->IHTMLTextContainer_iface.lpVtbl = &HTMLTextContainerVtbl;
HTMLElement_Init(&This->element, doc, nselem, dispex_data);
ConnectionPoint_Init(&This->cp, &This->element.cp_container, &DIID_HTMLTextContainerEvents, NULL);
}
......@@ -186,9 +186,12 @@ static HRESULT HTMLDOMTextNode_clone(HTMLDOMNode *iface, nsIDOMNode *nsnode, HTM
return HTMLDOMTextNode_Create(This->node.doc, nsnode, ret);
}
static const cpc_entry_t HTMLDOMTextNode_cpc[] = {{NULL}};
static const NodeImplVtbl HTMLDOMTextNodeImplVtbl = {
HTMLDOMTextNode_QI,
HTMLDOMNode_destructor,
HTMLDOMTextNode_cpc,
HTMLDOMTextNode_clone
};
......
......@@ -434,15 +434,21 @@ typedef struct _cp_static_data_t {
DISPID *ids;
} cp_static_data_t;
typedef struct {
const IID *riid;
cp_static_data_t *desc;
} cpc_entry_t;
typedef struct ConnectionPointContainer {
IConnectionPointContainer IConnectionPointContainer_iface;
ConnectionPoint *cp_list;
ConnectionPoint *cps;
const cpc_entry_t *cp_entries;
IUnknown *outer;
struct ConnectionPointContainer *forward_container;
} ConnectionPointContainer;
struct ConnectionPoint {
struct ConnectionPoint {
IConnectionPoint IConnectionPoint_iface;
ConnectionPointContainer *container;
......@@ -456,8 +462,6 @@ struct ConnectionPoint {
const IID *iid;
cp_static_data_t *data;
ConnectionPoint *next;
};
struct HTMLDocument {
......@@ -499,11 +503,6 @@ struct HTMLDocument {
LONG task_magic;
ConnectionPointContainer cp_container;
ConnectionPoint cp_htmldocevents;
ConnectionPoint cp_htmldocevents2;
ConnectionPoint cp_propnotif;
ConnectionPoint cp_dispatch;
IOleAdviseHolder *advise_holder;
};
......@@ -602,6 +601,7 @@ struct NSContainer {
typedef struct {
HRESULT (*qi)(HTMLDOMNode*,REFIID,void**);
void (*destructor)(HTMLDOMNode*);
const cpc_entry_t *cpc_entries;
HRESULT (*clone)(HTMLDOMNode*,nsIDOMNode*,HTMLDOMNode**);
HRESULT (*handle_event)(HTMLDOMNode*,DWORD,nsIDOMEvent*,BOOL*);
HRESULT (*get_attr_col)(HTMLDOMNode*,HTMLAttributeCollection**);
......@@ -666,12 +666,13 @@ typedef struct {
IHTMLElement3_tid, \
IHTMLElement4_tid
#define HTMLELEMENT_CPC {NULL}
extern const cpc_entry_t HTMLElement_cpc[];
typedef struct {
HTMLElement element;
IHTMLTextContainer IHTMLTextContainer_iface;
ConnectionPoint cp;
} HTMLTextContainer;
struct HTMLFrameBase {
......@@ -755,8 +756,7 @@ void HTMLDocumentNode_SecMgr_Init(HTMLDocumentNode*) DECLSPEC_HIDDEN;
HRESULT HTMLCurrentStyle_Create(HTMLElement*,IHTMLCurrentStyle**) DECLSPEC_HIDDEN;
void ConnectionPoint_Init(ConnectionPoint*,ConnectionPointContainer*,REFIID,cp_static_data_t*) DECLSPEC_HIDDEN;
void ConnectionPointContainer_Init(ConnectionPointContainer*,IUnknown*) DECLSPEC_HIDDEN;
void ConnectionPointContainer_Init(ConnectionPointContainer*,IUnknown*,const cpc_entry_t*) DECLSPEC_HIDDEN;
void ConnectionPointContainer_Destroy(ConnectionPointContainer*) DECLSPEC_HIDDEN;
HRESULT create_nscontainer(HTMLDocumentObj*,NSContainer**) DECLSPEC_HIDDEN;
......@@ -789,7 +789,7 @@ HRESULT nsuri_to_url(LPCWSTR,BOOL,BSTR*) DECLSPEC_HIDDEN;
HRESULT set_frame_doc(HTMLFrameBase*,nsIDOMDocument*) DECLSPEC_HIDDEN;
void call_property_onchanged(ConnectionPoint*,DISPID) DECLSPEC_HIDDEN;
void call_property_onchanged(ConnectionPointContainer*,DISPID) DECLSPEC_HIDDEN;
HRESULT call_set_active_object(IOleInPlaceUIWindow*,IOleInPlaceActiveObject*) DECLSPEC_HIDDEN;
void *nsalloc(size_t) __WINE_ALLOC_SIZE(1) DECLSPEC_HIDDEN;
......
......@@ -265,7 +265,7 @@ static void parse_complete(HTMLDocumentObj *doc)
call_explorer_69(doc);
if(doc->view_sink)
IAdviseSink_OnViewChange(doc->view_sink, DVASPECT_CONTENT, -1);
call_property_onchanged(&doc->basedoc.cp_propnotif, 1005);
call_property_onchanged(&doc->basedoc.cp_container, 1005);
call_explorer_69(doc);
if(doc->is_webbrowser && doc->usermode != EDITMODE && !(doc->basedoc.window->load_flags & BINDING_REFRESH))
......
......@@ -413,7 +413,7 @@ void set_ready_state(HTMLOuterWindow *window, READYSTATE readystate)
window->readystate = readystate;
if(window->doc_obj && window->doc_obj->basedoc.window == window)
call_property_onchanged(&window->doc_obj->basedoc.cp_propnotif, DISPID_READYSTATE);
call_property_onchanged(&window->doc_obj->basedoc.cp_container, DISPID_READYSTATE);
fire_event(window->base.inner_window->doc, EVENTID_READYSTATECHANGE, FALSE,
window->base.inner_window->doc->node.nsnode, NULL, NULL);
......
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