Jacek Caban : mshtml: Added IDOMEvent:: stopImmediatePropagation implementaition.
Alexandre Julliard
julliard at winehq.org
Thu Feb 15 14:42:28 CST 2018
Module: wine
Branch: master
Commit: ab210dd7a4c1966c5586d07d00b845a0409fef1b
URL: https://source.winehq.org/git/wine.git/?a=commit;h=ab210dd7a4c1966c5586d07d00b845a0409fef1b
Author: Jacek Caban <jacek at codeweavers.com>
Date: Thu Feb 15 17:04:51 2018 +0100
mshtml: Added IDOMEvent::stopImmediatePropagation implementaition.
Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/mshtml/htmlevent.c | 11 ++++++++---
dlls/mshtml/htmlevent.h | 1 +
dlls/mshtml/tests/events.js | 20 ++++++++++++++++++++
3 files changed, 29 insertions(+), 3 deletions(-)
diff --git a/dlls/mshtml/htmlevent.c b/dlls/mshtml/htmlevent.c
index d91de28..c5ae758 100644
--- a/dlls/mshtml/htmlevent.c
+++ b/dlls/mshtml/htmlevent.c
@@ -1051,8 +1051,12 @@ static HRESULT WINAPI DOMEvent_stopPropagation(IDOMEvent *iface)
static HRESULT WINAPI DOMEvent_stopImmediatePropagation(IDOMEvent *iface)
{
DOMEvent *This = impl_from_IDOMEvent(iface);
- FIXME("(%p)\n", This);
- return E_NOTIMPL;
+
+ TRACE("(%p)\n", This);
+
+ This->stop_immediate_propagation = This->stop_propagation = TRUE;
+ nsIDOMEvent_StopImmediatePropagation(This->nsevent);
+ return S_OK;
}
static HRESULT WINAPI DOMEvent_get_isTrusted(IDOMEvent *iface, VARIANT_BOOL *p)
@@ -2210,7 +2214,8 @@ static void call_event_handlers(EventTarget *event_target, DOMEvent *event, disp
}
}
- for(listener = listeners; listener < listeners + listeners_cnt; listener++) {
+ for(listener = listeners; !event->stop_immediate_propagation
+ && listener < listeners + listeners_cnt; listener++) {
if(listener->type != LISTENER_TYPE_ATTACHED) {
DISPID named_arg = DISPID_THIS;
VARIANTARG args[2];
diff --git a/dlls/mshtml/htmlevent.h b/dlls/mshtml/htmlevent.h
index e78c78c..182a36e 100644
--- a/dlls/mshtml/htmlevent.h
+++ b/dlls/mshtml/htmlevent.h
@@ -79,6 +79,7 @@ typedef struct {
BOOL cancelable;
BOOL prevent_default;
BOOL stop_propagation;
+ BOOL stop_immediate_propagation;
DOM_EVENT_PHASE phase;
IHTMLEventObj *event_obj;
diff --git a/dlls/mshtml/tests/events.js b/dlls/mshtml/tests/events.js
index 4560d93..6051295 100644
--- a/dlls/mshtml/tests/events.js
+++ b/dlls/mshtml/tests/events.js
@@ -251,9 +251,19 @@ function test_stop_propagation() {
ok(e.defaultPrevented === false, "defaultPrevented = " + e.defaultPrevented);
}
+ function stop_immediate_propagation(e) {
+ calls += "immediateStop,";
+ e.stopImmediatePropagation();
+ ok(e.bubbles === true, "bubbles = " + e.bubbles);
+ ok(e.cancelable === true, "cancelable = " + e.cancelable);
+ ok(e.defaultPrevented === false, "defaultPrevented = " + e.defaultPrevented);
+ }
+
+ div1.addEventListener("click", stop_immediate_propagation, true);
div1.addEventListener("click", stop_propagation, true);
div1.addEventListener("click", record_call("div1.click(capture)"), true);
+ div2.addEventListener("click", stop_immediate_propagation, true);
div2.addEventListener("click", stop_propagation, true);
div2.addEventListener("click", record_call("div2.click(capture)"), true);
@@ -265,11 +275,21 @@ function test_stop_propagation() {
calls = "";
div2.click();
+ ok(calls === "immediateStop,", "calls = " + calls);
+
+ div1.removeEventListener("click", stop_immediate_propagation, true);
+ calls = "";
+ div2.click();
ok(calls === "stop,div1.click(capture),", "calls = " + calls);
div1.removeEventListener("click", stop_propagation, true);
calls = "";
div2.click();
+ ok(calls === "div1.click(capture),immediateStop,", "calls = " + calls);
+
+ div2.removeEventListener("click", stop_immediate_propagation, true);
+ calls = "";
+ div2.click();
ok(calls === "div1.click(capture),stop,div2.click(capture),stop,div2.click(bubble),",
"calls = " + calls);
More information about the wine-cvs
mailing list