Jacek Caban : mshtml: Move IConnectionPointContainer to the separated struct.

Alexandre Julliard julliard at wine.codeweavers.com
Fri Jun 29 08:14:43 CDT 2007


Module: wine
Branch: master
Commit: f09a6f7283fc825a38fe0222954ab34784b82504
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=f09a6f7283fc825a38fe0222954ab34784b82504

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Fri Jun 29 02:49:27 2007 +0200

mshtml: Move IConnectionPointContainer to the separated struct.

---

 dlls/mshtml/conpoint.c       |   31 +++++++++++++++++--------------
 dlls/mshtml/htmldoc.c        |    6 +++---
 dlls/mshtml/mshtml_private.h |   14 ++++++++++----
 3 files changed, 30 insertions(+), 21 deletions(-)

diff --git a/dlls/mshtml/conpoint.c b/dlls/mshtml/conpoint.c
index 7900ff6..b19ca16 100644
--- a/dlls/mshtml/conpoint.c
+++ b/dlls/mshtml/conpoint.c
@@ -107,7 +107,7 @@ static HRESULT WINAPI ConnectionPoint_GetConnectionPointContainer(IConnectionPoi
     if(!ppCPC)
         return E_POINTER;
 
-    *ppCPC = CONPTCONT(This->doc);
+    *ppCPC = CONPTCONT(&This->doc->cp_container);
     IConnectionPointContainer_AddRef(*ppCPC);
     return S_OK;
 }
@@ -209,31 +209,31 @@ static void ConnectionPoint_Destroy(ConnectionPoint *This)
     mshtml_free(This->sinks);
 }
 
-#define CONPTCONT_THIS(iface) DEFINE_THIS(HTMLDocument, ConnectionPointContainer, iface)
+#define CONPTCONT_THIS(iface) DEFINE_THIS(ConnectionPointContainer, ConnectionPointContainer, iface)
 
 static HRESULT WINAPI ConnectionPointContainer_QueryInterface(IConnectionPointContainer *iface,
                                                               REFIID riid, void **ppv)
 {
-    HTMLDocument *This = CONPTCONT_THIS(iface);
-    return IHTMLDocument2_QueryInterface(HTMLDOC(This), riid, ppv);
+    ConnectionPointContainer *This = CONPTCONT_THIS(iface);
+    return IUnknown_QueryInterface(This->outer, riid, ppv);
 }
 
 static ULONG WINAPI ConnectionPointContainer_AddRef(IConnectionPointContainer *iface)
 {
-    HTMLDocument *This = CONPTCONT_THIS(iface);
-    return IHTMLDocument2_AddRef(HTMLDOC(This));
+    ConnectionPointContainer *This = CONPTCONT_THIS(iface);
+    return IUnknown_AddRef(This->outer);
 }
 
 static ULONG WINAPI ConnectionPointContainer_Release(IConnectionPointContainer *iface)
 {
-    HTMLDocument *This = CONPTCONT_THIS(iface);
-    return IHTMLDocument2_Release(HTMLDOC(This));
+    ConnectionPointContainer *This = CONPTCONT_THIS(iface);
+    return IUnknown_Release(This->outer);
 }
 
 static HRESULT WINAPI ConnectionPointContainer_EnumConnectionPoints(IConnectionPointContainer *iface,
         IEnumConnectionPoints **ppEnum)
 {
-    HTMLDocument *This = CONPTCONT_THIS(iface);
+    ConnectionPointContainer *This = CONPTCONT_THIS(iface);
     FIXME("(%p)->(%p)\n", This, ppEnum);
     return E_NOTIMPL;
 }
@@ -241,14 +241,14 @@ static HRESULT WINAPI ConnectionPointContainer_EnumConnectionPoints(IConnectionP
 static HRESULT WINAPI ConnectionPointContainer_FindConnectionPoint(IConnectionPointContainer *iface,
         REFIID riid, IConnectionPoint **ppCP)
 {
-    HTMLDocument *This = CONPTCONT_THIS(iface);
+    ConnectionPointContainer *This = CONPTCONT_THIS(iface);
     ConnectionPoint *iter;
 
     TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppCP);
 
     *ppCP = NULL;
 
-    for(iter = &This->cp_propnotif; iter; iter = iter->next) {
+    for(iter = This->cp_list; iter; iter = iter->next) {
         if(IsEqualGUID(&iter->iid, riid))
             *ppCP = CONPOINT(iter);
     }
@@ -272,14 +272,17 @@ static const IConnectionPointContainerVtbl ConnectionPointContainerVtbl = {
 
 #undef CONPTCONT_THIS
 
-void HTMLDocument_ConnectionPoints_Init(HTMLDocument *This)
+void ConnectionPointContainer_Init(ConnectionPointContainer *This, ConnectionPoint *cp_list,
+        IUnknown *outer)
 {
     This->lpConnectionPointContainerVtbl = &ConnectionPointContainerVtbl;
+    This->cp_list = cp_list;
+    This->outer = outer;
 }
 
-void HTMLDocument_ConnectionPoints_Destroy(HTMLDocument *This)
+void ConnectionPointContainer_Destroy(ConnectionPointContainer *This)
 {
-    ConnectionPoint *iter = &This->cp_propnotif;
+    ConnectionPoint *iter = This->cp_list;
 
     while(iter) {
         ConnectionPoint_Destroy(iter);
diff --git a/dlls/mshtml/htmldoc.c b/dlls/mshtml/htmldoc.c
index 649a849..b5eee9a 100644
--- a/dlls/mshtml/htmldoc.c
+++ b/dlls/mshtml/htmldoc.c
@@ -109,7 +109,7 @@ static HRESULT WINAPI HTMLDocument_QueryInterface(IHTMLDocument2 *iface, REFIID
         *ppvObject = HLNKTARGET(This);
     }else if(IsEqualGUID(&IID_IConnectionPointContainer, riid)) {
         TRACE("(%p)->(IID_IConnectionPointContainer %p)\n", This, ppvObject);
-        *ppvObject = CONPTCONT(This);
+        *ppvObject = CONPTCONT(&This->cp_container);
     }else if(IsEqualGUID(&IID_IPersistStreamInit, riid)) {
         TRACE("(%p)->(IID_IPersistStreamInit %p)\n", This, ppvObject);
         *ppvObject = PERSTRINIT(This);
@@ -171,7 +171,7 @@ static ULONG WINAPI HTMLDocument_Release(IHTMLDocument2 *iface)
 
         release_nodes(This);
 
-        HTMLDocument_ConnectionPoints_Destroy(This);
+        ConnectionPointContainer_Destroy(&This->cp_container);
 
         if(This->nscontainer)
             NSContainer_Release(This->nscontainer);
@@ -1141,12 +1141,12 @@ HRESULT HTMLDocument_Create(IUnknown *pUnkOuter, REFIID riid, void** ppvObject)
     HTMLDocument_Window_Init(ret);
     HTMLDocument_Service_Init(ret);
     HTMLDocument_Hlink_Init(ret);
-    HTMLDocument_ConnectionPoints_Init(ret);
 
     ConnectionPoint_Init(&ret->cp_propnotif, ret, &IID_IPropertyNotifySink, NULL);
     ConnectionPoint_Init(&ret->cp_htmldocevents, ret, &DIID_HTMLDocumentEvents, &ret->cp_propnotif);
     ConnectionPoint_Init(&ret->cp_htmldocevents2, ret, &DIID_HTMLDocumentEvents2,
         &ret->cp_htmldocevents);
+    ConnectionPointContainer_Init(&ret->cp_container, &ret->cp_propnotif, (IUnknown*)HTMLDOC(ret));
 
     ret->nscontainer = NSContainer_Create(ret, NULL);
     ret->window = HTMLWindow_Create(ret);
diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h
index 40bf08f..ecdab3d 100644
--- a/dlls/mshtml/mshtml_private.h
+++ b/dlls/mshtml/mshtml_private.h
@@ -71,6 +71,13 @@ typedef enum {
     EDITMODE        
 } USERMODE;
 
+typedef struct {
+    const IConnectionPointContainerVtbl  *lpConnectionPointContainerVtbl;
+
+    ConnectionPoint *cp_list;
+    IUnknown *outer;
+} ConnectionPointContainer;
+
 struct ConnectionPoint {
     const IConnectionPointVtbl *lpConnectionPointVtbl;
 
@@ -104,7 +111,6 @@ struct HTMLDocument {
     const IOleCommandTargetVtbl           *lpOleCommandTargetVtbl;
     const IOleControlVtbl                 *lpOleControlVtbl;
     const IHlinkTargetVtbl                *lpHlinkTargetVtbl;
-    const IConnectionPointContainerVtbl   *lpConnectionPointContainerVtbl;
     const IPersistStreamInitVtbl          *lpPersistStreamInitVtbl;
 
     LONG ref;
@@ -137,6 +143,7 @@ struct HTMLDocument {
 
     DWORD update;
 
+    ConnectionPointContainer cp_container;
     ConnectionPoint cp_htmldocevents;
     ConnectionPoint cp_htmldocevents2;
     ConnectionPoint cp_propnotif;
@@ -338,11 +345,10 @@ void HTMLDocument_View_Init(HTMLDocument*);
 void HTMLDocument_Window_Init(HTMLDocument*);
 void HTMLDocument_Service_Init(HTMLDocument*);
 void HTMLDocument_Hlink_Init(HTMLDocument*);
-void HTMLDocument_ConnectionPoints_Init(HTMLDocument*);
-
-void HTMLDocument_ConnectionPoints_Destroy(HTMLDocument*);
 
 void ConnectionPoint_Init(ConnectionPoint*,HTMLDocument*,REFIID,ConnectionPoint*);
+void ConnectionPointContainer_Init(ConnectionPointContainer*,ConnectionPoint*,IUnknown*);
+void ConnectionPointContainer_Destroy(ConnectionPointContainer*);
 
 NSContainer *NSContainer_Create(HTMLDocument*,NSContainer*);
 void NSContainer_Release(NSContainer*);




More information about the wine-cvs mailing list