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

Unified Diff: chrome/browser/cocoa/tab_controller.mm

Issue 509009: P1.
Patch Set: Created 11 years 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/cocoa/tab_controller.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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];
« no previous file with comments | « chrome/browser/cocoa/tab_controller.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698