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

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

Issue 2642663002: Rename class EditCommandComposition to UndoStep (Closed)
Patch Set: Remove a redundant TODO Created 3 years, 11 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) 2005, 2006, 2007 Apple, Inc. All rights reserved. 2 * Copyright (C) 2005, 2006, 2007 Apple, Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 EditCommand::~EditCommand() {} 45 EditCommand::~EditCommand() {}
46 46
47 InputEvent::InputType EditCommand::inputType() const { 47 InputEvent::InputType EditCommand::inputType() const {
48 return InputEvent::InputType::None; 48 return InputEvent::InputType::None;
49 } 49 }
50 50
51 String EditCommand::textDataForInputEvent() const { 51 String EditCommand::textDataForInputEvent() const {
52 return nullAtom; 52 return nullAtom;
53 } 53 }
54 54
55 static inline EditCommandComposition* compositionIfPossible( 55 static inline UndoStep* compositionIfPossible(EditCommand* command) {
56 EditCommand* command) {
57 if (!command->isCompositeEditCommand()) 56 if (!command->isCompositeEditCommand())
58 return 0; 57 return 0;
59 return toCompositeEditCommand(command)->composition(); 58 return toCompositeEditCommand(command)->composition();
60 } 59 }
61 60
62 void EditCommand::setStartingSelection(const VisibleSelection& selection) { 61 void EditCommand::setStartingSelection(const VisibleSelection& selection) {
63 for (EditCommand* command = this;; command = command->m_parent) { 62 for (EditCommand* command = this;; command = command->m_parent) {
64 if (EditCommandComposition* composition = compositionIfPossible(command)) { 63 if (UndoStep* composition = compositionIfPossible(command)) {
65 DCHECK(command->isTopLevelCommand()); 64 DCHECK(command->isTopLevelCommand());
66 composition->setStartingSelection(selection); 65 composition->setStartingSelection(selection);
67 } 66 }
68 command->m_startingSelection = selection; 67 command->m_startingSelection = selection;
69 if (!command->m_parent || command->m_parent->isFirstCommand(command)) 68 if (!command->m_parent || command->m_parent->isFirstCommand(command))
70 break; 69 break;
71 } 70 }
72 } 71 }
73 72
74 // TODO(yosin): We will make |SelectionInDOMTree| version of 73 // TODO(yosin): We will make |SelectionInDOMTree| version of
75 // |setEndingSelection()| as primary function instead of wrapper, once 74 // |setEndingSelection()| as primary function instead of wrapper, once
76 // |EditCommand| holds other than |VisibleSelection|. 75 // |EditCommand| holds other than |VisibleSelection|.
77 void EditCommand::setEndingSelection(const SelectionInDOMTree& selection) { 76 void EditCommand::setEndingSelection(const SelectionInDOMTree& selection) {
78 // TODO(editing-dev): The use of 77 // TODO(editing-dev): The use of
79 // updateStyleAndLayoutIgnorePendingStylesheets 78 // updateStyleAndLayoutIgnorePendingStylesheets
80 // needs to be audited. See http://crbug.com/590369 for more details. 79 // needs to be audited. See http://crbug.com/590369 for more details.
81 document().updateStyleAndLayoutIgnorePendingStylesheets(); 80 document().updateStyleAndLayoutIgnorePendingStylesheets();
82 setEndingVisibleSelection(createVisibleSelection(selection)); 81 setEndingVisibleSelection(createVisibleSelection(selection));
83 } 82 }
84 83
85 // TODO(yosin): We will make |SelectionInDOMTree| version of 84 // TODO(yosin): We will make |SelectionInDOMTree| version of
86 // |setEndingSelection()| as primary function instead of wrapper. 85 // |setEndingSelection()| as primary function instead of wrapper.
87 void EditCommand::setEndingVisibleSelection(const VisibleSelection& selection) { 86 void EditCommand::setEndingVisibleSelection(const VisibleSelection& selection) {
88 for (EditCommand* command = this; command; command = command->m_parent) { 87 for (EditCommand* command = this; command; command = command->m_parent) {
89 if (EditCommandComposition* composition = compositionIfPossible(command)) { 88 if (UndoStep* composition = compositionIfPossible(command)) {
90 DCHECK(command->isTopLevelCommand()); 89 DCHECK(command->isTopLevelCommand());
91 composition->setEndingSelection(selection); 90 composition->setEndingSelection(selection);
92 } 91 }
93 command->m_endingSelection = selection; 92 command->m_endingSelection = selection;
94 } 93 }
95 } 94 }
96 95
97 bool EditCommand::isRenderedCharacter(const Position& position) { 96 bool EditCommand::isRenderedCharacter(const Position& position) {
98 if (position.isNull()) 97 if (position.isNull())
99 return false; 98 return false;
(...skipping 26 matching lines...) Expand all
126 } 125 }
127 126
128 DEFINE_TRACE(EditCommand) { 127 DEFINE_TRACE(EditCommand) {
129 visitor->trace(m_document); 128 visitor->trace(m_document);
130 visitor->trace(m_startingSelection); 129 visitor->trace(m_startingSelection);
131 visitor->trace(m_endingSelection); 130 visitor->trace(m_endingSelection);
132 visitor->trace(m_parent); 131 visitor->trace(m_parent);
133 } 132 }
134 133
135 } // namespace blink 134 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698