Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ui/views/widget/root_view.h" | 5 #include "ui/views/widget/root_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 271 // events are not dispatched to any views. | 271 // events are not dispatched to any views. |
| 272 switch (event->type()) { | 272 switch (event->type()) { |
| 273 case ui::ET_GESTURE_SCROLL_UPDATE: | 273 case ui::ET_GESTURE_SCROLL_UPDATE: |
| 274 case ui::ET_GESTURE_SCROLL_END: | 274 case ui::ET_GESTURE_SCROLL_END: |
| 275 case ui::ET_SCROLL_FLING_START: | 275 case ui::ET_SCROLL_FLING_START: |
| 276 return; | 276 return; |
| 277 default: | 277 default: |
| 278 break; | 278 break; |
| 279 } | 279 } |
| 280 | 280 |
| 281 // Terry: A runtime flag will specify whether or not fuzzing should be | |
|
tdanderson
2013/10/07 21:35:21
I still have to define a --use-rect-based-views-ta
| |
| 282 // used here (and will possibly also specify an overlap percentage). | |
| 283 bool use_fuzzing = true; | |
| 284 | |
| 285 View* gesture_handler = NULL; | |
| 286 if (use_fuzzing) { | |
| 287 // Terry: account for any possible transformations on rect? | |
| 288 gfx::Rect touch_rect(event->details().bounding_box()); | |
| 289 gfx::Point origin(touch_rect.origin()); | |
| 290 View::ConvertPointFromScreen(this, &origin); | |
| 291 touch_rect.set_origin(origin); | |
| 292 gesture_handler = GetEventHandlerForRect(touch_rect); | |
| 293 } else { | |
| 294 gesture_handler = GetEventHandlerForPoint(event->location()); | |
| 295 } | |
| 296 | |
| 281 // Walk up the tree until we find a view that wants the gesture event. | 297 // Walk up the tree until we find a view that wants the gesture event. |
| 282 for (gesture_handler_ = GetEventHandlerForPoint(event->location()); | 298 for (gesture_handler_ = gesture_handler; |
| 283 gesture_handler_ && (gesture_handler_ != this); | 299 gesture_handler_ && (gesture_handler_ != this); |
| 284 gesture_handler_ = gesture_handler_->parent()) { | 300 gesture_handler_ = gesture_handler_->parent()) { |
| 285 if (!gesture_handler_->enabled()) { | 301 if (!gesture_handler_->enabled()) { |
| 286 // Disabled views eat events but are treated as not handled. | 302 // Disabled views eat events but are treated as not handled. |
| 287 return; | 303 return; |
| 288 } | 304 } |
| 289 | 305 |
| 290 // See if this view wants to handle the Gesture. | 306 // See if this view wants to handle the Gesture. |
| 291 ui::GestureEvent gesture_event(*event, static_cast<View*>(this), | 307 ui::GestureEvent gesture_event(*event, static_cast<View*>(this), |
| 292 gesture_handler_); | 308 gesture_handler_); |
| 293 DispatchEventToTarget(gesture_handler_, &gesture_event); | 309 DispatchEventToTarget(gesture_handler_, &gesture_event); |
| 294 | 310 |
| (...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 714 return; | 730 return; |
| 715 } | 731 } |
| 716 } | 732 } |
| 717 | 733 |
| 718 bool RootView::CanDispatchToTarget(ui::EventTarget* target) { | 734 bool RootView::CanDispatchToTarget(ui::EventTarget* target) { |
| 719 return event_dispatch_target_ == target; | 735 return event_dispatch_target_ == target; |
| 720 } | 736 } |
| 721 | 737 |
| 722 } // namespace internal | 738 } // namespace internal |
| 723 } // namespace views | 739 } // namespace views |
| OLD | NEW |