Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(322)

Unified Diff: ui/base/events/event.cc

Issue 11308322: events: Start changing EventHandler interface to not return a value. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ui/base/events/event.cc
diff --git a/ui/base/events/event.cc b/ui/base/events/event.cc
index 4658e46cb92caf76929c672c916b91d5a2dc4996..c8399d81fb3dc4d06c99bb4e1eadbfd62dc448e7 100644
--- a/ui/base/events/event.cc
+++ b/ui/base/events/event.cc
@@ -71,6 +71,17 @@ bool Event::HasNativeEvent() const {
return !!std::memcmp(&native_event_, &null_event, sizeof(null_event));
}
+void Event::StopPropagation() {
+ CHECK(phase_ != EP_PREDISPATCH && phase_ != EP_POSTDISPATCH);
+ result_ = static_cast<ui::EventResult>(result_ | ER_CONSUMED);
+ CHECK(stopped_propagation());
+}
+
+void Event::PreventDefault() {
+ CHECK(phase_ != EP_PREDISPATCH && phase_ != EP_POSTDISPATCH);
Ben Goodger (Google) 2012/12/03 17:36:54 i would also like the ability to prevent this (and
sadrul 2012/12/03 17:45:20 Indeed. I have that in mind :) [ crbug.com/163617
+ result_ = static_cast<ui::EventResult>(result_ | ER_HANDLED);
+}
+
Event::Event(EventType type, base::TimeDelta time_stamp, int flags)
: type_(type),
time_stamp_(time_stamp),

Powered by Google App Engine
This is Rietveld 408576698