Chromium Code Reviews| Index: chrome/browser/ui/views/frame/opaque_browser_frame_view.cc |
| diff --git a/chrome/browser/ui/views/frame/opaque_browser_frame_view.cc b/chrome/browser/ui/views/frame/opaque_browser_frame_view.cc |
| index 3e0547b6155530fcf009f0bda1bb006f30496d36..3bc5dba7fe4723599f512c6df2d9f592dc7ee81d 100644 |
| --- a/chrome/browser/ui/views/frame/opaque_browser_frame_view.cc |
| +++ b/chrome/browser/ui/views/frame/opaque_browser_frame_view.cc |
| @@ -323,7 +323,7 @@ gfx::Rect OpaqueBrowserFrameView::GetWindowBoundsForClientBounds( |
| client_bounds.height() + top_height + border_thickness); |
| } |
| -int OpaqueBrowserFrameView::NonClientHitTest(const gfx::Point& point) { |
| +int OpaqueBrowserFrameView::NonClientHitTest(const gfx::Point& point) const { |
| if (!bounds().Contains(point)) |
| return HTNOWHERE; |
| @@ -438,29 +438,20 @@ void OpaqueBrowserFrameView::Layout() { |
| } |
| bool OpaqueBrowserFrameView::HitTestRect(const gfx::Rect& rect) const { |
| - // If |rect| does not intersect the bounds of the client area, claim it. |
| - bool in_nonclient = NonClientFrameView::HitTestRect(rect); |
| - if (in_nonclient) |
| - return in_nonclient; |
| - |
| - // Otherwise claim it only if it's in a non-tab portion of the tabstrip. |
| - if (!browser_view()->tabstrip()) |
| - return false; |
| - gfx::Rect tabstrip_bounds(browser_view()->tabstrip()->bounds()); |
| - gfx::Point tabstrip_origin(tabstrip_bounds.origin()); |
| - View::ConvertPointToTarget(frame()->client_view(), this, &tabstrip_origin); |
| - tabstrip_bounds.set_origin(tabstrip_origin); |
| - if (rect.bottom() > tabstrip_bounds.bottom()) |
| - return false; |
| - |
| - // We convert from our parent's coordinates since we assume we fill its bounds |
| - // completely. We need to do this since we're not a parent of the tabstrip, |
| - // meaning ConvertPointToTarget would otherwise return something bogus. |
| + // NonClientHitTest() returns HTCLIENT for the avatar menu button and avatar |
|
James Cook
2013/07/16 19:25:52
I presume this block of code moved from somewhere
|
| + // label. They are parented to OpaqueBrowserFrameView so HitTestRect() needs |
| + // to return true. |
| + if ((avatar_button() && |
| + avatar_button()->GetMirroredBounds().Contains(rect)) || |
| + (avatar_label() && avatar_label()->GetMirroredBounds().Contains(rect))) { |
| + return true; |
| + } |
| + |
| // TODO(tdanderson): Initialize |browser_view_point| using |rect| instead of |
| // its center point once GetEventHandlerForRect() is implemented. |
| gfx::Point browser_view_point(rect.CenterPoint()); |
| View::ConvertPointToTarget(parent(), browser_view(), &browser_view_point); |
| - return browser_view()->IsPositionInWindowCaption(browser_view_point); |
| + return NonClientHitTest(browser_view_point) != HTCLIENT; |
| } |
| void OpaqueBrowserFrameView::GetAccessibleState( |