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

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

Issue 2747373004: Migrate WTF::Deque::remove() to ::erase() (Closed)
Patch Set: Created 3 years, 9 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007 Apple, Inc. All rights reserved. 2 * Copyright (C) 2006, 2007 Apple, Inc. All rights reserved.
3 * Copyright (C) 2012 Google, Inc. All rights reserved. 3 * Copyright (C) 2012 Google, Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 } 63 }
64 64
65 bool UndoStack::canRedo() const { 65 bool UndoStack::canRedo() const {
66 return !m_redoStack.isEmpty(); 66 return !m_redoStack.isEmpty();
67 } 67 }
68 68
69 void UndoStack::undo() { 69 void UndoStack::undo() {
70 if (canUndo()) { 70 if (canUndo()) {
71 UndoStepStack::iterator back = --m_undoStack.end(); 71 UndoStepStack::iterator back = --m_undoStack.end();
72 UndoStep* step(back->get()); 72 UndoStep* step(back->get());
73 m_undoStack.remove(back); 73 m_undoStack.erase(back);
74 step->unapply(); 74 step->unapply();
75 // unapply will call us back to push this command onto the redo stack. 75 // unapply will call us back to push this command onto the redo stack.
76 } 76 }
77 } 77 }
78 78
79 void UndoStack::redo() { 79 void UndoStack::redo() {
80 if (canRedo()) { 80 if (canRedo()) {
81 UndoStepStack::iterator back = --m_redoStack.end(); 81 UndoStepStack::iterator back = --m_redoStack.end();
82 UndoStep* step(back->get()); 82 UndoStep* step(back->get());
83 m_redoStack.remove(back); 83 m_redoStack.erase(back);
84 84
85 DCHECK(!m_inRedo); 85 DCHECK(!m_inRedo);
86 AutoReset<bool> redoScope(&m_inRedo, true); 86 AutoReset<bool> redoScope(&m_inRedo, true);
87 step->reapply(); 87 step->reapply();
88 // reapply will call us back to push this command onto the undo stack. 88 // reapply will call us back to push this command onto the undo stack.
89 } 89 }
90 } 90 }
91 91
92 void UndoStack::clear() { 92 void UndoStack::clear() {
93 m_undoStack.clear(); 93 m_undoStack.clear();
94 m_redoStack.clear(); 94 m_redoStack.clear();
95 } 95 }
96 96
97 DEFINE_TRACE(UndoStack) { 97 DEFINE_TRACE(UndoStack) {
98 visitor->trace(m_undoStack); 98 visitor->trace(m_undoStack);
99 visitor->trace(m_redoStack); 99 visitor->trace(m_redoStack);
100 } 100 }
101 101
102 UndoStack::UndoStepRange::UndoStepRange(const UndoStepStack& steps) 102 UndoStack::UndoStepRange::UndoStepRange(const UndoStepStack& steps)
103 : m_stepStack(steps) {} 103 : m_stepStack(steps) {}
104 104
105 UndoStack::UndoStepRange UndoStack::undoSteps() const { 105 UndoStack::UndoStepRange UndoStack::undoSteps() const {
106 return UndoStepRange(m_undoStack); 106 return UndoStepRange(m_undoStack);
107 } 107 }
108 108
109 } // namespace blink 109 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698