Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4863)

Unified Diff: chrome/browser/ui/views/frame/opaque_browser_frame_view.cc

Issue 19115003: Make the maximize button more easily hittable when there is a huge amount of tabs present (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Moved the implementation to OapqueBrowserFrameView and BrowserNonClientFrameViewAsh Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..3ae34a62fa0c247ad2703dbbabe8c7ab48f63581 100644
--- a/chrome/browser/ui/views/frame/opaque_browser_frame_view.cc
+++ b/chrome/browser/ui/views/frame/opaque_browser_frame_view.cc
@@ -438,29 +438,53 @@ 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())
+ if (!views::View::HitTestRect(rect)) {
+ // |rect| is outside OpaqueBrowserFrameView's bounds.
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())
+ }
+
+ // If the rect is outside the bounds of the client area, claim it.
+ if (!frame()->client_view()->HitTestRect(rect))
+ return true;
+
+ // 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;
- // 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);
+ gfx::Point rect_in_tabstrip_coords_origin(rect.origin());
+ View::ConvertPointToTarget(this, tabstrip,
+ &rect_in_tabstrip_coords_origin);
+ gfx::Rect rect_in_tabstrip_coords(
+ rect_in_tabstrip_coords_origin, rect.size());
+
+ if (tabstrip->HitTestRect(rect_in_tabstrip_coords)) {
+ // 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());
+ }
+
+ // The window switcher button is in the client view.
+ views::View* window_switcher_button =
+ browser_view()->window_switcher_button();
James Cook 2013/07/17 21:44:34 Does anything with the window switcher button need
pkotwicz 2013/07/18 14:38:29 GlassBrowserFrameView does not need to worry about
+ if (window_switcher_button) {
+ gfx::Point rect_in_window_switcher_coords_origin(rect.origin());
+ View::ConvertPointToTarget(this, window_switcher_button,
+ &rect_in_window_switcher_coords_origin);
+ gfx::Rect rect_in_window_switcher_coords(
+ rect_in_window_switcher_coords_origin, rect.size());
+
+ if (window_switcher_button->HitTestRect(rect_in_window_switcher_coords))
+ return false;
+ }
+
+ // Claim |rect| if is to the left or right of the tab strip. In
+ // particular, the window controls and the avatar label/button are there.
+ return rect_in_tabstrip_coords.bottom() <=
James Cook 2013/07/17 21:44:34 Again, maybe the comment could be clearer?
+ tabstrip->GetLocalBounds().bottom();
}
void OpaqueBrowserFrameView::GetAccessibleState(

Powered by Google App Engine
This is Rietveld 408576698