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

Unified Diff: third_party/WebKit/Source/core/editing/state_machines/StateMachineTestUtil.cpp

Issue 1857633002: Introduce ForwardGraphemeBoundaryStateMachine (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebasing 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
« no previous file with comments | « third_party/WebKit/Source/core/editing/state_machines/StateMachineTestUtil.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/editing/state_machines/StateMachineTestUtil.cpp
diff --git a/third_party/WebKit/Source/core/editing/state_machines/StateMachineTestUtil.cpp b/third_party/WebKit/Source/core/editing/state_machines/StateMachineTestUtil.cpp
index a2062f9b3a50e0215e84643ce1a615081689fa9a..c009346d469bcd63fe4740bc0d3b412fb1f443b1 100644
--- a/third_party/WebKit/Source/core/editing/state_machines/StateMachineTestUtil.cpp
+++ b/third_party/WebKit/Source/core/editing/state_machines/StateMachineTestUtil.cpp
@@ -5,6 +5,7 @@
#include "core/editing/state_machines/StateMachineTestUtil.h"
#include "core/editing/state_machines/BackwardGraphemeBoundaryStateMachine.h"
+#include "core/editing/state_machines/ForwardGraphemeBoundaryStateMachine.h"
#include "core/editing/state_machines/TextSegmentationMachineState.h"
#include "wtf/Assertions.h"
#include <algorithm>
@@ -64,7 +65,8 @@ std::string processSequence(StateMachine* machine,
break;
}
}
- if (state == TextSegmentationMachineState::NeedMoreCodeUnit) {
+ if (preceding.empty()
+ || state == TextSegmentationMachineState::NeedMoreCodeUnit) {
state = machine->tellEndOfPrecedingText();
out += MachineStateToChar(state);
}
@@ -95,9 +97,21 @@ std::string processSequenceBackward(
{
const std::string& out =
processSequence(machine, preceding, std::vector<UChar32>());
- DCHECK_EQ(machine->finalizeAndGetBoundaryOffset(),
- machine->finalizeAndGetBoundaryOffset())
- << "finalizeAndGetBoundaryOffset should return fixed values.";
+ if (machine->finalizeAndGetBoundaryOffset()
+ != machine->finalizeAndGetBoundaryOffset())
+ return "State machine changes final offset after finished.";
+ return out;
+}
+
+std::string processSequenceForward(
+ ForwardGraphemeBoundaryStateMachine* machine,
+ const std::vector<UChar32>& preceding,
+ const std::vector<UChar32>& following)
+{
+ const std::string& out = processSequence(machine, preceding, following);
+ if (machine->finalizeAndGetBoundaryOffset()
+ != machine->finalizeAndGetBoundaryOffset())
+ return "State machine changes final offset after finished.";
return out;
}
« no previous file with comments | « third_party/WebKit/Source/core/editing/state_machines/StateMachineTestUtil.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698