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

Unified Diff: third_party/WebKit/Source/core/xml/XPathFunctions.cpp

Issue 2560823003: Avoid WTF::Vector::at() and operator[] in core/xml. (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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/xml/XPathNodeSet.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/xml/XPathFunctions.cpp
diff --git a/third_party/WebKit/Source/core/xml/XPathFunctions.cpp b/third_party/WebKit/Source/core/xml/XPathFunctions.cpp
index 90f18471351ac9406a19af49712317a06370a21f..aae17d9aabdf42ddc5db8ad78a99b8e095eb5b1f 100644
--- a/third_party/WebKit/Source/core/xml/XPathFunctions.cpp
+++ b/third_party/WebKit/Source/core/xml/XPathFunctions.cpp
@@ -334,15 +334,12 @@ Value FunId::evaluate(EvaluationContext& context) const {
StringBuilder idList; // A whitespace-separated list of IDs
if (a.isNodeSet()) {
- const NodeSet& nodes = a.toNodeSet(&context);
- for (size_t i = 0; i < nodes.size(); ++i) {
- String str = stringValue(nodes[i]);
- idList.append(str);
+ for (const auto& node : a.toNodeSet(&context)) {
+ idList.append(stringValue(node));
idList.append(' ');
}
} else {
- String str = a.toString();
- idList.append(str);
+ idList.append(a.toString());
}
TreeScope& contextScope = context.node->treeScope();
@@ -677,8 +674,8 @@ Value FunSum::evaluate(EvaluationContext& context) const {
// addition is not associative. However, this is unlikely to ever become a
// practical issue, and sorting is slow.
- for (unsigned i = 0; i < nodes.size(); i++)
- sum += Value(stringValue(nodes[i])).toNumber();
+ for (const auto& node : nodes)
+ sum += Value(stringValue(node)).toNumber();
return sum;
}
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/xml/XPathNodeSet.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698