| Index: third_party/WebKit/Source/core/editing/commands/InsertIncrementalTextCommand.cpp
|
| diff --git a/third_party/WebKit/Source/core/editing/commands/InsertIncrementalTextCommand.cpp b/third_party/WebKit/Source/core/editing/commands/InsertIncrementalTextCommand.cpp
|
| index 5d01df334bae6e8115465cbcbf88449539a4fcf4..d0dd77ed19d88503e4b70e480b6f60f395ea602d 100644
|
| --- a/third_party/WebKit/Source/core/editing/commands/InsertIncrementalTextCommand.cpp
|
| +++ b/third_party/WebKit/Source/core/editing/commands/InsertIncrementalTextCommand.cpp
|
| @@ -12,6 +12,7 @@
|
| #include "core/editing/PlainTextRange.h"
|
| #include "core/editing/VisibleUnits.h"
|
| #include "core/editing/iterators/CharacterIterator.h"
|
| +#include "core/editing/state_machines/ForwardCodePointStateMachine.h"
|
| #include "core/html/HTMLSpanElement.h"
|
|
|
| namespace blink {
|
| @@ -20,9 +21,15 @@ namespace {
|
|
|
| size_t computeCommonPrefixLength(const String& str1, const String& str2) {
|
| const size_t maxCommonPrefixLength = std::min(str1.length(), str2.length());
|
| + ForwardCodePointStateMachine codePointStateMachine;
|
| + int result = 0;
|
| for (size_t index = 0; index < maxCommonPrefixLength; ++index) {
|
| if (str1[index] != str2[index])
|
| - return index;
|
| + return result;
|
| + codePointStateMachine.feedFollowingCodeUnit(str1[index]);
|
| + if (!codePointStateMachine.atCodePointBoundary())
|
| + continue;
|
| + result = index;
|
| }
|
| return maxCommonPrefixLength;
|
| }
|
|
|