| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |