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

Unified Diff: third_party/WebKit/Source/core/editing/state_machines/BackspaceStateMachine.h

Issue 1844663002: Implement backspace state machine for complex emoji sequence. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Move char definitions to CharacterNames.h Created 4 years, 9 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/editing/state_machines/BackspaceStateMachine.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/editing/state_machines/BackspaceStateMachine.h
diff --git a/third_party/WebKit/Source/core/editing/state_machines/BackspaceStateMachine.h b/third_party/WebKit/Source/core/editing/state_machines/BackspaceStateMachine.h
index e72e74a7be67177d2924ffe65d2152e56741d968..d073e3ef6450e9514871d0967f61bc7bc03534b6 100644
--- a/third_party/WebKit/Source/core/editing/state_machines/BackspaceStateMachine.h
+++ b/third_party/WebKit/Source/core/editing/state_machines/BackspaceStateMachine.h
@@ -10,6 +10,7 @@
#include "wtf/Allocator.h"
#include "wtf/Noncopyable.h"
#include "wtf/text/Unicode.h"
+#include <iosfwd>
namespace blink {
@@ -17,7 +18,7 @@ class CORE_EXPORT BackspaceStateMachine {
STACK_ALLOCATED();
WTF_MAKE_NONCOPYABLE(BackspaceStateMachine);
public:
- BackspaceStateMachine() = default;
+ BackspaceStateMachine();
// Prepares by feeding preceding text.
// This method must not be called after feedFollowingCodeUnit().
@@ -27,20 +28,40 @@ public:
TextSegmentationMachineState tellEndOfPrecedingText();
// Find boundary offset by feeding following text.
- // This method must be called after feedPrecedingCodeUnit() returns NeedsFollowingCodeUnit.
+ // This method must be called after feedPrecedingCodeUnit() returns
+ // NeedsFollowingCodeUnit.
TextSegmentationMachineState feedFollowingCodeUnit(UChar codeUnit);
- // Returns the next boundary offset. This method finalizes the state machine if it is not finished.
+ // Returns the next boundary offset. This method finalizes the state machine
+ // if it is not finished.
int finalizeAndGetBoundaryOffset();
// Resets the internal state to the initial state.
void reset();
private:
- int m_codeUnitsToBeDeleted = 0;
+ enum class BackspaceState;
+ friend std::ostream& operator<<(std::ostream&, BackspaceState);
+
+ // Updates the internal state to the |newState| then return
+ // InternalState::NeedMoreCodeUnit.
+ TextSegmentationMachineState moveToNextState(BackspaceState newState);
+
+ // Update the internal state to BackspaceState::Finished, then return
+ // MachineState::Finished.
+ TextSegmentationMachineState finish();
// Used for composing supplementary code point with surrogate pairs.
UChar m_trailSurrogate = 0;
+
+ // The number of code units to be deleted.
+ int m_codeUnitsToBeDeleted = 0;
+
+ // The length of the previously seen variation selector.
+ int m_lastSeenVSCodeUnits = 0;
+
+ // The internal state.
+ BackspaceState m_state;
};
} // namespace blink
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/editing/state_machines/BackspaceStateMachine.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698