Chromium Code Reviews| Index: chrome/browser/ui/cocoa/browser_window_controller_private.mm |
| diff --git a/chrome/browser/ui/cocoa/browser_window_controller_private.mm b/chrome/browser/ui/cocoa/browser_window_controller_private.mm |
| index 89bab85429536e56626929eda2e90a580e00be0b..70e689f3bb1c9150500ce6779c2dcb803ceb9a11 100644 |
| --- a/chrome/browser/ui/cocoa/browser_window_controller_private.mm |
| +++ b/chrome/browser/ui/cocoa/browser_window_controller_private.mm |
| @@ -187,10 +187,14 @@ willPositionSheet:(NSWindow*)sheet |
| if (![self hasTabStrip]) |
| return maxY; |
| + BOOL requiresRelayout = NO; |
| + |
| NSView* tabStripView = [self tabStripView]; |
| CGFloat tabStripHeight = NSHeight([tabStripView frame]); |
| maxY -= tabStripHeight; |
| NSRect tabStripFrame = NSMakeRect(0, maxY, width, tabStripHeight); |
| + if (!NSEqualRects(tabStripFrame, [tabStripView frame])) |
| + requiresRelayout = YES; |
|
Robert Sesek
2014/09/25 19:44:10
BOOL requiresRelayout = !NSEqualRects(tabStripFram
erikchen
2014/09/25 20:03:32
Done.
|
| // In Yosemite fullscreen, manually add the fullscreen controls to the tab |
| // strip. |
| @@ -201,7 +205,10 @@ willPositionSheet:(NSWindow*)sheet |
| CGFloat leftIndent = 0; |
| if (!fullscreen || addControlsInFullscreen) |
| leftIndent = [[tabStripController_ class] defaultLeftIndentForControls]; |
| - [tabStripController_ setLeftIndentForControls:leftIndent]; |
| + if (leftIndent != [tabStripController_ leftIndentForControls]) { |
| + [tabStripController_ setLeftIndentForControls:leftIndent]; |
| + requiresRelayout = YES; |
| + } |
| if (addControlsInFullscreen) |
| [tabStripController_ addWindowControls]; |
| @@ -258,14 +265,18 @@ willPositionSheet:(NSWindow*)sheet |
| } else if ([self shouldShowAvatar]) { |
| rightIndent += NSWidth([avatarButton frame]) + kAvatarRightOffset; |
| } |
| - [tabStripController_ setRightIndentForControls:rightIndent]; |
| + |
| + if (rightIndent != [tabStripController_ rightIndentForControls]) { |
| + [tabStripController_ setRightIndentForControls:rightIndent]; |
| + requiresRelayout = YES; |
| + } |
| // It is undesirable to force tabs relayout when the tap strip's frame did |
| // not change, because it will interrupt tab animations in progress. |
| // In addition, there appears to be an AppKit bug on <10.9 where interrupting |
| // a tab animation resulted in the tab frame being the animator's target |
| // frame instead of the interrupting setFrame. (See http://crbug.com/415093) |
| - if (!NSEqualRects(tabStripFrame, [tabStripView frame])){ |
| + if (requiresRelayout) { |
| [tabStripView setFrame:tabStripFrame]; |
| [tabStripController_ layoutTabsWithoutAnimation]; |
| } |