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), |