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

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

Issue 2639483002: Add sequence number to undo steps (Closed)
Patch Set: Rebase 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 unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/core/editing/commands/UndoStep.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/editing/commands/UndoStep.h" 5 #include "core/editing/commands/UndoStep.h"
6 6
7 #include "core/editing/Editor.h" 7 #include "core/editing/Editor.h"
8 #include "core/editing/commands/EditCommand.h" 8 #include "core/editing/commands/EditCommand.h"
9 9
10 namespace blink { 10 namespace blink {
11 11
12 namespace {
13 uint64_t s_currentSequenceNumber = 0;
14 }
15
12 UndoStep* UndoStep::create(Document* document, 16 UndoStep* UndoStep::create(Document* document,
13 const VisibleSelection& startingSelection, 17 const VisibleSelection& startingSelection,
14 const VisibleSelection& endingSelection, 18 const VisibleSelection& endingSelection,
15 InputEvent::InputType inputType) { 19 InputEvent::InputType inputType) {
16 return new UndoStep(document, startingSelection, endingSelection, inputType); 20 return new UndoStep(document, startingSelection, endingSelection, inputType);
17 } 21 }
18 22
19 UndoStep::UndoStep(Document* document, 23 UndoStep::UndoStep(Document* document,
20 const VisibleSelection& startingSelection, 24 const VisibleSelection& startingSelection,
21 const VisibleSelection& endingSelection, 25 const VisibleSelection& endingSelection,
22 InputEvent::InputType inputType) 26 InputEvent::InputType inputType)
23 : m_document(document), 27 : m_document(document),
24 m_startingSelection(startingSelection), 28 m_startingSelection(startingSelection),
25 m_endingSelection(endingSelection), 29 m_endingSelection(endingSelection),
26 m_startingRootEditableElement(startingSelection.rootEditableElement()), 30 m_startingRootEditableElement(startingSelection.rootEditableElement()),
27 m_endingRootEditableElement(endingSelection.rootEditableElement()), 31 m_endingRootEditableElement(endingSelection.rootEditableElement()),
28 m_inputType(inputType) {} 32 m_inputType(inputType),
33 m_sequenceNumber(++s_currentSequenceNumber) {}
29 34
30 void UndoStep::unapply() { 35 void UndoStep::unapply() {
31 DCHECK(m_document); 36 DCHECK(m_document);
32 LocalFrame* frame = m_document->frame(); 37 LocalFrame* frame = m_document->frame();
33 DCHECK(frame); 38 DCHECK(frame);
34 39
35 // Changes to the document may have been made since the last editing operation 40 // Changes to the document may have been made since the last editing operation
36 // that require a layout, as in <rdar://problem/5658603>. Low level 41 // that require a layout, as in <rdar://problem/5658603>. Low level
37 // operations, like RemoveNodeCommand, don't require a layout because the high 42 // operations, like RemoveNodeCommand, don't require a layout because the high
38 // level operations that use them perform one if one is necessary (like for 43 // level operations that use them perform one if one is necessary (like for
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 DEFINE_TRACE(UndoStep) { 98 DEFINE_TRACE(UndoStep) {
94 visitor->trace(m_document); 99 visitor->trace(m_document);
95 visitor->trace(m_startingSelection); 100 visitor->trace(m_startingSelection);
96 visitor->trace(m_endingSelection); 101 visitor->trace(m_endingSelection);
97 visitor->trace(m_commands); 102 visitor->trace(m_commands);
98 visitor->trace(m_startingRootEditableElement); 103 visitor->trace(m_startingRootEditableElement);
99 visitor->trace(m_endingRootEditableElement); 104 visitor->trace(m_endingRootEditableElement);
100 } 105 }
101 106
102 } // namespace blink 107 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/editing/commands/UndoStep.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698