Chromium Code Reviews| 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; |
| } |