| 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 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 510 m_needPlaceholder = true; | 510 m_needPlaceholder = true; |
| 511 } | 511 } |
| 512 if (node == m_endBlock) { | 512 if (node == m_endBlock) { |
| 513 VisiblePosition next = | 513 VisiblePosition next = |
| 514 nextPositionOf(VisiblePosition::lastPositionInNode(m_endBlock.get())); | 514 nextPositionOf(VisiblePosition::lastPositionInNode(m_endBlock.get())); |
| 515 if (next.isNotNull() && !isStartOfBlock(next)) | 515 if (next.isNotNull() && !isStartOfBlock(next)) |
| 516 m_needPlaceholder = true; | 516 m_needPlaceholder = true; |
| 517 } | 517 } |
| 518 | 518 |
| 519 // FIXME: Update the endpoints of the range being deleted. | 519 // FIXME: Update the endpoints of the range being deleted. |
| 520 updatePositionForNodeRemoval(m_endingPosition, *node); | 520 m_endingPosition = computePositionForNodeRemoval(m_endingPosition, *node); |
| 521 updatePositionForNodeRemoval(m_leadingWhitespace, *node); | 521 m_leadingWhitespace = |
| 522 updatePositionForNodeRemoval(m_trailingWhitespace, *node); | 522 computePositionForNodeRemoval(m_leadingWhitespace, *node); |
| 523 m_trailingWhitespace = |
| 524 computePositionForNodeRemoval(m_trailingWhitespace, *node); |
| 523 | 525 |
| 524 CompositeEditCommand::removeNode(node, editingState, | 526 CompositeEditCommand::removeNode(node, editingState, |
| 525 shouldAssumeContentIsAlwaysEditable); | 527 shouldAssumeContentIsAlwaysEditable); |
| 526 } | 528 } |
| 527 | 529 |
| 528 static void updatePositionForTextRemoval(Text* node, | 530 static void updatePositionForTextRemoval(Text* node, |
| 529 int offset, | 531 int offset, |
| 530 int count, | 532 int count, |
| 531 Position& position) { | 533 Position& position) { |
| 532 if (!position.isOffsetInAnchor() || position.computeContainerNode() != node) | 534 if (!position.isOffsetInAnchor() || position.computeContainerNode() != node) |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 664 while (node && node != m_downstreamEnd.anchorNode()) { | 666 while (node && node != m_downstreamEnd.anchorNode()) { |
| 665 if (comparePositions(firstPositionInOrBeforeNode(node), | 667 if (comparePositions(firstPositionInOrBeforeNode(node), |
| 666 m_downstreamEnd) >= 0) { | 668 m_downstreamEnd) >= 0) { |
| 667 // NodeTraversal::nextSkippingChildren just blew past the end position, | 669 // NodeTraversal::nextSkippingChildren just blew past the end position, |
| 668 // so stop deleting | 670 // so stop deleting |
| 669 node = nullptr; | 671 node = nullptr; |
| 670 } else if (!m_downstreamEnd.anchorNode()->isDescendantOf(node)) { | 672 } else if (!m_downstreamEnd.anchorNode()->isDescendantOf(node)) { |
| 671 Node* nextNode = NodeTraversal::nextSkippingChildren(*node); | 673 Node* nextNode = NodeTraversal::nextSkippingChildren(*node); |
| 672 // if we just removed a node from the end container, update end position | 674 // if we just removed a node from the end container, update end position |
| 673 // so the check above will work | 675 // so the check above will work |
| 674 updatePositionForNodeRemoval(m_downstreamEnd, *node); | 676 m_downstreamEnd = computePositionForNodeRemoval(m_downstreamEnd, *node); |
| 675 removeNode(node, editingState); | 677 removeNode(node, editingState); |
| 676 if (editingState->isAborted()) | 678 if (editingState->isAborted()) |
| 677 return; | 679 return; |
| 678 node = nextNode; | 680 node = nextNode; |
| 679 } else { | 681 } else { |
| 680 Node& n = NodeTraversal::lastWithinOrSelf(*node); | 682 Node& n = NodeTraversal::lastWithinOrSelf(*node); |
| 681 if (m_downstreamEnd.anchorNode() == n && | 683 if (m_downstreamEnd.anchorNode() == n && |
| 682 m_downstreamEnd.computeEditingOffset() >= caretMaxOffset(&n)) { | 684 m_downstreamEnd.computeEditingOffset() >= caretMaxOffset(&n)) { |
| 683 removeNode(node, editingState); | 685 removeNode(node, editingState); |
| 684 if (editingState->isAborted()) | 686 if (editingState->isAborted()) |
| (...skipping 542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1227 visitor->trace(m_deleteIntoBlockquoteStyle); | 1229 visitor->trace(m_deleteIntoBlockquoteStyle); |
| 1228 visitor->trace(m_startRoot); | 1230 visitor->trace(m_startRoot); |
| 1229 visitor->trace(m_endRoot); | 1231 visitor->trace(m_endRoot); |
| 1230 visitor->trace(m_startTableRow); | 1232 visitor->trace(m_startTableRow); |
| 1231 visitor->trace(m_endTableRow); | 1233 visitor->trace(m_endTableRow); |
| 1232 visitor->trace(m_temporaryPlaceholder); | 1234 visitor->trace(m_temporaryPlaceholder); |
| 1233 CompositeEditCommand::trace(visitor); | 1235 CompositeEditCommand::trace(visitor); |
| 1234 } | 1236 } |
| 1235 | 1237 |
| 1236 } // namespace blink | 1238 } // namespace blink |
| OLD | NEW |