Index: chrome/browser/ui/views/tabs/tab.cc |
diff --git a/chrome/browser/ui/views/tabs/tab.cc b/chrome/browser/ui/views/tabs/tab.cc |
index d1b36dd9fa31f63c24da7c01e216057a9e4ed7d2..61896f179ce5887650f8f09e745edf5f008269c3 100644 |
--- a/chrome/browser/ui/views/tabs/tab.cc |
+++ b/chrome/browser/ui/views/tabs/tab.cc |
@@ -43,6 +43,7 @@ |
#include "ui/gfx/skia_util.h" |
#include "ui/gfx/text_elider.h" |
#include "ui/views/controls/button/image_button.h" |
+#include "ui/views/rect_based_targeting_utils.h" |
#include "ui/views/widget/tooltip_manager.h" |
#include "ui/views/widget/widget.h" |
#include "ui/views/window/non_client_view.h" |
@@ -355,21 +356,26 @@ class Tab::TabCloseButton : public views::ImageButton { |
virtual ~TabCloseButton() {} |
// Overridden from views::View. |
- virtual View* GetEventHandlerForPoint(const gfx::Point& point) OVERRIDE { |
+ virtual View* GetEventHandlerForRect(const gfx::Rect& rect) OVERRIDE { |
+ if (!views::UsePointBasedTargeting(rect)) |
+ return View::GetEventHandlerForRect(rect); |
+ |
// Ignore the padding set on the button. |
- gfx::Rect rect = GetContentsBounds(); |
- rect.set_x(GetMirroredXForRect(rect)); |
+ gfx::Rect contents_bounds = GetContentsBounds(); |
+ contents_bounds.set_x(GetMirroredXForRect(contents_bounds)); |
+ // TODO(tdanderson): Remove this ifdef if rect-based targeting |
+ // is turned on by default. |
#if defined(USE_ASH) |
// Include the padding in hit-test for touch events. |
if (aura::Env::GetInstance()->is_touch_down()) |
- rect = GetLocalBounds(); |
+ contents_bounds = GetLocalBounds(); |
#elif defined(OS_WIN) |
// TODO(sky): Use local-bounds if a touch-point is active. |
// http://crbug.com/145258 |
#endif |
- return rect.Contains(point) ? this : parent(); |
+ return contents_bounds.Intersects(rect) ? this : parent(); |
} |
// Overridden from views::View. |