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 d7c94cbae624651be48ff5adf40405ab76ca02c0..369a621726a65396c03843366f38c100e2ff0721 100644 |
--- a/third_party/WebKit/Source/core/editing/iterators/TextIterator.cpp |
+++ b/third_party/WebKit/Source/core/editing/iterators/TextIterator.cpp |
@@ -457,7 +457,7 @@ bool TextIteratorAlgorithm<Strategy>::handleTextNode() |
// handle pre-formatted text |
if (!layoutObject->style()->collapseWhiteSpace()) { |
int runStart = m_offset; |
- if (m_lastTextNodeEndedWithCollapsedSpace && hasVisibleTextNode(layoutObject)) { |
+ if (m_lastTextNodeEndedWithCollapsedSpace && hasVisibleTextNode(layoutObject) && runStart > 0 && str[runStart - 1] == ' ') { |
emitCharacter(spaceCharacter, textNode, 0, runStart, runStart); |
return false; |
} |
@@ -670,10 +670,12 @@ bool TextIteratorAlgorithm<Strategy>::handleReplacedElement() |
emitCharacter(objectReplacementCharacter, Strategy::parent(*m_node), m_node, 0, 1); |
return true; |
} |
- |
- if (m_lastTextNodeEndedWithCollapsedSpace) { |
- emitCharacter(spaceCharacter, Strategy::parent(*m_lastTextNode), m_lastTextNode, 1, 1); |
- return false; |
+ if (m_lastTextNode) { |
+ String str = m_lastTextNode->layoutObject()->text(); |
+ if (m_lastTextNodeEndedWithCollapsedSpace && m_offset > 0 && str[m_offset-1] == ' ') { |
yosin_UTC9
2016/01/20 01:40:22
Please inserts spaces around '-'
nit: str[m_offset
ramya.v
2016/01/20 03:42:56
Done.
|
+ emitCharacter(spaceCharacter, Strategy::parent(*m_lastTextNode), m_lastTextNode, 1, 1); |
+ return false; |
+ } |
} |
if (entersTextControls() && layoutObject->isTextControl()) { |