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

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: Adds DCHECK 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"
11 #include "wtf/text/Unicode.h" 11 #include "wtf/text/Unicode.h"
12 12
13 namespace blink { 13 namespace blink {
14 14
15 class CORE_EXPORT BackspaceStateMachine { 15 class CORE_EXPORT BackspaceStateMachine {
16 STACK_ALLOCATED(); 16 STACK_ALLOCATED();
17 WTF_MAKE_NONCOPYABLE(BackspaceStateMachine); 17 WTF_MAKE_NONCOPYABLE(BackspaceStateMachine);
18 public: 18 public:
19 enum class State {
20 Unknown, // Indicates the state machine is in unknown state.
21 NeedMoreCodeUnit, // Indicates the state machine needs more code units t o transit the state.
22 NeedFollowingCodeUnit, // Indicates the state machine needs following co de units to transit the state.
23 Finished, // Indicates the state machine found a boundary.
24 };
19 BackspaceStateMachine() = default; 25 BackspaceStateMachine() = default;
20 26
21 // Returns true when the state machine has stopped. 27 // Prepares by feeding preceding text.
22 bool updateState(UChar codeUnit); 28 // This method must not be called after feedFollowingCodeUnit().
29 State feedPrecedingCodeUnit(UChar codeUnit);
yosin_UTC9 2016/03/30 04:44:27 BTW, how do we specify no preceding characters, e.
Seigo Nonaka 2016/03/30 06:58:57 Yes this is the reason why I can't put NOTREACHED
23 30
24 // Finalize the state machine and returns the code unit count to be deleted. 31 // Find boundary offset by feeding following text.
25 // If the state machine hasn't finished, this method finishes the state 32 // This method must be called after feedPrecedingCodeUnit() returns Preparat ionDone.
yosin_UTC9 2016/03/30 01:58:41 |enum class State| doesn't have member |Preparatio
Seigo Nonaka 2016/03/30 06:58:57 Done.
26 // machine first. 33 State feedFollowingCodeUnit(UChar codeUnit);
27 int finalizeAndGetCodeUnitCountToBeDeleted(); 34
35 // Returns the next boundary offset. This method finalizes the state machine if it is not finished.
36 int finalizeAndGetBoundaryOffset();
28 37
29 // Resets the internal state to the initial state. 38 // Resets the internal state to the initial state.
30 void reset(); 39 void reset();
31 40
32 private: 41 private:
33 int m_codeUnitsToBeDeleted = 0; 42 int m_codeUnitsToBeDeleted = 0;
34 43
35 // Used for composing supplementary code point with surrogate pairs. 44 // Used for composing supplementary code point with surrogate pairs.
36 UChar m_trailSurrogate = 0; 45 UChar m_trailSurrogate = 0;
37 }; 46 };
38 47
39 } // namespace blink 48 } // namespace blink
40 49
41 #endif 50 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698