Jacek Caban : mshtml: Moved events declaration to separated file.

Alexandre Julliard julliard at winehq.org
Fri Oct 10 08:06:43 CDT 2008


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

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Thu Oct  9 15:36:01 2008 -0500

mshtml: Moved events declaration to separated file.

---

 dlls/mshtml/htmlelem.c       |    1 +
 dlls/mshtml/htmlevent.c      |   15 ++++++++++++---
 dlls/mshtml/htmlevent.h      |   31 +++++++++++++++++++++++++++++++
 dlls/mshtml/htmlnode.c       |    1 +
 dlls/mshtml/htmlselect.c     |    1 +
 dlls/mshtml/mshtml_private.h |   16 +---------------
 dlls/mshtml/nsembed.c        |    1 +
 dlls/mshtml/nsevents.c       |    1 +
 8 files changed, 49 insertions(+), 18 deletions(-)

diff --git a/dlls/mshtml/htmlelem.c b/dlls/mshtml/htmlelem.c
index 1216838..60fd574 100644
--- a/dlls/mshtml/htmlelem.c
+++ b/dlls/mshtml/htmlelem.c
@@ -32,6 +32,7 @@
 #include "wine/unicode.h"
 
 #include "mshtml_private.h"
+#include "htmlevent.h"
 
 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
 
diff --git a/dlls/mshtml/htmlevent.c b/dlls/mshtml/htmlevent.c
index 3c56e87..d72b936 100644
--- a/dlls/mshtml/htmlevent.c
+++ b/dlls/mshtml/htmlevent.c
@@ -26,6 +26,7 @@
 #include "ole2.h"
 
 #include "mshtml_private.h"
+#include "htmlevent.h"
 
 #include "wine/debug.h"
 
@@ -435,9 +436,17 @@ static HRESULT set_node_event_disp(HTMLDOMNode *node, eventid_t eid, IDispatch *
     IDispatch_AddRef(disp);
     node->event_target->event_table[eid] = disp;
 
-    if((event_info[eid].flags & EVENT_DEFAULTLISTENER) && !node->doc->nscontainer->event_vector[eid]) {
-        node->doc->nscontainer->event_vector[eid] = TRUE;
-        add_nsevent_listener(node->doc->nscontainer, event_info[eid].name);
+    if(event_info[eid].flags & EVENT_DEFAULTLISTENER) {
+        if(!node->doc->nscontainer->event_vector) {
+            node->doc->nscontainer->event_vector = heap_alloc_zero(EVENTID_LAST*sizeof(BOOL));
+            if(!node->doc->nscontainer->event_vector)
+                return E_OUTOFMEMORY;
+        }
+
+        if(!node->doc->nscontainer->event_vector[eid]) {
+            node->doc->nscontainer->event_vector[eid] = TRUE;
+            add_nsevent_listener(node->doc->nscontainer, event_info[eid].name);
+        }
     }
 
     return S_OK;
diff --git a/dlls/mshtml/htmlevent.h b/dlls/mshtml/htmlevent.h
new file mode 100644
index 0000000..adc7692
--- /dev/null
+++ b/dlls/mshtml/htmlevent.h
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2008 Jacek Caban for CodeWeavers
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+typedef enum {
+    EVENTID_CHANGE,
+    EVENTID_CLICK,
+    EVENTID_KEYUP,
+    EVENTID_LOAD,
+    EVENTID_LAST
+} eventid_t;
+
+eventid_t str_to_eid(LPCWSTR);
+void check_event_attr(HTMLDocument*,nsIDOMElement*);
+void release_event_target(event_target_t*);
+void fire_event(HTMLDocument*,eventid_t,nsIDOMNode*);
+HRESULT set_node_event(HTMLDOMNode*,eventid_t,VARIANT*);
diff --git a/dlls/mshtml/htmlnode.c b/dlls/mshtml/htmlnode.c
index e923795..a3eaaaf 100644
--- a/dlls/mshtml/htmlnode.c
+++ b/dlls/mshtml/htmlnode.c
@@ -28,6 +28,7 @@
 #include "wine/debug.h"
 
 #include "mshtml_private.h"
+#include "htmlevent.h"
 
 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
 
diff --git a/dlls/mshtml/htmlselect.c b/dlls/mshtml/htmlselect.c
index ca24954..3a414cf 100644
--- a/dlls/mshtml/htmlselect.c
+++ b/dlls/mshtml/htmlselect.c
@@ -28,6 +28,7 @@
 #include "wine/debug.h"
 
 #include "mshtml_private.h"
+#include "htmlevent.h"
 
 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
 
diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h
index cfbe8f2..a58cfef 100644
--- a/dlls/mshtml/mshtml_private.h
+++ b/dlls/mshtml/mshtml_private.h
@@ -116,14 +116,6 @@ typedef enum {
     LAST_tid
 } tid_t;
 
-typedef enum {
-    EVENTID_CHANGE,
-    EVENTID_CLICK,
-    EVENTID_KEYUP,
-    EVENTID_LOAD,
-    EVENTID_LAST
-} eventid_t;
-
 typedef struct dispex_data_t dispex_data_t;
 typedef struct dispex_dynamic_data_t dispex_dynamic_data_t;
 
@@ -340,7 +332,7 @@ struct NSContainer {
     nsChannelBSC *bscallback; /* hack */
     HWND reset_focus; /* hack */
 
-    BOOL event_vector[EVENTID_LAST];
+    BOOL *event_vector;
 };
 
 typedef struct {
@@ -537,12 +529,6 @@ void add_nsevent_listener(NSContainer*,LPCWSTR);
 nsresult get_nsinterface(nsISupports*,REFIID,void**);
 void update_nsdocument(HTMLDocument*);
 
-void check_event_attr(HTMLDocument*,nsIDOMElement*);
-void release_event_target(event_target_t*);
-void fire_event(HTMLDocument*,eventid_t,nsIDOMNode*);
-HRESULT set_node_event(HTMLDOMNode*,eventid_t,VARIANT*);
-eventid_t str_to_eid(LPCWSTR);
-
 void set_document_bscallback(HTMLDocument*,nsChannelBSC*);
 void set_current_mon(HTMLDocument*,IMoniker*);
 HRESULT start_binding(HTMLDocument*,BSCallback*,IBindCtx*);
diff --git a/dlls/mshtml/nsembed.c b/dlls/mshtml/nsembed.c
index 94707c2..45386be 100644
--- a/dlls/mshtml/nsembed.c
+++ b/dlls/mshtml/nsembed.c
@@ -984,6 +984,7 @@ static nsrefcnt NSAPI nsWebBrowserChrome_Release(nsIWebBrowserChrome *iface)
     TRACE("(%p) ref=%d\n", This, ref);
 
     if(!ref) {
+        heap_free(This->event_vector);
         if(This->parent)
             nsIWebBrowserChrome_Release(NSWBCHROME(This->parent));
         heap_free(This);
diff --git a/dlls/mshtml/nsevents.c b/dlls/mshtml/nsevents.c
index b6cc0f8..dc54322 100644
--- a/dlls/mshtml/nsevents.c
+++ b/dlls/mshtml/nsevents.c
@@ -31,6 +31,7 @@
 #include "wine/unicode.h"
 
 #include "mshtml_private.h"
+#include "htmlevent.h"
 
 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
 




More information about the wine-cvs mailing list