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 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 430 updatePositionForTextRemoval(node, offset, count, m_endingPosition); | 430 updatePositionForTextRemoval(node, offset, count, m_endingPosition); |
| 431 updatePositionForTextRemoval(node, offset, count, m_leadingWhitespace); | 431 updatePositionForTextRemoval(node, offset, count, m_leadingWhitespace); |
| 432 updatePositionForTextRemoval(node, offset, count, m_trailingWhitespace); | 432 updatePositionForTextRemoval(node, offset, count, m_trailingWhitespace); |
| 433 updatePositionForTextRemoval(node, offset, count, m_downstreamEnd); | 433 updatePositionForTextRemoval(node, offset, count, m_downstreamEnd); |
| 434 | 434 |
| 435 CompositeEditCommand::deleteTextFromNode(node, offset, count); | 435 CompositeEditCommand::deleteTextFromNode(node, offset, count); |
| 436 } | 436 } |
| 437 | 437 |
| 438 void DeleteSelectionCommand::makeStylingElementsDirectChildrenOfEditableRootToPr eventStyleLoss(EditingState* editingState) | 438 void DeleteSelectionCommand::makeStylingElementsDirectChildrenOfEditableRootToPr eventStyleLoss(EditingState* editingState) |
| 439 { | 439 { |
| 440 Range* range = createRange(m_selectionToDelete.toNormalizedEphemeralRange()) ; | 440 auto iterableRange = m_selectionToDelete.toNormalizedEphemeralRange().nodes( ); |
| 441 Node* node = range->firstNode(); | 441 for (auto it = iterableRange.begin(), end = iterableRange.end(); !it.isNull( ) && it != end;) { |
|
yosin_UTC9
2016/08/18 02:11:09
We could write this loop as (copied from another m
| |
| 442 while (node && node != range->pastLastNode()) { | 442 Node& node = *it; |
| 443 Node* nextNode = NodeTraversal::next(*node); | 443 if (isHTMLStyleElement(node) || isHTMLLinkElement(node)) { |
| 444 if (isHTMLStyleElement(*node) || isHTMLLinkElement(*node)) { | 444 Node* nextNode = NodeTraversal::nextSkippingChildren(node); |
| 445 nextNode = NodeTraversal::nextSkippingChildren(*node); | 445 Element* element = rootEditableElement(node); |
| 446 Element* element = rootEditableElement(*node); | |
| 447 if (element) { | 446 if (element) { |
| 448 removeNode(node, editingState); | 447 removeNode(&node, editingState); |
| 449 if (editingState->isAborted()) | 448 if (editingState->isAborted()) |
| 450 return; | 449 return; |
| 451 appendNode(node, element, editingState); | 450 appendNode(&node, element, editingState); |
| 452 if (editingState->isAborted()) | 451 if (editingState->isAborted()) |
| 453 return; | 452 return; |
| 454 } | 453 } |
| 454 it.setCurrent(nextNode); | |
| 455 } else { | |
| 456 ++it; | |
| 455 } | 457 } |
| 456 node = nextNode; | |
| 457 } | 458 } |
| 458 } | 459 } |
| 459 | 460 |
| 460 void DeleteSelectionCommand::handleGeneralDelete(EditingState* editingState) | 461 void DeleteSelectionCommand::handleGeneralDelete(EditingState* editingState) |
| 461 { | 462 { |
| 462 if (m_upstreamStart.isNull()) | 463 if (m_upstreamStart.isNull()) |
| 463 return; | 464 return; |
| 464 | 465 |
| 465 int startOffset = m_upstreamStart.computeEditingOffset(); | 466 int startOffset = m_upstreamStart.computeEditingOffset(); |
| 466 Node* startNode = m_upstreamStart.anchorNode(); | 467 Node* startNode = m_upstreamStart.anchorNode(); |
| (...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 963 visitor->trace(m_deleteIntoBlockquoteStyle); | 964 visitor->trace(m_deleteIntoBlockquoteStyle); |
| 964 visitor->trace(m_startRoot); | 965 visitor->trace(m_startRoot); |
| 965 visitor->trace(m_endRoot); | 966 visitor->trace(m_endRoot); |
| 966 visitor->trace(m_startTableRow); | 967 visitor->trace(m_startTableRow); |
| 967 visitor->trace(m_endTableRow); | 968 visitor->trace(m_endTableRow); |
| 968 visitor->trace(m_temporaryPlaceholder); | 969 visitor->trace(m_temporaryPlaceholder); |
| 969 CompositeEditCommand::trace(visitor); | 970 CompositeEditCommand::trace(visitor); |
| 970 } | 971 } |
| 971 | 972 |
| 972 } // namespace blink | 973 } // namespace blink |
| OLD | NEW |