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

Side by Side Diff: chrome/browser/ui/cocoa/l10n_util.mm

Issue 2901973002: [Mac] Mirror profile switcher UI in RTL (Closed)
Patch Set: CL comments 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #import "chrome/browser/ui/cocoa/l10n_util.h" 5 #import "chrome/browser/ui/cocoa/l10n_util.h"
6 6
7 #include "base/i18n/rtl.h" 7 #include "base/i18n/rtl.h"
8 #include "base/mac/mac_util.h" 8 #include "base/mac/mac_util.h"
9 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "base/strings/sys_string_conversions.h" 10 #include "base/strings/sys_string_conversions.h"
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 } 110 }
111 #else 111 #else
112 NSCellImagePosition LeadingCellImagePosition() { 112 NSCellImagePosition LeadingCellImagePosition() {
113 return NSImageLeading; 113 return NSImageLeading;
114 } 114 }
115 NSCellImagePosition TrailingCellImagePosition() { 115 NSCellImagePosition TrailingCellImagePosition() {
116 return NSImageTrailing; 116 return NSImageTrailing;
117 } 117 }
118 #endif // MAC_OS_X_VERSION_10_12 118 #endif // MAC_OS_X_VERSION_10_12
119 119
120 NSRectEdge LeadingEdge() {
121 return ShouldDoExperimentalRTLLayout() ? NSMaxXEdge : NSMinXEdge;
122 }
123
124 NSRectEdge TrailingEdge() {
125 return ShouldDoExperimentalRTLLayout() ? NSMinXEdge : NSMaxXEdge;
126 }
127
120 // Adapted from Apple's RTL docs (goo.gl/cBaFnT) 128 // Adapted from Apple's RTL docs (goo.gl/cBaFnT)
121 NSImage* FlippedImage(NSImage* image) { 129 NSImage* FlippedImage(NSImage* image) {
122 const NSSize size = [image size]; 130 const NSSize size = [image size];
123 NSImage* flipped_image = [[[NSImage alloc] initWithSize:size] autorelease]; 131 NSImage* flipped_image = [[[NSImage alloc] initWithSize:size] autorelease];
124 132
125 [flipped_image lockFocus]; 133 [flipped_image lockFocus];
126 [[NSGraphicsContext currentContext] 134 [[NSGraphicsContext currentContext]
127 setImageInterpolation:NSImageInterpolationHigh]; 135 setImageInterpolation:NSImageInterpolationHigh];
128 136
129 NSAffineTransform* transform = [NSAffineTransform transform]; 137 NSAffineTransform* transform = [NSAffineTransform transform];
(...skipping 27 matching lines...) Expand all
157 subview.autoresizingMask &= ~NSViewMinXMargin; 165 subview.autoresizingMask &= ~NSViewMinXMargin;
158 subview.autoresizingMask |= NSViewMaxXMargin; 166 subview.autoresizingMask |= NSViewMaxXMargin;
159 } else if (subview.autoresizingMask & NSViewMaxXMargin) { 167 } else if (subview.autoresizingMask & NSViewMaxXMargin) {
160 subview.autoresizingMask &= ~NSViewMaxXMargin; 168 subview.autoresizingMask &= ~NSViewMaxXMargin;
161 subview.autoresizingMask |= NSViewMinXMargin; 169 subview.autoresizingMask |= NSViewMinXMargin;
162 } 170 }
163 } 171 }
164 } 172 }
165 173
166 } // namespace cocoa_l10n_util 174 } // namespace cocoa_l10n_util
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/l10n_util.h ('k') | chrome/browser/ui/cocoa/profiles/profile_chooser_controller.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698