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

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

Issue 2639483002: Add sequence number to undo steps (Closed)
Patch Set: Fri Feb 17 13:12:45 PST 2017 Created 3 years, 10 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..1d9b91d6e6d61689bbdf1809846a6178080aa123 100644
--- a/third_party/WebKit/Source/core/editing/commands/UndoStack.cpp
+++ b/third_party/WebKit/Source/core/editing/commands/UndoStack.cpp
@@ -45,10 +45,13 @@ UndoStack* UndoStack::create() {
}
void UndoStack::registerUndoStep(UndoStep* step) {
+ if (m_undoStack.size())
+ DCHECK_GE(step->sequenceNumber(), m_undoStack.back()->sequenceNumber());
if (m_undoStack.size() == maximumUndoStackDepth)
m_undoStack.removeFirst(); // drop oldest item off the far end
- if (!m_inRedo)
+ if (!m_inRedo) {
yosin_UTC9 2017/02/20 06:17:50 nit: No need to have braces.
Xiaocheng 2017/02/22 02:47:32 Whoops. Done.
m_redoStack.clear();
+ }
m_undoStack.append(step);
}

Powered by Google App Engine
This is Rietveld 408576698