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

Unified Diff: ui/views/widget/root_view.cc

Issue 22891016: Add support for rect-based event targeting in views (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: WIP Created 7 years, 3 months 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/views/widget/root_view.cc
diff --git a/ui/views/widget/root_view.cc b/ui/views/widget/root_view.cc
index efdca920a1694471b3df1b772596eb07105adf0e..298e513b31e67cbd3ab8c1c6971867bbb81756e2 100644
--- a/ui/views/widget/root_view.cc
+++ b/ui/views/widget/root_view.cc
@@ -274,10 +274,26 @@ void RootView::DispatchGestureEvent(ui::GestureEvent* event) {
break;
}
+ // Terry: A runtime flag will specify whether or not fuzzing should be
+ // used here (and will possibly also specify an overlap percentage).
+ bool use_fuzzing = true;
+
+ View* gesture_handler = NULL;
+ if (use_fuzzing) {
+ // Terry: account for any possible transformations on rect?
+ gfx::Rect touch_rect(event->details().bounding_box());
+ gfx::Point origin(touch_rect.origin());
+ View::ConvertPointFromScreen(this, &origin);
+ touch_rect.set_origin(origin);
+ gesture_handler = GetEventHandlerForRect(touch_rect);
+ } else {
+ gesture_handler = GetEventHandlerForPoint(event->location());
+ }
+
// Walk up the tree until we find a view that wants the gesture event.
- for (gesture_handler_ = GetEventHandlerForPoint(event->location());
- gesture_handler_ && (gesture_handler_ != this);
- gesture_handler_ = gesture_handler_->parent()) {
+ for (gesture_handler_ = gesture_handler;
+ gesture_handler_ && (gesture_handler_ != this);
+ gesture_handler_ = gesture_handler_->parent()) {
if (!gesture_handler_->enabled()) {
// Disabled views eat events but are treated as not handled.
return;
« ui/views/view.cc ('K') | « ui/views/view.cc ('k') | ui/views/window/non_client_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698