| Index: third_party/WebKit/Source/core/editing/BackspaceStateMachine.cpp
|
| diff --git a/third_party/WebKit/Source/core/editing/BackspaceStateMachine.cpp b/third_party/WebKit/Source/core/editing/BackspaceStateMachine.cpp
|
| index 701c07d0a03426b47cd8239bb53b97ed55bf0a9d..678ad06dd9ec19c81581a697cf639ae76cf32a41 100644
|
| --- a/third_party/WebKit/Source/core/editing/BackspaceStateMachine.cpp
|
| +++ b/third_party/WebKit/Source/core/editing/BackspaceStateMachine.cpp
|
| @@ -8,24 +8,14 @@
|
|
|
| namespace blink {
|
|
|
| -int BackspaceStateMachine::finalizeAndGetCodeUnitCountToBeDeleted()
|
| -{
|
| - if (m_trailSurrogate != 0) {
|
| - // Unpaired trail surrogate. Removing broken surrogate.
|
| - ++m_codeUnitsToBeDeleted;
|
| - m_trailSurrogate = 0;
|
| - }
|
| - return m_codeUnitsToBeDeleted;
|
| -}
|
| -
|
| -bool BackspaceStateMachine::updateState(UChar codeUnit)
|
| +MachineState BackspaceStateMachine::feedPrecedingCodeUnit(UChar codeUnit)
|
| {
|
| uint32_t codePoint = codeUnit;
|
| if (U16_IS_LEAD(codeUnit)) {
|
| if (m_trailSurrogate == 0) {
|
| // Unpaired lead surrogate. Aborting with deleting broken surrogate.
|
| ++m_codeUnitsToBeDeleted;
|
| - return true;
|
| + return MachineState::Finished;
|
| }
|
| codePoint = U16_GET_SUPPLEMENTARY(codeUnit, m_trailSurrogate);
|
| m_trailSurrogate = 0;
|
| @@ -33,21 +23,47 @@ bool BackspaceStateMachine::updateState(UChar codeUnit)
|
| if (m_trailSurrogate != 0) {
|
| // Unpaired trail surrogate. Aborting with deleting broken
|
| // surrogate.
|
| - return true;
|
| + return MachineState::Finished;
|
| }
|
| m_trailSurrogate = codeUnit;
|
| - return false; // Needs surrogate lead.
|
| + return MachineState::NeedMoreCodeUnit;
|
| } else {
|
| if (m_trailSurrogate != 0) {
|
| // Unpaired trail surrogate. Aborting with deleting broken
|
| // surrogate.
|
| - return true;
|
| + return MachineState::Finished;
|
| }
|
| }
|
|
|
| // TODO(nona): Handle emoji sequences.
|
| m_codeUnitsToBeDeleted = U16_LENGTH(codePoint);
|
| - return true;
|
| + return MachineState::Finished;
|
| +}
|
| +
|
| +MachineState BackspaceStateMachine::tellEndOfPrecedingText()
|
| +{
|
| + if (m_trailSurrogate != 0) {
|
| + // Unpaired trail surrogate. Removing broken surrogate.
|
| + ++m_codeUnitsToBeDeleted;
|
| + m_trailSurrogate = 0;
|
| + }
|
| + return MachineState::Finished;
|
| +}
|
| +
|
| +MachineState BackspaceStateMachine::feedFollowingCodeUnit(UChar codeUnit)
|
| +{
|
| + NOTREACHED();
|
| + return MachineState::Invalid;
|
| +}
|
| +
|
| +int BackspaceStateMachine::finalizeAndGetBoundaryOffset()
|
| +{
|
| + if (m_trailSurrogate != 0) {
|
| + // Unpaired trail surrogate. Removing broken surrogate.
|
| + ++m_codeUnitsToBeDeleted;
|
| + m_trailSurrogate = 0;
|
| + }
|
| + return -m_codeUnitsToBeDeleted;
|
| }
|
|
|
| void BackspaceStateMachine::reset()
|
|
|