Index: chrome/browser/cocoa/tab_controller.mm |
diff --git a/chrome/browser/cocoa/tab_controller.mm b/chrome/browser/cocoa/tab_controller.mm |
index c9469e0f37cac3290ed938c9397a07a77f932c64..558a341937b02f28f9b67f6ba492f17e611b88e8 100644 |
--- a/chrome/browser/cocoa/tab_controller.mm |
+++ b/chrome/browser/cocoa/tab_controller.mm |
@@ -124,7 +124,7 @@ class MenuDelegate : public menus::SimpleMenuModel::Delegate { |
// titleView_ under those conditions. |
NSRect titleFrame = [titleView_ frame]; |
iconTitleXOffset_ = NSMinX(titleFrame) - NSMinX(originalIconFrame_); |
- titleCloseWidthOffset_ = NSMaxX([closeButton_ frame]) - NSMaxX(titleFrame); |
+ titleCloseWidthOffset_ = NSMinX(originalIconFrame_) - NSMinX([closeButton_ frame]); |
[self internalSetSelected:selected_]; |
} |
@@ -171,6 +171,9 @@ class MenuDelegate : public menus::SimpleMenuModel::Delegate { |
- (void)setIconView:(NSView*)iconView { |
[iconView_ removeFromSuperview]; |
iconView_ = iconView; |
+ |
+ |
+NSLog(@"original frame: %@", NSStringFromRect(originalIconFrame_)); |
[iconView_ setFrame:originalIconFrame_]; |
// Ensure that the icon is suppressed if no icon is set or if the tab is too |
@@ -193,7 +196,7 @@ class MenuDelegate : public menus::SimpleMenuModel::Delegate { |
// tab. We never actually do this, but it's a helpful guide for determining |
// how much space we have available. |
- (int)iconCapacity { |
- CGFloat width = NSMaxX([closeButton_ frame]) - NSMinX(originalIconFrame_); |
+ CGFloat width = NSMaxX([titleView_ frame]) - NSMinX([closeButton_ frame]); |
CGFloat iconWidth = NSWidth(originalIconFrame_); |
return width / iconWidth; |
@@ -246,6 +249,8 @@ class MenuDelegate : public menus::SimpleMenuModel::Delegate { |
// visibility. |
NSRect titleFrame = [titleView_ frame]; |
+NSLog(@"r: %@", NSStringFromRect(titleFrame)); |
+ |
if (oldShowIcon != newShowIcon) { |
// Adjust the left edge of the title view according to the presence or |
// absence of the icon view. |
@@ -260,13 +265,24 @@ class MenuDelegate : public menus::SimpleMenuModel::Delegate { |
} |
if (oldShowCloseButton != newShowCloseButton) { |
- // Adjust the right edge of the title view according to the presence or |
+ // Adjust the left edge of the title view according to the presence or |
// absence of the close button. |
- if (newShowCloseButton) |
+ if (newShowCloseButton) { |
+ titleFrame.origin.x += titleCloseWidthOffset_; |
titleFrame.size.width -= titleCloseWidthOffset_; |
- else |
+ } else { |
+ titleFrame.origin.x -= titleCloseWidthOffset_; |
titleFrame.size.width += titleCloseWidthOffset_; |
+ } |
+ |
+ if (newShowCloseButton) { |
+ originalIconFrame_.origin.x += titleCloseWidthOffset_; |
+ } else { |
+ originalIconFrame_.origin.x -= titleCloseWidthOffset_; |
+ } |
+ [iconView_ setFrame:originalIconFrame_]; |
} |
+NSLog(@"r: %@", NSStringFromRect(titleFrame)); |
[titleView_ setFrame:titleFrame]; |
} |