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

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

Issue 2930803002: Remove flag --disable-views-rect-based-targeting (Closed)
Patch Set: restore enum entry Created 3 years, 6 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/views_switches.cc ('k') | no next file » | 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 rect-based targeting is enabled, use the gesture's bounding box to 34 // If non-empty, use the gesture's bounding box to determine the target.
35 // determine the target. Otherwise use the center point of the gesture's 35 // Otherwise use the center point of the gesture's bounding box.
36 // bounding box to determine the target.
37 gfx::Rect rect(gesture.location(), gfx::Size(1, 1)); 36 gfx::Rect rect(gesture.location(), gfx::Size(1, 1));
38 if (views::switches::IsRectBasedTargetingEnabled() && 37 if (!gesture.details().bounding_box().IsEmpty()) {
39 !gesture.details().bounding_box().IsEmpty()) {
40 // TODO(tdanderson): Pass in the bounding box to GetEventHandlerForRect() 38 // TODO(tdanderson): Pass in the bounding box to GetEventHandlerForRect()
41 // once crbug.com/313392 is resolved. 39 // once crbug.com/313392 is resolved.
42 rect.set_size(gesture.details().bounding_box().size()); 40 rect.set_size(gesture.details().bounding_box().size());
43 rect.Offset(-rect.width() / 2, -rect.height() / 2); 41 rect.Offset(-rect.width() / 2, -rect.height() / 2);
44 } 42 }
45 43
46 return root->GetEffectiveViewTargeter()->TargetForRect(root, rect); 44 return root->GetEffectiveViewTargeter()->TargetForRect(root, rect);
47 } 45 }
48 46
49 ui::EventTarget* RootViewTargeter::FindNextBestTargetForGestureEvent( 47 ui::EventTarget* RootViewTargeter::FindNextBestTargetForGestureEvent(
(...skipping 18 matching lines...) Expand all
68 // the GESTURE_END event corresponding to the removal of the last touch 66 // the GESTURE_END event corresponding to the removal of the last touch
69 // point. In either case, no further re-targeting of |gesture| should be 67 // point. In either case, no further re-targeting of |gesture| should be
70 // permitted. 68 // permitted.
71 if (!root_view_->gesture_handler_) 69 if (!root_view_->gesture_handler_)
72 return NULL; 70 return NULL;
73 71
74 return previous_target->GetParentTarget(); 72 return previous_target->GetParentTarget();
75 } 73 }
76 74
77 } // namespace views 75 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/views_switches.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698