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

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

Issue 8172010: Account for minimum tabstrip width in opaque browser frame. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 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
« no previous file with comments | « chrome/browser/ui/views/frame/opaque_browser_frame_view.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/frame/opaque_browser_frame_view.cc
===================================================================
--- chrome/browser/ui/views/frame/opaque_browser_frame_view.cc (revision 145906)
+++ chrome/browser/ui/views/frame/opaque_browser_frame_view.cc (working copy)
@@ -221,17 +221,12 @@
if (!tabstrip)
return gfx::Rect();
- int tabstrip_x = browser_view()->ShouldShowAvatar() ?
- (avatar_bounds_.right() + kAvatarRightSpacing) :
- NonClientBorderThickness() + kTabStripIndent;
-
- int maximized_spacing = kNewTabCaptionMaximizedSpacing;
- int tabstrip_width =
- (minimize_button_ ? minimize_button_->x() : width()) - tabstrip_x -
- (frame()->IsMaximized() ?
- maximized_spacing : kNewTabCaptionRestoredSpacing);
- return gfx::Rect(tabstrip_x, GetHorizontalTabStripVerticalOffset(false),
- std::max(0, tabstrip_width), tabstrip->GetPreferredSize().height());
+ gfx::Rect bounds = GetBoundsForTabStripAndAvatarArea(tabstrip);
+ const int space_left_of_tabstrip = browser_view()->ShouldShowAvatar() ?
+ (kAvatarLeftSpacing + avatar_bounds_.width() + kAvatarRightSpacing) :
+ kTabStripIndent;
+ bounds.Inset(space_left_of_tabstrip, 0, 0, 0);
+ return bounds;
}
int OpaqueBrowserFrameView::GetHorizontalTabStripVerticalOffset(
@@ -267,6 +262,19 @@
}
#endif
min_size.set_width(std::max(min_size.width(), min_titlebar_width));
+
+ // Ensure that the minimum width is enough to hold a minimum width tab strip
+ // and avatar icon at their usual insets.
+ if (browser_view()->IsTabStripVisible()) {
+ TabStrip* tabstrip = browser_view()->tabstrip();
+ const int min_tabstrip_width = tabstrip->GetMinimumSize().width();
+ const int min_tabstrip_area_width =
+ width() - GetBoundsForTabStripAndAvatarArea(tabstrip).width() +
+ min_tabstrip_width + browser_view()->GetOTRAvatarIcon().width() +
+ kAvatarLeftSpacing + kAvatarRightSpacing;
+ min_size.set_width(std::max(min_size.width(), min_tabstrip_area_width));
+ }
+
return min_size;
}
@@ -567,6 +575,19 @@
return gfx::Rect(frame_thickness + kIconLeftSpacing, y, size, size);
}
+gfx::Rect OpaqueBrowserFrameView::GetBoundsForTabStripAndAvatarArea(
+ views::View* tabstrip) const {
+ const int available_width =
+ minimize_button_ ? minimize_button_->x() : width();
+ const int caption_spacing = frame()->IsMaximized() ?
+ kNewTabCaptionMaximizedSpacing : kNewTabCaptionRestoredSpacing;
+ const int tabstrip_x = NonClientBorderThickness();
+ const int tabstrip_width = available_width - tabstrip_x - caption_spacing;
+ return gfx::Rect(tabstrip_x, GetHorizontalTabStripVerticalOffset(false),
+ std::max(0, tabstrip_width),
+ tabstrip->GetPreferredSize().height());
+}
+
void OpaqueBrowserFrameView::PaintRestoredFrameBorder(gfx::Canvas* canvas) {
frame_background_->set_frame_color(GetFrameColor());
frame_background_->set_theme_image(GetFrameImage());
« no previous file with comments | « chrome/browser/ui/views/frame/opaque_browser_frame_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698