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

Unified Diff: chrome/browser/ui/cocoa/passwords/credential_item_button.mm

Issue 2590123004: Fix RTL mode for the account picker on Mac. (Closed)
Patch Set: Created 4 years 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/cocoa/passwords/credential_item_button.mm
diff --git a/chrome/browser/ui/cocoa/passwords/credential_item_button.mm b/chrome/browser/ui/cocoa/passwords/credential_item_button.mm
index 27c200d3a353789ac1cad6c4c24cfd263c30b9bc..24d401ed99235f937d139abe0f425e6fbb3ea516 100644
--- a/chrome/browser/ui/cocoa/passwords/credential_item_button.mm
+++ b/chrome/browser/ui/cocoa/passwords/credential_item_button.mm
@@ -4,6 +4,7 @@
#import "chrome/browser/ui/cocoa/passwords/credential_item_button.h"
+#include "base/i18n/rtl.h"
#import "base/mac/scoped_nsobject.h"
#include "base/strings/sys_string_conversions.h"
#include "chrome/browser/ui/cocoa/passwords/passwords_bubble_utils.h"
@@ -50,7 +51,8 @@ constexpr CGFloat kHorizontalPaddingBetweenAvatarAndLabel = 10;
// in -drawImage, so it must be added when drawing the title.
NSRect marginRect;
NSDivideRect(frame, &marginRect, &frame, marginSpacing_, NSMinXEdge);
- NSDivideRect(frame, &marginRect, &frame, imageTitleSpacing_, NSMinXEdge);
+ NSDivideRect(frame, &marginRect, &frame, imageTitleSpacing_,
+ base::i18n::IsRTL() ? NSMaxXEdge : NSMinXEdge);
NSDivideRect(frame, &marginRect, &frame, marginSpacing_, NSMaxXEdge);
return [super drawTitle:title withFrame:frame inView:controlView];
@@ -59,7 +61,10 @@ constexpr CGFloat kHorizontalPaddingBetweenAvatarAndLabel = 10;
- (void)drawImage:(NSImage*)image
withFrame:(NSRect)frame
inView:(NSView*)controlView {
- frame.origin.x = marginSpacing_;
+ if (base::i18n::IsRTL())
+ frame.origin.x -= marginSpacing_;
+ else
+ frame.origin.x += marginSpacing_;
gfx::ScopedNSGraphicsContextSaveGState scopedGState;
NSBezierPath* path = [NSBezierPath bezierPathWithOvalInRect:frame];
[path addClip];
@@ -116,8 +121,7 @@ constexpr CGFloat kHorizontalPaddingBetweenAvatarAndLabel = 10;
.GetPrimaryFont()
.GetNativeFont()];
[self setButtonType:NSMomentaryLightButton];
- [self setImagePosition:NSImageLeft];
- [self setAlignment:NSLeftTextAlignment];
+ [self setImagePosition:base::i18n::IsRTL() ? NSImageRight : NSImageLeft];
}
return self;
}
« 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