mshtml: Added IHTMLDocument2::put_onmouseover implementation.

This commit is contained in:
Jacek Caban 2008-10-10 15:46:20 -05:00 committed by Alexandre Julliard
parent 4a2db7cc9b
commit 3cae9a7778
4 changed files with 37 additions and 18 deletions

View File

@ -31,6 +31,7 @@
#include "wine/debug.h"
#include "mshtml_private.h"
#include "htmlevent.h"
WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
@ -197,6 +198,9 @@ static ULONG WINAPI HTMLDocument_Release(IHTMLDocument2 *iface)
if(This->window)
IHTMLWindow2_Release(HTMLWINDOW2(This->window));
if(This->event_target)
release_event_target(This->event_target);
heap_free(This->mime);
detach_selection(This);
detach_ranges(This);
@ -1068,8 +1072,10 @@ static HRESULT WINAPI HTMLDocument_get_onmouseout(IHTMLDocument2 *iface, VARIANT
static HRESULT WINAPI HTMLDocument_put_onmouseover(IHTMLDocument2 *iface, VARIANT v)
{
HTMLDocument *This = HTMLDOC_THIS(iface);
FIXME("(%p)\n", This);
return E_NOTIMPL;
TRACE("(%p)\n", This);
return set_doc_event(This, EVENTID_MOUSEOVER, &v);
}
static HRESULT WINAPI HTMLDocument_get_onmouseover(IHTMLDocument2 *iface, VARIANT *p)

View File

@ -430,37 +430,39 @@ void fire_event(HTMLDocument *doc, eventid_t eid, nsIDOMNode *target)
}
}
static HRESULT set_node_event_disp(HTMLDOMNode *node, eventid_t eid, IDispatch *disp)
static HRESULT set_event_handler_disp(event_target_t **event_target, HTMLDocument *doc, eventid_t eid, IDispatch *disp)
{
if(!node->event_target)
node->event_target = heap_alloc_zero(sizeof(event_target_t));
else if(node->event_target->event_table[eid])
IDispatch_Release(node->event_target->event_table[eid]);
if(!*event_target)
*event_target = heap_alloc_zero(sizeof(event_target_t));
else if((*event_target)->event_table[eid])
IDispatch_Release((*event_target)->event_table[eid]);
(*event_target)->event_table[eid] = disp;
if(!disp)
return S_OK;
IDispatch_AddRef(disp);
node->event_target->event_table[eid] = disp;
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)
if(!doc->nscontainer->event_vector) {
doc->nscontainer->event_vector = heap_alloc_zero(EVENTID_LAST*sizeof(BOOL));
if(!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);
if(!doc->nscontainer->event_vector[eid]) {
doc->nscontainer->event_vector[eid] = TRUE;
add_nsevent_listener(doc->nscontainer, event_info[eid].name);
}
}
return S_OK;
}
HRESULT set_node_event(HTMLDOMNode *node, eventid_t eid, VARIANT *var)
HRESULT set_event_handler(event_target_t **event_target, HTMLDocument *doc, eventid_t eid, VARIANT *var)
{
switch(V_VT(var)) {
case VT_DISPATCH:
return set_node_event_disp(node, eid, V_DISPATCH(var));
return set_event_handler_disp(event_target, doc, eid, V_DISPATCH(var));
default:
FIXME("not supported vt=%d\n", V_VT(var));
@ -494,7 +496,7 @@ void check_event_attr(HTMLDocument *doc, nsIDOMElement *nselem)
disp = script_parse_event(doc, attr_value);
if(disp) {
node = get_node(doc, (nsIDOMNode*)nselem, TRUE);
set_node_event_disp(node, i, disp);
set_event_handler_disp(&node->event_target, node->doc, i, disp);
IDispatch_Release(disp);
}
}

View File

@ -29,4 +29,14 @@ 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*);
HRESULT set_event_handler(event_target_t**,HTMLDocument*,eventid_t,VARIANT*);
static inline HRESULT set_node_event(HTMLDOMNode *node, eventid_t eid, VARIANT *var)
{
return set_event_handler(&node->event_target, node->doc, eid, var);
}
static inline HRESULT set_doc_event(HTMLDocument *doc, eventid_t eid, VARIANT *var)
{
return set_event_handler(&doc->event_target, doc, eid, var);
}

View File

@ -276,6 +276,7 @@ struct HTMLDocument {
DWORD update;
event_target_t *event_target;
ConnectionPointContainer cp_container;
ConnectionPoint cp_htmldocevents;
ConnectionPoint cp_htmldocevents2;