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

Side by Side Diff: ui/views/widget/root_view_targeter.cc

Issue 619183002: Move check for gesture end events out of RootViewTargeter (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comment removed Created 6 years, 2 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 unified diff | Download patch
« no previous file with comments | « ui/views/widget/root_view.cc ('k') | ui/views/widget/widget_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 13 matching lines...) Expand all
24 View* root, 24 View* root,
25 const ui::GestureEvent& gesture) { 25 const ui::GestureEvent& gesture) {
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
35 // targeting for a ET_GESTURE_END event.
36 // TODO(tdanderson): This check belongs in
37 // RootView::OnEventProcessingStarted() instead of here.
38 if (gesture.type() == ui::ET_GESTURE_END)
39 return NULL;
40
41 // If rect-based targeting is enabled, use the gesture's bounding box to 34 // If rect-based targeting is enabled, use the gesture's bounding box to
42 // determine the target. Otherwise use the center point of the gesture's 35 // determine the target. Otherwise use the center point of the gesture's
43 // bounding box to determine the target. 36 // bounding box to determine the target.
44 gfx::Rect rect(gesture.location(), gfx::Size(1, 1)); 37 gfx::Rect rect(gesture.location(), gfx::Size(1, 1));
45 if (views::switches::IsRectBasedTargetingEnabled() && 38 if (views::switches::IsRectBasedTargetingEnabled() &&
46 !gesture.details().bounding_box().IsEmpty()) { 39 !gesture.details().bounding_box().IsEmpty()) {
47 // TODO(tdanderson): Pass in the bounding box to GetEventHandlerForRect() 40 // TODO(tdanderson): Pass in the bounding box to GetEventHandlerForRect()
48 // once crbug.com/313392 is resolved. 41 // once crbug.com/313392 is resolved.
49 rect.set_size(gesture.details().bounding_box().size()); 42 rect.set_size(gesture.details().bounding_box().size());
50 rect.Offset(-rect.width() / 2, -rect.height() / 2); 43 rect.Offset(-rect.width() / 2, -rect.height() / 2);
(...skipping 24 matching lines...) Expand all
75 // the GESTURE_END event corresponding to the removal of the last touch 68 // the GESTURE_END event corresponding to the removal of the last touch
76 // point. In either case, no further re-targeting of |gesture| should be 69 // point. In either case, no further re-targeting of |gesture| should be
77 // permitted. 70 // permitted.
78 if (!root_view_->gesture_handler_) 71 if (!root_view_->gesture_handler_)
79 return NULL; 72 return NULL;
80 73
81 return previous_target->GetParentTarget(); 74 return previous_target->GetParentTarget();
82 } 75 }
83 76
84 } // namespace views 77 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/widget/root_view.cc ('k') | ui/views/widget/widget_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698