| 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 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 } | 188 } |
| 189 | 189 |
| 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 // TODO(yosin): We should not call |createVisiblePosition()| here and use |
| 199 // |start| and |end| as base/extent since |VisibleSelection| also calls |
| 200 // |createVisiblePosition()| during construction. |
| 201 // Because of |newBase.affinity()| can be |Upstream|, we can't simply |
| 202 // use |start| and |end| here. |
| 198 VisiblePosition newBase = createVisiblePosition(isBaseFirst ? start : end); | 203 VisiblePosition newBase = createVisiblePosition(isBaseFirst ? start : end); |
| 199 VisiblePosition newExtent = createVisiblePosition(isBaseFirst ? end : start); | 204 VisiblePosition newExtent = createVisiblePosition(isBaseFirst ? end : start); |
| 200 setStartingSelection(createVisibleSelection( | 205 SelectionInDOMTree::Builder builder; |
| 201 newBase, newExtent, startingSelection().isDirectional())); | 206 builder.setAffinity(newBase.affinity()) |
| 207 .setBaseAndExtentDeprecated(newBase.deepEquivalent(), |
| 208 newExtent.deepEquivalent()) |
| 209 .setIsDirectional(startingSelection().isDirectional()); |
| 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 |