summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-26 17:42:31 +0000
committerpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-26 17:42:31 +0000
commitd187b23c6fafa275334d4586e99af342076a2ce5 (patch)
tree8a37bcb8c29f0dcd4a9e28394d8ebc5b63f6d70e
parent9f3ce2ffd0fee67250f1b27dda7d5f542faad6f5 (diff)
downloadchromium_src-d187b23c6fafa275334d4586e99af342076a2ce5.zip
chromium_src-d187b23c6fafa275334d4586e99af342076a2ce5.tar.gz
chromium_src-d187b23c6fafa275334d4586e99af342076a2ce5.tar.bz2
Merge 86845 - Fix hittesting in the OpaqueBrowserFrameView for frames without a tabstrip. The HitTest() function was using GetBoundsForTabstrip(), which returns the ideal tabstrip bounds assuming a tabstrip were visible, instead of the actual tabstrip bounds.
Also cleans up some unnecessarily verbose code. BUG=82524 TEST=Install a Chrome theme. Visit http://www.liveatc.net/search/?icao=ath and click the green "listen" button that "requires Java". A popup window with an infobar should appear. The infobar buttons should be clickable. Review URL: http://codereview.chromium.org/7071001 TBR=pkasting@chromium.org Review URL: http://codereview.chromium.org/7071018 git-svn-id: svn://svn.chromium.org/chrome/branches/742/src@86847 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/ui/views/frame/glass_browser_frame_view.cc11
-rw-r--r--chrome/browser/ui/views/frame/opaque_browser_frame_view.cc18
2 files changed, 11 insertions, 18 deletions
diff --git a/chrome/browser/ui/views/frame/glass_browser_frame_view.cc b/chrome/browser/ui/views/frame/glass_browser_frame_view.cc
index 9fa33d5..d000d0e 100644
--- a/chrome/browser/ui/views/frame/glass_browser_frame_view.cc
+++ b/chrome/browser/ui/views/frame/glass_browser_frame_view.cc
@@ -265,13 +265,10 @@ void GlassBrowserFrameView::Layout() {
bool GlassBrowserFrameView::HitTest(const gfx::Point& l) const {
// The ProfileMenuButton intrudes into the client area when the window is
// maximized.
- if (frame_->GetWindow()->IsMaximized() && show_profile_button() &&
- profile_button_->IsVisible() &&
- profile_button_->GetMirroredBounds().Contains(l)) {
- return true;
- } else {
- return !GetWindow()->client_view()->bounds().Contains(l);
- }
+ return (frame_->GetWindow()->IsMaximized() && show_profile_button() &&
+ profile_button_->IsVisible() &&
+ profile_button_->GetMirroredBounds().Contains(l)) ||
+ !GetWindow()->client_view()->bounds().Contains(l);
}
///////////////////////////////////////////////////////////////////////////////
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 6a0482b..4ee18185 100644
--- a/chrome/browser/ui/views/frame/opaque_browser_frame_view.cc
+++ b/chrome/browser/ui/views/frame/opaque_browser_frame_view.cc
@@ -222,9 +222,8 @@ int OpaqueBrowserFrameView::NonClientTopBorderHeight(
gfx::Rect OpaqueBrowserFrameView::GetBoundsForTabStrip(
views::View* tabstrip) const {
- if (!tabstrip) {
+ if (!tabstrip)
return gfx::Rect();
- }
if (browser_view_->UseVerticalTabs()) {
gfx::Size ps = tabstrip->GetPreferredSize();
@@ -240,11 +239,8 @@ gfx::Rect OpaqueBrowserFrameView::GetBoundsForTabStrip(
int tabstrip_width = minimize_button_->x() - tabstrip_x -
(frame_->GetWindow()->IsMaximized() ?
kNewTabCaptionMaximizedSpacing : kNewTabCaptionRestoredSpacing);
- int tabstrip_height = 0;
- if (tabstrip)
- tabstrip_height = tabstrip->GetPreferredSize().height();
return gfx::Rect(tabstrip_x, GetHorizontalTabStripVerticalOffset(false),
- std::max(0, tabstrip_width), tabstrip_height);
+ std::max(0, tabstrip_width), tabstrip->GetPreferredSize().height());
}
int OpaqueBrowserFrameView::GetHorizontalTabStripVerticalOffset(
@@ -413,16 +409,16 @@ bool OpaqueBrowserFrameView::HitTest(const gfx::Point& l) const {
return in_nonclient;
// Otherwise claim it only if it's in a non-tab portion of the tabstrip.
- bool vertical_tabs = browser_view_->UseVerticalTabs();
- gfx::Rect tabstrip_bounds = GetBoundsForTabStrip(browser_view_->tabstrip());
+ if (!browser_view_->tabstrip())
+ return false;
+ gfx::Rect tabstrip_bounds(browser_view_->tabstrip()->bounds());
gfx::Point tabstrip_origin(tabstrip_bounds.origin());
View::ConvertPointToView(frame_->GetWindow()->client_view(),
this, &tabstrip_origin);
tabstrip_bounds.set_origin(tabstrip_origin);
- if ((!vertical_tabs && l.y() > tabstrip_bounds.bottom()) ||
- (vertical_tabs && l.x() > tabstrip_bounds.right())) {
+ if (browser_view_->UseVerticalTabs() ?
+ (l.x() > tabstrip_bounds.right()) : (l.y() > 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,