| Index: third_party/WebKit/Source/core/editing/iterators/TextIterator.cpp
|
| diff --git a/third_party/WebKit/Source/core/editing/iterators/TextIterator.cpp b/third_party/WebKit/Source/core/editing/iterators/TextIterator.cpp
|
| index 5066087f2511b6ab5efd9ae5a543b93a0047209c..f95f9dfbd7e555b3811d676beec91e7aa7ddf8a8 100644
|
| --- a/third_party/WebKit/Source/core/editing/iterators/TextIterator.cpp
|
| +++ b/third_party/WebKit/Source/core/editing/iterators/TextIterator.cpp
|
| @@ -615,8 +615,13 @@ void TextIteratorAlgorithm<Strategy>::handleTextBox()
|
| // See http://crbug.com/318925
|
| // For trailing space.
|
| if (!nextTextBox && m_textBox->root().nextRootBox() && m_textBox->root().lastChild() == m_textBox) {
|
| - if (str.endsWith(' ') && subrunEnd == str.length() - 1 && str[subrunEnd - 1] != ' ')
|
| - ++subrunEnd;
|
| + if (str.endsWith(' ') && subrunEnd == str.length() - 1 && str[subrunEnd - 1] != ' ') {
|
| + // If there is the leading space in the next line, we don't need to restore the trailing space.
|
| + // Example: <div style="width: 2em;"><b><i>foo </i></b> bar</div>
|
| + String textOfNextline = m_textBox->root().nextRootBox()->firstChild()->getLineLayoutItem().node()->nodeValue();
|
| + if (textOfNextline[0] != ' ')
|
| + ++subrunEnd;
|
| + }
|
| }
|
| // For leading space.
|
| if (!emitsImageAltText() && !doesNotBreakAtReplacedElement() && !forInnerText()
|
|
|