Index: third_party/WebKit/Source/core/editing/SurroundingText.cpp |
diff --git a/third_party/WebKit/Source/core/editing/SurroundingText.cpp b/third_party/WebKit/Source/core/editing/SurroundingText.cpp |
index 4d10322b6b3ba3a274a1477ea461381377b74ed5..4a7d5f0965e3495af3f4f1209c9e8795e626f7bc 100644 |
--- a/third_party/WebKit/Source/core/editing/SurroundingText.cpp |
+++ b/third_party/WebKit/Source/core/editing/SurroundingText.cpp |
@@ -93,14 +93,12 @@ void SurroundingText::Initialize(const Position& start_position, |
if (!backwards_iterator.AtEnd()) |
backwards_iterator.Advance(half_max_length); |
- start_offset_in_content_ = |
- Range::Create(*document, backwards_iterator.EndPosition(), start_position) |
- ->GetText() |
- .length(); |
- end_offset_in_content_ = |
- Range::Create(*document, backwards_iterator.EndPosition(), end_position) |
- ->GetText() |
- .length(); |
+ const TextIteratorBehavior behavior = |
+ TextIteratorBehavior::NoTrailingSpaceRangeLengthBehavior(); |
+ start_offset_in_content_ = TextIterator::RangeLength( |
+ backwards_iterator.EndPosition(), start_position, behavior); |
+ end_offset_in_content_ = TextIterator::RangeLength( |
+ backwards_iterator.EndPosition(), end_position, behavior); |
content_range_ = Range::Create(*document, backwards_iterator.EndPosition(), |
forward_range.StartPosition()); |
DCHECK(content_range_); |