mshtml: Added IDOMEvent:get_eventPhase implementation.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2017-10-24 19:39:11 +02:00 committed by Alexandre Julliard
parent caa3c43272
commit 85527dbdf3
4 changed files with 27 additions and 6 deletions

View File

@ -938,8 +938,11 @@ static HRESULT WINAPI DOMEvent_get_defaultPrevented(IDOMEvent *iface, VARIANT_BO
static HRESULT WINAPI DOMEvent_get_eventPhase(IDOMEvent *iface, USHORT *p)
{
DOMEvent *This = impl_from_IDOMEvent(iface);
FIXME("(%p)->(%p)\n", This, p);
return E_NOTIMPL;
TRACE("(%p)->(%p)\n", This, p);
*p = This->phase;
return S_OK;
}
static HRESULT WINAPI DOMEvent_get_target(IDOMEvent *iface, IEventTarget **p)
@ -1434,10 +1437,13 @@ void dispatch_event(EventTarget *event_target, DOMEvent *event)
event->target = event_target;
IDispatchEx_AddRef(&event_target->dispex.IDispatchEx_iface);
for(i = 0; i < chain_cnt; i++) {
call_event_handlers(target_chain[i], event);
if(!(event_flags & EVENT_BUBBLES) || event->stop_propagation)
break;
event->phase = DEP_AT_TARGET;
call_event_handlers(target_chain[0], event);
if(event_flags & EVENT_BUBBLES) {
event->phase = DEP_BUBBLING_PHASE;
for(i = 1; !event->stop_propagation && i < chain_cnt; i++)
call_event_handlers(target_chain[i], event);
}
if(target_vtbl && target_vtbl->set_current_event) {

View File

@ -66,6 +66,7 @@ typedef struct {
EventTarget *target;
BOOL prevent_default;
BOOL stop_propagation;
USHORT phase;
IHTMLEventObj *event_obj;
BOOL no_event_obj;

View File

@ -2534,6 +2534,7 @@ static void test_create_event(IHTMLDocument2 *doc)
{
IDocumentEvent *doc_event;
IDOMEvent *event;
USHORT phase;
BSTR str;
HRESULT hres;
@ -2547,6 +2548,11 @@ static void test_create_event(IHTMLDocument2 *doc)
SysFreeString(str);
ok(hres == S_OK, "createEvent failed: %08x\n", hres);
phase = 0xdead;
hres = IDOMEvent_get_eventPhase(event, &phase);
ok(hres == S_OK, "get_eventPhase failed: %08x\n", hres);
ok(!phase, "phase = %u\n", phase);
hres = IDOMEvent_preventDefault(event);
ok(hres == S_OK, "preventDefault failed: %08x\n", hres);

View File

@ -20031,6 +20031,14 @@ interface IEventTarget : IDispatch
[out, retval] VARIANT_BOOL *pfResult);
}
typedef enum _DOM_EVENT_PHASE
{
DEP_CAPTURING_PHASE = 1,
DEP_AT_TARGET = 2,
DEP_BUBBLING_PHASE = 3,
DOM_EVENT_PHASE_Max = 0x7fffffff
} DOM_EVENT_PHASE;
/*****************************************************************************
* IDOMEvent interface
*/