Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(335)

Unified Diff: third_party/WebKit/Source/core/editing/iterators/TextIteratorTextState.cpp

Issue 2649923012: Avoid reporting space as NBSP in TextInputState. (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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()));

Powered by Google App Engine
This is Rietveld 408576698