mirror of
https://github.com/reactos/wine.git
synced 2024-11-25 12:49:45 +00:00
mshtml: Store body event target in window object.
This commit is contained in:
parent
284796e4bc
commit
b481b09248
@ -718,11 +718,21 @@ static void HTMLBodyElement_destructor(HTMLDOMNode *iface)
|
||||
HTMLElement_destructor(&This->textcont.element.node);
|
||||
}
|
||||
|
||||
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->window
|
||||
? &This->textcont.element.node.doc->window->event_target
|
||||
: &This->textcont.element.node.event_target;
|
||||
}
|
||||
|
||||
#undef HTMLBODY_NODE_THIS
|
||||
|
||||
static const NodeImplVtbl HTMLBodyElementImplVtbl = {
|
||||
HTMLBodyElement_QI,
|
||||
HTMLBodyElement_destructor
|
||||
HTMLBodyElement_destructor,
|
||||
HTMLBodyElement_get_event_target
|
||||
};
|
||||
|
||||
static const tid_t HTMLBodyElement_iface_tids[] = {
|
||||
|
@ -608,7 +608,7 @@ static HRESULT WINAPI HTMLElement2_attachEvent(IHTMLElement2 *iface, BSTR event,
|
||||
|
||||
TRACE("(%p)->(%s %p %p)\n", This, debugstr_w(event), pDisp, pfResult);
|
||||
|
||||
return attach_event(&This->node.event_target, This->node.doc, event, pDisp, pfResult);
|
||||
return attach_event(get_node_event_target(&This->node), This->node.doc, event, pDisp, pfResult);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLElement2_detachEvent(IHTMLElement2 *iface, BSTR event, IDispatch *pDisp)
|
||||
|
@ -750,7 +750,7 @@ void fire_event(HTMLDocument *doc, eventid_t eid, nsIDOMNode *target, nsIDOMEven
|
||||
node = get_node(doc, nsnode, FALSE);
|
||||
|
||||
if(node)
|
||||
call_event_handlers(doc, event_obj, node->event_target, eid, (IDispatch*)HTMLDOMNODE(node));
|
||||
call_event_handlers(doc, event_obj, *get_node_event_target(node), eid, (IDispatch*)HTMLDOMNODE(node));
|
||||
|
||||
if(!(event_info[eid].flags & EVENT_BUBBLE))
|
||||
break;
|
||||
@ -931,7 +931,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_event_handler_disp(&node->event_target, node->doc, i, disp);
|
||||
set_event_handler_disp(get_node_event_target(node), node->doc, i, disp);
|
||||
IDispatch_Release(disp);
|
||||
}
|
||||
}
|
||||
|
@ -43,14 +43,19 @@ HRESULT set_event_handler(event_target_t**,HTMLDocument*,eventid_t,VARIANT*);
|
||||
HRESULT get_event_handler(event_target_t**,eventid_t,VARIANT*);
|
||||
HRESULT attach_event(event_target_t**,HTMLDocument*,BSTR,IDispatch*,VARIANT_BOOL*);
|
||||
|
||||
static inline event_target_t **get_node_event_target(HTMLDOMNode *node)
|
||||
{
|
||||
return node->vtbl->get_event_target ? node->vtbl->get_event_target(node) : &node->event_target;
|
||||
}
|
||||
|
||||
static inline HRESULT set_node_event(HTMLDOMNode *node, eventid_t eid, VARIANT *var)
|
||||
{
|
||||
return set_event_handler(&node->event_target, node->doc, eid, var);
|
||||
return set_event_handler(get_node_event_target(node), node->doc, eid, var);
|
||||
}
|
||||
|
||||
static inline HRESULT get_node_event(HTMLDOMNode *node, eventid_t eid, VARIANT *var)
|
||||
{
|
||||
return get_event_handler(&node->event_target, eid, var);
|
||||
return get_event_handler(get_node_event_target(node), eid, var);
|
||||
}
|
||||
|
||||
static inline HRESULT set_doc_event(HTMLDocument *doc, eventid_t eid, VARIANT *var)
|
||||
|
@ -1119,6 +1119,7 @@ static HRESULT HTMLInputElementImpl_get_disabled(HTMLDOMNode *iface, VARIANT_BOO
|
||||
static const NodeImplVtbl HTMLInputElementImplVtbl = {
|
||||
HTMLInputElement_QI,
|
||||
HTMLInputElement_destructor,
|
||||
NULL,
|
||||
HTMLInputElementImpl_put_disabled,
|
||||
HTMLInputElementImpl_get_disabled,
|
||||
};
|
||||
|
@ -480,6 +480,7 @@ static HRESULT HTMLSelectElementImpl_get_disabled(HTMLDOMNode *iface, VARIANT_BO
|
||||
static const NodeImplVtbl HTMLSelectElementImplVtbl = {
|
||||
HTMLSelectElement_QI,
|
||||
HTMLSelectElement_destructor,
|
||||
NULL,
|
||||
HTMLSelectElementImpl_put_disabled,
|
||||
HTMLSelectElementImpl_get_disabled
|
||||
};
|
||||
|
@ -405,6 +405,7 @@ static HRESULT HTMLTextAreaElementImpl_get_disabled(HTMLDOMNode *iface, VARIANT_
|
||||
static const NodeImplVtbl HTMLTextAreaElementImplVtbl = {
|
||||
HTMLTextAreaElement_QI,
|
||||
HTMLTextAreaElement_destructor,
|
||||
NULL,
|
||||
HTMLTextAreaElementImpl_put_disabled,
|
||||
HTMLTextAreaElementImpl_get_disabled
|
||||
};
|
||||
|
@ -29,6 +29,7 @@
|
||||
#include "wine/unicode.h"
|
||||
|
||||
#include "mshtml_private.h"
|
||||
#include "htmlevent.h"
|
||||
#include "resource.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
|
||||
@ -92,6 +93,8 @@ static ULONG WINAPI HTMLWindow2_Release(IHTMLWindow2 *iface)
|
||||
TRACE("(%p) ref=%d\n", This, ref);
|
||||
|
||||
if(!ref) {
|
||||
if(This->event_target)
|
||||
release_event_target(This->event_target);
|
||||
list_remove(&This->entry);
|
||||
release_dispex(&This->dispex);
|
||||
heap_free(This);
|
||||
|
@ -164,6 +164,7 @@ typedef struct {
|
||||
HTMLDocument *doc;
|
||||
nsIDOMWindow *nswindow;
|
||||
|
||||
event_target_t *event_target;
|
||||
IHTMLEventObj *event;
|
||||
|
||||
struct list entry;
|
||||
@ -382,6 +383,7 @@ typedef struct {
|
||||
typedef struct {
|
||||
HRESULT (*qi)(HTMLDOMNode*,REFIID,void**);
|
||||
void (*destructor)(HTMLDOMNode*);
|
||||
event_target_t **(*get_event_target)(HTMLDOMNode*);
|
||||
HRESULT (*put_disabled)(HTMLDOMNode*,VARIANT_BOOL);
|
||||
HRESULT (*get_disabled)(HTMLDOMNode*,VARIANT_BOOL*);
|
||||
} NodeImplVtbl;
|
||||
|
Loading…
Reference in New Issue
Block a user