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

Unified Diff: Source/core/editing/PlainTextRange.cpp

Issue 297003003: Emit object replacement char to IME (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: only emit replacement char with InputMethodController Created 6 years, 7 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: Source/core/editing/PlainTextRange.cpp
diff --git a/Source/core/editing/PlainTextRange.cpp b/Source/core/editing/PlainTextRange.cpp
index e67ddd7d6a842c9e8b6d7e7e3f046f1e6adcb9b4..9ad1bb3d78076fb6b23f7076e6f22269f0442085 100644
--- a/Source/core/editing/PlainTextRange.cpp
+++ b/Source/core/editing/PlainTextRange.cpp
@@ -67,6 +67,11 @@ PassRefPtrWillBeRawPtr<Range> PlainTextRange::createRangeForSelection(const Cont
return createRangeFor(scope, ForSelection);
}
+PassRefPtrWillBeRawPtr<Range> PlainTextRange::createRangeForInput(const ContainerNode& scope) const
+{
+ return createRangeFor(scope, ForInput);
+}
+
PassRefPtrWillBeRawPtr<Range> PlainTextRange::createRangeFor(const ContainerNode& scope, GetRangeFor getRangeFor) const
{
ASSERT(isNotNull());
@@ -78,7 +83,12 @@ PassRefPtrWillBeRawPtr<Range> PlainTextRange::createRangeFor(const ContainerNode
RefPtrWillBeRawPtr<Range> textRunRange = nullptr;
- TextIterator it(rangeOfContents(const_cast<ContainerNode*>(&scope)).get(), getRangeFor == ForSelection ? TextIteratorEmitsCharactersBetweenAllVisiblePositions : TextIteratorDefaultBehavior);
+ TextIteratorBehavior behaviorFlags = TextIteratorDefaultBehavior;
+ if (getRangeFor == ForSelection)
+ behaviorFlags = TextIteratorEmitsCharactersBetweenAllVisiblePositions;
+ else if (getRangeFor == ForInput)
+ behaviorFlags = TextIteratorEmitsReplacementChar;
+ TextIterator it(rangeOfContents(const_cast<ContainerNode*>(&scope)).get(), behaviorFlags);
// FIXME: the atEnd() check shouldn't be necessary, workaround for <http://bugs.webkit.org/show_bug.cgi?id=6289>.
if (!start() && !length() && it.atEnd()) {

Powered by Google App Engine
This is Rietveld 408576698