mshtml: Make connection points container independent.

This commit is contained in:
Jacek Caban 2007-06-29 02:50:04 +02:00 committed by Alexandre Julliard
parent f09a6f7283
commit 88f4fb1f4f
3 changed files with 14 additions and 11 deletions

View File

@ -75,13 +75,13 @@ static HRESULT WINAPI ConnectionPoint_QueryInterface(IConnectionPoint *iface,
static ULONG WINAPI ConnectionPoint_AddRef(IConnectionPoint *iface) static ULONG WINAPI ConnectionPoint_AddRef(IConnectionPoint *iface)
{ {
ConnectionPoint *This = CONPOINT_THIS(iface); ConnectionPoint *This = CONPOINT_THIS(iface);
return IHTMLDocument2_AddRef(HTMLDOC(This->doc)); return IConnectionPointContainer_AddRef(This->container);
} }
static ULONG WINAPI ConnectionPoint_Release(IConnectionPoint *iface) static ULONG WINAPI ConnectionPoint_Release(IConnectionPoint *iface)
{ {
ConnectionPoint *This = CONPOINT_THIS(iface); ConnectionPoint *This = CONPOINT_THIS(iface);
return IHTMLDocument2_Release(HTMLDOC(This->doc)); return IConnectionPointContainer_Release(This->container);
} }
static HRESULT WINAPI ConnectionPoint_GetConnectionInterface(IConnectionPoint *iface, IID *pIID) static HRESULT WINAPI ConnectionPoint_GetConnectionInterface(IConnectionPoint *iface, IID *pIID)
@ -107,7 +107,7 @@ static HRESULT WINAPI ConnectionPoint_GetConnectionPointContainer(IConnectionPoi
if(!ppCPC) if(!ppCPC)
return E_POINTER; return E_POINTER;
*ppCPC = CONPTCONT(&This->doc->cp_container); *ppCPC = This->container;
IConnectionPointContainer_AddRef(*ppCPC); IConnectionPointContainer_AddRef(*ppCPC);
return S_OK; return S_OK;
} }
@ -184,10 +184,11 @@ static const IConnectionPointVtbl ConnectionPointVtbl =
ConnectionPoint_EnumConnections ConnectionPoint_EnumConnections
}; };
void ConnectionPoint_Init(ConnectionPoint *cp, HTMLDocument *doc, REFIID riid, ConnectionPoint *prev) void ConnectionPoint_Init(ConnectionPoint *cp, IConnectionPointContainer *container,
REFIID riid, ConnectionPoint *prev)
{ {
cp->lpConnectionPointVtbl = &ConnectionPointVtbl; cp->lpConnectionPointVtbl = &ConnectionPointVtbl;
cp->doc = doc; cp->container = container;
cp->sinks = NULL; cp->sinks = NULL;
cp->sinks_size = 0; cp->sinks_size = 0;
cp->iid = *riid; cp->iid = *riid;

View File

@ -1142,10 +1142,12 @@ HRESULT HTMLDocument_Create(IUnknown *pUnkOuter, REFIID riid, void** ppvObject)
HTMLDocument_Service_Init(ret); HTMLDocument_Service_Init(ret);
HTMLDocument_Hlink_Init(ret); HTMLDocument_Hlink_Init(ret);
ConnectionPoint_Init(&ret->cp_propnotif, ret, &IID_IPropertyNotifySink, NULL); ConnectionPoint_Init(&ret->cp_propnotif, CONPTCONT(&ret->cp_container),
ConnectionPoint_Init(&ret->cp_htmldocevents, ret, &DIID_HTMLDocumentEvents, &ret->cp_propnotif); &IID_IPropertyNotifySink, NULL);
ConnectionPoint_Init(&ret->cp_htmldocevents2, ret, &DIID_HTMLDocumentEvents2, ConnectionPoint_Init(&ret->cp_htmldocevents, CONPTCONT(&ret->cp_container),
&ret->cp_htmldocevents); &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, &ret->cp_propnotif, (IUnknown*)HTMLDOC(ret));
ret->nscontainer = NSContainer_Create(ret, NULL); ret->nscontainer = NSContainer_Create(ret, NULL);

View File

@ -81,7 +81,7 @@ typedef struct {
struct ConnectionPoint { struct ConnectionPoint {
const IConnectionPointVtbl *lpConnectionPointVtbl; const IConnectionPointVtbl *lpConnectionPointVtbl;
HTMLDocument *doc; IConnectionPointContainer *container;
union { union {
IUnknown *unk; IUnknown *unk;
@ -346,7 +346,7 @@ void HTMLDocument_Window_Init(HTMLDocument*);
void HTMLDocument_Service_Init(HTMLDocument*); void HTMLDocument_Service_Init(HTMLDocument*);
void HTMLDocument_Hlink_Init(HTMLDocument*); void HTMLDocument_Hlink_Init(HTMLDocument*);
void ConnectionPoint_Init(ConnectionPoint*,HTMLDocument*,REFIID,ConnectionPoint*); void ConnectionPoint_Init(ConnectionPoint*,IConnectionPointContainer*,REFIID,ConnectionPoint*);
void ConnectionPointContainer_Init(ConnectionPointContainer*,ConnectionPoint*,IUnknown*); void ConnectionPointContainer_Init(ConnectionPointContainer*,ConnectionPoint*,IUnknown*);
void ConnectionPointContainer_Destroy(ConnectionPointContainer*); void ConnectionPointContainer_Destroy(ConnectionPointContainer*);