| 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..b0160b17eb336b033932cc8ae45aee89561d7760 100644
|
| --- a/chrome/browser/cocoa/tab_controller.mm
|
| +++ b/chrome/browser/cocoa/tab_controller.mm
|
| @@ -116,15 +116,17 @@ class MenuDelegate : public menus::SimpleMenuModel::Delegate {
|
| - (void)awakeFromNib {
|
| // Remember the icon's frame, so that if the icon is ever removed, a new
|
| // one can later replace it in the proper location.
|
| - originalIconFrame_ = [iconView_ frame];
|
| +// originalIconFrame_ = [iconView_ frame];
|
|
|
| // When the icon is removed, the title expands to the left to fill the space
|
| // left by the icon. When the close button is removed, the title expands to
|
| // the right to fill its space. These are the amounts to expand and contract
|
| // titleView_ under those conditions.
|
| NSRect titleFrame = [titleView_ frame];
|
| - iconTitleXOffset_ = NSMinX(titleFrame) - NSMinX(originalIconFrame_);
|
| - titleCloseWidthOffset_ = NSMaxX([closeButton_ frame]) - NSMaxX(titleFrame);
|
| +// iconTitleXOffset_ = NSMinX(titleFrame) - NSMinX(originalIconFrame_);
|
| +// titleCloseWidthOffset_ = NSMaxX([closeButton_ frame]) - NSMaxX(titleFrame);
|
| + titleCloseWidthOffset_ = NSMinX(titleFrame) - NSMinX([closeButton_ frame]);
|
| + iconTitleXOffset_ = NSMaxX([iconView_ frame]) - NSMaxX(titleFrame);
|
|
|
| [self internalSetSelected:selected_];
|
| }
|
| @@ -169,9 +171,14 @@ class MenuDelegate : public menus::SimpleMenuModel::Delegate {
|
| }
|
|
|
| - (void)setIconView:(NSView*)iconView {
|
| + [iconView setAutoresizingMask:[iconView_ autoresizingMask]];
|
| +
|
| + NSRect originalIconFrame = [iconView_ frame];
|
| [iconView_ removeFromSuperview];
|
| iconView_ = iconView;
|
| - [iconView_ setFrame:originalIconFrame_];
|
| + [iconView_ setFrame:originalIconFrame];
|
| +
|
| +NSLog(@"Frame: %@\n", NSStringFromRect(originalIconFrame));
|
|
|
| // Ensure that the icon is suppressed if no icon is set or if the tab is too
|
| // narrow to display one.
|
| @@ -193,8 +200,9 @@ 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 iconWidth = NSWidth(originalIconFrame_);
|
| +// CGFloat width = NSMaxX([closeButton_ frame]) - NSMinX(originalIconFrame_);
|
| + CGFloat width = NSMaxX([iconView_ frame]) - NSMinX([closeButton_ frame]);
|
| + CGFloat iconWidth = NSWidth([iconView_ frame]);
|
|
|
| return width / iconWidth;
|
| }
|
| @@ -247,25 +255,25 @@ class MenuDelegate : public menus::SimpleMenuModel::Delegate {
|
| NSRect titleFrame = [titleView_ frame];
|
|
|
| if (oldShowIcon != newShowIcon) {
|
| - // Adjust the left edge of the title view according to the presence or
|
| + // Adjust the right edge of the title view according to the presence or
|
| // absence of the icon view.
|
|
|
| - if (newShowIcon) {
|
| - titleFrame.origin.x += iconTitleXOffset_;
|
| + if (newShowIcon)
|
| titleFrame.size.width -= iconTitleXOffset_;
|
| - } else {
|
| - titleFrame.origin.x -= iconTitleXOffset_;
|
| + else
|
| titleFrame.size.width += iconTitleXOffset_;
|
| - }
|
| }
|
|
|
| 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_;
|
| + }
|
| }
|
|
|
| [titleView_ setFrame:titleFrame];
|
|
|