Chromium Code Reviews| 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 fa9e9d88a2bf886462a3959999e8debd57b0c552..818ad43bb8c2fe6e6d154ba656daede029a1c270 100644 |
| --- a/chrome/browser/ui/views/tabs/tab.cc |
| +++ b/chrome/browser/ui/views/tabs/tab.cc |
| @@ -422,16 +422,24 @@ class Tab::TabCloseButton : public views::ImageButton { |
| views::View::ConvertRectToTarget(tab_, this, &tab_bounds_f); |
| gfx::Rect tab_bounds = gfx::ToEnclosingRect(tab_bounds_f); |
| - // If the button is hidden behind another tab, the hit test mask is empty. |
| - // Otherwise set the hit test mask to be the contents bounds. |
| + // If the hit test request is in response to a gesture, |path| should be |
| + // empty unless the entire tab close button is visible to the user. Hit |
| + // test requests in response to a mouse event should always set |path| |
| + // to be the visible portion of the tab close button, even if it is |
| + // partially hidden behind another tab. |
| path->reset(); |
| - if (tab_bounds.Intersects(button_bounds)) { |
| - // Include the padding in the hit test mask for touch events. |
| - if (source == HIT_TEST_SOURCE_TOUCH) |
| - button_bounds = GetLocalBounds(); |
| - |
| - // TODO: this isn't quite right, really need to intersect the two regions. |
| - path->addRect(RectToSkRect(button_bounds)); |
| + gfx::Rect intersection(gfx::IntersectRects(tab_bounds, button_bounds)); |
| + if (!intersection.IsEmpty()) { |
| +#if !defined(OS_WIN) |
|
sky
2014/02/03 20:55:47
Why the ifdef?
I also don't understand why we can
tdanderson
2014/02/03 23:08:13
If we always return the intersection, then tabs wi
|
| + // TODO(tdanderson): Enforce this constraint on Windows once the issue |
| + // described in crbug.com/337850 is resolved; the |
| + // improper layout/clipping of the tab close button |
| + // causes Contains() to always return false. |
| + if (source == HIT_TEST_SOURCE_TOUCH && |
| + !tab_bounds.Contains(button_bounds)) |
| + return; |
| +#endif |
| + path->addRect(RectToSkRect(intersection)); |
| } |
| } |