Index: Source/core/editing/PlainTextRange.cpp |
diff --git a/Source/core/editing/PlainTextRange.cpp b/Source/core/editing/PlainTextRange.cpp |
index e67ddd7d6a842c9e8b6d7e7e3f046f1e6adcb9b4..1ebc8f4716fb1799a702f0b3bebb88d5e8f3b1a4 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::createRangeForInputMethod(const ContainerNode& scope) const |
+{ |
+ return createRangeFor(scope, ForInputMethod); |
+} |
+ |
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 == ForInputMethod) |
+ behaviorFlags = TextIteratorEmitsObjectReplacementCharacter; |
+ 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()) { |