Index: ios/chrome/browser/ui/util/text_region_mapper.mm |
diff --git a/ios/chrome/browser/ui/util/text_region_mapper.mm b/ios/chrome/browser/ui/util/text_region_mapper.mm |
index f9c25f08b1e3cc47de6469f89c05f8ca1bbcd45f..bddc24ee05ac49338ae533d7eae5a77abf2e19f9 100644 |
--- a/ios/chrome/browser/ui/util/text_region_mapper.mm |
+++ b/ios/chrome/browser/ui/util/text_region_mapper.mm |
@@ -11,38 +11,41 @@ |
#include "base/ios/ios_util.h" |
#include "base/logging.h" |
#include "base/mac/foundation_util.h" |
-#include "base/mac/scoped_nsobject.h" |
#include "ios/chrome/browser/ui/ui_util.h" |
#import "ios/chrome/browser/ui/util/core_text_util.h" |
#import "ios/chrome/browser/ui/util/manual_text_framer.h" |
#import "ios/chrome/browser/ui/util/text_frame.h" |
-@interface CoreTextRegionMapper () { |
- // Backing object for property of the same name. |
- base::scoped_nsprotocol<id<TextFrame>> _textFrame; |
-} |
+#if !defined(__has_feature) || !__has_feature(objc_arc) |
+#error "This file requires ARC support." |
+#endif |
+ |
+@interface CoreTextRegionMapper () |
// The TextFrame used to calculate rects. |
-@property(nonatomic, readonly) id<TextFrame> textFrame; |
+@property(strong, nonatomic, readonly) id<TextFrame> textFrame; |
@end |
@implementation CoreTextRegionMapper |
+ |
+@synthesize textFrame = _textFrame; |
+ |
- (instancetype)initWithAttributedString:(NSAttributedString*)string |
bounds:(CGRect)bounds { |
if ((self = [super init])) { |
base::ScopedCFTypeRef<CTFrameRef> ctFrame = |
core_text_util::CreateTextFrameForStringInBounds(string, bounds); |
- base::scoped_nsobject<ManualTextFramer> framer( |
- [[ManualTextFramer alloc] initWithString:string inBounds:bounds]); |
+ ManualTextFramer* framer = |
+ [[ManualTextFramer alloc] initWithString:string inBounds:bounds]; |
[framer frameText]; |
if (core_text_util::IsTextFrameValid(ctFrame, framer, string)) { |
- _textFrame.reset([[CoreTextTextFrame alloc] initWithString:string |
- bounds:bounds |
- frame:ctFrame]); |
+ _textFrame = [[CoreTextTextFrame alloc] initWithString:string |
+ bounds:bounds |
+ frame:ctFrame]; |
} else { |
// Use ManualTextFramer if |ctFrame| is invalid. |
- _textFrame.reset([[framer textFrame] retain]); |
+ _textFrame = [framer textFrame]; |
} |
DCHECK(self.textFrame); |
} |
@@ -54,10 +57,6 @@ |
return nil; |
} |
-- (id<TextFrame>)textFrame { |
- return _textFrame.get(); |
-} |
- |
- (NSArray*)rectsForRange:(NSRange)range { |
NSRange framedRange = self.textFrame.framedRange; |
if (!range.length || range.location + range.length > framedRange.length) |