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

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

Issue 67473002: Have ElementTraversal / NodeTraversal's next() methods take a reference (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase on master Created 7 years, 1 month 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2005, 2006, 2007, 2008 Apple 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 779 matching lines...) Expand 10 before | Expand all | Expand 10 after
790 790
791 void CompositeEditCommand::deleteInsignificantText(const Position& start, const Position& end) 791 void CompositeEditCommand::deleteInsignificantText(const Position& start, const Position& end)
792 { 792 {
793 if (start.isNull() || end.isNull()) 793 if (start.isNull() || end.isNull())
794 return; 794 return;
795 795
796 if (comparePositions(start, end) >= 0) 796 if (comparePositions(start, end) >= 0)
797 return; 797 return;
798 798
799 Vector<RefPtr<Text> > nodes; 799 Vector<RefPtr<Text> > nodes;
800 for (Node* node = start.deprecatedNode(); node; node = NodeTraversal::next(n ode)) { 800 for (Node* node = start.deprecatedNode(); node; node = NodeTraversal::next(* node)) {
801 if (node->isTextNode()) 801 if (node->isTextNode())
802 nodes.append(toText(node)); 802 nodes.append(toText(node));
803 if (node == end.deprecatedNode()) 803 if (node == end.deprecatedNode())
804 break; 804 break;
805 } 805 }
806 806
807 for (size_t i = 0; i < nodes.size(); ++i) { 807 for (size_t i = 0; i < nodes.size(); ++i) {
808 Text* textNode = nodes[i].get(); 808 Text* textNode = nodes[i].get();
809 int startOffset = textNode == start.deprecatedNode() ? start.deprecatedE ditingOffset() : 0; 809 int startOffset = textNode == start.deprecatedNode() ? start.deprecatedE ditingOffset() : 0;
810 int endOffset = textNode == end.deprecatedNode() ? end.deprecatedEditing Offset() : static_cast<int>(textNode->length()); 810 int endOffset = textNode == end.deprecatedNode() ? end.deprecatedEditing Offset() : static_cast<int>(textNode->length());
(...skipping 652 matching lines...) Expand 10 before | Expand all | Expand 10 after
1463 return node.release(); 1463 return node.release();
1464 } 1464 }
1465 1465
1466 PassRefPtr<Element> createBlockPlaceholderElement(Document& document) 1466 PassRefPtr<Element> createBlockPlaceholderElement(Document& document)
1467 { 1467 {
1468 RefPtr<Element> breakNode = document.createElement(brTag, false); 1468 RefPtr<Element> breakNode = document.createElement(brTag, false);
1469 return breakNode.release(); 1469 return breakNode.release();
1470 } 1470 }
1471 1471
1472 } // namespace WebCore 1472 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/editing/BreakBlockquoteCommand.cpp ('k') | Source/core/editing/DeleteSelectionCommand.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698