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

Side by Side Diff: third_party/WebKit/Source/core/editing/commands/SimplifyMarkupCommand.cpp

Issue 2571953004: Migrate WTF::Vector::append() to ::push_back() [part 5 of N] (Closed)
Patch Set: Created 4 years 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) 2012 Apple Computer, Inc. All rights reserved. 2 * Copyright (C) 2012 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 if (!startingNode) 58 if (!startingNode)
59 continue; 59 continue;
60 const ComputedStyle* startingStyle = startingNode->computedStyle(); 60 const ComputedStyle* startingStyle = startingNode->computedStyle();
61 if (!startingStyle) 61 if (!startingStyle)
62 continue; 62 continue;
63 ContainerNode* currentNode = startingNode; 63 ContainerNode* currentNode = startingNode;
64 ContainerNode* topNodeWithStartingStyle = nullptr; 64 ContainerNode* topNodeWithStartingStyle = nullptr;
65 while (currentNode != rootNode) { 65 while (currentNode != rootNode) {
66 if (currentNode->parentNode() != rootNode && 66 if (currentNode->parentNode() != rootNode &&
67 isRemovableBlock(currentNode)) 67 isRemovableBlock(currentNode))
68 nodesToRemove.append(currentNode); 68 nodesToRemove.push_back(currentNode);
69 69
70 currentNode = currentNode->parentNode(); 70 currentNode = currentNode->parentNode();
71 if (!currentNode) 71 if (!currentNode)
72 break; 72 break;
73 73
74 if (!currentNode->layoutObject() || 74 if (!currentNode->layoutObject() ||
75 !currentNode->layoutObject()->isLayoutInline() || 75 !currentNode->layoutObject()->isLayoutInline() ||
76 toLayoutInline(currentNode->layoutObject())->alwaysCreateLineBoxes()) 76 toLayoutInline(currentNode->layoutObject())->alwaysCreateLineBoxes())
77 continue; 77 continue;
78 78
79 if (currentNode->firstChild() != currentNode->lastChild()) { 79 if (currentNode->firstChild() != currentNode->lastChild()) {
80 topNodeWithStartingStyle = 0; 80 topNodeWithStartingStyle = 0;
81 break; 81 break;
82 } 82 }
83 83
84 if (!currentNode->computedStyle() 84 if (!currentNode->computedStyle()
85 ->visualInvalidationDiff(*startingStyle) 85 ->visualInvalidationDiff(*startingStyle)
86 .hasDifference()) 86 .hasDifference())
87 topNodeWithStartingStyle = currentNode; 87 topNodeWithStartingStyle = currentNode;
88 } 88 }
89 if (topNodeWithStartingStyle) { 89 if (topNodeWithStartingStyle) {
90 for (Node& node : NodeTraversal::inclusiveAncestorsOf(*startingNode)) { 90 for (Node& node : NodeTraversal::inclusiveAncestorsOf(*startingNode)) {
91 if (node == topNodeWithStartingStyle) 91 if (node == topNodeWithStartingStyle)
92 break; 92 break;
93 nodesToRemove.append(static_cast<ContainerNode*>(&node)); 93 nodesToRemove.push_back(static_cast<ContainerNode*>(&node));
94 } 94 }
95 } 95 }
96 } 96 }
97 97
98 // we perform all the DOM mutations at once. 98 // we perform all the DOM mutations at once.
99 for (size_t i = 0; i < nodesToRemove.size(); ++i) { 99 for (size_t i = 0; i < nodesToRemove.size(); ++i) {
100 // FIXME: We can do better by directly moving children from 100 // FIXME: We can do better by directly moving children from
101 // nodesToRemove[i]. 101 // nodesToRemove[i].
102 int numPrunedAncestors = 102 int numPrunedAncestors =
103 pruneSubsequentAncestorsToRemove(nodesToRemove, i, editingState); 103 pruneSubsequentAncestorsToRemove(nodesToRemove, i, editingState);
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 return pastLastNodeToRemove - startNodeIndex - 1; 151 return pastLastNodeToRemove - startNodeIndex - 1;
152 } 152 }
153 153
154 DEFINE_TRACE(SimplifyMarkupCommand) { 154 DEFINE_TRACE(SimplifyMarkupCommand) {
155 visitor->trace(m_firstNode); 155 visitor->trace(m_firstNode);
156 visitor->trace(m_nodeAfterLast); 156 visitor->trace(m_nodeAfterLast);
157 CompositeEditCommand::trace(visitor); 157 CompositeEditCommand::trace(visitor);
158 } 158 }
159 159
160 } // namespace blink 160 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698