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

Side by Side Diff: third_party/WebKit/Source/core/editing/commands/UndoStep.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 unified diff | Download patch
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
yosin_UTC9 2017/02/20 06:17:50 nit: Get rid this extra blank line or add a blank
Xiaocheng 2017/02/22 02:47:32 |git cl format| did this. I'll remove the blank l
14 uint64_t s_nextSequenceNumber = 0;
yosin_UTC9 2017/02/20 06:17:50 nit:s/nextSequneceNumber/currentSequenceNumber/ Si
Xiaocheng 2017/02/22 02:47:32 Done.
15 }
16
12 UndoStep* UndoStep::create(Document* document, 17 UndoStep* UndoStep::create(Document* document,
13 const VisibleSelection& startingSelection, 18 const VisibleSelection& startingSelection,
14 const VisibleSelection& endingSelection, 19 const VisibleSelection& endingSelection,
15 InputEvent::InputType inputType) { 20 InputEvent::InputType inputType) {
16 return new UndoStep(document, startingSelection, endingSelection, inputType); 21 return new UndoStep(document, startingSelection, endingSelection, inputType);
17 } 22 }
18 23
19 UndoStep::UndoStep(Document* document, 24 UndoStep::UndoStep(Document* document,
20 const VisibleSelection& startingSelection, 25 const VisibleSelection& startingSelection,
21 const VisibleSelection& endingSelection, 26 const VisibleSelection& endingSelection,
22 InputEvent::InputType inputType) 27 InputEvent::InputType inputType)
23 : m_document(document), 28 : m_document(document),
24 m_startingSelection(startingSelection), 29 m_startingSelection(startingSelection),
25 m_endingSelection(endingSelection), 30 m_endingSelection(endingSelection),
26 m_startingRootEditableElement(startingSelection.rootEditableElement()), 31 m_startingRootEditableElement(startingSelection.rootEditableElement()),
27 m_endingRootEditableElement(endingSelection.rootEditableElement()), 32 m_endingRootEditableElement(endingSelection.rootEditableElement()),
28 m_inputType(inputType) {} 33 m_inputType(inputType),
34 m_sequenceNumber(++s_nextSequenceNumber) {}
29 35
30 void UndoStep::unapply() { 36 void UndoStep::unapply() {
31 DCHECK(m_document); 37 DCHECK(m_document);
32 LocalFrame* frame = m_document->frame(); 38 LocalFrame* frame = m_document->frame();
33 DCHECK(frame); 39 DCHECK(frame);
34 40
35 // Changes to the document may have been made since the last editing operation 41 // 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 42 // that require a layout, as in <rdar://problem/5658603>. Low level
37 // operations, like RemoveNodeCommand, don't require a layout because the high 43 // 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 44 // 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) { 99 DEFINE_TRACE(UndoStep) {
94 visitor->trace(m_document); 100 visitor->trace(m_document);
95 visitor->trace(m_startingSelection); 101 visitor->trace(m_startingSelection);
96 visitor->trace(m_endingSelection); 102 visitor->trace(m_endingSelection);
97 visitor->trace(m_commands); 103 visitor->trace(m_commands);
98 visitor->trace(m_startingRootEditableElement); 104 visitor->trace(m_startingRootEditableElement);
99 visitor->trace(m_endingRootEditableElement); 105 visitor->trace(m_endingRootEditableElement);
100 } 106 }
101 107
102 } // namespace blink 108 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698