Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / core / dom / ChildNodeList.cpp
index c1a895c..30ceeb6 100644 (file)
@@ -27,7 +27,7 @@
 #include "core/dom/Element.h"
 #include "core/dom/NodeRareData.h"
 
-namespace WebCore {
+namespace blink {
 
 ChildNodeList::ChildNodeList(ContainerNode& parent)
     : m_parent(parent)
@@ -49,8 +49,7 @@ ChildNodeList::~ChildNodeList()
 Node* ChildNodeList::traverseForwardToOffset(unsigned offset, Node& currentNode, unsigned& currentOffset) const
 {
     ASSERT(currentOffset < offset);
-    Node* next = &currentNode;
-    while ((next = next->nextSibling())) {
+    for (Node* next = currentNode.nextSibling(); next; next = next->nextSibling()) {
         if (++currentOffset == offset)
             return next;
     }
@@ -60,8 +59,7 @@ Node* ChildNodeList::traverseForwardToOffset(unsigned offset, Node& currentNode,
 Node* ChildNodeList::traverseBackwardToOffset(unsigned offset, Node& currentNode, unsigned& currentOffset) const
 {
     ASSERT(currentOffset > offset);
-    Node* previous = &currentNode;
-    while ((previous = previous->previousSibling())) {
+    for (Node* previous = currentNode.previousSibling(); previous; previous = previous->previousSibling()) {
         if (--currentOffset == offset)
             return previous;
     }
@@ -75,4 +73,4 @@ void ChildNodeList::trace(Visitor* visitor)
     NodeList::trace(visitor);
 }
 
-} // namespace WebCore
+} // namespace blink