Commit 3cae9a77 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

mshtml: Added IHTMLDocument2::put_onmouseover implementation.

parent 4a2db7cc
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#include "wine/debug.h" #include "wine/debug.h"
#include "mshtml_private.h" #include "mshtml_private.h"
#include "htmlevent.h"
WINE_DEFAULT_DEBUG_CHANNEL(mshtml); WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
...@@ -197,6 +198,9 @@ static ULONG WINAPI HTMLDocument_Release(IHTMLDocument2 *iface) ...@@ -197,6 +198,9 @@ static ULONG WINAPI HTMLDocument_Release(IHTMLDocument2 *iface)
if(This->window) if(This->window)
IHTMLWindow2_Release(HTMLWINDOW2(This->window)); IHTMLWindow2_Release(HTMLWINDOW2(This->window));
if(This->event_target)
release_event_target(This->event_target);
heap_free(This->mime); heap_free(This->mime);
detach_selection(This); detach_selection(This);
detach_ranges(This); detach_ranges(This);
...@@ -1068,8 +1072,10 @@ static HRESULT WINAPI HTMLDocument_get_onmouseout(IHTMLDocument2 *iface, VARIANT ...@@ -1068,8 +1072,10 @@ static HRESULT WINAPI HTMLDocument_get_onmouseout(IHTMLDocument2 *iface, VARIANT
static HRESULT WINAPI HTMLDocument_put_onmouseover(IHTMLDocument2 *iface, VARIANT v) static HRESULT WINAPI HTMLDocument_put_onmouseover(IHTMLDocument2 *iface, VARIANT v)
{ {
HTMLDocument *This = HTMLDOC_THIS(iface); 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) static HRESULT WINAPI HTMLDocument_get_onmouseover(IHTMLDocument2 *iface, VARIANT *p)
......
...@@ -430,37 +430,39 @@ void fire_event(HTMLDocument *doc, eventid_t eid, nsIDOMNode *target) ...@@ -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) if(!*event_target)
node->event_target = heap_alloc_zero(sizeof(event_target_t)); *event_target = heap_alloc_zero(sizeof(event_target_t));
else if(node->event_target->event_table[eid]) else if((*event_target)->event_table[eid])
IDispatch_Release(node->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); IDispatch_AddRef(disp);
node->event_target->event_table[eid] = disp;
if(event_info[eid].flags & EVENT_DEFAULTLISTENER) { if(event_info[eid].flags & EVENT_DEFAULTLISTENER) {
if(!node->doc->nscontainer->event_vector) { if(!doc->nscontainer->event_vector) {
node->doc->nscontainer->event_vector = heap_alloc_zero(EVENTID_LAST*sizeof(BOOL)); doc->nscontainer->event_vector = heap_alloc_zero(EVENTID_LAST*sizeof(BOOL));
if(!node->doc->nscontainer->event_vector) if(!doc->nscontainer->event_vector)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
} }
if(!node->doc->nscontainer->event_vector[eid]) { if(!doc->nscontainer->event_vector[eid]) {
node->doc->nscontainer->event_vector[eid] = TRUE; doc->nscontainer->event_vector[eid] = TRUE;
add_nsevent_listener(node->doc->nscontainer, event_info[eid].name); add_nsevent_listener(doc->nscontainer, event_info[eid].name);
} }
} }
return S_OK; 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)) { switch(V_VT(var)) {
case VT_DISPATCH: 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: default:
FIXME("not supported vt=%d\n", V_VT(var)); FIXME("not supported vt=%d\n", V_VT(var));
...@@ -494,7 +496,7 @@ void check_event_attr(HTMLDocument *doc, nsIDOMElement *nselem) ...@@ -494,7 +496,7 @@ void check_event_attr(HTMLDocument *doc, nsIDOMElement *nselem)
disp = script_parse_event(doc, attr_value); disp = script_parse_event(doc, attr_value);
if(disp) { if(disp) {
node = get_node(doc, (nsIDOMNode*)nselem, TRUE); 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); IDispatch_Release(disp);
} }
} }
......
...@@ -29,4 +29,14 @@ eventid_t str_to_eid(LPCWSTR); ...@@ -29,4 +29,14 @@ eventid_t str_to_eid(LPCWSTR);
void check_event_attr(HTMLDocument*,nsIDOMElement*); void check_event_attr(HTMLDocument*,nsIDOMElement*);
void release_event_target(event_target_t*); void release_event_target(event_target_t*);
void fire_event(HTMLDocument*,eventid_t,nsIDOMNode*); 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);
}
...@@ -276,6 +276,7 @@ struct HTMLDocument { ...@@ -276,6 +276,7 @@ struct HTMLDocument {
DWORD update; DWORD update;
event_target_t *event_target;
ConnectionPointContainer cp_container; ConnectionPointContainer cp_container;
ConnectionPoint cp_htmldocevents; ConnectionPoint cp_htmldocevents;
ConnectionPoint cp_htmldocevents2; ConnectionPoint cp_htmldocevents2;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment