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

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

Issue 239703007: Rename Node::lastDescendant() / Node::highestAncestor() for clarity (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rename highestAncestor() as well Created 6 years, 8 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
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 498 matching lines...) Expand 10 before | Expand all | Expand 10 after
509 // NodeTraversal::nextSkippingChildren just blew past the end po sition, so stop deleting 509 // NodeTraversal::nextSkippingChildren just blew past the end po sition, so stop deleting
510 node = nullptr; 510 node = nullptr;
511 } else if (!m_downstreamEnd.deprecatedNode()->isDescendantOf(node.ge t())) { 511 } else if (!m_downstreamEnd.deprecatedNode()->isDescendantOf(node.ge t())) {
512 RefPtr<Node> nextNode = NodeTraversal::nextSkippingChildren(*nod e); 512 RefPtr<Node> nextNode = NodeTraversal::nextSkippingChildren(*nod e);
513 // if we just removed a node from the end container, update end position so the 513 // if we just removed a node from the end container, update end position so the
514 // check above will work 514 // check above will work
515 updatePositionForNodeRemoval(m_downstreamEnd, *node); 515 updatePositionForNodeRemoval(m_downstreamEnd, *node);
516 removeNode(node.get()); 516 removeNode(node.get());
517 node = nextNode.get(); 517 node = nextNode.get();
518 } else { 518 } else {
519 Node& n = node->lastDescendant(); 519 Node& n = node->lastDescendantOrSelf();
520 if (m_downstreamEnd.deprecatedNode() == n && m_downstreamEnd.dep recatedEditingOffset() >= caretMaxOffset(&n)) { 520 if (m_downstreamEnd.deprecatedNode() == n && m_downstreamEnd.dep recatedEditingOffset() >= caretMaxOffset(&n)) {
521 removeNode(node.get()); 521 removeNode(node.get());
522 node = nullptr; 522 node = nullptr;
523 } else { 523 } else {
524 node = NodeTraversal::next(*node); 524 node = NodeTraversal::next(*node);
525 } 525 }
526 } 526 }
527 } 527 }
528 528
529 if (m_downstreamEnd.deprecatedNode() != startNode && !m_upstreamStart.de precatedNode()->isDescendantOf(m_downstreamEnd.deprecatedNode()) && m_downstream End.inDocument() && m_downstreamEnd.deprecatedEditingOffset() >= caretMinOffset( m_downstreamEnd.deprecatedNode())) { 529 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 327 matching lines...) Expand 10 before | Expand all | Expand 10 after
857 857
858 // Normally deletion doesn't preserve the typing style that was present before i t. For example, 858 // Normally deletion doesn't preserve the typing style that was present before i t. For example,
859 // type a character, Bold, then delete the character and start typing. The Bold typing style shouldn't 859 // type a character, Bold, then delete the character and start typing. The Bold typing style shouldn't
860 // stick around. Deletion should preserve a typing style that *it* sets, howeve r. 860 // stick around. Deletion should preserve a typing style that *it* sets, howeve r.
861 bool DeleteSelectionCommand::preservesTypingStyle() const 861 bool DeleteSelectionCommand::preservesTypingStyle() const
862 { 862 {
863 return m_typingStyle; 863 return m_typingStyle;
864 } 864 }
865 865
866 } // namespace WebCore 866 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/editing/ApplyStyleCommand.cpp ('k') | Source/core/editing/ReplaceSelectionCommand.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698