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

Unified Diff: chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm

Issue 2541583002: [Mac] Don't flip window controls in RTL for macOS < 10.12 (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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/cocoa/profiles/profile_chooser_controller.mm ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm
diff --git a/chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm b/chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm
index e7bad4b7bd4785c9408900f4007cd2fd493f93bb..116c021143d4a3b9a8a072ff822c65b919704b47 100644
--- a/chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm
+++ b/chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm
@@ -2270,25 +2270,33 @@ NSRect FlipRectInView(NSView* view, NSRect rect) {
}
- (void)addCustomWindowControls {
- BOOL isRTL = cocoa_l10n_util::ShouldDoExperimentalRTLLayout();
+ BOOL shouldFlipWindowControls =
+ cocoa_l10n_util::ShouldFlipWindowControlsInRTL();
if (!customWindowControls_) {
// Make the container view.
CGFloat height = NSHeight([tabStripView_ frame]);
CGFloat width = [self leadingIndentForControls];
- CGFloat xOrigin = isRTL ? NSWidth([tabStripView_ frame]) - width : 0;
+ if (cocoa_l10n_util::ShouldDoExperimentalRTLLayout() &&
+ !shouldFlipWindowControls)
+ // The trailing indent is correct in this case, since the controls should
+ // stay on the left.
+ width = [self trailingIndentForControls];
+ CGFloat xOrigin =
+ shouldFlipWindowControls ? NSWidth([tabStripView_ frame]) - width : 0;
NSRect frame = NSMakeRect(xOrigin, 0, width, height);
customWindowControls_.reset(
[[CustomWindowControlsView alloc] initWithFrame:frame]);
[customWindowControls_
- setAutoresizingMask:isRTL ? NSViewMinXMargin | NSViewHeightSizable
- : NSViewMaxXMargin | NSViewHeightSizable];
+ setAutoresizingMask:shouldFlipWindowControls
+ ? NSViewMinXMargin | NSViewHeightSizable
+ : NSViewMaxXMargin | NSViewHeightSizable];
// Add the traffic light buttons. The horizontal layout was determined by
// manual inspection on Yosemite.
CGFloat closeButtonX = 11;
CGFloat pinnedButtonX = 31;
CGFloat zoomButtonX = 51;
- if (isRTL)
+ if (shouldFlipWindowControls)
std::swap(closeButtonX, zoomButtonX);
NSUInteger styleMask = [[tabStripView_ window] styleMask];
@@ -2321,7 +2329,7 @@ NSRect FlipRectInView(NSView* view, NSRect rect) {
[customWindowControls_
addTrackingArea:customWindowControlsTrackingArea_.get()];
}
- if (isRTL &&
+ if (shouldFlipWindowControls &&
NSMaxX([customWindowControls_ frame]) != NSMaxX([tabStripView_ frame])) {
NSRect frame = [customWindowControls_ frame];
frame.origin.x =
« no previous file with comments | « chrome/browser/ui/cocoa/profiles/profile_chooser_controller.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698