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

Unified Diff: third_party/WebKit/Source/core/editing/commands/UndoStack.cpp

Issue 2639483002: Add sequence number to undo steps (Closed)
Patch Set: Created 3 years, 11 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/commands/UndoStack.cpp
diff --git a/third_party/WebKit/Source/core/editing/commands/UndoStack.cpp b/third_party/WebKit/Source/core/editing/commands/UndoStack.cpp
index 7f435982f87767a5c40c03c6590b17436a7cefc5..e492b81869c1569e2f3a0c67e283336a46c2a1ea 100644
--- a/third_party/WebKit/Source/core/editing/commands/UndoStack.cpp
+++ b/third_party/WebKit/Source/core/editing/commands/UndoStack.cpp
@@ -38,7 +38,7 @@ namespace blink {
// into a single action.
static const size_t maximumUndoStackDepth = 1000;
-UndoStack::UndoStack() : m_inRedo(false) {}
+UndoStack::UndoStack() : m_maxSequence(0), m_inRedo(false) {}
UndoStack* UndoStack::create() {
return new UndoStack();
@@ -47,8 +47,10 @@ UndoStack* UndoStack::create() {
void UndoStack::registerUndoStep(UndoStep* step) {
if (m_undoStack.size() == maximumUndoStackDepth)
m_undoStack.removeFirst(); // drop oldest item off the far end
- if (!m_inRedo)
+ if (!m_inRedo) {
m_redoStack.clear();
+ step->setSequence(++m_maxSequence);
yosin_UTC9 2017/01/17 08:13:29 Usage of |m_maxSequence| isn't clear. Why incremen
Xiaocheng 2017/01/17 09:04:02 This is the place where a new undo step is pushed
+ }
m_undoStack.append(step);
}

Powered by Google App Engine
This is Rietveld 408576698