Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 190 void DeleteSelectionCommand::setStartingSelectionOnSmartDelete( | 190 void DeleteSelectionCommand::setStartingSelectionOnSmartDelete( |
| 191 const Position& start, | 191 const Position& start, |
| 192 const Position& end) { | 192 const Position& end) { |
| 193 DCHECK(!document().needsLayoutTreeUpdate()); | 193 DCHECK(!document().needsLayoutTreeUpdate()); |
| 194 DocumentLifecycle::DisallowTransitionScope disallowTransition( | 194 DocumentLifecycle::DisallowTransitionScope disallowTransition( |
| 195 document().lifecycle()); | 195 document().lifecycle()); |
| 196 | 196 |
| 197 bool isBaseFirst = startingSelection().isBaseFirst(); | 197 bool isBaseFirst = startingSelection().isBaseFirst(); |
| 198 VisiblePosition newBase = createVisiblePosition(isBaseFirst ? start : end); | 198 VisiblePosition newBase = createVisiblePosition(isBaseFirst ? start : end); |
| 199 VisiblePosition newExtent = createVisiblePosition(isBaseFirst ? end : start); | 199 VisiblePosition newExtent = createVisiblePosition(isBaseFirst ? end : start); |
| 200 setStartingSelection(createVisibleSelection( | 200 SelectionInDOMTree::Builder builder; |
| 201 newBase, newExtent, startingSelection().isDirectional())); | 201 builder.setIsDirectional(startingSelection().isDirectional()); |
| 202 if (newBase.isNotNull() && newExtent.isNotNull()) { | |
|
Xiaocheng
2016/10/21 11:18:36
Let's use setBaseAndExtentDeprecated, as having a
yosin_UTC9
2016/10/24 06:19:44
Done.
| |
| 203 builder.collapse(newBase.deepEquivalent()) | |
| 204 .extend(newExtent.deepEquivalent()); | |
| 205 } else if (newBase.isNotNull()) { | |
| 206 builder.collapse(newBase.deepEquivalent()); | |
| 207 } else if (newExtent.isNotNull()) { | |
| 208 builder.collapse(newExtent.deepEquivalent()); | |
| 209 } | |
| 210 setStartingSelection(createVisibleSelection(builder.build())); | |
| 202 } | 211 } |
| 203 | 212 |
| 204 void DeleteSelectionCommand::initializePositionData( | 213 void DeleteSelectionCommand::initializePositionData( |
| 205 EditingState* editingState) { | 214 EditingState* editingState) { |
| 206 DCHECK(!document().needsLayoutTreeUpdate()); | 215 DCHECK(!document().needsLayoutTreeUpdate()); |
| 207 DocumentLifecycle::DisallowTransitionScope disallowTransition( | 216 DocumentLifecycle::DisallowTransitionScope disallowTransition( |
| 208 document().lifecycle()); | 217 document().lifecycle()); |
| 209 | 218 |
| 210 Position start, end; | 219 Position start, end; |
| 211 initializeStartEnd(start, end); | 220 initializeStartEnd(start, end); |
| (...skipping 998 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1210 visitor->trace(m_deleteIntoBlockquoteStyle); | 1219 visitor->trace(m_deleteIntoBlockquoteStyle); |
| 1211 visitor->trace(m_startRoot); | 1220 visitor->trace(m_startRoot); |
| 1212 visitor->trace(m_endRoot); | 1221 visitor->trace(m_endRoot); |
| 1213 visitor->trace(m_startTableRow); | 1222 visitor->trace(m_startTableRow); |
| 1214 visitor->trace(m_endTableRow); | 1223 visitor->trace(m_endTableRow); |
| 1215 visitor->trace(m_temporaryPlaceholder); | 1224 visitor->trace(m_temporaryPlaceholder); |
| 1216 CompositeEditCommand::trace(visitor); | 1225 CompositeEditCommand::trace(visitor); |
| 1217 } | 1226 } |
| 1218 | 1227 |
| 1219 } // namespace blink | 1228 } // namespace blink |
| OLD | NEW |