Chromium Code Reviews| Index: third_party/WebKit/Source/core/editing/iterators/TextIteratorTextState.cpp |
| diff --git a/third_party/WebKit/Source/core/editing/iterators/TextIteratorTextState.cpp b/third_party/WebKit/Source/core/editing/iterators/TextIteratorTextState.cpp |
| index 06262fb3c1c295ddda943d6406850f37a6f6d2fe..c8f7c4784671701ffbac406a4797cfa94cefe732 100644 |
| --- a/third_party/WebKit/Source/core/editing/iterators/TextIteratorTextState.cpp |
| +++ b/third_party/WebKit/Source/core/editing/iterators/TextIteratorTextState.cpp |
| @@ -31,7 +31,8 @@ |
| namespace blink { |
| -TextIteratorTextState::TextIteratorTextState(bool emitsOriginalText) |
| +TextIteratorTextState::TextIteratorTextState(bool emitsOriginalText, |
|
yosin_UTC9
2017/01/25 03:41:23
How about making |TextIteratorTextState| to take |
aelias_OOO_until_Jul13
2017/01/25 04:33:29
Done.
|
| + bool emitsSpaceForNbsp) |
| : m_textLength(0), |
| m_singleCharacterBuffer(0), |
| m_positionNode(nullptr), |
| @@ -40,6 +41,7 @@ TextIteratorTextState::TextIteratorTextState(bool emitsOriginalText) |
| m_hasEmitted(false), |
| m_lastCharacter(0), |
| m_emitsOriginalText(emitsOriginalText), |
| + m_emitsSpaceForNbsp(emitsSpaceForNbsp), |
| m_textStartOffset(0) {} |
| UChar TextIteratorTextState::characterAt(unsigned index) const { |
| @@ -149,6 +151,8 @@ void TextIteratorTextState::emitText(Node* textNode, |
| DCHECK(textNode); |
| m_text = |
| m_emitsOriginalText ? layoutObject->originalText() : layoutObject->text(); |
| + if (m_emitsSpaceForNbsp) |
| + m_text.replace(noBreakSpaceCharacter, spaceCharacter); |
| DCHECK(!m_text.isEmpty()); |
| DCHECK_LE(0, textStartOffset); |
| DCHECK_LT(textStartOffset, static_cast<int>(m_text.length())); |