Index: chrome/browser/ui/views/frame/glass_browser_frame_view.cc |
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 f1d8ba599c940e8351b1882d3ca433e0263edf25..09c43205a39b0ceb312874627f2614e33cc3dd83 100644 |
--- a/chrome/browser/ui/views/frame/glass_browser_frame_view.cc |
+++ b/chrome/browser/ui/views/frame/glass_browser_frame_view.cc |
@@ -102,12 +102,15 @@ gfx::Rect GlassBrowserFrameView::GetBoundsForTabStrip( |
views::View* tabstrip) const { |
int minimize_button_offset = |
std::min(frame()->GetMinimizeButtonOffset(), width()); |
- int tabstrip_x = browser_view()->ShouldShowAvatar() ? |
- (avatar_bounds_.right() + kAvatarRightSpacing) : |
- NonClientBorderThickness() + kTabStripIndent; |
- if (avatar_label()) { |
- tabstrip_x += avatar_label()->bounds().width() + |
- views::kRelatedControlHorizontalSpacing; |
+ int tabstrip_x = NonClientBorderThickness() + kTabStripIndent; |
+ if (browser_view()->ShouldShowAvatar()) { |
+ // Space between the right edge of the avatar label and the tabstrip. |
+ // Note: Setting this < -2 makes the first tab draw over the avatar label. |
+ const int kAvatarLabelRightSpacing = -2; |
+ if (avatar_label() && avatar_label()->bounds().width()) |
+ tabstrip_x = avatar_label()->bounds().right() + kAvatarLabelRightSpacing; |
+ else |
+ tabstrip_x = avatar_bounds_.right() + kAvatarRightSpacing; |
} |
// In RTL languages, we have moved an avatar icon left by the size of window |
// controls to prevent it from being rendered over them. So, we use its x |
@@ -256,6 +259,8 @@ void GlassBrowserFrameView::Layout() { |
bool GlassBrowserFrameView::HitTestRect(const gfx::Rect& rect) const { |
return (avatar_button() && |
avatar_button()->GetMirroredBounds().Intersects(rect)) || |
+ (avatar_label() && |
+ avatar_label()->GetMirroredBounds().Intersects(rect)) || |
!frame()->client_view()->bounds().Intersects(rect); |
} |
@@ -430,13 +435,17 @@ void GlassBrowserFrameView::LayoutAvatar() { |
avatar_button()->SetBoundsRect(avatar_bounds_); |
if (avatar_label()) { |
- gfx::Size size = avatar_label()->GetPreferredSize(); |
- int label_height = std::min(avatar_bounds_.height(), size.height()); |
+ // Space between the bottom of the avatar and the bottom of the avatar |
+ // label. |
+ const int kAvatarLabelBottomSpacing = 3; |
+ // Space between the frame border and the left edge of the avatar label. |
+ const int kAvatarLabelLeftSpacing = -2; |
+ gfx::Size label_size = avatar_label()->GetPreferredSize(); |
gfx::Rect label_bounds( |
- avatar_bounds_.right() + views::kRelatedControlHorizontalSpacing, |
- avatar_y + (avatar_bounds_.height() - label_height) / 2, |
- size.width(), |
- browser_view()->ShouldShowAvatar() ? size.height() : 0); |
+ NonClientBorderThickness() + kAvatarLabelLeftSpacing, |
+ avatar_bottom - kAvatarLabelBottomSpacing - label_size.height(), |
+ label_size.width(), |
+ browser_view()->ShouldShowAvatar() ? label_size.height() : 0); |
avatar_label()->SetBoundsRect(label_bounds); |
} |
} |