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

Side by Side Diff: chrome/browser/ui/cocoa/browser_window_controller_private.mm

Issue 593223002: Mac: Don't relayout tabs if the tab strip's frame didn't change. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix for rsesek Created 6 years, 2 months 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #import "chrome/browser/ui/cocoa/browser_window_controller_private.h" 5 #import "chrome/browser/ui/cocoa/browser_window_controller_private.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/mac/mac_util.h" 10 #include "base/mac/mac_util.h"
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 - (CGFloat)layoutTabStripAtMaxY:(CGFloat)maxY 183 - (CGFloat)layoutTabStripAtMaxY:(CGFloat)maxY
184 width:(CGFloat)width 184 width:(CGFloat)width
185 fullscreen:(BOOL)fullscreen { 185 fullscreen:(BOOL)fullscreen {
186 // Nothing to do if no tab strip. 186 // Nothing to do if no tab strip.
187 if (![self hasTabStrip]) 187 if (![self hasTabStrip])
188 return maxY; 188 return maxY;
189 189
190 NSView* tabStripView = [self tabStripView]; 190 NSView* tabStripView = [self tabStripView];
191 CGFloat tabStripHeight = NSHeight([tabStripView frame]); 191 CGFloat tabStripHeight = NSHeight([tabStripView frame]);
192 maxY -= tabStripHeight; 192 maxY -= tabStripHeight;
193 [tabStripView setFrame:NSMakeRect(0, maxY, width, tabStripHeight)]; 193 NSRect tabStripFrame = NSMakeRect(0, maxY, width, tabStripHeight);
194 194
195 // In Yosemite fullscreen, manually add the fullscreen controls to the tab 195 // In Yosemite fullscreen, manually add the fullscreen controls to the tab
196 // strip. 196 // strip.
197 BOOL addControlsInFullscreen = 197 BOOL addControlsInFullscreen =
198 [self isInAppKitFullscreen] && base::mac::IsOSYosemiteOrLater(); 198 [self isInAppKitFullscreen] && base::mac::IsOSYosemiteOrLater();
199 199
200 // Set left indentation based on fullscreen mode status. 200 // Set left indentation based on fullscreen mode status.
201 CGFloat leftIndent = 0; 201 CGFloat leftIndent = 0;
202 if (!fullscreen || addControlsInFullscreen) 202 if (!fullscreen || addControlsInFullscreen)
203 leftIndent = [[tabStripController_ class] defaultLeftIndentForControls]; 203 leftIndent = [[tabStripController_ class] defaultLeftIndentForControls];
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 if ([self shouldUseNewAvatarButton]) { 253 if ([self shouldUseNewAvatarButton]) {
254 // The new avatar button is to the left of the fullscreen button. 254 // The new avatar button is to the left of the fullscreen button.
255 // (The old avatar button is to the right). 255 // (The old avatar button is to the right).
256 rightIndent += NSWidth([avatarButton frame]) + kAvatarRightOffset; 256 rightIndent += NSWidth([avatarButton frame]) + kAvatarRightOffset;
257 } 257 }
258 } else if ([self shouldShowAvatar]) { 258 } else if ([self shouldShowAvatar]) {
259 rightIndent += NSWidth([avatarButton frame]) + kAvatarRightOffset; 259 rightIndent += NSWidth([avatarButton frame]) + kAvatarRightOffset;
260 } 260 }
261 [tabStripController_ setRightIndentForControls:rightIndent]; 261 [tabStripController_ setRightIndentForControls:rightIndent];
262 262
263 // Go ahead and layout the tabs. 263 // It is undesirable to force tabs relayout when the tap strip's frame did
264 [tabStripController_ layoutTabsWithoutAnimation]; 264 // not change, because it will interrupt tab animations in progress.
265 // In addition, there appears to be an AppKit bug on <10.9 where interrupting
266 // a tab animation resulted in the tab frame being the animator's target
267 // frame instead of the interrupting setFrame. (See http://crbug.com/415093)
268 if (!NSEqualRects(tabStripFrame, [tabStripView frame])){
269 [tabStripView setFrame:tabStripFrame];
270 [tabStripController_ layoutTabsWithoutAnimation];
271 }
265 272
266 return maxY; 273 return maxY;
267 } 274 }
268 275
269 - (BOOL)placeBookmarkBarBelowInfoBar { 276 - (BOOL)placeBookmarkBarBelowInfoBar {
270 // If we are currently displaying the NTP detached bookmark bar or animating 277 // If we are currently displaying the NTP detached bookmark bar or animating
271 // to/from it (from/to anything else), we display the bookmark bar below the 278 // to/from it (from/to anything else), we display the bookmark bar below the
272 // info bar. 279 // info bar.
273 return [bookmarkBarController_ isInState:BookmarkBar::DETACHED] || 280 return [bookmarkBarController_ isInState:BookmarkBar::DETACHED] ||
274 [bookmarkBarController_ isAnimatingToState:BookmarkBar::DETACHED] || 281 [bookmarkBarController_ isAnimatingToState:BookmarkBar::DETACHED] ||
(...skipping 743 matching lines...) Expand 10 before | Expand all | Expand 10 after
1018 1025
1019 [CATransaction commit]; 1026 [CATransaction commit];
1020 hasAdjustedTabStripWhileEnteringAppKitFullscreen_ = YES; 1027 hasAdjustedTabStripWhileEnteringAppKitFullscreen_ = YES;
1021 } 1028 }
1022 } else { 1029 } else {
1023 hasAdjustedTabStripWhileEnteringAppKitFullscreen_ = NO; 1030 hasAdjustedTabStripWhileEnteringAppKitFullscreen_ = NO;
1024 } 1031 }
1025 } 1032 }
1026 1033
1027 @end // @implementation BrowserWindowController(Private) 1034 @end // @implementation BrowserWindowController(Private)
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698