| 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 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 // events are not dispatched to any views. | 267 // events are not dispatched to any views. |
| 268 switch (event->type()) { | 268 switch (event->type()) { |
| 269 case ui::ET_GESTURE_SCROLL_UPDATE: | 269 case ui::ET_GESTURE_SCROLL_UPDATE: |
| 270 case ui::ET_GESTURE_SCROLL_END: | 270 case ui::ET_GESTURE_SCROLL_END: |
| 271 case ui::ET_SCROLL_FLING_START: | 271 case ui::ET_SCROLL_FLING_START: |
| 272 return; | 272 return; |
| 273 default: | 273 default: |
| 274 break; | 274 break; |
| 275 } | 275 } |
| 276 | 276 |
| 277 // Terry: A runtime flag will specify whether or not fuzzing should be |
| 278 // used here (and will possibly also specify an overlap percentage). |
| 279 bool use_fuzzing = true; |
| 280 |
| 281 View* gesture_handler = NULL; |
| 282 if (use_fuzzing) { |
| 283 // Terry: account for any possible transformations on rect? |
| 284 gfx::Rect touch_rect(event->details().bounding_box()); |
| 285 gfx::Point origin(touch_rect.origin()); |
| 286 View::ConvertPointFromScreen(this, &origin); |
| 287 touch_rect.set_origin(origin); |
| 288 gesture_handler = GetEventHandlerForRect(touch_rect); |
| 289 } else { |
| 290 gesture_handler = GetEventHandlerForPoint(event->location()); |
| 291 } |
| 292 |
| 277 // Walk up the tree until we find a view that wants the gesture event. | 293 // Walk up the tree until we find a view that wants the gesture event. |
| 278 for (gesture_handler_ = GetEventHandlerForPoint(event->location()); | 294 for (gesture_handler_ = gesture_handler; |
| 279 gesture_handler_ && (gesture_handler_ != this); | 295 gesture_handler_ && (gesture_handler_ != this); |
| 280 gesture_handler_ = gesture_handler_->parent()) { | 296 gesture_handler_ = gesture_handler_->parent()) { |
| 281 if (!gesture_handler_->enabled()) { | 297 if (!gesture_handler_->enabled()) { |
| 282 // Disabled views eat events but are treated as not handled. | 298 // Disabled views eat events but are treated as not handled. |
| 283 return; | 299 return; |
| 284 } | 300 } |
| 285 | 301 |
| 286 // See if this view wants to handle the Gesture. | 302 // See if this view wants to handle the Gesture. |
| 287 ui::GestureEvent gesture_event(*event, static_cast<View*>(this), | 303 ui::GestureEvent gesture_event(*event, static_cast<View*>(this), |
| 288 gesture_handler_); | 304 gesture_handler_); |
| 289 DispatchEventToTarget(gesture_handler_, &gesture_event); | 305 DispatchEventToTarget(gesture_handler_, &gesture_event); |
| 290 | 306 |
| (...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 705 return; | 721 return; |
| 706 } | 722 } |
| 707 } | 723 } |
| 708 | 724 |
| 709 bool RootView::CanDispatchToTarget(ui::EventTarget* target) { | 725 bool RootView::CanDispatchToTarget(ui::EventTarget* target) { |
| 710 return event_dispatch_target_ == target; | 726 return event_dispatch_target_ == target; |
| 711 } | 727 } |
| 712 | 728 |
| 713 } // namespace internal | 729 } // namespace internal |
| 714 } // namespace views | 730 } // namespace views |
| OLD | NEW |