mshtml: Store body event target in HTMLDocumentNode.
This commit is contained in:
parent
2e6353d4bc
commit
e4a936a2d2
|
@ -783,8 +783,8 @@ static event_target_t **HTMLBodyElement_get_event_target(HTMLDOMNode *iface)
|
|||
{
|
||||
HTMLBodyElement *This = HTMLBODY_NODE_THIS(iface);
|
||||
|
||||
return This->textcont.element.node.doc && This->textcont.element.node.doc->basedoc.window
|
||||
? &This->textcont.element.node.doc->basedoc.window->event_target
|
||||
return This->textcont.element.node.doc
|
||||
? &This->textcont.element.node.doc->body_event_target
|
||||
: &This->textcont.element.node.event_target;
|
||||
}
|
||||
|
||||
|
|
|
@ -1842,6 +1842,8 @@ static void HTMLDocumentNode_destructor(HTMLDOMNode *iface)
|
|||
{
|
||||
HTMLDocumentNode *This = HTMLDOCNODE_NODE_THIS(iface);
|
||||
|
||||
if(This->body_event_target)
|
||||
release_event_target(This->body_event_target);
|
||||
if(This->nsevent_listener)
|
||||
release_nsevents(This);
|
||||
if(This->catmgr)
|
||||
|
|
|
@ -934,7 +934,7 @@ void fire_event(HTMLDocumentNode *doc, eventid_t eid, nsIDOMNode *target, nsIDOM
|
|||
}
|
||||
}
|
||||
|
||||
call_event_handlers(doc, event_obj, doc->basedoc.doc_node->node.event_target, &doc->basedoc.cp_container, eid,
|
||||
call_event_handlers(doc, event_obj, doc->node.event_target, &doc->basedoc.cp_container, eid,
|
||||
(IDispatch*)HTMLDOC(&doc->basedoc));
|
||||
break;
|
||||
|
||||
|
|
|
@ -74,13 +74,3 @@ static inline HRESULT get_doc_event(HTMLDocument *doc, eventid_t eid, VARIANT *v
|
|||
{
|
||||
return get_node_event(&doc->doc_node->node, eid, var);
|
||||
}
|
||||
|
||||
static inline HRESULT set_window_event(HTMLWindow *window, eventid_t eid, VARIANT *var)
|
||||
{
|
||||
return set_event_handler(&window->event_target, window->doc, eid, var);
|
||||
}
|
||||
|
||||
static inline HRESULT get_window_event(HTMLWindow *window, eventid_t eid, VARIANT *var)
|
||||
{
|
||||
return get_event_handler(&window->event_target, eid, var);
|
||||
}
|
||||
|
|
|
@ -117,6 +117,26 @@ static HRESULT get_location(HTMLWindow *This, HTMLLocation **ret)
|
|||
return S_OK;
|
||||
}
|
||||
|
||||
static inline HRESULT set_window_event(HTMLWindow *window, eventid_t eid, VARIANT *var)
|
||||
{
|
||||
if(!window->doc) {
|
||||
FIXME("No document\n");
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
return set_event_handler(&window->doc->body_event_target, window->doc, eid, var);
|
||||
}
|
||||
|
||||
static inline HRESULT get_window_event(HTMLWindow *window, eventid_t eid, VARIANT *var)
|
||||
{
|
||||
if(!window->doc) {
|
||||
FIXME("No document\n");
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
return get_event_handler(&window->doc->body_event_target, eid, var);
|
||||
}
|
||||
|
||||
#define HTMLWINDOW2_THIS(iface) DEFINE_THIS(HTMLWindow, HTMLWindow2, iface)
|
||||
|
||||
static HRESULT WINAPI HTMLWindow2_QueryInterface(IHTMLWindow2 *iface, REFIID riid, void **ppv)
|
||||
|
@ -206,8 +226,6 @@ static ULONG WINAPI HTMLWindow2_Release(IHTMLWindow2 *iface)
|
|||
if(This->screen)
|
||||
IHTMLScreen_Release(This->screen);
|
||||
|
||||
if(This->event_target)
|
||||
release_event_target(This->event_target);
|
||||
for(i=0; i < This->global_prop_cnt; i++)
|
||||
heap_free(This->global_props[i].name);
|
||||
|
||||
|
@ -1391,7 +1409,12 @@ static HRESULT WINAPI HTMLWindow3_attachEvent(IHTMLWindow3 *iface, BSTR event, I
|
|||
|
||||
TRACE("(%p)->(%s %p %p)\n", This, debugstr_w(event), pDisp, pfResult);
|
||||
|
||||
return attach_event(&This->event_target, &This->doc_obj->basedoc, event, pDisp, pfResult);
|
||||
if(!This->doc) {
|
||||
FIXME("No document\n");
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
return attach_event(&This->doc->body_event_target, &This->doc->basedoc, event, pDisp, pfResult);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLWindow3_detachEvent(IHTMLWindow3 *iface, BSTR event, IDispatch *pDisp)
|
||||
|
|
|
@ -242,7 +242,6 @@ struct HTMLWindow {
|
|||
IMoniker *mon;
|
||||
LPOLESTR url;
|
||||
|
||||
event_target_t *event_target;
|
||||
IHTMLEventObj *event;
|
||||
|
||||
SCRIPTMODE scriptmode;
|
||||
|
@ -531,6 +530,7 @@ struct HTMLDocumentNode {
|
|||
nsIDOMHTMLDocument *nsdoc;
|
||||
HTMLDOMNode *nodes;
|
||||
BOOL content_ready;
|
||||
event_target_t *body_event_target;
|
||||
|
||||
IInternetSecurityManager *secmgr;
|
||||
ICatInformation *catmgr;
|
||||
|
|
Loading…
Reference in New Issue