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

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: Introduce notifyEndOfPrecedingText. 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..357790a3607dd995313ea78443098580319061d8 100644
--- a/third_party/WebKit/Source/core/editing/BackspaceStateMachine.h
+++ b/third_party/WebKit/Source/core/editing/BackspaceStateMachine.h
@@ -16,15 +16,27 @@ class CORE_EXPORT BackspaceStateMachine {
STACK_ALLOCATED();
WTF_MAKE_NONCOPYABLE(BackspaceStateMachine);
public:
+ enum class State {
+ Unknown, // 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().
+ State 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();
+ // Notify the end of preceding text to the state machine.
+ State notifyEndOfPrecedingText();
yosin_UTC9 2016/03/30 07:43:07 How about |tellEndOfPrecedingText()|. It seems |no
Seigo Nonaka 2016/03/30 08:13:09 Done.
+
+ // Find boundary offset by feeding following text.
+ // This method must be called after feedPrecedingCodeUnit() returns NeedsFollowingCodeUnit.
+ State 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