| Index: content/browser/renderer_host/render_widget_host_view_mac.mm
|
| diff --git a/content/browser/renderer_host/render_widget_host_view_mac.mm b/content/browser/renderer_host/render_widget_host_view_mac.mm
|
| index aeee8788919e3abfda36e1accdb3e41f98fde247..c81f211e3a5205e6f96f712e7474a290b7b20e5b 100644
|
| --- a/content/browser/renderer_host/render_widget_host_view_mac.mm
|
| +++ b/content/browser/renderer_host/render_widget_host_view_mac.mm
|
| @@ -2965,12 +2965,6 @@ extern NSString *NSTextInputReplacementRangeAttributeName;
|
| return rect;
|
| }
|
|
|
| -- (NSRange)selectedRange {
|
| - if (selectedRange_.location == NSNotFound || selectedRange_.length == 0)
|
| - return NSMakeRange(NSNotFound, 0);
|
| - return selectedRange_;
|
| -}
|
| -
|
| - (NSRange)markedRange {
|
| // An input method calls this method to check if an application really has
|
| // a text being composed when hasMarkedText call returns true.
|
| @@ -2983,17 +2977,9 @@ extern NSString *NSTextInputReplacementRangeAttributeName;
|
|
|
| - (NSAttributedString*)attributedSubstringForProposedRange:(NSRange)range
|
| actualRange:(NSRangePointer)actualRange {
|
| - // Prepare |actualRange| as if the proposed range is invalid. If it is valid,
|
| - // then |actualRange| will be updated again.
|
| + // TODO(thakis): Pipe |actualRange| through TextInputClientMac machinery.
|
| if (actualRange)
|
| - *actualRange = NSMakeRange(NSNotFound, 0);
|
| -
|
| - // The caller of this method is allowed to pass nonsensical ranges. These
|
| - // can't even be converted into gfx::Ranges.
|
| - if (range.location == NSNotFound || range.length == 0)
|
| - return nil;
|
| - if (range.length >= std::numeric_limits<NSUInteger>::max() - range.location)
|
| - return nil;
|
| + *actualRange = range;
|
|
|
| const gfx::Range requested_range(range);
|
| if (requested_range.is_reversed())
|
| @@ -3011,16 +2997,15 @@ extern NSString *NSTextInputReplacementRangeAttributeName;
|
| expected_range = gfx::Range(offset, offset + expected_text->size());
|
| }
|
|
|
| - gfx::Range actual_range = expected_range.Intersect(requested_range);
|
| - if (!actual_range.IsValid())
|
| + if (!expected_range.Contains(requested_range))
|
| return nil;
|
|
|
| // Gets the raw bytes to avoid unnecessary string copies for generating
|
| // NSString.
|
| const base::char16* bytes =
|
| - &(*expected_text)[actual_range.start() - expected_range.start()];
|
| + &(*expected_text)[requested_range.start() - expected_range.start()];
|
| // Avoid integer overflow.
|
| - base::CheckedNumeric<size_t> requested_len = actual_range.length();
|
| + base::CheckedNumeric<size_t> requested_len = requested_range.length();
|
| requested_len *= sizeof(base::char16);
|
| NSUInteger bytes_len = base::strict_cast<NSUInteger, size_t>(
|
| requested_len.ValueOrDefault(0));
|
| @@ -3028,9 +3013,6 @@ extern NSString *NSTextInputReplacementRangeAttributeName;
|
| [[NSString alloc] initWithBytes:bytes
|
| length:bytes_len
|
| encoding:NSUTF16LittleEndianStringEncoding]);
|
| - if (actualRange)
|
| - *actualRange = actual_range.ToNSRange();
|
| -
|
| return [[[NSAttributedString alloc] initWithString:ns_string] autorelease];
|
| }
|
|
|
|
|