Commit 85527dbd authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

mshtml: Added IDOMEvent:get_eventPhase implementation.

parent caa3c432
......@@ -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) {
......
......@@ -66,6 +66,7 @@ typedef struct {
EventTarget *target;
BOOL prevent_default;
BOOL stop_propagation;
USHORT phase;
IHTMLEventObj *event_obj;
BOOL no_event_obj;
......
......@@ -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);
......
......@@ -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
*/
......
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