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

Unified Diff: chrome/browser/ui/cocoa/content_settings/content_setting_bubble_cocoa.mm

Issue 2924353002: [Mac] Mirror content settings bubble in RTL. (Closed)
Patch Set: Whitespace Created 3 years, 6 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 | « chrome/browser/ui/cocoa/content_settings/content_setting_bubble_cocoa.h ('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/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 acc447fdfea75241e269f23768b93fff4a91cdfc..0b1b1a35f2b900b029a7ae5cdbef1f28eae6116f 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
@@ -110,6 +110,7 @@ NSTextField* LabelWithFrame(NSString* text, const NSRect& frame) {
[label setStringValue:text];
[label setSelectable:NO];
[label setBezeled:NO];
+ [label setAlignment:NSNaturalTextAlignment];
return [label autorelease];
}
@@ -390,6 +391,7 @@ const ContentTypeToNibPath kNibPaths[] = {
NSRect titleFrame = [titleLabel_ frame];
titleFrame.origin.y -= deltaY;
[titleLabel_ setFrame:titleFrame];
+ [titleLabel_ setAlignment:NSNaturalTextAlignment];
}
- (void)initializeMessage {
@@ -408,6 +410,7 @@ const ContentTypeToNibPath kNibPaths[] = {
NSRect messageFrame = [messageLabel_ frame];
messageFrame.origin.y -= deltaY;
[messageLabel_ setFrame:messageFrame];
+ [messageLabel_ setAlignment:NSNaturalTextAlignment];
}
- (void)initializeRadioGroup {
@@ -450,6 +453,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
@@ -982,6 +998,20 @@ const ContentTypeToNibPath kNibPaths[] = {
if (contentSettingBubbleModel_->AsMediaStreamBubbleModel())
[self initializeMediaMenus];
+
+ // RTL-ize NIBS:
+ 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]);
+ }
}
///////////////////////////////////////////////////////////////////////////////
« no previous file with comments | « chrome/browser/ui/cocoa/content_settings/content_setting_bubble_cocoa.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698