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

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

Issue 2442673002: Get rid of createVisibleSelection() taking one Position (Closed)
Patch Set: 2016-10-24T17:42:38 Created 4 years, 1 month 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 Apple Computer, Inc. All rights reserved. 2 * Copyright (C) 2005 Apple Computer, 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 1075 matching lines...) Expand 10 before | Expand all | Expand 10 after
1086 saveTypingStyleState(); 1086 saveTypingStyleState();
1087 1087
1088 // deleting just a BR is handled specially, at least because we do not 1088 // deleting just a BR is handled specially, at least because we do not
1089 // want to replace it with a placeholder BR! 1089 // want to replace it with a placeholder BR!
1090 bool brResult = handleSpecialCaseBRDelete(editingState); 1090 bool brResult = handleSpecialCaseBRDelete(editingState);
1091 if (editingState->isAborted()) 1091 if (editingState->isAborted())
1092 return; 1092 return;
1093 if (brResult) { 1093 if (brResult) {
1094 calculateTypingStyleAfterDelete(); 1094 calculateTypingStyleAfterDelete();
1095 document().updateStyleAndLayoutIgnorePendingStylesheets(); 1095 document().updateStyleAndLayoutIgnorePendingStylesheets();
1096 setEndingSelection(createVisibleSelection( 1096 SelectionInDOMTree::Builder builder;
1097 m_endingPosition, affinity, endingSelection().isDirectional())); 1097 builder.setAffinity(affinity);
1098 builder.setIsDirectional(endingSelection().isDirectional());
1099 if (m_endingPosition.isNotNull())
1100 builder.collapse(m_endingPosition);
1101 setEndingSelection(createVisibleSelection(builder.build()));
1098 clearTransientState(); 1102 clearTransientState();
1099 rebalanceWhitespace(); 1103 rebalanceWhitespace();
1100 return; 1104 return;
1101 } 1105 }
1102 1106
1103 document().updateStyleAndLayoutIgnorePendingStylesheets(); 1107 document().updateStyleAndLayoutIgnorePendingStylesheets();
1104 1108
1105 handleGeneralDelete(editingState); 1109 handleGeneralDelete(editingState);
1106 if (editingState->isAborted()) 1110 if (editingState->isAborted())
1107 return; 1111 return;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
1143 return; 1147 return;
1144 } 1148 }
1145 } 1149 }
1146 1150
1147 rebalanceWhitespaceAt(m_endingPosition); 1151 rebalanceWhitespaceAt(m_endingPosition);
1148 1152
1149 calculateTypingStyleAfterDelete(); 1153 calculateTypingStyleAfterDelete();
1150 1154
1151 document().updateStyleAndLayoutIgnorePendingStylesheets(); 1155 document().updateStyleAndLayoutIgnorePendingStylesheets();
1152 1156
1153 setEndingSelection(createVisibleSelection(m_endingPosition, affinity, 1157 SelectionInDOMTree::Builder builder;
1154 endingSelection().isDirectional())); 1158 builder.setAffinity(affinity);
1159 builder.setIsDirectional(endingSelection().isDirectional());
1160 if (m_endingPosition.isNotNull())
1161 builder.collapse(m_endingPosition);
1162 setEndingSelection(createVisibleSelection(builder.build()));
1155 1163
1156 if (relocatableReferencePosition.position().isNull()) { 1164 if (relocatableReferencePosition.position().isNull()) {
1157 clearTransientState(); 1165 clearTransientState();
1158 return; 1166 return;
1159 } 1167 }
1160 1168
1161 // This deletion command is part of a move operation, we need to cleanup after 1169 // This deletion command is part of a move operation, we need to cleanup after
1162 // deletion. 1170 // deletion.
1163 m_referenceMovePosition = relocatableReferencePosition.position(); 1171 m_referenceMovePosition = relocatableReferencePosition.position();
1164 // If the node for the destination has been removed as a result of the 1172 // If the node for the destination has been removed as a result of the
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
1210 visitor->trace(m_deleteIntoBlockquoteStyle); 1218 visitor->trace(m_deleteIntoBlockquoteStyle);
1211 visitor->trace(m_startRoot); 1219 visitor->trace(m_startRoot);
1212 visitor->trace(m_endRoot); 1220 visitor->trace(m_endRoot);
1213 visitor->trace(m_startTableRow); 1221 visitor->trace(m_startTableRow);
1214 visitor->trace(m_endTableRow); 1222 visitor->trace(m_endTableRow);
1215 visitor->trace(m_temporaryPlaceholder); 1223 visitor->trace(m_temporaryPlaceholder);
1216 CompositeEditCommand::trace(visitor); 1224 CompositeEditCommand::trace(visitor);
1217 } 1225 }
1218 1226
1219 } // namespace blink 1227 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698