| OLD | NEW |
| 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 return new UndoStack(); | 44 return new UndoStack(); |
| 45 } | 45 } |
| 46 | 46 |
| 47 void UndoStack::registerUndoStep(UndoStep* step) { | 47 void UndoStack::registerUndoStep(UndoStep* step) { |
| 48 if (m_undoStack.size()) | 48 if (m_undoStack.size()) |
| 49 DCHECK_GE(step->sequenceNumber(), m_undoStack.back()->sequenceNumber()); | 49 DCHECK_GE(step->sequenceNumber(), m_undoStack.back()->sequenceNumber()); |
| 50 if (m_undoStack.size() == maximumUndoStackDepth) | 50 if (m_undoStack.size() == maximumUndoStackDepth) |
| 51 m_undoStack.removeFirst(); // drop oldest item off the far end | 51 m_undoStack.removeFirst(); // drop oldest item off the far end |
| 52 if (!m_inRedo) | 52 if (!m_inRedo) |
| 53 m_redoStack.clear(); | 53 m_redoStack.clear(); |
| 54 m_undoStack.append(step); | 54 m_undoStack.push_back(step); |
| 55 } | 55 } |
| 56 | 56 |
| 57 void UndoStack::registerRedoStep(UndoStep* step) { | 57 void UndoStack::registerRedoStep(UndoStep* step) { |
| 58 m_redoStack.append(step); | 58 m_redoStack.push_back(step); |
| 59 } | 59 } |
| 60 | 60 |
| 61 bool UndoStack::canUndo() const { | 61 bool UndoStack::canUndo() const { |
| 62 return !m_undoStack.isEmpty(); | 62 return !m_undoStack.isEmpty(); |
| 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 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 |
| OLD | NEW |