Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(452)

Side by Side Diff: Source/core/editing/DeleteSelectionCommand.cpp

Issue 420323002: Move Node::lastDescendantOrSelf() to NodeTraversal and rename to lastWithinOrSelf() (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/dom/NodeTraversal.cpp ('k') | Source/core/editing/ReplaceSelectionCommand.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 504 matching lines...) Expand 10 before | Expand all | Expand 10 after
515 // NodeTraversal::nextSkippingChildren just blew past the end po sition, so stop deleting 515 // NodeTraversal::nextSkippingChildren just blew past the end po sition, so stop deleting
516 node = nullptr; 516 node = nullptr;
517 } else if (!m_downstreamEnd.deprecatedNode()->isDescendantOf(node.ge t())) { 517 } else if (!m_downstreamEnd.deprecatedNode()->isDescendantOf(node.ge t())) {
518 RefPtrWillBeRawPtr<Node> nextNode = NodeTraversal::nextSkippingC hildren(*node); 518 RefPtrWillBeRawPtr<Node> nextNode = NodeTraversal::nextSkippingC hildren(*node);
519 // if we just removed a node from the end container, update end position so the 519 // if we just removed a node from the end container, update end position so the
520 // check above will work 520 // check above will work
521 updatePositionForNodeRemoval(m_downstreamEnd, *node); 521 updatePositionForNodeRemoval(m_downstreamEnd, *node);
522 removeNode(node.get()); 522 removeNode(node.get());
523 node = nextNode.get(); 523 node = nextNode.get();
524 } else { 524 } else {
525 Node& n = node->lastDescendantOrSelf(); 525 Node& n = NodeTraversal::lastWithinOrSelf(*node);
526 if (m_downstreamEnd.deprecatedNode() == n && m_downstreamEnd.dep recatedEditingOffset() >= caretMaxOffset(&n)) { 526 if (m_downstreamEnd.deprecatedNode() == n && m_downstreamEnd.dep recatedEditingOffset() >= caretMaxOffset(&n)) {
527 removeNode(node.get()); 527 removeNode(node.get());
528 node = nullptr; 528 node = nullptr;
529 } else { 529 } else {
530 node = NodeTraversal::next(*node); 530 node = NodeTraversal::next(*node);
531 } 531 }
532 } 532 }
533 } 533 }
534 534
535 if (m_downstreamEnd.deprecatedNode() != startNode && !m_upstreamStart.de precatedNode()->isDescendantOf(m_downstreamEnd.deprecatedNode()) && m_downstream End.inDocument() && m_downstreamEnd.deprecatedEditingOffset() >= caretMinOffset( m_downstreamEnd.deprecatedNode())) { 535 if (m_downstreamEnd.deprecatedNode() != startNode && !m_upstreamStart.de precatedNode()->isDescendantOf(m_downstreamEnd.deprecatedNode()) && m_downstream End.inDocument() && m_downstreamEnd.deprecatedEditingOffset() >= caretMinOffset( m_downstreamEnd.deprecatedNode())) {
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
OLDNEW
« no previous file with comments | « Source/core/dom/NodeTraversal.cpp ('k') | Source/core/editing/ReplaceSelectionCommand.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698