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 76c7962bb74fc37bf1c58a8ac2258c158a26a7fd..5d667875efeccd7173129132b49d64611cc36667 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 (!(m_behavior & TextIteratorForInnerText) && !(m_behavior & TextIteratorDoesNotBreakAtReplacedElement) |
+ && m_textBox->root().prevRootBox() && m_textBox->root().firstChild() == m_textBox) { |
joone
2016/09/09 19:07:40
* DumpRenderTree doesn't trim the leading space so
yosin_UTC9
2016/09/12 04:09:10
Could you put this explanation in code as comment?
joone
2016/09/12 21:33:02
Done.
|
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] != ' ') |
joone
2016/09/09 19:07:40
We need to check double leading spaces like checki
|
--runStart; |
} |
} |