mshtml: Make IConnectionPointContainer more flexible.

This commit is contained in:
Jacek Caban 2007-12-04 13:36:27 +01:00 committed by Alexandre Julliard
parent 440af17322
commit a1bdef2d62
4 changed files with 21 additions and 28 deletions

View File

@ -93,7 +93,7 @@ static HRESULT WINAPI ConnectionPoint_GetConnectionInterface(IConnectionPoint *i
if(!pIID)
return E_POINTER;
memcpy(pIID, &This->iid, sizeof(IID));
memcpy(pIID, This->iid, sizeof(IID));
return S_OK;
}
@ -122,8 +122,8 @@ static HRESULT WINAPI ConnectionPoint_Advise(IConnectionPoint *iface, IUnknown *
TRACE("(%p)->(%p %p)\n", This, pUnkSink, pdwCookie);
hres = IUnknown_QueryInterface(pUnkSink, &This->iid, (void**)&sink);
if(FAILED(hres) && !IsEqualGUID(&IID_IPropertyNotifySink, &This->iid))
hres = IUnknown_QueryInterface(pUnkSink, This->iid, (void**)&sink);
if(FAILED(hres) && !IsEqualGUID(&IID_IPropertyNotifySink, This->iid))
hres = IUnknown_QueryInterface(pUnkSink, &IID_IDispatch, (void**)&sink);
if(FAILED(hres))
return CONNECT_E_CANNOTCONNECT;
@ -184,18 +184,17 @@ static const IConnectionPointVtbl ConnectionPointVtbl =
ConnectionPoint_EnumConnections
};
void ConnectionPoint_Init(ConnectionPoint *cp, IConnectionPointContainer *container,
REFIID riid, ConnectionPoint *prev)
void ConnectionPoint_Init(ConnectionPoint *cp, ConnectionPointContainer *container, REFIID riid)
{
cp->lpConnectionPointVtbl = &ConnectionPointVtbl;
cp->container = container;
cp->container = CONPTCONT(container);
cp->sinks = NULL;
cp->sinks_size = 0;
cp->iid = *riid;
cp->iid = riid;
cp->next = NULL;
if(prev)
prev->next = cp;
cp->next = container->cp_list;
container->cp_list = cp;
}
static void ConnectionPoint_Destroy(ConnectionPoint *This)
@ -250,7 +249,7 @@ static HRESULT WINAPI ConnectionPointContainer_FindConnectionPoint(IConnectionPo
*ppCP = NULL;
for(iter = This->cp_list; iter; iter = iter->next) {
if(IsEqualGUID(&iter->iid, riid))
if(IsEqualGUID(iter->iid, riid))
*ppCP = CONPOINT(iter);
}
@ -273,11 +272,10 @@ static const IConnectionPointContainerVtbl ConnectionPointContainerVtbl = {
#undef CONPTCONT_THIS
void ConnectionPointContainer_Init(ConnectionPointContainer *This, ConnectionPoint *cp_list,
IUnknown *outer)
void ConnectionPointContainer_Init(ConnectionPointContainer *This, IUnknown *outer)
{
This->lpConnectionPointContainerVtbl = &ConnectionPointContainerVtbl;
This->cp_list = cp_list;
This->cp_list = NULL;
This->outer = outer;
}

View File

@ -506,11 +506,9 @@ HTMLElement *HTMLBodyElement_Create(nsIDOMHTMLElement *nselem)
HTMLTextContainer_Init(&ret->textcont);
ConnectionPoint_Init(&ret->cp_propnotif, CONPTCONT(&ret->cp_container),
&IID_IPropertyNotifySink, NULL);
ConnectionPoint_Init(&ret->cp_txtcontevents, CONPTCONT(&ret->cp_container),
&DIID_HTMLTextContainerEvents, &ret->cp_propnotif);
ConnectionPointContainer_Init(&ret->cp_container, &ret->cp_propnotif, (IUnknown*)HTMLBODY(ret));
ConnectionPointContainer_Init(&ret->cp_container, (IUnknown*)HTMLBODY(ret));
ConnectionPoint_Init(&ret->cp_propnotif, &ret->cp_container, &IID_IPropertyNotifySink);
ConnectionPoint_Init(&ret->cp_txtcontevents, &ret->cp_container, &DIID_HTMLTextContainerEvents);
nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLBodyElement,
(void**)&ret->nsbody);

View File

@ -1207,13 +1207,10 @@ HRESULT HTMLDocument_Create(IUnknown *pUnkOuter, REFIID riid, void** ppvObject)
HTMLDocument_Service_Init(ret);
HTMLDocument_Hlink_Init(ret);
ConnectionPoint_Init(&ret->cp_propnotif, CONPTCONT(&ret->cp_container),
&IID_IPropertyNotifySink, NULL);
ConnectionPoint_Init(&ret->cp_htmldocevents, CONPTCONT(&ret->cp_container),
&DIID_HTMLDocumentEvents, &ret->cp_propnotif);
ConnectionPoint_Init(&ret->cp_htmldocevents2, CONPTCONT(&ret->cp_container),
&DIID_HTMLDocumentEvents2, &ret->cp_htmldocevents);
ConnectionPointContainer_Init(&ret->cp_container, &ret->cp_propnotif, (IUnknown*)HTMLDOC(ret));
ConnectionPointContainer_Init(&ret->cp_container, (IUnknown*)HTMLDOC(ret));
ConnectionPoint_Init(&ret->cp_propnotif, &ret->cp_container, &IID_IPropertyNotifySink);
ConnectionPoint_Init(&ret->cp_htmldocevents, &ret->cp_container, &DIID_HTMLDocumentEvents);
ConnectionPoint_Init(&ret->cp_htmldocevents2, &ret->cp_container, &DIID_HTMLDocumentEvents2);
ret->nscontainer = NSContainer_Create(ret, NULL);
ret->window = HTMLWindow_Create(ret);

View File

@ -90,7 +90,7 @@ struct ConnectionPoint {
} *sinks;
DWORD sinks_size;
IID iid;
const IID *iid;
ConnectionPoint *next;
};
@ -372,8 +372,8 @@ void HTMLDocument_Window_Init(HTMLDocument*);
void HTMLDocument_Service_Init(HTMLDocument*);
void HTMLDocument_Hlink_Init(HTMLDocument*);
void ConnectionPoint_Init(ConnectionPoint*,IConnectionPointContainer*,REFIID,ConnectionPoint*);
void ConnectionPointContainer_Init(ConnectionPointContainer*,ConnectionPoint*,IUnknown*);
void ConnectionPoint_Init(ConnectionPoint*,ConnectionPointContainer*,REFIID);
void ConnectionPointContainer_Init(ConnectionPointContainer*,IUnknown*);
void ConnectionPointContainer_Destroy(ConnectionPointContainer*);
NSContainer *NSContainer_Create(HTMLDocument*,NSContainer*);