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

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

Issue 2489373002: [Mac] (More) RTL support for tab strip (Closed)
Patch Set: Created 4 years, 1 month 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 | chrome/browser/ui/cocoa/browser_window_layout.h » ('j') | 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 #import "base/auto_reset.h" 9 #import "base/auto_reset.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 } 123 }
124 124
125 - (void)updateFullscreenCollectionBehavior { 125 - (void)updateFullscreenCollectionBehavior {
126 // Set the window to participate in Lion Fullscreen mode. Setting this flag 126 // Set the window to participate in Lion Fullscreen mode. Setting this flag
127 // has no effect on Snow Leopard or earlier. Panels can share a fullscreen 127 // has no effect on Snow Leopard or earlier. Panels can share a fullscreen
128 // space with a tabbed window, but they can not be primary fullscreen 128 // space with a tabbed window, but they can not be primary fullscreen
129 // windows. 129 // windows.
130 // This ensures the fullscreen button is appropriately positioned. It must 130 // This ensures the fullscreen button is appropriately positioned. It must
131 // be done before calling layoutSubviews because the new avatar button's 131 // be done before calling layoutSubviews because the new avatar button's
132 // position depends on the fullscreen button's position, as well as 132 // position depends on the fullscreen button's position, as well as
133 // TabStripController's rightIndentForControls. 133 // TabStripController's trailingIndentForControls.
134 // The fullscreen button's position may depend on the old avatar button's 134 // The fullscreen button's position may depend on the old avatar button's
135 // width, but that does not require calling layoutSubviews first. 135 // width, but that does not require calling layoutSubviews first.
136 NSWindow* window = [self window]; 136 NSWindow* window = [self window];
137 NSUInteger collectionBehavior = [window collectionBehavior]; 137 NSUInteger collectionBehavior = [window collectionBehavior];
138 collectionBehavior &= ~NSWindowCollectionBehaviorFullScreenAuxiliary; 138 collectionBehavior &= ~NSWindowCollectionBehaviorFullScreenAuxiliary;
139 collectionBehavior &= ~NSWindowCollectionBehaviorFullScreenPrimary; 139 collectionBehavior &= ~NSWindowCollectionBehaviorFullScreenPrimary;
140 collectionBehavior |= browser_->type() == Browser::TYPE_TABBED || 140 collectionBehavior |= browser_->type() == Browser::TYPE_TABBED ||
141 browser_->type() == Browser::TYPE_POPUP 141 browser_->type() == Browser::TYPE_POPUP
142 ? NSWindowCollectionBehaviorFullScreenPrimary 142 ? NSWindowCollectionBehaviorFullScreenPrimary
143 : NSWindowCollectionBehaviorFullScreenAuxiliary; 143 : NSWindowCollectionBehaviorFullScreenAuxiliary;
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 if (!NSIsEmptyRect(layout.avatarFrame)) { 285 if (!NSIsEmptyRect(layout.avatarFrame)) {
286 NSView* avatarButton = [avatarButtonController_ view]; 286 NSView* avatarButton = [avatarButtonController_ view];
287 [avatarButton setFrame:layout.avatarFrame]; 287 [avatarButton setFrame:layout.avatarFrame];
288 [avatarButton setHidden:NO]; 288 [avatarButton setHidden:NO];
289 } 289 }
290 290
291 // Check if the tab strip's frame has changed. 291 // Check if the tab strip's frame has changed.
292 BOOL requiresRelayout = 292 BOOL requiresRelayout =
293 !NSEqualRects([[self tabStripView] frame], layout.frame); 293 !NSEqualRects([[self tabStripView] frame], layout.frame);
294 294
295 // Check if the left indent has changed. 295 // Check if the leading indent has changed.
296 if (layout.leftIndent != [tabStripController_ leftIndentForControls]) { 296 if (layout.leadingIndent != [tabStripController_ leadingIndentForControls]) {
297 [tabStripController_ setLeftIndentForControls:layout.leftIndent]; 297 [tabStripController_ setLeadingIndentForControls:layout.leadingIndent];
298 requiresRelayout = YES; 298 requiresRelayout = YES;
299 } 299 }
300 300
301 // Check if the right indent has changed. 301 // Check if the trailing indent has changed.
302 if (layout.rightIndent != [tabStripController_ rightIndentForControls]) { 302 if (layout.trailingIndent !=
303 [tabStripController_ setRightIndentForControls:layout.rightIndent]; 303 [tabStripController_ trailingIndentForControls]) {
304 [tabStripController_ setTrailingIndentForControls:layout.trailingIndent];
304 requiresRelayout = YES; 305 requiresRelayout = YES;
305 } 306 }
306 307
307 // It is undesirable to force tabs relayout when the tap strip's frame did 308 // It is undesirable to force tabs relayout when the tap strip's frame did
308 // not change, because it will interrupt tab animations in progress. 309 // not change, because it will interrupt tab animations in progress.
309 // In addition, there appears to be an AppKit bug on <10.9 where interrupting 310 // In addition, there appears to be an AppKit bug on <10.9 where interrupting
310 // a tab animation resulted in the tab frame being the animator's target 311 // a tab animation resulted in the tab frame being the animator's target
311 // frame instead of the interrupting setFrame. (See http://crbug.com/415093) 312 // frame instead of the interrupting setFrame. (See http://crbug.com/415093)
312 if (requiresRelayout) { 313 if (requiresRelayout) {
313 [[self tabStripView] setFrame:layout.frame]; 314 [[self tabStripView] setFrame:layout.frame];
(...skipping 870 matching lines...) Expand 10 before | Expand all | Expand 10 after
1184 if (fullscreenLowPowerCoordinator_) 1185 if (fullscreenLowPowerCoordinator_)
1185 fullscreenLowPowerCoordinator_->SetHasActiveSheet(false); 1186 fullscreenLowPowerCoordinator_->SetHasActiveSheet(false);
1186 } 1187 }
1187 1188
1188 - (void)childWindowsDidChange { 1189 - (void)childWindowsDidChange {
1189 if (fullscreenLowPowerCoordinator_) 1190 if (fullscreenLowPowerCoordinator_)
1190 fullscreenLowPowerCoordinator_->ChildWindowsChanged(); 1191 fullscreenLowPowerCoordinator_->ChildWindowsChanged();
1191 } 1192 }
1192 1193
1193 @end // @implementation BrowserWindowController(Private) 1194 @end // @implementation BrowserWindowController(Private)
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/cocoa/browser_window_layout.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698