| 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 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 335 | 335 |
| 336 void DeleteSelectionCommand::removeNode(PassRefPtrWillBeRawPtr<Node> node, Shoul
dAssumeContentIsAlwaysEditable shouldAssumeContentIsAlwaysEditable) | 336 void DeleteSelectionCommand::removeNode(PassRefPtrWillBeRawPtr<Node> node, Shoul
dAssumeContentIsAlwaysEditable shouldAssumeContentIsAlwaysEditable) |
| 337 { | 337 { |
| 338 if (!node) | 338 if (!node) |
| 339 return; | 339 return; |
| 340 | 340 |
| 341 if (m_startRoot != m_endRoot && !(node->isDescendantOf(m_startRoot.get()) &&
node->isDescendantOf(m_endRoot.get()))) { | 341 if (m_startRoot != m_endRoot && !(node->isDescendantOf(m_startRoot.get()) &&
node->isDescendantOf(m_endRoot.get()))) { |
| 342 // If a node is not in both the start and end editable roots, remove it
only if its inside an editable region. | 342 // If a node is not in both the start and end editable roots, remove it
only if its inside an editable region. |
| 343 if (!node->parentNode()->hasEditableStyle()) { | 343 if (!node->parentNode()->hasEditableStyle()) { |
| 344 // Don't remove non-editable atomic nodes. | 344 // Don't remove non-editable atomic nodes. |
| 345 if (!node->firstChild()) | 345 if (!node->hasChildren()) |
| 346 return; | 346 return; |
| 347 // Search this non-editable region for editable regions to empty. | 347 // Search this non-editable region for editable regions to empty. |
| 348 RefPtrWillBeRawPtr<Node> child = node->firstChild(); | 348 RefPtrWillBeRawPtr<Node> child = node->firstChild(); |
| 349 while (child) { | 349 while (child) { |
| 350 RefPtrWillBeRawPtr<Node> nextChild = child->nextSibling(); | 350 RefPtrWillBeRawPtr<Node> nextChild = child->nextSibling(); |
| 351 removeNode(child.get(), shouldAssumeContentIsAlwaysEditable); | 351 removeNode(child.get(), shouldAssumeContentIsAlwaysEditable); |
| 352 // Bail if nextChild is no longer node's child. | 352 // Bail if nextChild is no longer node's child. |
| 353 if (nextChild && nextChild->parentNode() != node) | 353 if (nextChild && nextChild->parentNode() != node) |
| 354 return; | 354 return; |
| 355 child = nextChild; | 355 child = nextChild; |
| (...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 617 | 617 |
| 618 // m_downstreamEnd's block has been emptied out by deletion. There is no co
ntent inside of it to | 618 // m_downstreamEnd's block has been emptied out by deletion. There is no co
ntent inside of it to |
| 619 // move, so just remove it. | 619 // move, so just remove it. |
| 620 Element* endBlock = enclosingBlock(m_downstreamEnd.deprecatedNode()); | 620 Element* endBlock = enclosingBlock(m_downstreamEnd.deprecatedNode()); |
| 621 if (!endBlock || !endBlock->contains(startOfParagraphToMove.deepEquivalent()
.deprecatedNode()) || !startOfParagraphToMove.deepEquivalent().deprecatedNode())
{ | 621 if (!endBlock || !endBlock->contains(startOfParagraphToMove.deepEquivalent()
.deprecatedNode()) || !startOfParagraphToMove.deepEquivalent().deprecatedNode())
{ |
| 622 removeNode(enclosingBlock(m_downstreamEnd.deprecatedNode())); | 622 removeNode(enclosingBlock(m_downstreamEnd.deprecatedNode())); |
| 623 return; | 623 return; |
| 624 } | 624 } |
| 625 | 625 |
| 626 // We need to merge into m_upstreamStart's block, but it's been emptied out
and collapsed by deletion. | 626 // We need to merge into m_upstreamStart's block, but it's been emptied out
and collapsed by deletion. |
| 627 if (!mergeDestination.deepEquivalent().deprecatedNode() || (!mergeDestinatio
n.deepEquivalent().deprecatedNode()->isDescendantOf(enclosingBlock(m_upstreamSta
rt.containerNode())) && (!mergeDestination.deepEquivalent().anchorNode()->firstC
hild() || !m_upstreamStart.containerNode()->firstChild())) || (m_startsAtEmptyLi
ne && mergeDestination != startOfParagraphToMove)) { | 627 if (!mergeDestination.deepEquivalent().deprecatedNode() || (!mergeDestinatio
n.deepEquivalent().deprecatedNode()->isDescendantOf(enclosingBlock(m_upstreamSta
rt.containerNode())) && (!mergeDestination.deepEquivalent().anchorNode()->hasChi
ldren() || !m_upstreamStart.containerNode()->hasChildren())) || (m_startsAtEmpty
Line && mergeDestination != startOfParagraphToMove)) { |
| 628 insertNodeAt(createBreakElement(document()).get(), m_upstreamStart); | 628 insertNodeAt(createBreakElement(document()).get(), m_upstreamStart); |
| 629 mergeDestination = VisiblePosition(m_upstreamStart); | 629 mergeDestination = VisiblePosition(m_upstreamStart); |
| 630 } | 630 } |
| 631 | 631 |
| 632 if (mergeDestination == startOfParagraphToMove) | 632 if (mergeDestination == startOfParagraphToMove) |
| 633 return; | 633 return; |
| 634 | 634 |
| 635 VisiblePosition endOfParagraphToMove = endOfParagraph(startOfParagraphToMove
, CanSkipOverEditingBoundary); | 635 VisiblePosition endOfParagraphToMove = endOfParagraph(startOfParagraphToMove
, CanSkipOverEditingBoundary); |
| 636 | 636 |
| 637 if (mergeDestination == endOfParagraphToMove) | 637 if (mergeDestination == endOfParagraphToMove) |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 886 visitor->trace(m_deleteIntoBlockquoteStyle); | 886 visitor->trace(m_deleteIntoBlockquoteStyle); |
| 887 visitor->trace(m_startRoot); | 887 visitor->trace(m_startRoot); |
| 888 visitor->trace(m_endRoot); | 888 visitor->trace(m_endRoot); |
| 889 visitor->trace(m_startTableRow); | 889 visitor->trace(m_startTableRow); |
| 890 visitor->trace(m_endTableRow); | 890 visitor->trace(m_endTableRow); |
| 891 visitor->trace(m_temporaryPlaceholder); | 891 visitor->trace(m_temporaryPlaceholder); |
| 892 CompositeEditCommand::trace(visitor); | 892 CompositeEditCommand::trace(visitor); |
| 893 } | 893 } |
| 894 | 894 |
| 895 } // namespace blink | 895 } // namespace blink |
| OLD | NEW |