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

Unified Diff: ios/chrome/browser/ui/util/text_region_mapper.mm

Issue 2819283004: [ObjC ARC] Converts ios/chrome/browser/ui/util:util to ARC. (Closed)
Patch Set: Fix copy for block Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
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)

Powered by Google App Engine
This is Rietveld 408576698