Commit 8db98e9e authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

mshtml: Added IHTMLEventObj::get_srcElement implementation.

parent a9bebdf5
...@@ -84,7 +84,10 @@ eventid_t str_to_eid(LPCWSTR str) ...@@ -84,7 +84,10 @@ eventid_t str_to_eid(LPCWSTR str)
typedef struct { typedef struct {
DispatchEx dispex; DispatchEx dispex;
const IHTMLEventObjVtbl *lpIHTMLEventObjVtbl; const IHTMLEventObjVtbl *lpIHTMLEventObjVtbl;
LONG ref; LONG ref;
HTMLDOMNode *target;
} HTMLEventObj; } HTMLEventObj;
#define HTMLEVENTOBJ(x) ((IHTMLEventObj*) &(x)->lpIHTMLEventObjVtbl) #define HTMLEVENTOBJ(x) ((IHTMLEventObj*) &(x)->lpIHTMLEventObjVtbl)
...@@ -177,8 +180,10 @@ static HRESULT WINAPI HTMLEventObj_Invoke(IHTMLEventObj *iface, DISPID dispIdMem ...@@ -177,8 +180,10 @@ static HRESULT WINAPI HTMLEventObj_Invoke(IHTMLEventObj *iface, DISPID dispIdMem
static HRESULT WINAPI HTMLEventObj_get_srcElement(IHTMLEventObj *iface, IHTMLElement **p) static HRESULT WINAPI HTMLEventObj_get_srcElement(IHTMLEventObj *iface, IHTMLElement **p)
{ {
HTMLEventObj *This = HTMLEVENTOBJ_THIS(iface); HTMLEventObj *This = HTMLEVENTOBJ_THIS(iface);
FIXME("(%p)->(%p)\n", This, p);
return E_NOTIMPL; TRACE("(%p)->(%p)\n", This, p);
return IHTMLDOMNode_QueryInterface(HTMLDOMNODE(This->target), &IID_IHTMLElement, (void**)p);
} }
static HRESULT WINAPI HTMLEventObj_get_altKey(IHTMLEventObj *iface, VARIANT_BOOL *p) static HRESULT WINAPI HTMLEventObj_get_altKey(IHTMLEventObj *iface, VARIANT_BOOL *p)
...@@ -398,13 +403,15 @@ static dispex_static_data_t HTMLEventObj_dispex = { ...@@ -398,13 +403,15 @@ static dispex_static_data_t HTMLEventObj_dispex = {
HTMLEventObj_iface_tids HTMLEventObj_iface_tids
}; };
static IHTMLEventObj *create_event(void) static IHTMLEventObj *create_event(HTMLDOMNode *target)
{ {
HTMLEventObj *ret; HTMLEventObj *ret;
ret = heap_alloc(sizeof(*ret)); ret = heap_alloc(sizeof(*ret));
ret->lpIHTMLEventObjVtbl = &HTMLEventObjVtbl; ret->lpIHTMLEventObjVtbl = &HTMLEventObjVtbl;
ret->ref = 1; ret->ref = 1;
ret->target = target;
IHTMLDOMNode_AddRef(HTMLDOMNODE(target));
init_dispex(&ret->dispex, (IUnknown*)HTMLEVENTOBJ(ret), &HTMLEventObj_dispex); init_dispex(&ret->dispex, (IUnknown*)HTMLEVENTOBJ(ret), &HTMLEventObj_dispex);
...@@ -433,7 +440,7 @@ void fire_event(HTMLDocument *doc, eventid_t eid, nsIDOMNode *target) ...@@ -433,7 +440,7 @@ void fire_event(HTMLDocument *doc, eventid_t eid, nsIDOMNode *target)
if(node && node->event_target && node->event_target->event_table[eid]) { if(node && node->event_target && node->event_target->event_table[eid]) {
if(!event_obj) if(!event_obj)
event_obj = doc->window->event = create_event(); event_obj = doc->window->event = create_event(get_node(doc, target, TRUE));
TRACE("%s >>>\n", debugstr_w(event_info[eid].name)); TRACE("%s >>>\n", debugstr_w(event_info[eid].name));
call_disp_func(doc, node->event_target->event_table[eid], (IDispatch*)HTMLDOMNODE(node)); call_disp_func(doc, node->event_target->event_table[eid], (IDispatch*)HTMLDOMNODE(node));
...@@ -459,7 +466,7 @@ void fire_event(HTMLDocument *doc, eventid_t eid, nsIDOMNode *target) ...@@ -459,7 +466,7 @@ void fire_event(HTMLDocument *doc, eventid_t eid, nsIDOMNode *target)
if((event_info[eid].flags & EVENT_BUBBLE) && doc->event_target && doc->event_target->event_table[eid]) { if((event_info[eid].flags & EVENT_BUBBLE) && doc->event_target && doc->event_target->event_table[eid]) {
if(!event_obj) if(!event_obj)
event_obj = doc->window->event = create_event(); event_obj = doc->window->event = create_event(get_node(doc, target, TRUE));
TRACE("doc %s >>>\n", debugstr_w(event_info[eid].name)); TRACE("doc %s >>>\n", debugstr_w(event_info[eid].name));
call_disp_func(doc, doc->event_target->event_table[eid], (IDispatch*)HTMLDOC(doc)); call_disp_func(doc, doc->event_target->event_table[eid], (IDispatch*)HTMLDOC(doc));
......
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