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 fde98892ecf4e44523e02ef81c9d4da247d205dc..a18c842a8b3c22fada0d54f8054634edab93b1ee 100644 |
--- a/chrome/browser/ui/views/tabs/tab.cc |
+++ b/chrome/browser/ui/views/tabs/tab.cc |
@@ -251,6 +251,8 @@ const double kProjectingFaviconResizeScale = 0.75; |
// Scale to resize the projection sheet glow by. |
const double kProjectingGlowResizeScale = 2.0; |
+const char kTabCloseButtonName[] = "TabCloseButton"; |
+ |
void DrawIconAtLocation(gfx::Canvas* canvas, |
const gfx::ImageSkia& image, |
int image_offset, |
@@ -360,21 +362,24 @@ 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 (!View::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)); |
#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. |
@@ -417,6 +422,10 @@ class Tab::TabCloseButton : public views::ImageButton { |
event->SetHandled(); |
} |
+ virtual const char* GetClassName() const OVERRIDE { |
+ return kTabCloseButtonName; |
+ } |
+ |
private: |
Tab* tab_; |