Chromium Code Reviews| Index: chrome/browser/ui/cocoa/content_settings/content_setting_bubble_cocoa.mm |
| diff --git a/chrome/browser/ui/cocoa/content_settings/content_setting_bubble_cocoa.mm b/chrome/browser/ui/cocoa/content_settings/content_setting_bubble_cocoa.mm |
| index c10a6631d2933e3fe5430885b112338c73d786e6..585a82908ffdd074b768830f902581b7cb427429 100644 |
| --- a/chrome/browser/ui/cocoa/content_settings/content_setting_bubble_cocoa.mm |
| +++ b/chrome/browser/ui/cocoa/content_settings/content_setting_bubble_cocoa.mm |
| @@ -99,6 +99,7 @@ NSTextField* LabelWithFrame(NSString* text, const NSRect& frame) { |
| [label setStringValue:text]; |
| [label setSelectable:NO]; |
| [label setBezeled:NO]; |
| + [label setAlignment:NSNaturalTextAlignment]; |
| return [label autorelease]; |
| } |
| @@ -379,6 +380,7 @@ const ContentTypeToNibPath kNibPaths[] = { |
| NSRect titleFrame = [titleLabel_ frame]; |
| titleFrame.origin.y -= deltaY; |
| [titleLabel_ setFrame:titleFrame]; |
| + [titleLabel_ setAlignment:NSNaturalTextAlignment]; |
| } |
| - (void)initializeMessage { |
| @@ -397,6 +399,7 @@ const ContentTypeToNibPath kNibPaths[] = { |
| NSRect messageFrame = [messageLabel_ frame]; |
| messageFrame.origin.y -= deltaY; |
| [messageLabel_ setFrame:messageFrame]; |
| + [messageLabel_ setAlignment:NSNaturalTextAlignment]; |
| } |
| - (void)initializeRadioGroup { |
| @@ -439,6 +442,19 @@ const ContentTypeToNibPath kNibPaths[] = { |
| NSRect windowFrame = [[self window] frame]; |
| windowFrame.size.height += radioDeltaY; |
| [[self window] setFrame:windowFrame display:NO]; |
| + |
| + // NSMatrix-based radio buttons don't get automatically flipped for |
| + // RTL. Setting the user interface layout direction explicitly |
| + // doesn't affect rendering, so set image position and text alignment |
| + // manually. |
| + if (cocoa_l10n_util::ShouldDoExperimentalRTLLayout()) |
| + for (NSButtonCell* cell in [allowBlockRadioGroup_ cells]) { |
| + [cell setAlignment:NSNaturalTextAlignment]; |
| + [cell setImagePosition:cocoa_l10n_util::LeadingCellImagePosition()]; |
| + // Why not? |
| + [cell setUserInterfaceLayoutDirection: |
| + NSUserInterfaceLayoutDirectionRightToLeft]; |
| + } |
| } |
| - (NSButton*)hyperlinkButtonWithFrame:(NSRect)frame |
| @@ -919,6 +935,17 @@ const ContentTypeToNibPath kNibPaths[] = { |
| if (contentSettingBubbleModel_->AsMediaStreamBubbleModel()) |
| [self initializeMediaMenus]; |
| + // RTL-ize NIBS: |
|
Avi (use Gerrit)
2017/06/09 17:41:05
blank line above this comment to separate it from
lgrey
2017/06/09 17:59:13
Done.
|
| + if (cocoa_l10n_util::ShouldDoExperimentalRTLLayout()) { |
| + cocoa_l10n_util::FlipAllSubviewsIfNecessary([self bubble]); |
| + // Some NIBs have the manage/done buttons outside of the bubble. |
| + cocoa_l10n_util::FlipAllSubviewsIfNecessary([[self bubble] superview]); |
| + cocoa_l10n_util::FlipAllSubviewsIfNecessary(contentsContainer_); |
| + // These buttons are inside |GTMWidthBasedTweaker|s, so fix margins. |
| + cocoa_l10n_util::FlipAllSubviewsIfNecessary([infoButton_ superview]); |
| + cocoa_l10n_util::FlipAllSubviewsIfNecessary([doneButton_ superview]); |
| + cocoa_l10n_util::FlipAllSubviewsIfNecessary([manageButton_ superview]); |
|
Avi (use Gerrit)
2017/06/09 17:41:05
for both of these line comments (941, 944), since
lgrey
2017/06/09 17:59:13
Done.
|
| + } |
| } |
| /////////////////////////////////////////////////////////////////////////////// |