| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef BackspaceStateMachine_h |
| 6 #define BackspaceStateMachine_h |
| 7 |
| 8 #include "core/CoreExport.h" |
| 9 #include "wtf/Allocator.h" |
| 10 #include "wtf/Noncopyable.h" |
| 11 #include "wtf/text/Unicode.h" |
| 12 |
| 13 namespace blink { |
| 14 |
| 15 class CORE_EXPORT BackspaceStateMachine { |
| 16 STACK_ALLOCATED(); |
| 17 WTF_MAKE_NONCOPYABLE(BackspaceStateMachine); |
| 18 public: |
| 19 BackspaceStateMachine() = default; |
| 20 |
| 21 // Returns true when the state machine has stopped. |
| 22 bool updateState(UChar codeUnit); |
| 23 |
| 24 // Finalize the state machine and returns the code unit count to be deleted. |
| 25 // If the state machine hasn't finished, this method finishes the state |
| 26 // machine first. |
| 27 int finalizeAndGetCodeUnitCountToBeDeleted(); |
| 28 |
| 29 // Resets the internal state to the initial state. |
| 30 void reset(); |
| 31 |
| 32 private: |
| 33 int m_codeUnitsToBeDeleted = 0; |
| 34 |
| 35 // Used for composing supplementary code point with surrogate pairs. |
| 36 UChar m_trailSurrogate = 0; |
| 37 }; |
| 38 |
| 39 } // namespace blink |
| 40 |
| 41 #endif |
| OLD | NEW |