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

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

Issue 69543007: Have NodeTraversal::nextSkippingChildren() take a reference (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 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 997 matching lines...) Expand 10 before | Expand all | Expand 10 after
1008 1008
1009 if (start.deprecatedNode() != end.deprecatedNode() && !start.deprecatedNode( )->isDescendantOf(end.deprecatedNode())) { 1009 if (start.deprecatedNode() != end.deprecatedNode() && !start.deprecatedNode( )->isDescendantOf(end.deprecatedNode())) {
1010 // If end is not a descendant of outerNode we need to 1010 // If end is not a descendant of outerNode we need to
1011 // find the first common ancestor to increase the scope 1011 // find the first common ancestor to increase the scope
1012 // of our nextSibling traversal. 1012 // of our nextSibling traversal.
1013 while (!end.deprecatedNode()->isDescendantOf(outerNode.get())) { 1013 while (!end.deprecatedNode()->isDescendantOf(outerNode.get())) {
1014 outerNode = outerNode->parentNode(); 1014 outerNode = outerNode->parentNode();
1015 } 1015 }
1016 1016
1017 RefPtr<Node> startNode = start.deprecatedNode(); 1017 RefPtr<Node> startNode = start.deprecatedNode();
1018 for (RefPtr<Node> node = NodeTraversal::nextSkippingChildren(startNode.g et(), outerNode.get()); node; node = NodeTraversal::nextSkippingChildren(node.ge t(), outerNode.get())) { 1018 for (RefPtr<Node> node = NodeTraversal::nextSkippingChildren(*startNode, outerNode.get()); node; node = NodeTraversal::nextSkippingChildren(*node, outer Node.get())) {
1019 // Move lastNode up in the tree as much as node was moved up in the 1019 // Move lastNode up in the tree as much as node was moved up in the
1020 // tree by NodeTraversal::nextSkippingChildren, so that the relative depth between 1020 // tree by NodeTraversal::nextSkippingChildren, so that the relative depth between
1021 // node and the original start node is maintained in the clone. 1021 // node and the original start node is maintained in the clone.
1022 while (startNode->parentNode() != node->parentNode()) { 1022 while (startNode->parentNode() != node->parentNode()) {
1023 startNode = startNode->parentNode(); 1023 startNode = startNode->parentNode();
1024 lastNode = lastNode->parentNode(); 1024 lastNode = lastNode->parentNode();
1025 } 1025 }
1026 1026
1027 RefPtr<Node> clonedNode = node->cloneNode(true); 1027 RefPtr<Node> clonedNode = node->cloneNode(true);
1028 insertNodeAfter(clonedNode, lastNode); 1028 insertNodeAfter(clonedNode, lastNode);
(...skipping 434 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

Powered by Google App Engine
This is Rietveld 408576698