mshtml: Added IDOMEvent::get_srcElement implementation.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2018-01-24 17:38:12 +01:00 committed by Alexandre Julliard
parent 6f7532cb7b
commit 07954f3621
2 changed files with 17 additions and 6 deletions

View File

@ -396,10 +396,12 @@ static HRESULT WINAPI HTMLEventObj_get_srcElement(IHTMLEventObj *iface, IHTMLEle
TRACE("(%p)->(%p)\n", This, p); TRACE("(%p)->(%p)\n", This, p);
*p = NULL; if(!This->event) {
if(This->event && This->event->target) *p = NULL;
IDispatchEx_QueryInterface(&This->event->target->dispex.IDispatchEx_iface, &IID_IHTMLElement, (void**)p); return S_OK;
return S_OK; }
return IDOMEvent_get_srcElement(&This->event->IDOMEvent_iface, p);
} }
static HRESULT WINAPI HTMLEventObj_get_altKey(IHTMLEventObj *iface, VARIANT_BOOL *p) static HRESULT WINAPI HTMLEventObj_get_altKey(IHTMLEventObj *iface, VARIANT_BOOL *p)
@ -1167,8 +1169,14 @@ static HRESULT WINAPI DOMEvent_get_cancelBubble(IDOMEvent *iface, VARIANT_BOOL *
static HRESULT WINAPI DOMEvent_get_srcElement(IDOMEvent *iface, IHTMLElement **p) static HRESULT WINAPI DOMEvent_get_srcElement(IDOMEvent *iface, IHTMLElement **p)
{ {
DOMEvent *This = impl_from_IDOMEvent(iface); DOMEvent *This = impl_from_IDOMEvent(iface);
FIXME("(%p)->(%p)\n", This, p);
return E_NOTIMPL; TRACE("(%p)->(%p)\n", This, p);
if(This->target)
IDispatchEx_QueryInterface(&This->target->dispex.IDispatchEx_iface, &IID_IHTMLElement, (void**)p);
else
*p = NULL;
return S_OK;
} }
static const IDOMEventVtbl DOMEventVtbl = { static const IDOMEventVtbl DOMEventVtbl = {

View File

@ -469,6 +469,7 @@ function test_dispatch_event() {
return function(event) { return function(event) {
ok(event === e, "event != e"); ok(event === e, "event != e");
ok(event.target === child, "target != child"); ok(event.target === child, "target != child");
ok(event.srcElement === child, "srcElement != child");
calls += msg + ","; calls += msg + ",";
}; };
} }
@ -485,12 +486,14 @@ function test_dispatch_event() {
e = document.createEvent("Event"); e = document.createEvent("Event");
e.initEvent("click", true, true); e.initEvent("click", true, true);
ok(e.target === null, "e.target != null"); ok(e.target === null, "e.target != null");
ok(e.srcElement === null, "e.srcElement != null");
calls = ""; calls = "";
child.dispatchEvent(e); child.dispatchEvent(e);
ok(calls === "parent.click(capture),child.click(capture),child.click(bubble)," ok(calls === "parent.click(capture),child.click(capture),child.click(bubble),"
+ "parent.click(bubble),", "calls = " + calls); + "parent.click(bubble),", "calls = " + calls);
ok(e.target === child, "e.target != child"); ok(e.target === child, "e.target != child");
ok(e.srcElement === child, "e.srcElement != child");
ok(e.currentTarget === null, "e.currentTarget != null"); ok(e.currentTarget === null, "e.currentTarget != null");
e = document.createEvent("Event"); e = document.createEvent("Event");