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

Unified Diff: third_party/WebKit/Source/core/editing/state_machines/BackwardGraphemeBoundaryStateMachine.h

Issue 1855813002: Introduce BackwardGraphemeBoundaryStateMachine (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix typo 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/editing/state_machines/BackwardGraphemeBoundaryStateMachine.h
diff --git a/third_party/WebKit/Source/core/editing/state_machines/BackspaceStateMachine.h b/third_party/WebKit/Source/core/editing/state_machines/BackwardGraphemeBoundaryStateMachine.h
similarity index 57%
copy from third_party/WebKit/Source/core/editing/state_machines/BackspaceStateMachine.h
copy to third_party/WebKit/Source/core/editing/state_machines/BackwardGraphemeBoundaryStateMachine.h
index d073e3ef6450e9514871d0967f61bc7bc03534b6..7db5c0d50573b3304ddb7194a08eb70bdff049d9 100644
--- a/third_party/WebKit/Source/core/editing/state_machines/BackspaceStateMachine.h
+++ b/third_party/WebKit/Source/core/editing/state_machines/BackwardGraphemeBoundaryStateMachine.h
@@ -2,8 +2,8 @@
// 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
+#ifndef BackwardGraphemeBoundaryStateMachine_h
+#define BackwardGraphemeBoundaryStateMachine_h
#include "core/CoreExport.h"
#include "core/editing/state_machines/TextSegmentationMachineState.h"
@@ -14,13 +14,14 @@
namespace blink {
-class CORE_EXPORT BackspaceStateMachine {
+class CORE_EXPORT BackwardGraphemeBoundaryStateMachine {
STACK_ALLOCATED();
- WTF_MAKE_NONCOPYABLE(BackspaceStateMachine);
+ WTF_MAKE_NONCOPYABLE(BackwardGraphemeBoundaryStateMachine);
+
public:
- BackspaceStateMachine();
+ BackwardGraphemeBoundaryStateMachine();
- // Prepares by feeding preceding text.
+ // Find boundary offset by feeding preceding text.
// This method must not be called after feedFollowingCodeUnit().
TextSegmentationMachineState feedPrecedingCodeUnit(UChar codeUnit);
@@ -40,28 +41,31 @@ public:
void reset();
private:
- enum class BackspaceState;
- friend std::ostream& operator<<(std::ostream&, BackspaceState);
+ enum class InternalState;
+ friend std::ostream& operator<<(std::ostream&, InternalState);
+
+ TextSegmentationMachineState moveToNextState(InternalState nextState);
- // Updates the internal state to the |newState| then return
- // InternalState::NeedMoreCodeUnit.
- TextSegmentationMachineState moveToNextState(BackspaceState newState);
+ TextSegmentationMachineState staySameState();
- // Update the internal state to BackspaceState::Finished, then return
- // MachineState::Finished.
+ // Updates the internal state to InternalState::Finished then returns
+ // TextSegmentationMachineState::Finished.
TextSegmentationMachineState finish();
// Used for composing supplementary code point with surrogate pairs.
UChar m_trailSurrogate = 0;
- // The number of code units to be deleted.
- int m_codeUnitsToBeDeleted = 0;
+ // The code point immediately after the m_BoundaryOffset.
+ UChar32 m_nextCodePoint = 0;
+
+ // The relative offset from the begging of this state machine.
+ int m_boundaryOffset = 0;
- // The length of the previously seen variation selector.
- int m_lastSeenVSCodeUnits = 0;
+ // The number of regional indicator symbols preceding to the begging offset.
+ int m_precedingRISCount = 0;
// The internal state.
- BackspaceState m_state;
+ InternalState m_internalState;
};
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698