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

Side by Side 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, 8 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef BackspaceStateMachine_h 5 #ifndef BackspaceStateMachine_h
6 #define BackspaceStateMachine_h 6 #define BackspaceStateMachine_h
7 7
8 #include "core/CoreExport.h" 8 #include "core/CoreExport.h"
9 #include "wtf/Allocator.h" 9 #include "wtf/Allocator.h"
10 #include "wtf/Noncopyable.h" 10 #include "wtf/Noncopyable.h"
(...skipping 21 matching lines...) Expand all
32 // This method must be called after feedPrecedingCodeUnit() returns Preparat ionDone. 32 // This method must be called after feedPrecedingCodeUnit() returns Preparat ionDone.
33 State feedFollowingCodeUnit(UChar codeUnit); 33 State feedFollowingCodeUnit(UChar codeUnit);
34 34
35 // Returns the next boundary offset. This method finalizes the state machine if it is not finished. 35 // Returns the next boundary offset. This method finalizes the state machine if it is not finished.
36 int finalizeAndGetBoundaryOffset(); 36 int finalizeAndGetBoundaryOffset();
37 37
38 // Resets the internal state to the initial state. 38 // Resets the internal state to the initial state.
39 void reset(); 39 void reset();
40 40
41 private: 41 private:
42 int m_codeUnitsToBeDeleted = 0; 42 enum class BackspaceState {
43 Start, // Initial state
44 BeforeLF, // Indicates the current offset is just before line feed.
45 BeforeKeycap, // Indicates the current offset is just before keycap.
46 BeforeVSAndKeycap, // Indicates the current offset is just before variat ion selector and keycap.
47 BeforeEmojiModifier, // Indicates the current offset is just before emoj i modifier.
48 BeforeVSAndEmojiModifier, // Indicates the current offset is just before variation selector and emoji modifier.
49 BeforeVS, // Indicates the current offset is just before variation seque nce.
50 BeforeZWJEmoji, // Indicates the current offset is just before ZWJ emoji .
51 BeforeZWJ, // Indicates the current offset is just before ZWJ.
52 BeforeVSAndZWJ, // Indicates the current offset is just before variation selector and ZWJ.
53 OddNumberedRIS, // Indicates that there are odd numbered RIS from the be ggining.
54 EvenNumberedRIS, // Indicates that there are even numbered RIS from the begging.
55 Finished, // Indicates this state machine has finished.
56 } m_state = BackspaceState::Start;
43 57
44 // Used for composing supplementary code point with surrogate pairs. 58 // Used for composing supplementary code point with surrogate pairs.
45 UChar m_trailSurrogate = 0; 59 UChar m_trailSurrogate = 0;
60
61 // The number of code units to be deleted.
62 int m_codeUnitsToBeDeleted = 0;
63
64 // The length of the previously seen variation selector.
65 int m_lastSeenVSCodeUnits = 0;
46 }; 66 };
47 67
48 } // namespace blink 68 } // namespace blink
49 69
50 #endif 70 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698