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

Unified Diff: third_party/WebKit/Source/core/editing/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: 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
Index: third_party/WebKit/Source/core/editing/BackspaceStateMachine.h
diff --git a/third_party/WebKit/Source/core/editing/BackspaceStateMachine.h b/third_party/WebKit/Source/core/editing/BackspaceStateMachine.h
index 7043af79e44818985efc51dfe50941d26b5893eb..a8184a3138bcd5d0ef26473197ffb98de8fdb3be 100644
--- a/third_party/WebKit/Source/core/editing/BackspaceStateMachine.h
+++ b/third_party/WebKit/Source/core/editing/BackspaceStateMachine.h
@@ -39,10 +39,30 @@ public:
void reset();
private:
- int m_codeUnitsToBeDeleted = 0;
+ enum class BackspaceState {
+ Start, // Initial state
+ BeforeLF, // Indicates the current offset is just before line feed.
+ BeforeKeycap, // Indicates the current offset is just before keycap.
+ BeforeVSAndKeycap, // Indicates the current offset is just before variation selector and keycap.
+ BeforeEmojiModifier, // Indicates the current offset is just before emoji modifier.
+ BeforeVSAndEmojiModifier, // Indicates the current offset is just before variation selector and emoji modifier.
+ BeforeVS, // Indicates the current offset is just before variation sequence.
+ BeforeZWJEmoji, // Indicates the current offset is just before ZWJ emoji.
+ BeforeZWJ, // Indicates the current offset is just before ZWJ.
+ BeforeVSAndZWJ, // Indicates the current offset is just before variation selector and ZWJ.
+ OddNumberedRIS, // Indicates that there are odd numbered RIS from the beggining.
+ EvenNumberedRIS, // Indicates that there are even numbered RIS from the begging.
+ Finished, // Indicates this state machine has finished.
+ } m_state = BackspaceState::Start;
// 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;
};
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698