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

Side by Side Diff: third_party/WebKit/Source/core/editing/BackspaceStateMachine.h

Issue 1839753005: Move state machines to state_machines subdir (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: extracted machine state for other state machines. 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 "core/editing/StateMachineCommon.h"
9 #include "wtf/Allocator.h" 10 #include "wtf/Allocator.h"
10 #include "wtf/Noncopyable.h" 11 #include "wtf/Noncopyable.h"
11 #include "wtf/text/Unicode.h" 12 #include "wtf/text/Unicode.h"
12 13
13 namespace blink { 14 namespace blink {
14 15
15 class CORE_EXPORT BackspaceStateMachine { 16 class CORE_EXPORT BackspaceStateMachine {
16 STACK_ALLOCATED(); 17 STACK_ALLOCATED();
17 WTF_MAKE_NONCOPYABLE(BackspaceStateMachine); 18 WTF_MAKE_NONCOPYABLE(BackspaceStateMachine);
18 public: 19 public:
20 enum class State {
yosin_UTC9 2016/03/30 08:52:23 Should we use |MachineState| defined in "StateMach
Seigo Nonaka 2016/03/30 09:13:23 Ugh, yes, I'm sorry my brain was messed up by reba
21 Invalid, // Indicates the state machine is in unknown state.
22 NeedMoreCodeUnit, // Indicates the state machine needs more code units t o transit the state.
23 NeedFollowingCodeUnit, // Indicates the state machine needs following co de units to transit the state.
24 Finished, // Indicates the state machine found a boundary.
25 };
19 BackspaceStateMachine() = default; 26 BackspaceStateMachine() = default;
20 27
21 // Returns true when the state machine has stopped. 28 // Prepares by feeding preceding text.
22 bool updateState(UChar codeUnit); 29 // This method must not be called after feedFollowingCodeUnit().
30 MachineState feedPrecedingCodeUnit(UChar codeUnit);
23 31
24 // Finalize the state machine and returns the code unit count to be deleted. 32 // Tells the end of preceding text to the state machine.
25 // If the state machine hasn't finished, this method finishes the state 33 MachineState tellEndOfPrecedingText();
26 // machine first. 34
27 int finalizeAndGetCodeUnitCountToBeDeleted(); 35 // Find boundary offset by feeding following text.
36 // This method must be called after feedPrecedingCodeUnit() returns NeedsFol lowingCodeUnit.
37 MachineState feedFollowingCodeUnit(UChar codeUnit);
38
39 // Returns the next boundary offset. This method finalizes the state machine if it is not finished.
40 int finalizeAndGetBoundaryOffset();
28 41
29 // Resets the internal state to the initial state. 42 // Resets the internal state to the initial state.
30 void reset(); 43 void reset();
31 44
32 private: 45 private:
33 int m_codeUnitsToBeDeleted = 0; 46 int m_codeUnitsToBeDeleted = 0;
34 47
35 // Used for composing supplementary code point with surrogate pairs. 48 // Used for composing supplementary code point with surrogate pairs.
36 UChar m_trailSurrogate = 0; 49 UChar m_trailSurrogate = 0;
37 }; 50 };
38 51
39 } // namespace blink 52 } // namespace blink
40 53
41 #endif 54 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698