OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "ui/gfx/ios/NSString+CrStringDrawing.h" | 5 #import "ui/gfx/ios/NSString+CrStringDrawing.h" |
6 | 6 |
| 7 #include <stddef.h> |
| 8 |
7 #include "base/logging.h" | 9 #include "base/logging.h" |
8 #include "ui/gfx/ios/uikit_util.h" | 10 #include "ui/gfx/ios/uikit_util.h" |
9 | 11 |
10 @implementation NSString (CrStringDrawing) | 12 @implementation NSString (CrStringDrawing) |
11 | 13 |
12 - (CGRect)cr_boundingRectWithSize:(CGSize)size | 14 - (CGRect)cr_boundingRectWithSize:(CGSize)size |
13 font:(UIFont*)font { | 15 font:(UIFont*)font { |
14 NSDictionary* attributes = font ? @{NSFontAttributeName: font} : @{}; | 16 NSDictionary* attributes = font ? @{NSFontAttributeName: font} : @{}; |
15 return [self boundingRectWithSize:size | 17 return [self boundingRectWithSize:size |
16 options:NSStringDrawingUsesLineFragmentOrigin | 18 options:NSStringDrawingUsesLineFragmentOrigin |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 if (hi < lo) | 63 if (hi < lo) |
62 hi = lo; | 64 hi = lo; |
63 } else { | 65 } else { |
64 lo = guess + 1; | 66 lo = guess + 1; |
65 } | 67 } |
66 } | 68 } |
67 return [self cr_stringByCuttingToIndex:lo]; | 69 return [self cr_stringByCuttingToIndex:lo]; |
68 } | 70 } |
69 | 71 |
70 @end | 72 @end |
OLD | NEW |