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

Unified Diff: chrome/browser/ui/cocoa/browser_window_layout.mm

Issue 2313723004: cocoa: flip window controls and profile switcher for RTL (Closed)
Patch Set: Created 4 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/ui/cocoa/framed_browser_window.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/cocoa/browser_window_layout.mm
diff --git a/chrome/browser/ui/cocoa/browser_window_layout.mm b/chrome/browser/ui/cocoa/browser_window_layout.mm
index 84a1c83ef8fd429487f83e44748458b6baa1c08d..5f2279a0f5e0b79817df54956a033f5a73c61b83 100644
--- a/chrome/browser/ui/cocoa/browser_window_layout.mm
+++ b/chrome/browser/ui/cocoa/browser_window_layout.mm
@@ -7,6 +7,7 @@
#include <math.h>
#include <string.h>
+#include "base/i18n/rtl.h"
#include "base/logging.h"
#include "base/mac/mac_util.h"
#import "chrome/browser/ui/cocoa/tabs/tab_strip_controller.h"
@@ -197,10 +198,6 @@ - (void)computeTabStripLayout {
layout.addCustomWindowControls =
parameters_.inAnyFullscreen && parameters_.isOSYosemiteOrLater;
- // Set left indentation based on fullscreen mode status.
- if (!parameters_.inAnyFullscreen || layout.addCustomWindowControls)
- layout.leftIndent = [TabStripController defaultLeftIndentForControls];
-
// Lay out the icognito/avatar badge because calculating the indentation on
// the right depends on it.
if (parameters_.shouldShowAvatar) {
@@ -225,13 +222,25 @@ - (void)computeTabStripLayout {
NSSize size = NSMakeSize(parameters_.avatarSize.width,
std::min(buttonHeight, chrome::kTabStripHeight));
- NSPoint origin =
- NSMakePoint(width - parameters_.avatarSize.width + badgeXOffset,
- maxY_ + badgeYOffset);
+ NSPoint origin;
+ if (base::i18n::IsRTL()) {
+ origin = NSMakePoint(-badgeXOffset, maxY_ + badgeYOffset);
+ } else {
+ origin = NSMakePoint(width - parameters_.avatarSize.width + badgeXOffset,
+ maxY_ + badgeYOffset);
+ }
layout.avatarFrame =
NSMakeRect(origin.x, origin.y, size.width, size.height);
}
+ // Set left indentation based on fullscreen mode status.
+ if (!parameters_.inAnyFullscreen || layout.addCustomWindowControls) {
+ if (base::i18n::IsRTL())
+ layout.leftIndent = NSMaxX(layout.avatarFrame);
+ else
+ layout.leftIndent = [TabStripController defaultLeftIndentForControls];
+ }
+
// Calculate the right indentation.
// On 10.7 Lion to 10.9 Mavericks, there will be a fullscreen button when not
// in fullscreen mode.
@@ -239,14 +248,18 @@ - (void)computeTabStripLayout {
// fullscreen button (old style), or to its left (new style).
// The right indentation is calculated to prevent the tab strip from
// overlapping these buttons.
- CGFloat maxX = width;
- if (!NSIsEmptyRect(parameters_.fullscreenButtonFrame)) {
- maxX = NSMinX(parameters_.fullscreenButtonFrame);
- }
- if (parameters_.shouldShowAvatar) {
- maxX = std::min(maxX, NSMinX(layout.avatarFrame));
+ if (base::i18n::IsRTL()) {
+ layout.rightIndent = [TabStripController defaultLeftIndentForControls];
+ } else {
+ CGFloat maxX = width;
+ if (!NSIsEmptyRect(parameters_.fullscreenButtonFrame)) {
+ maxX = NSMinX(parameters_.fullscreenButtonFrame);
+ }
+ if (parameters_.shouldShowAvatar) {
+ maxX = std::min(maxX, NSMinX(layout.avatarFrame));
+ }
+ layout.rightIndent = width - maxX;
Avi (use Gerrit) 2016/09/06 15:38:00 Some thoughts. I would have thought that the code
}
- layout.rightIndent = width - maxX;
output_.tabStripLayout = layout;
}
« no previous file with comments | « no previous file | chrome/browser/ui/cocoa/framed_browser_window.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698