| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_targeter.h" | 5 #include "ui/views/widget/root_view_targeter.h" |
| 6 | 6 |
| 7 #include "ui/views/view.h" | 7 #include "ui/views/view.h" |
| 8 #include "ui/views/view_targeter_delegate.h" | 8 #include "ui/views/view_targeter_delegate.h" |
| 9 #include "ui/views/views_switches.h" | 9 #include "ui/views/views_switches.h" |
| 10 #include "ui/views/widget/root_view.h" | 10 #include "ui/views/widget/root_view.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 CHECK_EQ(root, root_view_); | 26 CHECK_EQ(root, root_view_); |
| 27 | 27 |
| 28 // Return the default gesture handler if one is already set. | 28 // Return the default gesture handler if one is already set. |
| 29 if (root_view_->gesture_handler_) { | 29 if (root_view_->gesture_handler_) { |
| 30 CHECK(root_view_->gesture_handler_set_before_processing_); | 30 CHECK(root_view_->gesture_handler_set_before_processing_); |
| 31 return root_view_->gesture_handler_; | 31 return root_view_->gesture_handler_; |
| 32 } | 32 } |
| 33 | 33 |
| 34 // If no default gesture handler has already been set, do not perform any | 34 // If no default gesture handler has already been set, do not perform any |
| 35 // targeting for a ET_GESTURE_END event. | 35 // targeting for a ET_GESTURE_END event. |
| 36 // TODO(tdanderson): This check belongs in |
| 37 // RootView::OnEventProcessingStarted() instead of here. |
| 36 if (gesture.type() == ui::ET_GESTURE_END) | 38 if (gesture.type() == ui::ET_GESTURE_END) |
| 37 return NULL; | 39 return NULL; |
| 38 | 40 |
| 39 // If rect-based targeting is enabled, use the gesture's bounding box to | 41 // If rect-based targeting is enabled, use the gesture's bounding box to |
| 40 // determine the target. Otherwise use the center point of the gesture's | 42 // determine the target. Otherwise use the center point of the gesture's |
| 41 // bounding box to determine the target. | 43 // bounding box to determine the target. |
| 42 gfx::Rect rect(gesture.location(), gfx::Size(1, 1)); | 44 gfx::Rect rect(gesture.location(), gfx::Size(1, 1)); |
| 43 if (views::switches::IsRectBasedTargetingEnabled() && | 45 if (views::switches::IsRectBasedTargetingEnabled() && |
| 44 !gesture.details().bounding_box().IsEmpty()) { | 46 !gesture.details().bounding_box().IsEmpty()) { |
| 45 // TODO(tdanderson): Pass in the bounding box to GetEventHandlerForRect() | 47 // TODO(tdanderson): Pass in the bounding box to GetEventHandlerForRect() |
| (...skipping 27 matching lines...) Expand all Loading... |
| 73 // the GESTURE_END event corresponding to the removal of the last touch | 75 // the GESTURE_END event corresponding to the removal of the last touch |
| 74 // point. In either case, no further re-targeting of |gesture| should be | 76 // point. In either case, no further re-targeting of |gesture| should be |
| 75 // permitted. | 77 // permitted. |
| 76 if (!root_view_->gesture_handler_) | 78 if (!root_view_->gesture_handler_) |
| 77 return NULL; | 79 return NULL; |
| 78 | 80 |
| 79 return previous_target->GetParentTarget(); | 81 return previous_target->GetParentTarget(); |
| 80 } | 82 } |
| 81 | 83 |
| 82 } // namespace views | 84 } // namespace views |
| OLD | NEW |