<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[184566] trunk/Source/WebCore</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/184566">184566</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2015-05-19 09:29:37 -0700 (Tue, 19 May 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>Use modern for-loops in WebCore/xml.
https://bugs.webkit.org/show_bug.cgi?id=145046

Patch by Hunseop Jeong &lt;hs85.jeong@samsung.com&gt; on 2015-05-19
Reviewed by Chris Dumez.

No new tests, no new tests.

* xml/XMLHttpRequest.cpp:
(WebCore::XMLHttpRequest::uppercaseKnownHTTPMethod):
* xml/XPathExpressionNode.cpp:
(WebCore::XPath::Expression::setSubexpressions):
* xml/XPathFunctions.cpp:
(WebCore::XPath::FunSum::evaluate):
(WebCore::XPath::populateFunctionMap):
* xml/XPathNodeSet.cpp:
(WebCore::XPath::NodeSet::traversalSort):
* xml/XPathParser.cpp:
(WebCore::XPath::populateAxisNamesMap):
* xml/XPathPath.cpp:
(WebCore::XPath::Filter::evaluate):
(WebCore::XPath::LocationPath::evaluate):
* xml/XPathPredicate.cpp:
(WebCore::XPath::EqTestOp::compare):
(WebCore::XPath::Union::evaluate):
* xml/XPathStep.cpp:
(WebCore::XPath::Step::optimize):
(WebCore::XPath::Step::predicatesAreContextListInsensitive):
(WebCore::XPath::Step::evaluate):
(WebCore::XPath::nodeMatches):
* xml/XSLStyleSheetLibxslt.cpp:
(WebCore::XSLStyleSheet::~XSLStyleSheet):
(WebCore::XSLStyleSheet::isLoading):
(WebCore::XSLStyleSheet::clearDocuments):
(WebCore::XSLStyleSheet::locateStylesheetSubResource):
* xml/XSLTProcessorLibxslt.cpp:
(WebCore::xsltParamArrayFromParameterMap):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorexmlXMLHttpRequestcpp">trunk/Source/WebCore/xml/XMLHttpRequest.cpp</a></li>
<li><a href="#trunkSourceWebCorexmlXPathExpressionNodecpp">trunk/Source/WebCore/xml/XPathExpressionNode.cpp</a></li>
<li><a href="#trunkSourceWebCorexmlXPathFunctionscpp">trunk/Source/WebCore/xml/XPathFunctions.cpp</a></li>
<li><a href="#trunkSourceWebCorexmlXPathNodeSetcpp">trunk/Source/WebCore/xml/XPathNodeSet.cpp</a></li>
<li><a href="#trunkSourceWebCorexmlXPathParsercpp">trunk/Source/WebCore/xml/XPathParser.cpp</a></li>
<li><a href="#trunkSourceWebCorexmlXPathPathcpp">trunk/Source/WebCore/xml/XPathPath.cpp</a></li>
<li><a href="#trunkSourceWebCorexmlXPathPredicatecpp">trunk/Source/WebCore/xml/XPathPredicate.cpp</a></li>
<li><a href="#trunkSourceWebCorexmlXPathStepcpp">trunk/Source/WebCore/xml/XPathStep.cpp</a></li>
<li><a href="#trunkSourceWebCorexmlXSLStyleSheetLibxsltcpp">trunk/Source/WebCore/xml/XSLStyleSheetLibxslt.cpp</a></li>
<li><a href="#trunkSourceWebCorexmlXSLTProcessorLibxsltcpp">trunk/Source/WebCore/xml/XSLTProcessorLibxslt.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (184565 => 184566)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-05-19 16:26:04 UTC (rev 184565)
+++ trunk/Source/WebCore/ChangeLog        2015-05-19 16:29:37 UTC (rev 184566)
</span><span class="lines">@@ -1,3 +1,42 @@
</span><ins>+2015-05-19  Hunseop Jeong  &lt;hs85.jeong@samsung.com&gt;
+
+        Use modern for-loops in WebCore/xml.
+        https://bugs.webkit.org/show_bug.cgi?id=145046
+
+        Reviewed by Chris Dumez.
+
+        No new tests, no new tests.
+
+        * xml/XMLHttpRequest.cpp:
+        (WebCore::XMLHttpRequest::uppercaseKnownHTTPMethod):
+        * xml/XPathExpressionNode.cpp:
+        (WebCore::XPath::Expression::setSubexpressions):
+        * xml/XPathFunctions.cpp:
+        (WebCore::XPath::FunSum::evaluate):
+        (WebCore::XPath::populateFunctionMap):
+        * xml/XPathNodeSet.cpp:
+        (WebCore::XPath::NodeSet::traversalSort):
+        * xml/XPathParser.cpp:
+        (WebCore::XPath::populateAxisNamesMap):
+        * xml/XPathPath.cpp:
+        (WebCore::XPath::Filter::evaluate):
+        (WebCore::XPath::LocationPath::evaluate):
+        * xml/XPathPredicate.cpp:
+        (WebCore::XPath::EqTestOp::compare):
+        (WebCore::XPath::Union::evaluate):
+        * xml/XPathStep.cpp:
+        (WebCore::XPath::Step::optimize):
+        (WebCore::XPath::Step::predicatesAreContextListInsensitive):
+        (WebCore::XPath::Step::evaluate):
+        (WebCore::XPath::nodeMatches):
+        * xml/XSLStyleSheetLibxslt.cpp:
+        (WebCore::XSLStyleSheet::~XSLStyleSheet):
+        (WebCore::XSLStyleSheet::isLoading):
+        (WebCore::XSLStyleSheet::clearDocuments):
+        (WebCore::XSLStyleSheet::locateStylesheetSubResource):
+        * xml/XSLTProcessorLibxslt.cpp:
+        (WebCore::xsltParamArrayFromParameterMap):
+
</ins><span class="cx"> 2015-05-19  Jon Lee  &lt;jonlee@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Improve text rendering of placeholder
</span></span></pre></div>
<a id="trunkSourceWebCorexmlXMLHttpRequestcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/xml/XMLHttpRequest.cpp (184565 => 184566)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/xml/XMLHttpRequest.cpp        2015-05-19 16:26:04 UTC (rev 184565)
+++ trunk/Source/WebCore/xml/XMLHttpRequest.cpp        2015-05-19 16:29:37 UTC (rev 184566)
</span><span class="lines">@@ -405,12 +405,12 @@
</span><span class="cx"> String XMLHttpRequest::uppercaseKnownHTTPMethod(const String&amp; method)
</span><span class="cx"> {
</span><span class="cx">     const char* const methods[] = { &quot;DELETE&quot;, &quot;GET&quot;, &quot;HEAD&quot;, &quot;OPTIONS&quot;, &quot;POST&quot;, &quot;PUT&quot; };
</span><del>-    for (unsigned i = 0; i &lt; WTF_ARRAY_LENGTH(methods); ++i) {
-        if (equalIgnoringCase(method, methods[i])) {
</del><ins>+    for (auto* value : methods) {
+        if (equalIgnoringCase(method, value)) {
</ins><span class="cx">             // Don't bother allocating a new string if it's already all uppercase.
</span><del>-            if (method == methods[i])
</del><ins>+            if (method == value)
</ins><span class="cx">                 break;
</span><del>-            return ASCIILiteral(methods[i]);
</del><ins>+            return ASCIILiteral(value);
</ins><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx">     return method;
</span></span></pre></div>
<a id="trunkSourceWebCorexmlXPathExpressionNodecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/xml/XPathExpressionNode.cpp (184565 => 184566)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/xml/XPathExpressionNode.cpp        2015-05-19 16:26:04 UTC (rev 184565)
+++ trunk/Source/WebCore/xml/XPathExpressionNode.cpp        2015-05-19 16:29:37 UTC (rev 184566)
</span><span class="lines">@@ -50,10 +50,10 @@
</span><span class="cx"> {
</span><span class="cx">     ASSERT(m_subexpressions.isEmpty());
</span><span class="cx">     m_subexpressions = WTF::move(subexpressions);
</span><del>-    for (unsigned i = 0; i &lt; m_subexpressions.size(); ++i) {
-        m_isContextNodeSensitive |= m_subexpressions[i]-&gt;m_isContextNodeSensitive;
-        m_isContextPositionSensitive |= m_subexpressions[i]-&gt;m_isContextPositionSensitive;
-        m_isContextSizeSensitive |= m_subexpressions[i]-&gt;m_isContextSizeSensitive;
</del><ins>+    for (auto&amp; subexpression : m_subexpressions) {
+        m_isContextNodeSensitive |= subexpression-&gt;m_isContextNodeSensitive;
+        m_isContextPositionSensitive |= subexpression-&gt;m_isContextPositionSensitive;
+        m_isContextSizeSensitive |= subexpression-&gt;m_isContextSizeSensitive;
</ins><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorexmlXPathFunctionscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/xml/XPathFunctions.cpp (184565 => 184566)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/xml/XPathFunctions.cpp        2015-05-19 16:26:04 UTC (rev 184565)
+++ trunk/Source/WebCore/xml/XPathFunctions.cpp        2015-05-19 16:29:37 UTC (rev 184566)
</span><span class="lines">@@ -634,8 +634,8 @@
</span><span class="cx">     // To be really compliant, we should sort the node-set, as floating point addition is not associative.
</span><span class="cx">     // However, this is unlikely to ever become a practical issue, and sorting is slow.
</span><span class="cx"> 
</span><del>-    for (unsigned i = 0; i &lt; nodes.size(); i++)
-        sum += Value(stringValue(nodes[i])).toNumber();
</del><ins>+    for (auto&amp; node : nodes)
+        sum += Value(stringValue(node.get())).toNumber();
</ins><span class="cx">     
</span><span class="cx">     return sum;
</span><span class="cx"> }
</span><span class="lines">@@ -708,8 +708,8 @@
</span><span class="cx">         { &quot;true&quot;, { createFunctionTrue, 0 } },
</span><span class="cx">     };
</span><span class="cx"> 
</span><del>-    for (size_t i = 0; i &lt; WTF_ARRAY_LENGTH(functions); ++i)
-        functionMap.add(functions[i].name, functions[i].function);
</del><ins>+    for (auto&amp; function : functions)
+        functionMap.add(function.name, function.function);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> std::unique_ptr&lt;Function&gt; Function::create(const String&amp; name, unsigned numArguments)
</span></span></pre></div>
<a id="trunkSourceWebCorexmlXPathNodeSetcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/xml/XPathNodeSet.cpp (184565 => 184566)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/xml/XPathNodeSet.cpp        2015-05-19 16:26:04 UTC (rev 184565)
+++ trunk/Source/WebCore/xml/XPathNodeSet.cpp        2015-05-19 16:29:37 UTC (rev 184566)
</span><span class="lines">@@ -197,9 +197,8 @@
</span><span class="cx"> 
</span><span class="cx">     unsigned nodeCount = m_nodes.size();
</span><span class="cx">     ASSERT(nodeCount &gt; 1);
</span><del>-    for (unsigned i = 0; i &lt; nodeCount; ++i) {
-        Node* node = m_nodes[i].get();
-        nodes.add(node);
</del><ins>+    for (auto&amp; node : m_nodes) {
+        nodes.add(node.get());
</ins><span class="cx">         if (node-&gt;isAttributeNode())
</span><span class="cx">             containsAttributeNodes = true;
</span><span class="cx">     }
</span></span></pre></div>
<a id="trunkSourceWebCorexmlXPathParsercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/xml/XPathParser.cpp (184565 => 184566)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/xml/XPathParser.cpp        2015-05-19 16:26:04 UTC (rev 184565)
+++ trunk/Source/WebCore/xml/XPathParser.cpp        2015-05-19 16:29:37 UTC (rev 184566)
</span><span class="lines">@@ -99,8 +99,8 @@
</span><span class="cx">         { &quot;preceding-sibling&quot;, Step::PrecedingSiblingAxis },
</span><span class="cx">         { &quot;self&quot;, Step::SelfAxis }
</span><span class="cx">     };
</span><del>-    for (unsigned i = 0; i &lt; WTF_ARRAY_LENGTH(axisNameList); ++i)
-        axisNames.add(axisNameList[i].name, axisNameList[i].axis);
</del><ins>+    for (auto&amp; axisName : axisNameList)
+        axisNames.add(axisName.name, axisName.axis);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static bool parseAxisName(const String&amp; name, Step::Axis&amp; type)
</span></span></pre></div>
<a id="trunkSourceWebCorexmlXPathPathcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/xml/XPathPath.cpp (184565 => 184566)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/xml/XPathPath.cpp        2015-05-19 16:26:04 UTC (rev 184565)
+++ trunk/Source/WebCore/xml/XPathPath.cpp        2015-05-19 16:29:37 UTC (rev 184566)
</span><span class="lines">@@ -51,18 +51,16 @@
</span><span class="cx">     nodes.sort();
</span><span class="cx"> 
</span><span class="cx">     EvaluationContext&amp; evaluationContext = Expression::evaluationContext();
</span><del>-    for (unsigned i = 0; i &lt; m_predicates.size(); i++) {
</del><ins>+    for (auto&amp; predicate : m_predicates) {
</ins><span class="cx">         NodeSet newNodes;
</span><span class="cx">         evaluationContext.size = nodes.size();
</span><span class="cx">         evaluationContext.position = 0;
</span><span class="cx">         
</span><del>-        for (unsigned j = 0; j &lt; nodes.size(); j++) {
-            Node* node = nodes[j];
-            
</del><ins>+        for (auto&amp; node : nodes) {
</ins><span class="cx">             evaluationContext.node = node;
</span><span class="cx">             ++evaluationContext.position;
</span><span class="cx">             
</span><del>-            if (evaluatePredicate(*m_predicates[i]))
</del><ins>+            if (evaluatePredicate(*predicate))
</ins><span class="cx">                 newNodes.append(node);
</span><span class="cx">         }
</span><span class="cx">         nodes = WTF::move(newNodes);
</span><span class="lines">@@ -109,32 +107,30 @@
</span><span class="cx"> {
</span><span class="cx">     bool resultIsSorted = nodes.isSorted();
</span><span class="cx"> 
</span><del>-    for (unsigned i = 0; i &lt; m_steps.size(); i++) {
-        Step&amp; step = *m_steps[i];
</del><ins>+    for (auto&amp; step : m_steps) {
</ins><span class="cx">         NodeSet newNodes;
</span><span class="cx">         HashSet&lt;Node*&gt; newNodesSet;
</span><span class="cx"> 
</span><del>-        bool needToCheckForDuplicateNodes = !nodes.subtreesAreDisjoint() || (step.axis() != Step::ChildAxis &amp;&amp; step.axis() != Step::SelfAxis
-            &amp;&amp; step.axis() != Step::DescendantAxis &amp;&amp; step.axis() != Step::DescendantOrSelfAxis &amp;&amp; step.axis() != Step::AttributeAxis);
</del><ins>+        bool needToCheckForDuplicateNodes = !nodes.subtreesAreDisjoint() || (step-&gt;axis() != Step::ChildAxis &amp;&amp; step-&gt;axis() != Step::SelfAxis
+            &amp;&amp; step-&gt;axis() != Step::DescendantAxis &amp;&amp; step-&gt;axis() != Step::DescendantOrSelfAxis &amp;&amp; step-&gt;axis() != Step::AttributeAxis);
</ins><span class="cx"> 
</span><span class="cx">         if (needToCheckForDuplicateNodes)
</span><span class="cx">             resultIsSorted = false;
</span><span class="cx"> 
</span><span class="cx">         // This is a simplified check that can be improved to handle more cases.
</span><del>-        if (nodes.subtreesAreDisjoint() &amp;&amp; (step.axis() == Step::ChildAxis || step.axis() == Step::SelfAxis))
</del><ins>+        if (nodes.subtreesAreDisjoint() &amp;&amp; (step-&gt;axis() == Step::ChildAxis || step-&gt;axis() == Step::SelfAxis))
</ins><span class="cx">             newNodes.markSubtreesDisjoint(true);
</span><span class="cx"> 
</span><del>-        for (unsigned j = 0; j &lt; nodes.size(); j++) {
</del><ins>+        for (auto&amp; node : nodes) {
</ins><span class="cx">             NodeSet matches;
</span><del>-            step.evaluate(*nodes[j], matches);
</del><ins>+            step-&gt;evaluate(*node, matches);
</ins><span class="cx"> 
</span><span class="cx">             if (!matches.isSorted())
</span><span class="cx">                 resultIsSorted = false;
</span><span class="cx"> 
</span><del>-            for (size_t nodeIndex = 0; nodeIndex &lt; matches.size(); ++nodeIndex) {
-                Node* node = matches[nodeIndex];
-                if (!needToCheckForDuplicateNodes || newNodesSet.add(node).isNewEntry)
-                    newNodes.append(node);
</del><ins>+            for (auto&amp; match : matches) {
+                if (!needToCheckForDuplicateNodes || newNodesSet.add(match.get()).isNewEntry)
+                    newNodes.append(match);
</ins><span class="cx">             }
</span><span class="cx">         }
</span><span class="cx">         
</span></span></pre></div>
<a id="trunkSourceWebCorexmlXPathPredicatecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/xml/XPathPredicate.cpp (184565 => 184566)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/xml/XPathPredicate.cpp        2015-05-19 16:26:04 UTC (rev 184565)
+++ trunk/Source/WebCore/xml/XPathPredicate.cpp        2015-05-19 16:29:37 UTC (rev 184566)
</span><span class="lines">@@ -111,28 +111,32 @@
</span><span class="cx">             // there is a node in the first node-set and a node in the second node-set such that the result of
</span><span class="cx">             // performing the comparison on the string-values of the two nodes is true.
</span><span class="cx">             const NodeSet&amp; rhsSet = rhs.toNodeSet();
</span><del>-            for (unsigned lindex = 0; lindex &lt; lhsSet.size(); ++lindex)
-                for (unsigned rindex = 0; rindex &lt; rhsSet.size(); ++rindex)
-                    if (compare(stringValue(lhsSet[lindex]), stringValue(rhsSet[rindex])))
</del><ins>+            for (auto&amp; lhs : lhsSet) {
+                for (auto&amp; rhs : rhsSet) {
+                    if (compare(stringValue(lhs.get()), stringValue(rhs.get())))
</ins><span class="cx">                         return true;
</span><ins>+                }
+            }
</ins><span class="cx">             return false;
</span><span class="cx">         }
</span><span class="cx">         if (rhs.isNumber()) {
</span><span class="cx">             // If one object to be compared is a node-set and the other is a number, then the comparison will be true
</span><span class="cx">             // if and only if there is a node in the node-set such that the result of performing the comparison on the number
</span><span class="cx">             // to be compared and on the result of converting the string-value of that node to a number using the number function is true.
</span><del>-            for (unsigned lindex = 0; lindex &lt; lhsSet.size(); ++lindex)
-                if (compare(Value(stringValue(lhsSet[lindex])).toNumber(), rhs))
</del><ins>+            for (auto&amp; lhs : lhsSet) {
+                if (compare(Value(stringValue(lhs.get())).toNumber(), rhs))
</ins><span class="cx">                     return true;
</span><ins>+            }
</ins><span class="cx">             return false;
</span><span class="cx">         }
</span><span class="cx">         if (rhs.isString()) {
</span><span class="cx">             // If one object to be compared is a node-set and the other is a string, then the comparison will be true
</span><span class="cx">             // if and only if there is a node in the node-set such that the result of performing the comparison on
</span><span class="cx">             // the string-value of the node and the other string is true.
</span><del>-            for (unsigned lindex = 0; lindex &lt; lhsSet.size(); ++lindex)
-                if (compare(stringValue(lhsSet[lindex]), rhs))
</del><ins>+            for (auto&amp; lhs : lhsSet) {
+                if (compare(stringValue(lhs.get()), rhs))
</ins><span class="cx">                     return true;
</span><ins>+            }
</ins><span class="cx">             return false;
</span><span class="cx">         }
</span><span class="cx">         if (rhs.isBoolean()) {
</span><span class="lines">@@ -146,15 +150,17 @@
</span><span class="cx">     if (rhs.isNodeSet()) {
</span><span class="cx">         const NodeSet&amp; rhsSet = rhs.toNodeSet();
</span><span class="cx">         if (lhs.isNumber()) {
</span><del>-            for (unsigned rindex = 0; rindex &lt; rhsSet.size(); ++rindex)
-                if (compare(lhs, Value(stringValue(rhsSet[rindex])).toNumber()))
</del><ins>+            for (auto&amp; rhs : rhsSet) {
+                if (compare(lhs, Value(stringValue(rhs.get())).toNumber()))
</ins><span class="cx">                     return true;
</span><ins>+            }
</ins><span class="cx">             return false;
</span><span class="cx">         }
</span><span class="cx">         if (lhs.isString()) {
</span><del>-            for (unsigned rindex = 0; rindex &lt; rhsSet.size(); ++rindex)
-                if (compare(lhs, stringValue(rhsSet[rindex])))
</del><ins>+            for (auto&amp; rhs : rhsSet) {
+                if (compare(lhs, stringValue(rhs.get())))
</ins><span class="cx">                     return true;
</span><ins>+            }
</ins><span class="cx">             return false;
</span><span class="cx">         }
</span><span class="cx">         if (lhs.isBoolean())
</span><span class="lines">@@ -236,13 +242,12 @@
</span><span class="cx">     const NodeSet&amp; rhsNodes = rhs.toNodeSet();
</span><span class="cx"> 
</span><span class="cx">     HashSet&lt;Node*&gt; nodes;
</span><del>-    for (size_t i = 0; i &lt; resultSet.size(); ++i)
-        nodes.add(resultSet[i]);
</del><ins>+    for (auto&amp; result : resultSet)
+        nodes.add(result.get());
</ins><span class="cx"> 
</span><del>-    for (size_t i = 0; i &lt; rhsNodes.size(); ++i) {
-        Node* node = rhsNodes[i];
-        if (nodes.add(node).isNewEntry)
-            resultSet.append(node);
</del><ins>+    for (auto&amp; node : rhsNodes) {
+        if (nodes.add(node.get()).isNewEntry)
+            resultSet.append(node.get());
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     // It would also be possible to perform a merge sort here to avoid making an unsorted result,
</span></span></pre></div>
<a id="trunkSourceWebCorexmlXPathStepcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/xml/XPathStep.cpp (184565 => 184566)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/xml/XPathStep.cpp        2015-05-19 16:26:04 UTC (rev 184565)
+++ trunk/Source/WebCore/xml/XPathStep.cpp        2015-05-19 16:29:37 UTC (rev 184566)
</span><span class="lines">@@ -63,8 +63,7 @@
</span><span class="cx">     // E.g., there is no need to build a set of all &quot;foo&quot; nodes to evaluate &quot;foo[@bar]&quot;, we can check the predicate while enumerating.
</span><span class="cx">     // This optimization can be applied to predicates that are not context node list sensitive, or to first predicate that is only context position sensitive, e.g. foo[position() mod 2 = 0].
</span><span class="cx">     Vector&lt;std::unique_ptr&lt;Expression&gt;&gt; remainingPredicates;
</span><del>-    for (size_t i = 0; i &lt; m_predicates.size(); ++i) {
-        auto&amp; predicate = m_predicates[i];
</del><ins>+    for (auto&amp; predicate : m_predicates) {
</ins><span class="cx">         if ((!predicateIsContextPositionSensitive(*predicate) || m_nodeTest.m_mergedPredicates.isEmpty()) &amp;&amp; !predicate-&gt;isContextSizeSensitive() &amp;&amp; remainingPredicates.isEmpty())
</span><span class="cx">             m_nodeTest.m_mergedPredicates.append(WTF::move(predicate));
</span><span class="cx">         else
</span><span class="lines">@@ -108,15 +107,13 @@
</span><span class="cx"> 
</span><span class="cx"> bool Step::predicatesAreContextListInsensitive() const
</span><span class="cx"> {
</span><del>-    for (size_t i = 0; i &lt; m_predicates.size(); ++i) {
-        auto&amp; predicate = *m_predicates[i];
-        if (predicateIsContextPositionSensitive(predicate) || predicate.isContextSizeSensitive())
</del><ins>+    for (auto&amp; predicate : m_predicates) {
+        if (predicateIsContextPositionSensitive(*predicate) || predicate-&gt;isContextSizeSensitive())
</ins><span class="cx">             return false;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    for (size_t i = 0; i &lt; m_nodeTest.m_mergedPredicates.size(); ++i) {
-        auto&amp; predicate = *m_nodeTest.m_mergedPredicates[i];
-        if (predicateIsContextPositionSensitive(predicate) || predicate.isContextSizeSensitive())
</del><ins>+    for (auto&amp; predicate : m_nodeTest.m_mergedPredicates) {
+        if (predicateIsContextPositionSensitive(*predicate) || predicate-&gt;isContextSizeSensitive())
</ins><span class="cx">             return false;
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -131,9 +128,7 @@
</span><span class="cx">     nodesInAxis(context, nodes);
</span><span class="cx"> 
</span><span class="cx">     // Check predicates that couldn't be merged into node test.
</span><del>-    for (unsigned i = 0; i &lt; m_predicates.size(); i++) {
-        auto&amp; predicate = *m_predicates[i];
-
</del><ins>+    for (auto&amp; predicate : m_predicates) {
</ins><span class="cx">         NodeSet newNodes;
</span><span class="cx">         if (!nodes.isSorted())
</span><span class="cx">             newNodes.markSorted(false);
</span><span class="lines">@@ -144,7 +139,7 @@
</span><span class="cx">             evaluationContext.node = node;
</span><span class="cx">             evaluationContext.size = nodes.size();
</span><span class="cx">             evaluationContext.position = j + 1;
</span><del>-            if (evaluatePredicate(predicate))
</del><ins>+            if (evaluatePredicate(*predicate))
</ins><span class="cx">                 newNodes.append(node);
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="lines">@@ -233,11 +228,10 @@
</span><span class="cx">     // Only the first merged predicate may depend on position.
</span><span class="cx">     ++evaluationContext.position;
</span><span class="cx"> 
</span><del>-    auto&amp; mergedPredicates = nodeTest.m_mergedPredicates;
-    for (unsigned i = 0; i &lt; mergedPredicates.size(); i++) {
</del><ins>+    for (auto&amp; predicate : nodeTest.m_mergedPredicates) {
</ins><span class="cx">         // No need to set context size - we only get here when evaluating predicates that do not depend on it.
</span><span class="cx">         evaluationContext.node = &amp;node;
</span><del>-        if (!evaluatePredicate(*mergedPredicates[i]))
</del><ins>+        if (!evaluatePredicate(*predicate))
</ins><span class="cx">             return false;
</span><span class="cx">     }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorexmlXSLStyleSheetLibxsltcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/xml/XSLStyleSheetLibxslt.cpp (184565 => 184566)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/xml/XSLStyleSheetLibxslt.cpp        2015-05-19 16:26:04 UTC (rev 184565)
+++ trunk/Source/WebCore/xml/XSLStyleSheetLibxslt.cpp        2015-05-19 16:29:37 UTC (rev 184566)
</span><span class="lines">@@ -82,16 +82,16 @@
</span><span class="cx">     if (!m_stylesheetDocTaken)
</span><span class="cx">         xmlFreeDoc(m_stylesheetDoc);
</span><span class="cx"> 
</span><del>-    for (unsigned i = 0; i &lt; m_children.size(); ++i) {
-        ASSERT(m_children.at(i)-&gt;parentStyleSheet() == this);
-        m_children.at(i)-&gt;setParentStyleSheet(0);
</del><ins>+    for (auto&amp; child : m_children) {
+        ASSERT(child-&gt;parentStyleSheet() == this);
+        child-&gt;setParentStyleSheet(0);
</ins><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool XSLStyleSheet::isLoading() const
</span><span class="cx"> {
</span><del>-    for (unsigned i = 0; i &lt; m_children.size(); ++i) {
-        if (m_children.at(i)-&gt;isLoading())
</del><ins>+    for (auto&amp; child : m_children) {
+        if (child-&gt;isLoading())
</ins><span class="cx">             return true;
</span><span class="cx">     }
</span><span class="cx">     return false;
</span><span class="lines">@@ -117,8 +117,7 @@
</span><span class="cx"> void XSLStyleSheet::clearDocuments()
</span><span class="cx"> {
</span><span class="cx">     m_stylesheetDoc = 0;
</span><del>-    for (unsigned i = 0; i &lt; m_children.size(); ++i) {
-        XSLImportRule* import = m_children.at(i).get();
</del><ins>+    for (auto&amp; import : m_children) {
</ins><span class="cx">         if (import-&gt;styleSheet())
</span><span class="cx">             import-&gt;styleSheet()-&gt;clearDocuments();
</span><span class="cx">     }
</span><span class="lines">@@ -273,8 +272,7 @@
</span><span class="cx"> xmlDocPtr XSLStyleSheet::locateStylesheetSubResource(xmlDocPtr parentDoc, const xmlChar* uri)
</span><span class="cx"> {
</span><span class="cx">     bool matchedParent = (parentDoc == document());
</span><del>-    for (unsigned i = 0; i &lt; m_children.size(); ++i) {
-        XSLImportRule* import = m_children.at(i).get();
</del><ins>+    for (auto&amp; import : m_children) {
</ins><span class="cx">         XSLStyleSheet* child = import-&gt;styleSheet();
</span><span class="cx">         if (!child)
</span><span class="cx">             continue;
</span></span></pre></div>
<a id="trunkSourceWebCorexmlXSLTProcessorLibxsltcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/xml/XSLTProcessorLibxslt.cpp (184565 => 184566)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/xml/XSLTProcessorLibxslt.cpp        2015-05-19 16:26:04 UTC (rev 184565)
+++ trunk/Source/WebCore/xml/XSLTProcessorLibxslt.cpp        2015-05-19 16:29:37 UTC (rev 184566)
</span><span class="lines">@@ -226,11 +226,10 @@
</span><span class="cx"> 
</span><span class="cx">     const char** parameterArray = (const char**)fastMalloc(((parameters.size() * 2) + 1) * sizeof(char*));
</span><span class="cx"> 
</span><del>-    XSLTProcessor::ParameterMap::iterator end = parameters.end();
</del><span class="cx">     unsigned index = 0;
</span><del>-    for (XSLTProcessor::ParameterMap::iterator it = parameters.begin(); it != end; ++it) {
-        parameterArray[index++] = fastStrDup(it-&gt;key.utf8().data());
-        parameterArray[index++] = fastStrDup(it-&gt;value.utf8().data());
</del><ins>+    for (auto&amp; parameter : parameters) {
+        parameterArray[index++] = fastStrDup(parameter.key.utf8().data());
+        parameterArray[index++] = fastStrDup(parameter.value.utf8().data());
</ins><span class="cx">     }
</span><span class="cx">     parameterArray[index] = 0;
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>