Jacek Caban : mshtml: Pass HTMLDOMNode pointer to HTMLElement's destructor.

Alexandre Julliard julliard at winehq.org
Thu Oct 4 06:21:09 CDT 2007


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

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Thu Oct  4 02:08:56 2007 +0200

mshtml: Pass HTMLDOMNode pointer to HTMLElement's destructor.

---

 dlls/mshtml/htmlanchor.c     |   16 ++++++++++------
 dlls/mshtml/htmlbody.c       |   22 ++++++++++++++--------
 dlls/mshtml/htmlelem.c       |    2 +-
 dlls/mshtml/htmlinput.c      |   20 ++++++++++++--------
 dlls/mshtml/htmlselect.c     |   22 ++++++++++++++--------
 dlls/mshtml/htmltextarea.c   |   20 ++++++++++++--------
 dlls/mshtml/mshtml_private.h |    2 +-
 7 files changed, 64 insertions(+), 40 deletions(-)

diff --git a/dlls/mshtml/htmlanchor.c b/dlls/mshtml/htmlanchor.c
index 71390e9..1494efb 100644
--- a/dlls/mshtml/htmlanchor.c
+++ b/dlls/mshtml/htmlanchor.c
@@ -412,12 +412,6 @@ static HRESULT WINAPI HTMLAnchorElement_blur(IHTMLAnchorElement *iface)
     return E_NOTIMPL;
 }
 
-static void HTMLAnchorElement_destructor(IUnknown *iface)
-{
-    HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
-    mshtml_free(This);
-}
-
 static const IHTMLAnchorElementVtbl HTMLAnchorElementVtbl = {
     HTMLAnchorElement_QueryInterface,
     HTMLAnchorElement_AddRef,
@@ -469,6 +463,16 @@ static const IHTMLAnchorElementVtbl HTMLAnchorElementVtbl = {
     HTMLAnchorElement_blur
 };
 
+#define HTMLANCHOR_NODE_THIS(iface) DEFINE_THIS2(HTMLAnchorElement, element.node, iface)
+
+static void HTMLAnchorElement_destructor(HTMLDOMNode *iface)
+{
+    HTMLAnchorElement *This = HTMLANCHOR_NODE_THIS(iface);
+    mshtml_free(This);
+}
+
+#undef HTMLANCHOR_NODE_THIS
+
 HTMLElement *HTMLAnchorElement_Create(nsIDOMHTMLElement *nselem)
 {
     HTMLAnchorElement *ret = mshtml_alloc(sizeof(HTMLAnchorElement));
diff --git a/dlls/mshtml/htmlbody.c b/dlls/mshtml/htmlbody.c
index 3064347..8742032 100644
--- a/dlls/mshtml/htmlbody.c
+++ b/dlls/mshtml/htmlbody.c
@@ -426,14 +426,7 @@ static HRESULT WINAPI HTMLBodyElement_createTextRange(IHTMLBodyElement *iface, I
     return S_OK;
 }
 
-static void HTMLBodyElement_destructor(IUnknown *iface)
-{
-    HTMLBodyElement *This = HTMLBODY_THIS(iface);
-
-    ConnectionPointContainer_Destroy(&This->cp_container);
-    nsIDOMHTMLBodyElement_Release(This->nsbody);
-    mshtml_free(This);
-}
+#undef HTMLBODY_THIS
 
 static const IHTMLBodyElementVtbl HTMLBodyElementVtbl = {
     HTMLBodyElement_QueryInterface,
@@ -480,6 +473,19 @@ static const IHTMLBodyElementVtbl HTMLBodyElementVtbl = {
     HTMLBodyElement_createTextRange
 };
 
+#define HTMLBODY_NODE_THIS(iface) DEFINE_THIS2(HTMLBodyElement, textcont.element.node, iface)
+
+static void HTMLBodyElement_destructor(HTMLDOMNode *iface)
+{
+    HTMLBodyElement *This = HTMLBODY_NODE_THIS(iface);
+
+    ConnectionPointContainer_Destroy(&This->cp_container);
+    nsIDOMHTMLBodyElement_Release(This->nsbody);
+    mshtml_free(This);
+}
+
+#undef HTMLBODY_NODE_THIS
+
 HTMLElement *HTMLBodyElement_Create(nsIDOMHTMLElement *nselem)
 {
     HTMLBodyElement *ret = mshtml_alloc(sizeof(HTMLBodyElement));
diff --git a/dlls/mshtml/htmlelem.c b/dlls/mshtml/htmlelem.c
index f646084..76098ce 100644
--- a/dlls/mshtml/htmlelem.c
+++ b/dlls/mshtml/htmlelem.c
@@ -1270,7 +1270,7 @@ static void HTMLElement_destructor(HTMLDOMNode *iface)
     HTMLElement *This = HTMLELEM_NODE_THIS(iface);
 
     if(This->destructor)
-        This->destructor(This->impl);
+        This->destructor(&This->node);
 
     if(This->nselem)
         nsIDOMHTMLElement_Release(This->nselem);
diff --git a/dlls/mshtml/htmlinput.c b/dlls/mshtml/htmlinput.c
index dc3ec8a..4b60e21 100644
--- a/dlls/mshtml/htmlinput.c
+++ b/dlls/mshtml/htmlinput.c
@@ -649,14 +649,6 @@ static HRESULT WINAPI HTMLInputElement_get_start(IHTMLInputElement *iface, BSTR
     return E_NOTIMPL;
 }
 
-static void HTMLInputElement_destructor(IUnknown *iface)
-{
-    HTMLInputElement *This = HTMLINPUT_THIS(iface);
-
-    nsIDOMHTMLInputElement_Release(This->nsinput);
-    mshtml_free(This);
-}
-
 #undef HTMLINPUT_THIS
 
 static const IHTMLInputElementVtbl HTMLInputElementVtbl = {
@@ -734,6 +726,18 @@ static const IHTMLInputElementVtbl HTMLInputElementVtbl = {
     HTMLInputElement_get_start
 };
 
+#define HTMLINPUT_NODE_THIS(iface) DEFINE_THIS2(HTMLInputElement, element.node, iface)
+
+static void HTMLInputElement_destructor(HTMLDOMNode *iface)
+{
+    HTMLInputElement *This = HTMLINPUT_NODE_THIS(iface);
+
+    nsIDOMHTMLInputElement_Release(This->nsinput);
+    mshtml_free(This);
+}
+
+#undef HTMLINPUT_NODE_THIS
+
 HTMLElement *HTMLInputElement_Create(nsIDOMHTMLElement *nselem)
 {
     HTMLInputElement *ret = mshtml_alloc(sizeof(HTMLInputElement));
diff --git a/dlls/mshtml/htmlselect.c b/dlls/mshtml/htmlselect.c
index c50b431..65175f9 100644
--- a/dlls/mshtml/htmlselect.c
+++ b/dlls/mshtml/htmlselect.c
@@ -43,7 +43,7 @@ typedef struct {
     nsIDOMHTMLSelectElement *nsselect;
 } HTMLSelectElement;
 
-#define HTMLSELECT(x)  ((IHTMLSelectElement*)  &(x)->lpHTMLSelectElementVtbl)
+#define HTMLSELECT(x)      ((IHTMLSelectElement*)         &(x)->lpHTMLSelectElementVtbl)
 
 #define HTMLSELECT_THIS(iface) DEFINE_THIS(HTMLSelectElement, HTMLSelectElement, iface)
 
@@ -341,13 +341,7 @@ static HRESULT WINAPI HTMLSelectElement_tags(IHTMLSelectElement *iface, VARIANT
     return E_NOTIMPL;
 }
 
-static void HTMLSelectElement_destructor(IUnknown *iface)
-{
-    HTMLSelectElement *This = HTMLSELECT_THIS(iface);
-
-    nsIDOMHTMLSelectElement_Release(This->nsselect);
-    mshtml_free(This);
-}
+#undef HTMLSELECT_THIS
 
 static const IHTMLSelectElementVtbl HTMLSelectElementVtbl = {
     HTMLSelectElement_QueryInterface,
@@ -383,6 +377,18 @@ static const IHTMLSelectElementVtbl HTMLSelectElementVtbl = {
     HTMLSelectElement_tags
 };
 
+#define HTMLSELECT_NODE_THIS(iface) DEFINE_THIS2(HTMLSelectElement, element.node, iface)
+
+static void HTMLSelectElement_destructor(HTMLDOMNode *iface)
+{
+    HTMLSelectElement *This = HTMLSELECT_NODE_THIS(iface);
+
+    nsIDOMHTMLSelectElement_Release(This->nsselect);
+    mshtml_free(This);
+}
+
+#undef HTMLSELECT_NODE_THIS
+
 HTMLElement *HTMLSelectElement_Create(nsIDOMHTMLElement *nselem)
 {
     HTMLSelectElement *ret = mshtml_alloc(sizeof(HTMLSelectElement));
diff --git a/dlls/mshtml/htmltextarea.c b/dlls/mshtml/htmltextarea.c
index c9b0c3e..6994d97 100644
--- a/dlls/mshtml/htmltextarea.c
+++ b/dlls/mshtml/htmltextarea.c
@@ -346,14 +346,6 @@ static HRESULT WINAPI HTMLTextAreaElement_createTextRange(IHTMLTextAreaElement *
     return E_NOTIMPL;
 }
 
-static void HTMLTextAreaElement_destructor(IUnknown *iface)
-{
-    HTMLTextAreaElement *This = HTMLTXTAREA_THIS(iface);
-
-    nsIDOMHTMLTextAreaElement_Release(This->nstextarea);
-    mshtml_free(This);
-}
-
 #undef HTMLTXTAREA_THIS
 
 static const IHTMLTextAreaElementVtbl HTMLTextAreaElementVtbl = {
@@ -392,6 +384,18 @@ static const IHTMLTextAreaElementVtbl HTMLTextAreaElementVtbl = {
     HTMLTextAreaElement_createTextRange
 };
 
+#define HTMLTXTAREA_NODE_THIS(iface) DEFINE_THIS2(HTMLTextAreaElement, element.node, iface)
+
+static void HTMLTextAreaElement_destructor(HTMLDOMNode *iface)
+{
+    HTMLTextAreaElement *This = HTMLTXTAREA_NODE_THIS(iface);
+
+    nsIDOMHTMLTextAreaElement_Release(This->nstextarea);
+    mshtml_free(This);
+}
+
+#undef HTMLTXTAREA_NODE_THIS
+
 HTMLElement *HTMLTextAreaElement_Create(nsIDOMHTMLElement *nselem)
 {
     HTMLTextAreaElement *ret = mshtml_alloc(sizeof(HTMLTextAreaElement));
diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h
index 2a6c15c..4e49923 100644
--- a/dlls/mshtml/mshtml_private.h
+++ b/dlls/mshtml/mshtml_private.h
@@ -272,7 +272,7 @@ typedef struct {
     const IHTMLElementVtbl *lpHTMLElementVtbl;
     const IHTMLElement2Vtbl *lpHTMLElement2Vtbl;
 
-    void (*destructor)(IUnknown*);
+    void (*destructor)(HTMLDOMNode*);
 
     nsIDOMHTMLElement *nselem;
 




More information about the wine-cvs mailing list