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

Unified 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, 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 140442cd7414bda02ebee0db8f437c3f997ab467..e303e2c58a1d769f2f0e74b34135f85db8021688 100644
--- a/third_party/WebKit/Source/core/editing/BackspaceStateMachine.h
+++ b/third_party/WebKit/Source/core/editing/BackspaceStateMachine.h
@@ -6,6 +6,7 @@
#define BackspaceStateMachine_h
#include "core/CoreExport.h"
+#include "core/editing/StateMachineCommon.h"
#include "wtf/Allocator.h"
#include "wtf/Noncopyable.h"
#include "wtf/text/Unicode.h"
@@ -16,15 +17,27 @@ class CORE_EXPORT BackspaceStateMachine {
STACK_ALLOCATED();
WTF_MAKE_NONCOPYABLE(BackspaceStateMachine);
public:
+ 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
+ Invalid, // Indicates the state machine is in unknown state.
+ NeedMoreCodeUnit, // Indicates the state machine needs more code units to transit the state.
+ NeedFollowingCodeUnit, // Indicates the state machine needs following code units to transit the state.
+ Finished, // Indicates the state machine found a boundary.
+ };
BackspaceStateMachine() = default;
- // Returns true when the state machine has stopped.
- bool updateState(UChar codeUnit);
+ // Prepares by feeding preceding text.
+ // This method must not be called after feedFollowingCodeUnit().
+ MachineState feedPrecedingCodeUnit(UChar codeUnit);
- // Finalize the state machine and returns the code unit count to be deleted.
- // If the state machine hasn't finished, this method finishes the state
- // machine first.
- int finalizeAndGetCodeUnitCountToBeDeleted();
+ // Tells the end of preceding text to the state machine.
+ MachineState tellEndOfPrecedingText();
+
+ // Find boundary offset by feeding following text.
+ // This method must be called after feedPrecedingCodeUnit() returns NeedsFollowingCodeUnit.
+ MachineState feedFollowingCodeUnit(UChar codeUnit);
+
+ // 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();

Powered by Google App Engine
This is Rietveld 408576698