Index: third_party/WebKit/Source/core/editing/iterators/TextIteratorTest.cpp |
diff --git a/third_party/WebKit/Source/core/editing/iterators/TextIteratorTest.cpp b/third_party/WebKit/Source/core/editing/iterators/TextIteratorTest.cpp |
index 8938d190a226763c1461e75f800d7a763177fc3e..2c679bdacf1ff6e921a2da445dcc18c3c91383b4 100644 |
--- a/third_party/WebKit/Source/core/editing/iterators/TextIteratorTest.cpp |
+++ b/third_party/WebKit/Source/core/editing/iterators/TextIteratorTest.cpp |
@@ -459,6 +459,34 @@ TEST_F(TextIteratorTest, RangeLengthWithReplacedElements) { |
range->EndPosition())); |
} |
+TEST_F(TextIteratorTest, RangeLengthInMultilineSpan) { |
+ static const char* body_content = |
+ "<table style='width:5em'>" |
+ "<tbody>" |
+ "<tr>" |
+ "<td>" |
+ "<span id='span1'>one two three four five</span>" |
+ "</td>" |
+ "</tr>" |
+ "</tbody>" |
+ "</table>"; |
+ |
+ SetBodyContent(body_content); |
+ GetDocument().View()->UpdateAllLifecyclePhases(); |
+ |
+ Node* span_node = GetDocument().getElementById("span1"); |
+ Node* text_node = span_node->firstChild(); |
+ |
+ // Select the word "two", this is the last word on the line. |
+ const Position start = Position(text_node, 4); |
+ const Position end = Position(text_node, 7); |
+ |
+ EXPECT_EQ(4, TextIterator::RangeLength(start, end)); |
+ EXPECT_EQ(3, TextIterator::RangeLength( |
+ start, end, |
+ TextIteratorBehavior::NoTrailingSpaceRangeLengthBehavior())); |
+} |
+ |
TEST_F(TextIteratorTest, WhitespaceCollapseForReplacedElements) { |
static const char* body_content = |
"<span>Some text </span> <input type='button' value='Button " |