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

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

Issue 2127463002: Revert of Move UndoStack from Page to Editor (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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 0839c553e07a4206087dbd898745e5002cad88fb..778e50f556ffbc4e5bc36735d705130aae9856a5 100644
--- a/third_party/WebKit/Source/core/editing/commands/UndoStack.cpp
+++ b/third_party/WebKit/Source/core/editing/commands/UndoStack.cpp
@@ -28,6 +28,7 @@
#include "core/dom/ContainerNode.h"
#include "core/editing/commands/UndoStep.h"
+#include "platform/EventDispatchForbiddenScope.h"
#include "wtf/TemporaryChange.h"
namespace blink {
@@ -60,6 +61,25 @@
void UndoStack::registerRedoStep(UndoStep* step)
{
m_redoStack.append(step);
+}
+
+void UndoStack::didUnloadFrame(const LocalFrame& frame)
+{
+ EventDispatchForbiddenScope assertNoEventDispatch;
+ filterOutUndoSteps(m_undoStack, frame);
+ filterOutUndoSteps(m_redoStack, frame);
+}
+
+void UndoStack::filterOutUndoSteps(UndoStepStack& stack, const LocalFrame& frame)
+{
+ UndoStepStack newStack;
+ while (!stack.isEmpty()) {
+ UndoStep* step = stack.first().get();
+ if (!step->belongsTo(frame))
+ newStack.append(step);
+ stack.removeFirst();
+ }
+ stack.swap(newStack);
}
bool UndoStack::canUndo() const
« no previous file with comments | « third_party/WebKit/Source/core/editing/commands/UndoStack.h ('k') | third_party/WebKit/Source/core/loader/FrameLoader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698