mshtml: Pass EventTarget to get_event_handler.

This commit is contained in:
Jacek Caban 2015-05-14 13:25:34 +02:00 committed by Alexandre Julliard
parent f26597753a
commit f2fa7e662e
3 changed files with 9 additions and 7 deletions

View File

@ -1462,18 +1462,20 @@ HRESULT set_event_handler(EventTarget *event_target, HTMLDocumentNode *doc, even
return S_OK;
}
HRESULT get_event_handler(DispatchEx *dispex, event_target_t **event_target, eventid_t eid, VARIANT *var)
HRESULT get_event_handler(EventTarget *event_target, eventid_t eid, VARIANT *var)
{
event_target_t *data;
VARIANT *v;
HRESULT hres;
hres = dispex_get_dprop_ref(dispex, event_info[eid].attr_name, FALSE, &v);
hres = dispex_get_dprop_ref(&event_target->dispex, event_info[eid].attr_name, FALSE, &v);
if(SUCCEEDED(hres) && V_VT(v) != VT_EMPTY)
return VariantCopy(var, v);
if(*event_target && (*event_target)->event_table[eid] && (*event_target)->event_table[eid]->handler_prop) {
data = get_event_target_data(event_target, FALSE);
if(data && data->event_table[eid] && data->event_table[eid]->handler_prop) {
V_VT(var) = VT_DISPATCH;
V_DISPATCH(var) = (*event_target)->event_table[eid]->handler_prop;
V_DISPATCH(var) = data->event_table[eid]->handler_prop;
IDispatch_AddRef(V_DISPATCH(var));
}else {
V_VT(var) = VT_NULL;

View File

@ -55,7 +55,7 @@ void check_event_attr(HTMLDocumentNode*,nsIDOMHTMLElement*) DECLSPEC_HIDDEN;
void release_event_target(event_target_t*) DECLSPEC_HIDDEN;
void fire_event(HTMLDocumentNode*,eventid_t,BOOL,nsIDOMNode*,nsIDOMEvent*,IDispatch*) DECLSPEC_HIDDEN;
HRESULT set_event_handler(EventTarget*,HTMLDocumentNode*,eventid_t,VARIANT*) DECLSPEC_HIDDEN;
HRESULT get_event_handler(DispatchEx*,event_target_t**,eventid_t,VARIANT*) DECLSPEC_HIDDEN;
HRESULT get_event_handler(EventTarget*,eventid_t,VARIANT*) DECLSPEC_HIDDEN;
HRESULT attach_event(event_target_t**,HTMLDocument*,BSTR,IDispatch*,VARIANT_BOOL*) DECLSPEC_HIDDEN;
HRESULT detach_event(event_target_t*,HTMLDocument*,BSTR,IDispatch*) DECLSPEC_HIDDEN;
HRESULT dispatch_event(HTMLDOMNode*,const WCHAR*,VARIANT*,VARIANT_BOOL*) DECLSPEC_HIDDEN;
@ -85,7 +85,7 @@ static inline HRESULT set_node_event(HTMLDOMNode *node, eventid_t eid, VARIANT *
static inline HRESULT get_node_event(HTMLDOMNode *node, eventid_t eid, VARIANT *var)
{
return get_event_handler(&node->event_target.dispex, get_node_event_target(node), eid, var);
return get_event_handler(&node->event_target, eid, var);
}
static inline HRESULT set_doc_event(HTMLDocument *doc, eventid_t eid, VARIANT *var)

View File

@ -105,7 +105,7 @@ static inline HRESULT get_window_event(HTMLWindow *window, eventid_t eid, VARIAN
return E_FAIL;
}
return get_event_handler(&window->inner_window->event_target.dispex, &window->inner_window->doc->body_event_target, eid, var);
return get_event_handler(&window->inner_window->event_target, eid, var);
}
static void detach_inner_window(HTMLInnerWindow *window)