Chromium Code Reviews| Index: chrome/browser/ui/views/frame/browser_non_client_frame_view_ash.cc |
| diff --git a/chrome/browser/ui/views/frame/browser_non_client_frame_view_ash.cc b/chrome/browser/ui/views/frame/browser_non_client_frame_view_ash.cc |
| index 98f40fc89f790341307083cfbca261a15761b771..f4f0f52ac866f1b65c7850c32f2624ddfa2d42ce 100644 |
| --- a/chrome/browser/ui/views/frame/browser_non_client_frame_view_ash.cc |
| +++ b/chrome/browser/ui/views/frame/browser_non_client_frame_view_ash.cc |
| @@ -264,28 +264,49 @@ const char* BrowserNonClientFrameViewAsh::GetClassName() const { |
| } |
| bool BrowserNonClientFrameViewAsh::HitTestRect(const gfx::Rect& rect) const { |
| + if (!views::View::HitTestRect(rect)) { |
| + // |rect| is outside BrowserNonClientFrameViewAsh's bounds. |
| + return false; |
| + } |
| // If the rect is outside the bounds of the client area, claim it. |
| - if (NonClientFrameView::HitTestRect(rect)) |
| + gfx::Point rect_in_client_view_coords_origin(rect.origin()); |
| + View::ConvertPointToTarget(this, frame()->client_view(), |
|
tdanderson
2013/07/18 20:47:04
Also add a TODO for me here.
|
| + &rect_in_client_view_coords_origin); |
| + gfx::Rect rect_in_client_view_coords( |
| + rect_in_client_view_coords_origin, rect.size()); |
| + if (!frame()->client_view()->HitTestRect(rect_in_client_view_coords)) |
| return true; |
| - // Otherwise claim it only if it's in a non-tab portion of the tabstrip. |
| - if (!browser_view()->tabstrip()) |
| + // Otherwise, claim |rect| only if it is above the bottom of the tabstrip in |
| + // a non-tab portion. |
| + TabStrip* tabstrip = browser_view()->tabstrip(); |
| + if (!tabstrip || !browser_view()->IsTabStripVisible()) |
| 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()) |
| + |
| + gfx::Point rect_in_tabstrip_coords_origin(rect.origin()); |
| + View::ConvertPointToTarget(this, tabstrip, |
|
tdanderson
2013/07/18 20:47:04
Also add a TODO for me here.
|
| + &rect_in_tabstrip_coords_origin); |
| + gfx::Rect rect_in_tabstrip_coords(rect_in_tabstrip_coords_origin, |
| + rect.size()); |
| + |
| + if (rect_in_tabstrip_coords.bottom() > tabstrip->GetLocalBounds().bottom()) { |
| + // |rect| is below the tabstrip. |
| return false; |
| + } |
| + |
| + if (tabstrip->HitTestRect(rect_in_tabstrip_coords)) { |
| + // Claim |rect| if it is in a non-tab portion of the tabstrip. |
| + // TODO(tdanderson): Pass |rect_in_tabstrip_coords| instead of its center |
| + // point to TabStrip::IsPositionInWindowCaption() once |
| + // GetEventHandlerForRect() is implemented. |
| + return tabstrip->IsPositionInWindowCaption( |
| + rect_in_tabstrip_coords.CenterPoint()); |
| + } |
| - // 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. |
| - // 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); |
| + // We claim |rect| because it is above the bottom of the tabstrip, but |
| + // not in the tabstrip. In particular, the window controls are right of |
| + // the tabstrip. |
| + return true; |
| } |
| void BrowserNonClientFrameViewAsh::GetAccessibleState( |