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

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

Issue 425223005: Move Node/ContainerNode's traverseToChildAt() to NodeTraversal (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: 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
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 487 matching lines...) Expand 10 before | Expand all | Expand 10 after
498 // The selection to delete spans more than one node. 498 // The selection to delete spans more than one node.
499 RefPtrWillBeRawPtr<Node> node(startNode); 499 RefPtrWillBeRawPtr<Node> node(startNode);
500 500
501 if (startOffset > 0) { 501 if (startOffset > 0) {
502 if (startNode->isTextNode()) { 502 if (startNode->isTextNode()) {
503 // in a text node that needs to be trimmed 503 // in a text node that needs to be trimmed
504 Text* text = toText(node); 504 Text* text = toText(node);
505 deleteTextFromNode(text, startOffset, text->length() - startOffs et); 505 deleteTextFromNode(text, startOffset, text->length() - startOffs et);
506 node = NodeTraversal::next(*node); 506 node = NodeTraversal::next(*node);
507 } else { 507 } else {
508 node = startNode->traverseToChildAt(startOffset); 508 node = NodeTraversal::childAt(*startNode, startOffset);
509 } 509 }
510 } else if (startNode == m_upstreamEnd.deprecatedNode() && startNode->isT extNode()) { 510 } else if (startNode == m_upstreamEnd.deprecatedNode() && startNode->isT extNode()) {
511 Text* text = toText(m_upstreamEnd.deprecatedNode()); 511 Text* text = toText(m_upstreamEnd.deprecatedNode());
512 deleteTextFromNode(text, 0, m_upstreamEnd.deprecatedEditingOffset()) ; 512 deleteTextFromNode(text, 0, m_upstreamEnd.deprecatedEditingOffset()) ;
513 } 513 }
514 514
515 // handle deleting all nodes that are completely selected 515 // handle deleting all nodes that are completely selected
516 while (node && node != m_downstreamEnd.deprecatedNode()) { 516 while (node && node != m_downstreamEnd.deprecatedNode()) {
517 if (comparePositions(firstPositionInOrBeforeNode(node.get()), m_down streamEnd) >= 0) { 517 if (comparePositions(firstPositionInOrBeforeNode(node.get()), m_down streamEnd) >= 0) {
518 // NodeTraversal::nextSkippingChildren just blew past the end po sition, so stop deleting 518 // NodeTraversal::nextSkippingChildren just blew past the end po sition, so stop deleting
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
889 visitor->trace(m_deleteIntoBlockquoteStyle); 889 visitor->trace(m_deleteIntoBlockquoteStyle);
890 visitor->trace(m_startRoot); 890 visitor->trace(m_startRoot);
891 visitor->trace(m_endRoot); 891 visitor->trace(m_endRoot);
892 visitor->trace(m_startTableRow); 892 visitor->trace(m_startTableRow);
893 visitor->trace(m_endTableRow); 893 visitor->trace(m_endTableRow);
894 visitor->trace(m_temporaryPlaceholder); 894 visitor->trace(m_temporaryPlaceholder);
895 CompositeEditCommand::trace(visitor); 895 CompositeEditCommand::trace(visitor);
896 } 896 }
897 897
898 } // namespace blink 898 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/editing/CompositeEditCommand.cpp ('k') | Source/core/editing/InsertParagraphSeparatorCommand.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698