mshtml: Moved events declaration to separated file.

This commit is contained in:
Jacek Caban 2008-10-09 15:36:01 -05:00 committed by Alexandre Julliard
parent 70bb5b0749
commit 2b0013128f
8 changed files with 49 additions and 18 deletions

View File

@ -32,6 +32,7 @@
#include "wine/unicode.h"
#include "mshtml_private.h"
#include "htmlevent.h"
WINE_DEFAULT_DEBUG_CHANNEL(mshtml);

View File

@ -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;

31
dlls/mshtml/htmlevent.h Normal file
View File

@ -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*);

View File

@ -28,6 +28,7 @@
#include "wine/debug.h"
#include "mshtml_private.h"
#include "htmlevent.h"
WINE_DEFAULT_DEBUG_CHANNEL(mshtml);

View File

@ -28,6 +28,7 @@
#include "wine/debug.h"
#include "mshtml_private.h"
#include "htmlevent.h"
WINE_DEFAULT_DEBUG_CHANNEL(mshtml);

View File

@ -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*);

View File

@ -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);

View File

@ -31,6 +31,7 @@
#include "wine/unicode.h"
#include "mshtml_private.h"
#include "htmlevent.h"
WINE_DEFAULT_DEBUG_CHANNEL(mshtml);