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 62273a380a729eed99f1835c90cbe03d65a22026..5066087f2511b6ab5efd9ae5a543b93a0047209c 100644 |
--- a/third_party/WebKit/Source/core/editing/iterators/TextIterator.cpp |
+++ b/third_party/WebKit/Source/core/editing/iterators/TextIterator.cpp |
@@ -619,11 +619,12 @@ void TextIteratorAlgorithm<Strategy>::handleTextBox() |
++subrunEnd; |
} |
// For leading space. |
- if (m_textBox->root().prevRootBox() && m_textBox->root().firstChild() == m_textBox) { |
+ if (!emitsImageAltText() && !doesNotBreakAtReplacedElement() && !forInnerText() |
+ && m_textBox->root().prevRootBox() && m_textBox->root().firstChild() == m_textBox) { |
InlineBox* lastChildOfPrevRoot = m_textBox->root().prevRootBox()->lastChild(); |
- if (!lastChildOfPrevRoot->isText() && !lastChildOfPrevRoot->getLineLayoutItem().isBR() |
+ if (m_textBox->getLineLayoutItem() != lastChildOfPrevRoot->getLineLayoutItem() && !lastChildOfPrevRoot->getLineLayoutItem().isBR() |
&& !lastChildOfPrevRoot->isInlineFlowBox()) { |
- if (runStart > 0 && str[0] == ' ') |
+ if (runStart > 0 && str[0] == ' ' && str[1] != ' ') |
--runStart; |
} |
} |