Fix memory leak with IME on macOS (see http://crbug.com/654695)

This commit is contained in:
Marshall Greenblatt 2016-11-10 16:13:14 -05:00
parent 18763fde50
commit 607d420baf
1 changed files with 6 additions and 0 deletions

View File

@ -81,6 +81,12 @@ extern NSString* NSTextInputReplacementRangeAttributeName;
return validAttributesForMarkedText_;
}
- (NSRange)selectedRange {
if (selectedRange_.location == NSNotFound || selectedRange_.length == 0)
return NSMakeRange(NSNotFound, 0);
return selectedRange_;
}
- (NSRange)markedRange {
return hasMarkedText_ ? markedRange_ : NSMakeRange(NSNotFound, 0);
}