| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Apple Computer, Inc. All rights reserved. | 2 * Copyright (C) 2012 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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 i += numPrunedAncestors; | 99 i += numPrunedAncestors; |
| 100 } | 100 } |
| 101 } | 101 } |
| 102 | 102 |
| 103 int SimplifyMarkupCommand::pruneSubsequentAncestorsToRemove(HeapVector<Member<Co
ntainerNode>>& nodesToRemove, size_t startNodeIndex, EditingState* editingState) | 103 int SimplifyMarkupCommand::pruneSubsequentAncestorsToRemove(HeapVector<Member<Co
ntainerNode>>& nodesToRemove, size_t startNodeIndex, EditingState* editingState) |
| 104 { | 104 { |
| 105 size_t pastLastNodeToRemove = startNodeIndex + 1; | 105 size_t pastLastNodeToRemove = startNodeIndex + 1; |
| 106 for (; pastLastNodeToRemove < nodesToRemove.size(); ++pastLastNodeToRemove)
{ | 106 for (; pastLastNodeToRemove < nodesToRemove.size(); ++pastLastNodeToRemove)
{ |
| 107 if (nodesToRemove[pastLastNodeToRemove - 1]->parentNode() != nodesToRemo
ve[pastLastNodeToRemove]) | 107 if (nodesToRemove[pastLastNodeToRemove - 1]->parentNode() != nodesToRemo
ve[pastLastNodeToRemove]) |
| 108 break; | 108 break; |
| 109 ASSERT(nodesToRemove[pastLastNodeToRemove]->firstChild() == nodesToRemov
e[pastLastNodeToRemove]->lastChild()); | 109 DCHECK_EQ(nodesToRemove[pastLastNodeToRemove]->firstChild(), nodesToRemo
ve[pastLastNodeToRemove]->lastChild()); |
| 110 } | 110 } |
| 111 | 111 |
| 112 ContainerNode* highestAncestorToRemove = nodesToRemove[pastLastNodeToRemove
- 1].get(); | 112 ContainerNode* highestAncestorToRemove = nodesToRemove[pastLastNodeToRemove
- 1].get(); |
| 113 ContainerNode* parent = highestAncestorToRemove->parentNode(); | 113 ContainerNode* parent = highestAncestorToRemove->parentNode(); |
| 114 if (!parent) // Parent has already been removed. | 114 if (!parent) // Parent has already been removed. |
| 115 return -1; | 115 return -1; |
| 116 | 116 |
| 117 if (pastLastNodeToRemove == startNodeIndex + 1) | 117 if (pastLastNodeToRemove == startNodeIndex + 1) |
| 118 return 0; | 118 return 0; |
| 119 | 119 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 131 } | 131 } |
| 132 | 132 |
| 133 DEFINE_TRACE(SimplifyMarkupCommand) | 133 DEFINE_TRACE(SimplifyMarkupCommand) |
| 134 { | 134 { |
| 135 visitor->trace(m_firstNode); | 135 visitor->trace(m_firstNode); |
| 136 visitor->trace(m_nodeAfterLast); | 136 visitor->trace(m_nodeAfterLast); |
| 137 CompositeEditCommand::trace(visitor); | 137 CompositeEditCommand::trace(visitor); |
| 138 } | 138 } |
| 139 | 139 |
| 140 } // namespace blink | 140 } // namespace blink |
| OLD | NEW |