Commit 21151f3e authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

mshtml: Pass EventTarget to detach_event.

parent 513c77d9
...@@ -2042,7 +2042,7 @@ static HRESULT WINAPI HTMLDocument3_detachEvent(IHTMLDocument3 *iface, BSTR even ...@@ -2042,7 +2042,7 @@ static HRESULT WINAPI HTMLDocument3_detachEvent(IHTMLDocument3 *iface, BSTR even
TRACE("(%p)->(%s %p)\n", This, debugstr_w(event), pDisp); TRACE("(%p)->(%s %p)\n", This, debugstr_w(event), pDisp);
return detach_event(This->doc_node->node.event_target.ptr, This, event, pDisp); return detach_event(&This->doc_node->node.event_target, This, event, pDisp);
} }
static HRESULT WINAPI HTMLDocument3_put_onrowsdelete(IHTMLDocument3 *iface, VARIANT v) static HRESULT WINAPI HTMLDocument3_put_onrowsdelete(IHTMLDocument3 *iface, VARIANT v)
......
...@@ -2575,7 +2575,7 @@ static HRESULT WINAPI HTMLElement2_detachEvent(IHTMLElement2 *iface, BSTR event, ...@@ -2575,7 +2575,7 @@ static HRESULT WINAPI HTMLElement2_detachEvent(IHTMLElement2 *iface, BSTR event,
TRACE("(%p)->(%s %p)\n", This, debugstr_w(event), pDisp); TRACE("(%p)->(%s %p)\n", This, debugstr_w(event), pDisp);
return detach_event(*get_node_event_target(&This->node), &This->node.doc->basedoc, event, pDisp); return detach_event(&This->node.event_target, &This->node.doc->basedoc, event, pDisp);
} }
static HRESULT WINAPI HTMLElement2_get_readyState(IHTMLElement2 *iface, VARIANT *p) static HRESULT WINAPI HTMLElement2_get_readyState(IHTMLElement2 *iface, VARIANT *p)
......
...@@ -1518,27 +1518,29 @@ HRESULT attach_event(EventTarget *event_target, HTMLDocument *doc, BSTR name, ...@@ -1518,27 +1518,29 @@ HRESULT attach_event(EventTarget *event_target, HTMLDocument *doc, BSTR name,
return ensure_nsevent_handler(doc->doc_node, data, eid); return ensure_nsevent_handler(doc->doc_node, data, eid);
} }
HRESULT detach_event(event_target_t *event_target, HTMLDocument *doc, BSTR name, IDispatch *disp) HRESULT detach_event(EventTarget *event_target, HTMLDocument *doc, BSTR name, IDispatch *disp)
{ {
event_target_t *data;
eventid_t eid; eventid_t eid;
DWORD i = 0; DWORD i = 0;
if(!event_target)
return S_OK;
eid = attr_to_eid(name); eid = attr_to_eid(name);
if(eid == EVENTID_LAST) { if(eid == EVENTID_LAST) {
WARN("Unknown event\n"); WARN("Unknown event\n");
return S_OK; return S_OK;
} }
if(!event_target->event_table[eid]) data = get_event_target_data(event_target, FALSE);
if(!data)
return S_OK;
if(!data->event_table[eid])
return S_OK; return S_OK;
while(i < event_target->event_table[eid]->handler_cnt) { while(i < data->event_table[eid]->handler_cnt) {
if(event_target->event_table[eid]->handlers[i] == disp) { if(data->event_table[eid]->handlers[i] == disp) {
IDispatch_Release(event_target->event_table[eid]->handlers[i]); IDispatch_Release(data->event_table[eid]->handlers[i]);
event_target->event_table[eid]->handlers[i] = NULL; data->event_table[eid]->handlers[i] = NULL;
} }
i++; i++;
} }
......
...@@ -57,7 +57,7 @@ void fire_event(HTMLDocumentNode*,eventid_t,BOOL,nsIDOMNode*,nsIDOMEvent*,IDispa ...@@ -57,7 +57,7 @@ void fire_event(HTMLDocumentNode*,eventid_t,BOOL,nsIDOMNode*,nsIDOMEvent*,IDispa
HRESULT set_event_handler(EventTarget*,HTMLDocumentNode*,eventid_t,VARIANT*) DECLSPEC_HIDDEN; HRESULT set_event_handler(EventTarget*,HTMLDocumentNode*,eventid_t,VARIANT*) DECLSPEC_HIDDEN;
HRESULT get_event_handler(EventTarget*,eventid_t,VARIANT*) DECLSPEC_HIDDEN; HRESULT get_event_handler(EventTarget*,eventid_t,VARIANT*) DECLSPEC_HIDDEN;
HRESULT attach_event(EventTarget*,HTMLDocument*,BSTR,IDispatch*,VARIANT_BOOL*) DECLSPEC_HIDDEN; HRESULT attach_event(EventTarget*,HTMLDocument*,BSTR,IDispatch*,VARIANT_BOOL*) DECLSPEC_HIDDEN;
HRESULT detach_event(event_target_t*,HTMLDocument*,BSTR,IDispatch*) DECLSPEC_HIDDEN; HRESULT detach_event(EventTarget*,HTMLDocument*,BSTR,IDispatch*) DECLSPEC_HIDDEN;
HRESULT dispatch_event(HTMLDOMNode*,const WCHAR*,VARIANT*,VARIANT_BOOL*) DECLSPEC_HIDDEN; HRESULT dispatch_event(HTMLDOMNode*,const WCHAR*,VARIANT*,VARIANT_BOOL*) DECLSPEC_HIDDEN;
HRESULT call_fire_event(HTMLDOMNode*,eventid_t) DECLSPEC_HIDDEN; HRESULT call_fire_event(HTMLDOMNode*,eventid_t) DECLSPEC_HIDDEN;
void update_cp_events(HTMLInnerWindow*,event_target_t**,cp_static_data_t*) DECLSPEC_HIDDEN; void update_cp_events(HTMLInnerWindow*,event_target_t**,cp_static_data_t*) DECLSPEC_HIDDEN;
......
...@@ -1669,7 +1669,7 @@ static HRESULT WINAPI HTMLWindow3_detachEvent(IHTMLWindow3 *iface, BSTR event, I ...@@ -1669,7 +1669,7 @@ static HRESULT WINAPI HTMLWindow3_detachEvent(IHTMLWindow3 *iface, BSTR event, I
return E_FAIL; return E_FAIL;
} }
return detach_event(window->doc->body_event_target, &window->doc->basedoc, event, pDisp); return detach_event(&window->event_target, &window->doc->basedoc, event, pDisp);
} }
static HRESULT window_set_timer(HTMLInnerWindow *This, VARIANT *expr, LONG msec, VARIANT *language, static HRESULT window_set_timer(HTMLInnerWindow *This, VARIANT *expr, LONG msec, VARIANT *language,
......
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