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

Side by Side Diff: ios/chrome/browser/ui/rtl_geometry.mm

Issue 2437573004: Removed use of IsRunningOnIOS9OrLater from rtl_geometry.mm (Closed)
Patch Set: Created 4 years, 2 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 #include "ios/chrome/browser/ui/rtl_geometry.h" 5 #include "ios/chrome/browser/ui/rtl_geometry.h"
6 6
7 #import <UIKit/UIKit.h> 7 #import <UIKit/UIKit.h>
8 #include <limits> 8 #include <limits>
9 9
10 #include "base/ios/ios_util.h"
11 #include "base/logging.h" 10 #include "base/logging.h"
12 #include "ios/chrome/browser/ui/ui_util.h" 11 #include "ios/chrome/browser/ui/ui_util.h"
13 12
14 bool UseRTLLayout() { 13 bool UseRTLLayout() {
15 return base::i18n::IsRTL() && base::ios::IsRunningOnIOS9OrLater(); 14 return base::i18n::IsRTL();
16 } 15 }
17 16
18 base::i18n::TextDirection LayoutDirection() { 17 base::i18n::TextDirection LayoutDirection() {
19 return UseRTLLayout() ? base::i18n::RIGHT_TO_LEFT : base::i18n::LEFT_TO_RIGHT; 18 return UseRTLLayout() ? base::i18n::RIGHT_TO_LEFT : base::i18n::LEFT_TO_RIGHT;
20 } 19 }
21 20
22 #pragma mark - LayoutRects. 21 #pragma mark - LayoutRects.
23 22
24 const LayoutRectPosition LayoutRectPositionZero = {0.0, 0.0}; 23 const LayoutRectPosition LayoutRectPositionZero = {0.0, 0.0};
25 24
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 223
225 CGFloat CGRectGetLeadingEdge(CGRect rect) { 224 CGFloat CGRectGetLeadingEdge(CGRect rect) {
226 return CGRectGetLeadingEdgeUsingDirection(rect, LayoutDirection()); 225 return CGRectGetLeadingEdgeUsingDirection(rect, LayoutDirection());
227 } 226 }
228 227
229 CGFloat CGRectGetTrailingEdge(CGRect rect) { 228 CGFloat CGRectGetTrailingEdge(CGRect rect) {
230 return CGRectGetTrailingEdgeUsingDirection(rect, LayoutDirection()); 229 return CGRectGetTrailingEdgeUsingDirection(rect, LayoutDirection());
231 } 230 }
232 231
233 UIViewAutoresizing UIViewAutoresizingFlexibleLeadingMargin() { 232 UIViewAutoresizing UIViewAutoresizingFlexibleLeadingMargin() {
234 return base::i18n::IsRTL() && base::ios::IsRunningOnIOS9OrLater() 233 return base::i18n::IsRTL() ? UIViewAutoresizingFlexibleRightMargin
235 ? UIViewAutoresizingFlexibleRightMargin 234 : UIViewAutoresizingFlexibleLeftMargin;
236 : UIViewAutoresizingFlexibleLeftMargin;
237 } 235 }
238 236
239 UIViewAutoresizing UIViewAutoresizingFlexibleTrailingMargin() { 237 UIViewAutoresizing UIViewAutoresizingFlexibleTrailingMargin() {
240 return base::i18n::IsRTL() && base::ios::IsRunningOnIOS9OrLater() 238 return base::i18n::IsRTL() ? UIViewAutoresizingFlexibleLeftMargin
241 ? UIViewAutoresizingFlexibleLeftMargin 239 : UIViewAutoresizingFlexibleRightMargin;
242 : UIViewAutoresizingFlexibleRightMargin;
243 } 240 }
244 241
245 UIEdgeInsets UIEdgeInsetsMakeUsingDirection( 242 UIEdgeInsets UIEdgeInsetsMakeUsingDirection(
246 CGFloat top, 243 CGFloat top,
247 CGFloat leading, 244 CGFloat leading,
248 CGFloat bottom, 245 CGFloat bottom,
249 CGFloat trailing, 246 CGFloat trailing,
250 base::i18n::TextDirection direction) { 247 base::i18n::TextDirection direction) {
251 if (direction == base::i18n::RIGHT_TO_LEFT) { 248 if (direction == base::i18n::RIGHT_TO_LEFT) {
252 using std::swap; 249 using std::swap;
(...skipping 20 matching lines...) Expand all
273 } 270 }
274 271
275 #pragma mark - autolayout utilities 272 #pragma mark - autolayout utilities
276 273
277 NSLayoutFormatOptions LayoutOptionForRTLSupport() { 274 NSLayoutFormatOptions LayoutOptionForRTLSupport() {
278 if (UseRTLLayout()) { 275 if (UseRTLLayout()) {
279 return NSLayoutFormatDirectionLeadingToTrailing; 276 return NSLayoutFormatDirectionLeadingToTrailing;
280 } 277 }
281 return NSLayoutFormatDirectionLeftToRight; 278 return NSLayoutFormatDirectionLeftToRight;
282 } 279 }
OLDNEW
« 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