Chromium Code Reviews| Index: Source/core/editing/TextIterator.cpp |
| diff --git a/Source/core/editing/TextIterator.cpp b/Source/core/editing/TextIterator.cpp |
| index 7baf1c49df1e8a5c28764f5c2bc76f7cf5a144de..2d2dd979cc985ea40a61249737e1a13488499c89 100644 |
| --- a/Source/core/editing/TextIterator.cpp |
| +++ b/Source/core/editing/TextIterator.cpp |
| @@ -268,6 +268,7 @@ TextIterator::TextIterator(const Range* range, TextIteratorBehaviorFlags behavio |
| , m_entersAuthorShadowRoots(behavior & TextIteratorEntersAuthorShadowRoots) |
| , m_emitsObjectReplacementCharacter(behavior & TextIteratorEmitsObjectReplacementCharacter) |
| , m_breaksAtReplacedElement(!(behavior & TextIteratorDoesNotBreakAtReplacedElement)) |
| + , m_hasNodesFollowing(behavior & TextIteratorBehavesAsIfNodesFollowing) |
|
yosin_UTC9
2015/01/14 01:46:20
Do we need to have new behavior? It seems the issu
c.shu
2015/01/14 21:13:41
The bug is not a general issue. It only shows up w
|
| { |
| if (range) |
| initialize(range->startPosition(), range->endPosition()); |
| @@ -744,6 +745,13 @@ void TextIterator::handleTextBox() |
| if (nextRunStart > runEnd) |
| m_lastTextNodeEndedWithCollapsedSpace = true; // collapsed space between runs or at the end |
| + // Don't advance if last spaces, excluding '\n', are collapsed by next non-text box. |
| + if (m_lastTextNodeEndedWithCollapsedSpace && !nextTextBox && m_hasNodesFollowing) { |
|
yosin_UTC9
2015/01/14 01:46:20
Sorry, I'm not sure why newline character is a spe
c.shu
2015/01/14 21:13:41
We don't want to restore the space for newline as
|
| + // None of the collapsed spaces should be '\n' but check the last one is enough. |
| + if (str[str.length() -1] != '\n') |
| + return; |
| + } |
| + |
| m_textBox = nextTextBox; |
| if (renderer->containsReversedText()) |
| ++m_sortedTextBoxesPosition; |