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

Side by Side Diff: ui/aura/window.cc

Issue 27458002: Allow setting different hit test bounds overrides for mouse and touch (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 | Annotate | Revision Log
OLDNEW
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/aura/window.h" 5 #include "ui/aura/window.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 726 matching lines...) Expand 10 before | Expand all | Expand 10 after
737 bool for_event_handling) { 737 bool for_event_handling) {
738 if (!IsVisible()) 738 if (!IsVisible())
739 return NULL; 739 return NULL;
740 740
741 if ((for_event_handling && !HitTest(local_point)) || 741 if ((for_event_handling && !HitTest(local_point)) ||
742 (!for_event_handling && !ContainsPoint(local_point))) 742 (!for_event_handling && !ContainsPoint(local_point)))
743 return NULL; 743 return NULL;
744 744
745 // Check if I should claim this event and not pass it to my children because 745 // Check if I should claim this event and not pass it to my children because
746 // the location is inside my hit test override area. For details, see 746 // the location is inside my hit test override area. For details, see
747 // set_hit_test_bounds_override_inner(). 747 // SetHitTestBoundsOverrideInner().
748 if (for_event_handling && !hit_test_bounds_override_inner_.empty()) { 748 gfx::Insets hit_test_bounds_override_inner =
749 aura::Env::GetInstance()->is_touch_down() ?
750 hit_test_bounds_override_inner_touch_ :
751 hit_test_bounds_override_inner_mouse_;
752 if (for_event_handling && !hit_test_bounds_override_inner.empty()) {
749 gfx::Rect inset_local_bounds(gfx::Point(), bounds().size()); 753 gfx::Rect inset_local_bounds(gfx::Point(), bounds().size());
750 inset_local_bounds.Inset(hit_test_bounds_override_inner_); 754 inset_local_bounds.Inset(hit_test_bounds_override_inner);
751 // We know we're inside the normal local bounds, so if we're outside the 755 // We know we're inside the normal local bounds, so if we're outside the
752 // inset bounds we must be in the special hit test override area. 756 // inset bounds we must be in the special hit test override area.
753 DCHECK(HitTest(local_point)); 757 DCHECK(HitTest(local_point));
754 if (!inset_local_bounds.Contains(local_point)) 758 if (!inset_local_bounds.Contains(local_point))
755 return delegate_ ? this : NULL; 759 return delegate_ ? this : NULL;
756 } 760 }
757 761
758 if (!return_tightest && delegate_) 762 if (!return_tightest && delegate_)
759 return this; 763 return this;
760 764
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after
1145 bool contains_mouse = false; 1149 bool contains_mouse = false;
1146 if (IsVisible()) { 1150 if (IsVisible()) {
1147 RootWindow* root_window = GetRootWindow(); 1151 RootWindow* root_window = GetRootWindow();
1148 contains_mouse = root_window && 1152 contains_mouse = root_window &&
1149 ContainsPointInRoot(root_window->GetLastMouseLocationInRoot()); 1153 ContainsPointInRoot(root_window->GetLastMouseLocationInRoot());
1150 } 1154 }
1151 return contains_mouse; 1155 return contains_mouse;
1152 } 1156 }
1153 1157
1154 } // namespace aura 1158 } // namespace aura
OLDNEW
« ui/aura/window.h ('K') | « ui/aura/window.h ('k') | ui/aura/window_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698