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

Unified Diff: third_party/WebKit/Source/core/editing/BackspaceStateMachine.h

Issue 1832343002: Introduce BackspaceStateMachine (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove unnecessary includes. 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
new file mode 100644
index 0000000000000000000000000000000000000000..140442cd7414bda02ebee0db8f437c3f997ab467
--- /dev/null
+++ b/third_party/WebKit/Source/core/editing/BackspaceStateMachine.h
@@ -0,0 +1,41 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef BackspaceStateMachine_h
+#define BackspaceStateMachine_h
+
+#include "core/CoreExport.h"
+#include "wtf/Allocator.h"
+#include "wtf/Noncopyable.h"
+#include "wtf/text/Unicode.h"
+
+namespace blink {
+
+class CORE_EXPORT BackspaceStateMachine {
+ STACK_ALLOCATED();
+ WTF_MAKE_NONCOPYABLE(BackspaceStateMachine);
+public:
+ BackspaceStateMachine() = default;
+
+ // Returns true when the state machine has stopped.
+ bool updateState(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();
+
+ // Resets the internal state to the initial state.
+ void reset();
+
+private:
+ int m_codeUnitsToBeDeleted = 0;
+
+ // Used for composing supplementary code point with surrogate pairs.
+ UChar m_trailSurrogate = 0;
+};
+
+} // namespace blink
+
+#endif
« no previous file with comments | « third_party/WebKit/Source/core/core.gypi ('k') | third_party/WebKit/Source/core/editing/BackspaceStateMachine.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698