Title: [173684] trunk/Source/WebCore
Revision
173684
Author
cdu...@apple.com
Date
2014-09-16 19:00:40 -0700 (Tue, 16 Sep 2014)

Log Message

Rename Node::childNode(index) to traverseToChildAt(index) for clarity
https://bugs.webkit.org/show_bug.cgi?id=136825

Reviewed by Benjamin Poulain.

Rename Node::childNode(index) to traverseToChildAt(index) to make it
clearer that the method is actually traversing the children and thus
potentially expensive.

This patch also avoids calling traverseToChildAt() in a couple of
easily avoidable cases.

No new tests, no behavior change.

* WebCore.exp.in:
* WebCore.order:
Remove symbol for ContainerNode::childNode() as it was renamed. It does
not seem we need to expose ContainerNode::traverseToChildAt().

* accessibility/AccessibilityObject.cpp:
(WebCore::AccessibilityObject::stringForVisiblePositionRange):
(WebCore::AccessibilityObject::lengthForVisiblePositionRange):
* accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
(-[WebAccessibilityObjectWrapper arrayOfTextForTextMarkers:attributed:]):
* accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
(-[WebAccessibilityObjectWrapper doAXAttributedStringForTextMarkerRange:]):
Mechanical renaming.

* dom/ContainerNode.cpp:
(WebCore::ContainerNode::traverseToChildAt):
(WebCore::ContainerNode::childNode): Deleted.
* dom/ContainerNode.h:
(WebCore::Node::traverseToChildAt):
(WebCore::Node::childNode): Deleted.
* dom/Node.h:
- Rename Node / ContainerNode's childNode(index) to
  traverseToChildAt(index) to make it clear that it is actually
  traversing the children and thus potentially expensive.
- Clean up the implementation of ContainerNode::traverseToChildAt()
  to avoid the use of an extra |i| variable.

* dom/Position.cpp:
(WebCore::Position::computeNodeBeforePosition):
Avoid calling traverseToChildAt(-1). Relying on the unsigned argument
wrapping and the method returning null in this case is a bit obscure
and causes unnecessary traversal of all children.

(WebCore::Position::computeNodeAfterPosition):
(WebCore::Position::previous):
(WebCore::Position::next):
Mechanical renaming and update variable names to stop using
abbreviations as per coding style.

* dom/PositionIterator.h:
(WebCore::PositionIterator::PositionIterator):
* dom/Range.cpp:
(WebCore::Range::insertNode):
(WebCore::Range::checkNodeWOffset):
(WebCore::Range::firstNode):
(WebCore::Range::pastLastNode):
* dom/RangeBoundaryPoint.h:
(WebCore::RangeBoundaryPoint::set):
* editing/BreakBlockquoteCommand.cpp:
(WebCore::BreakBlockquoteCommand::doApply):
* editing/CompositeEditCommand.cpp:
(WebCore::CompositeEditCommand::removeChildrenInRange):
* editing/DeleteSelectionCommand.cpp:
(WebCore::DeleteSelectionCommand::handleGeneralDelete):
* editing/InsertParagraphSeparatorCommand.cpp:
(WebCore::InsertParagraphSeparatorCommand::doApply):
* editing/TextIterator.cpp:
(WebCore::nextInPreOrderCrossingShadowBoundaries):
(WebCore::TextIterator::node):
(WebCore::SimplifiedBackwardsTextIterator::SimplifiedBackwardsTextIterator):
* editing/VisibleUnits.cpp:
(WebCore::nextLinePosition):
* editing/cocoa/HTMLConverter.mm:
(WebCore::editingAttributedStringFromRange):
Mechanical renaming.

* inspector/DOMPatchSupport.cpp:
(WebCore::DOMPatchSupport::innerPatchChildren):
Iterate over children while incrementing the |i| variable to avoid
calling traverseToChildAt(index) repeatedly and thus traversing the
children from the beginning every time.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (173683 => 173684)


--- trunk/Source/WebCore/ChangeLog	2014-09-17 00:49:20 UTC (rev 173683)
+++ trunk/Source/WebCore/ChangeLog	2014-09-17 02:00:40 UTC (rev 173684)
@@ -1,3 +1,91 @@
+2014-09-16  Chris Dumez  <cdu...@apple.com>
+
+        Rename Node::childNode(index) to traverseToChildAt(index) for clarity
+        https://bugs.webkit.org/show_bug.cgi?id=136825
+
+        Reviewed by Benjamin Poulain.
+
+        Rename Node::childNode(index) to traverseToChildAt(index) to make it
+        clearer that the method is actually traversing the children and thus
+        potentially expensive.
+
+        This patch also avoids calling traverseToChildAt() in a couple of
+        easily avoidable cases.
+
+        No new tests, no behavior change.
+
+        * WebCore.exp.in:
+        * WebCore.order:
+        Remove symbol for ContainerNode::childNode() as it was renamed. It does
+        not seem we need to expose ContainerNode::traverseToChildAt().
+
+        * accessibility/AccessibilityObject.cpp:
+        (WebCore::AccessibilityObject::stringForVisiblePositionRange):
+        (WebCore::AccessibilityObject::lengthForVisiblePositionRange):
+        * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
+        (-[WebAccessibilityObjectWrapper arrayOfTextForTextMarkers:attributed:]):
+        * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
+        (-[WebAccessibilityObjectWrapper doAXAttributedStringForTextMarkerRange:]):
+        Mechanical renaming.
+
+        * dom/ContainerNode.cpp:
+        (WebCore::ContainerNode::traverseToChildAt):
+        (WebCore::ContainerNode::childNode): Deleted.
+        * dom/ContainerNode.h:
+        (WebCore::Node::traverseToChildAt):
+        (WebCore::Node::childNode): Deleted.
+        * dom/Node.h:
+        - Rename Node / ContainerNode's childNode(index) to
+          traverseToChildAt(index) to make it clear that it is actually
+          traversing the children and thus potentially expensive.
+        - Clean up the implementation of ContainerNode::traverseToChildAt()
+          to avoid the use of an extra |i| variable.
+
+        * dom/Position.cpp:
+        (WebCore::Position::computeNodeBeforePosition):
+        Avoid calling traverseToChildAt(-1). Relying on the unsigned argument
+        wrapping and the method returning null in this case is a bit obscure
+        and causes unnecessary traversal of all children.
+
+        (WebCore::Position::computeNodeAfterPosition):
+        (WebCore::Position::previous):
+        (WebCore::Position::next):
+        Mechanical renaming and update variable names to stop using
+        abbreviations as per coding style.
+
+        * dom/PositionIterator.h:
+        (WebCore::PositionIterator::PositionIterator):
+        * dom/Range.cpp:
+        (WebCore::Range::insertNode):
+        (WebCore::Range::checkNodeWOffset):
+        (WebCore::Range::firstNode):
+        (WebCore::Range::pastLastNode):
+        * dom/RangeBoundaryPoint.h:
+        (WebCore::RangeBoundaryPoint::set):
+        * editing/BreakBlockquoteCommand.cpp:
+        (WebCore::BreakBlockquoteCommand::doApply):
+        * editing/CompositeEditCommand.cpp:
+        (WebCore::CompositeEditCommand::removeChildrenInRange):
+        * editing/DeleteSelectionCommand.cpp:
+        (WebCore::DeleteSelectionCommand::handleGeneralDelete):
+        * editing/InsertParagraphSeparatorCommand.cpp:
+        (WebCore::InsertParagraphSeparatorCommand::doApply):
+        * editing/TextIterator.cpp:
+        (WebCore::nextInPreOrderCrossingShadowBoundaries):
+        (WebCore::TextIterator::node):
+        (WebCore::SimplifiedBackwardsTextIterator::SimplifiedBackwardsTextIterator):
+        * editing/VisibleUnits.cpp:
+        (WebCore::nextLinePosition):
+        * editing/cocoa/HTMLConverter.mm:
+        (WebCore::editingAttributedStringFromRange):
+        Mechanical renaming.
+
+        * inspector/DOMPatchSupport.cpp:
+        (WebCore::DOMPatchSupport::innerPatchChildren):
+        Iterate over children while incrementing the |i| variable to avoid
+        calling traverseToChildAt(index) repeatedly and thus traversing the
+        children from the beginning every time.
+
 2014-09-16  Joseph Pecoraro  <pecor...@apple.com>
 
         Web Inspector: Reduce a bit of churn setting initial remote inspection state

Modified: trunk/Source/WebCore/WebCore.exp.in (173683 => 173684)


--- trunk/Source/WebCore/WebCore.exp.in	2014-09-17 00:49:20 UTC (rev 173683)
+++ trunk/Source/WebCore/WebCore.exp.in	2014-09-17 02:00:40 UTC (rev 173684)
@@ -1626,7 +1626,6 @@
 __ZNK7WebCore12TextIterator4nodeEv
 __ZNK7WebCore12TextIterator5rangeEv
 __ZNK7WebCore13ContainerNode15countChildNodesEv
-__ZNK7WebCore13ContainerNode9childNodeEj
 __ZNK7WebCore13GraphicsLayer18accumulatedOpacityEv
 __ZNK7WebCore13GraphicsLayer18getDebugBorderInfoERNS_5ColorERf
 __ZNK7WebCore13GraphicsLayer26backingStoreMemoryEstimateEv

Modified: trunk/Source/WebCore/WebCore.order (173683 => 173684)


--- trunk/Source/WebCore/WebCore.order	2014-09-17 00:49:20 UTC (rev 173683)
+++ trunk/Source/WebCore/WebCore.order	2014-09-17 02:00:40 UTC (rev 173684)
@@ -8133,7 +8133,6 @@
 __ZN7WebCore5Range14setStartBeforeEPNS_4NodeERi
 __ZNK7WebCore4Node16computeNodeIndexEv
 __ZN7WebCore5Range8setStartEN3WTF10PassRefPtrINS_4NodeEEEiRi
-__ZNK7WebCore13ContainerNode9childNodeEj
 __ZN7WebCoreL30checkForDifferentRootContainerERKNS_18RangeBoundaryPointES2_
 __ZN7WebCore5Range21compareBoundaryPointsEPNS_4NodeEiS2_iRi
 __ZN7WebCore5Range8collapseEbRi

Modified: trunk/Source/WebCore/accessibility/AccessibilityObject.cpp (173683 => 173684)


--- trunk/Source/WebCore/accessibility/AccessibilityObject.cpp	2014-09-17 00:49:20 UTC (rev 173683)
+++ trunk/Source/WebCore/accessibility/AccessibilityObject.cpp	2014-09-17 02:00:40 UTC (rev 173684)
@@ -1139,7 +1139,7 @@
             Node* node = it.range()->startContainer();
             ASSERT(node == it.range()->endContainer());
             int offset = it.range()->startOffset();
-            if (replacedNodeNeedsCharacter(node->childNode(offset)))
+            if (replacedNodeNeedsCharacter(node->traverseToChildAt(offset)))
                 builder.append(objectReplacementCharacter);
         }
     }
@@ -1166,7 +1166,7 @@
             ASSERT(node == it.range()->endContainer(exception));
             int offset = it.range()->startOffset(exception);
 
-            if (replacedNodeNeedsCharacter(node->childNode(offset)))
+            if (replacedNodeNeedsCharacter(node->traverseToChildAt(offset)))
                 length++;
         }
     }

Modified: trunk/Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm (173683 => 173684)


--- trunk/Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm	2014-09-17 00:49:20 UTC (rev 173683)
+++ trunk/Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm	2014-09-17 02:00:40 UTC (rev 173684)
@@ -1844,7 +1844,7 @@
                 [attrString release];
             }
         } else {
-            Node* replacedNode = node->childNode(offset);
+            Node* replacedNode = node->traverseToChildAt(offset);
             if (replacedNode) {
                 AccessibilityObject* obj = m_object->axObjectCache()->getOrCreate(replacedNode->renderer());
                 if (obj && !obj->accessibilityIsIgnored())

Modified: trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm (173683 => 173684)


--- trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm	2014-09-17 00:49:20 UTC (rev 173683)
+++ trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm	2014-09-17 02:00:40 UTC (rev 173684)
@@ -1102,7 +1102,7 @@
                 AXAttributedStringAppendText(attrString, node, listMarkerText);
             AXAttributedStringAppendText(attrString, node, it.text());
         } else {
-            Node* replacedNode = node->childNode(offset);
+            Node* replacedNode = node->traverseToChildAt(offset);
             NSString *attachmentString = nsStringForReplacedNode(replacedNode);
             if (attachmentString) {
                 NSRange attrStringRange = NSMakeRange([attrString length], [attachmentString length]);

Modified: trunk/Source/WebCore/dom/ContainerNode.cpp (173683 => 173684)


--- trunk/Source/WebCore/dom/ContainerNode.cpp	2014-09-17 00:49:20 UTC (rev 173683)
+++ trunk/Source/WebCore/dom/ContainerNode.cpp	2014-09-17 02:00:40 UTC (rev 173684)
@@ -939,13 +939,12 @@
     return count;
 }
 
-Node *ContainerNode::childNode(unsigned index) const
+Node* ContainerNode::traverseToChildAt(unsigned index) const
 {
-    unsigned i;
-    Node *n = firstChild();
-    for (i = 0; n != 0 && i < index; i++)
-        n = n->nextSibling();
-    return n;
+    Node* child = firstChild();
+    for (; child && index > 0; --index)
+        child = child->nextSibling();
+    return child;
 }
 
 static void dispatchChildInsertionEvents(Node& child)

Modified: trunk/Source/WebCore/dom/ContainerNode.h (173683 => 173684)


--- trunk/Source/WebCore/dom/ContainerNode.h	2014-09-17 00:49:20 UTC (rev 173683)
+++ trunk/Source/WebCore/dom/ContainerNode.h	2014-09-17 02:00:40 UTC (rev 173684)
@@ -93,7 +93,7 @@
     void setDirectChildNeedsStyleRecalc() { setFlag(DirectChildNeedsStyleRecalcFlag); }
 
     WEBCORE_EXPORT unsigned countChildNodes() const;
-    WEBCORE_EXPORT Node* childNode(unsigned index) const;
+    WEBCORE_EXPORT Node* traverseToChildAt(unsigned) const;
 
     bool insertBefore(PassRefPtr<Node> newChild, Node* refChild, ExceptionCode& = ASSERT_NO_EXCEPTION);
     bool replaceChild(PassRefPtr<Node> newChild, Node* oldChild, ExceptionCode& = ASSERT_NO_EXCEPTION);
@@ -192,11 +192,11 @@
     return toContainerNode(this)->countChildNodes();
 }
 
-inline Node* Node::childNode(unsigned index) const
+inline Node* Node::traverseToChildAt(unsigned index) const
 {
     if (!isContainerNode())
         return 0;
-    return toContainerNode(this)->childNode(index);
+    return toContainerNode(this)->traverseToChildAt(index);
 }
 
 inline Node* Node::firstChild() const

Modified: trunk/Source/WebCore/dom/Node.h (173683 => 173684)


--- trunk/Source/WebCore/dom/Node.h	2014-09-17 00:49:20 UTC (rev 173683)
+++ trunk/Source/WebCore/dom/Node.h	2014-09-17 02:00:40 UTC (rev 173684)
@@ -417,7 +417,7 @@
     bool isDocumentTypeNode() const { return nodeType() == DOCUMENT_TYPE_NODE; }
     virtual bool childTypeAllowed(NodeType) const { return false; }
     unsigned countChildNodes() const;
-    Node* childNode(unsigned index) const;
+    Node* traverseToChildAt(unsigned) const;
 
     void checkSetPrefix(const AtomicString& prefix, ExceptionCode&);
 

Modified: trunk/Source/WebCore/dom/Position.cpp (173683 => 173684)


--- trunk/Source/WebCore/dom/Position.cpp	2014-09-17 00:49:20 UTC (rev 173683)
+++ trunk/Source/WebCore/dom/Position.cpp	2014-09-17 02:00:40 UTC (rev 173684)
@@ -246,7 +246,7 @@
     case PositionIsAfterChildren:
         return m_anchorNode->lastChild();
     case PositionIsOffsetInAnchor:
-        return m_anchorNode->childNode(m_offset - 1); // -1 converts to childNode((unsigned)-1) and returns null.
+        return m_offset ? m_anchorNode->traverseToChildAt(m_offset - 1) : nullptr;
     case PositionIsBeforeAnchor:
         return m_anchorNode->previousSibling();
     case PositionIsAfterAnchor:
@@ -267,7 +267,7 @@
     case PositionIsAfterChildren:
         return 0;
     case PositionIsOffsetInAnchor:
-        return m_anchorNode->childNode(m_offset);
+        return m_anchorNode->traverseToChildAt(m_offset);
     case PositionIsBeforeAnchor:
         return m_anchorNode.get();
     case PositionIsAfterAnchor:
@@ -298,17 +298,16 @@
 
 Position Position::previous(PositionMoveType moveType) const
 {
-    Node* n = deprecatedNode();
-    if (!n)
+    Node* node = deprecatedNode();
+    if (!node)
         return *this;
 
-    int o = deprecatedEditingOffset();
+    int offset = deprecatedEditingOffset();
     // FIXME: Negative offsets shouldn't be allowed. We should catch this earlier.
-    ASSERT(o >= 0);
+    ASSERT(offset >= 0);
 
-    if (o > 0) {
-        Node* child = n->childNode(o - 1);
-        if (child)
+    if (offset > 0) {
+        if (Node* child = node->traverseToChildAt(offset - 1))
             return lastPositionInOrAfterNode(child);
 
         // There are two reasons child might be 0:
@@ -318,35 +317,35 @@
         //      Going from 1 to 0 is correct.
         switch (moveType) {
         case CodePoint:
-            return createLegacyEditingPosition(n, o - 1);
+            return createLegacyEditingPosition(node, offset - 1);
         case Character:
-            return createLegacyEditingPosition(n, uncheckedPreviousOffset(n, o));
+            return createLegacyEditingPosition(node, uncheckedPreviousOffset(node, offset));
         case BackwardDeletion:
-            return createLegacyEditingPosition(n, uncheckedPreviousOffsetForBackwardDeletion(n, o));
+            return createLegacyEditingPosition(node, uncheckedPreviousOffsetForBackwardDeletion(node, offset));
         }
     }
 
-    ContainerNode* parent = findParent(n);
+    ContainerNode* parent = findParent(node);
     if (!parent)
         return *this;
 
-    return createLegacyEditingPosition(parent, n->computeNodeIndex());
+    return createLegacyEditingPosition(parent, node->computeNodeIndex());
 }
 
 Position Position::next(PositionMoveType moveType) const
 {
     ASSERT(moveType != BackwardDeletion);
 
-    Node* n = deprecatedNode();
-    if (!n)
+    Node* node = deprecatedNode();
+    if (!node)
         return *this;
 
-    int o = deprecatedEditingOffset();
+    int offset = deprecatedEditingOffset();
     // FIXME: Negative offsets shouldn't be allowed. We should catch this earlier.
-    ASSERT(o >= 0);
+    ASSERT(offset >= 0);
 
-    Node* child = n->childNode(o);
-    if (child || (!n->hasChildNodes() && o < lastOffsetForEditing(n))) {
+    Node* child = node->traverseToChildAt(offset);
+    if (child || (!node->hasChildNodes() && offset < lastOffsetForEditing(node))) {
         if (child)
             return firstPositionInOrBeforeNode(child);
 
@@ -355,14 +354,14 @@
         //      Going forward one character at a time is correct.
         //   2) The new offset is a bogus offset like (<br>, 1), and there is no child.
         //      Going from 0 to 1 is correct.
-        return createLegacyEditingPosition(n, (moveType == Character) ? uncheckedNextOffset(n, o) : o + 1);
+        return createLegacyEditingPosition(node, (moveType == Character) ? uncheckedNextOffset(node, offset) : offset + 1);
     }
 
-    ContainerNode* parent = findParent(n);
+    ContainerNode* parent = findParent(node);
     if (!parent)
         return *this;
 
-    return createLegacyEditingPosition(parent, n->computeNodeIndex() + 1);
+    return createLegacyEditingPosition(parent, node->computeNodeIndex() + 1);
 }
 
 int Position::uncheckedPreviousOffset(const Node* n, int current)

Modified: trunk/Source/WebCore/dom/PositionIterator.h (173683 => 173684)


--- trunk/Source/WebCore/dom/PositionIterator.h	2014-09-17 00:49:20 UTC (rev 173683)
+++ trunk/Source/WebCore/dom/PositionIterator.h	2014-09-17 02:00:40 UTC (rev 173684)
@@ -45,7 +45,7 @@
 
     PositionIterator(const Position& pos)
         : m_anchorNode(pos.anchorNode())
-        , m_nodeAfterPositionInAnchor(m_anchorNode->childNode(pos.deprecatedEditingOffset()))
+        , m_nodeAfterPositionInAnchor(m_anchorNode->traverseToChildAt(pos.deprecatedEditingOffset()))
         , m_offsetInAnchor(m_nodeAfterPositionInAnchor ? 0 : pos.deprecatedEditingOffset())
     {
     }

Modified: trunk/Source/WebCore/dom/Range.cpp (173683 => 173684)


--- trunk/Source/WebCore/dom/Range.cpp	2014-09-17 00:49:20 UTC (rev 173683)
+++ trunk/Source/WebCore/dom/Range.cpp	2014-09-17 02:00:40 UTC (rev 173684)
@@ -1056,7 +1056,7 @@
         container = m_start.container();
         RefPtr<Node> firstInsertedChild = newNodeType == Node::DOCUMENT_FRAGMENT_NODE ? newNode->firstChild() : newNode;
         RefPtr<Node> lastInsertedChild = newNodeType == Node::DOCUMENT_FRAGMENT_NODE ? newNode->lastChild() : newNode;
-        RefPtr<Node> childAfterInsertedContent = container->childNode(m_start.offset());
+        RefPtr<Node> childAfterInsertedContent = container->traverseToChildAt(m_start.offset());
         container->insertBefore(newNode.release(), childAfterInsertedContent.get(), ec);
         if (ec)
             return;
@@ -1171,7 +1171,7 @@
         case Node::XPATH_NAMESPACE_NODE: {
             if (!offset)
                 return 0;
-            Node* childBefore = n->childNode(offset - 1);
+            Node* childBefore = n->traverseToChildAt(offset - 1);
             if (!childBefore)
                 ec = INDEX_SIZE_ERR;
             return childBefore;
@@ -1568,7 +1568,7 @@
         return 0;
     if (m_start.container()->offsetInCharacters())
         return m_start.container();
-    if (Node* child = m_start.container()->childNode(m_start.offset()))
+    if (Node* child = m_start.container()->traverseToChildAt(m_start.offset()))
         return child;
     if (!m_start.offset())
         return m_start.container();
@@ -1586,7 +1586,7 @@
         return 0;
     if (m_end.container()->offsetInCharacters())
         return NodeTraversal::nextSkippingChildren(m_end.container());
-    if (Node* child = m_end.container()->childNode(m_end.offset()))
+    if (Node* child = m_end.container()->traverseToChildAt(m_end.offset()))
         return child;
     return NodeTraversal::nextSkippingChildren(m_end.container());
 }

Modified: trunk/Source/WebCore/dom/RangeBoundaryPoint.h (173683 => 173684)


--- trunk/Source/WebCore/dom/RangeBoundaryPoint.h	2014-09-17 00:49:20 UTC (rev 173683)
+++ trunk/Source/WebCore/dom/RangeBoundaryPoint.h	2014-09-17 02:00:40 UTC (rev 173684)
@@ -121,7 +121,7 @@
 {
     ASSERT(container);
     ASSERT(offset >= 0);
-    ASSERT(childBefore == (offset ? container->childNode(offset - 1) : 0));
+    ASSERT(childBefore == (offset ? container->traverseToChildAt(offset - 1) : 0));
     m_containerNode = container;
     m_offsetInContainer = offset;
     m_childBeforeBoundary = childBefore;

Modified: trunk/Source/WebCore/editing/BreakBlockquoteCommand.cpp (173683 => 173684)


--- trunk/Source/WebCore/editing/BreakBlockquoteCommand.cpp	2014-09-17 00:49:20 UTC (rev 173683)
+++ trunk/Source/WebCore/editing/BreakBlockquoteCommand.cpp	2014-09-17 02:00:40 UTC (rev 173684)
@@ -114,7 +114,7 @@
         } else if (pos.deprecatedEditingOffset() > 0)
             splitTextNode(textNode, pos.deprecatedEditingOffset());
     } else if (pos.deprecatedEditingOffset() > 0) {
-        Node* childAtOffset = startNode->childNode(pos.deprecatedEditingOffset());
+        Node* childAtOffset = startNode->traverseToChildAt(pos.deprecatedEditingOffset());
         startNode = childAtOffset ? childAtOffset : NodeTraversal::next(startNode);
         ASSERT(startNode);
     }

Modified: trunk/Source/WebCore/editing/CompositeEditCommand.cpp (173683 => 173684)


--- trunk/Source/WebCore/editing/CompositeEditCommand.cpp	2014-09-17 00:49:20 UTC (rev 173683)
+++ trunk/Source/WebCore/editing/CompositeEditCommand.cpp	2014-09-17 02:00:40 UTC (rev 173684)
@@ -396,7 +396,7 @@
 void CompositeEditCommand::removeChildrenInRange(PassRefPtr<Node> node, unsigned from, unsigned to)
 {
     Vector<RefPtr<Node>> children;
-    Node* child = node->childNode(from);
+    Node* child = node->traverseToChildAt(from);
     for (unsigned i = from; child && i < to; i++, child = child->nextSibling())
         children.append(child);
 

Modified: trunk/Source/WebCore/editing/DeleteSelectionCommand.cpp (173683 => 173684)


--- trunk/Source/WebCore/editing/DeleteSelectionCommand.cpp	2014-09-17 00:49:20 UTC (rev 173683)
+++ trunk/Source/WebCore/editing/DeleteSelectionCommand.cpp	2014-09-17 02:00:40 UTC (rev 173684)
@@ -507,7 +507,7 @@
                 deleteTextFromNode(text, startOffset, text->length() - startOffset);
                 node = NodeTraversal::next(node.get());
             } else {
-                node = startNode->childNode(startOffset);
+                node = startNode->traverseToChildAt(startOffset);
             }
         } else if (startNode == m_upstreamEnd.deprecatedNode() && startNode->isTextNode()) {
             Text* text = toText(m_upstreamEnd.deprecatedNode());

Modified: trunk/Source/WebCore/editing/InsertParagraphSeparatorCommand.cpp (173683 => 173684)


--- trunk/Source/WebCore/editing/InsertParagraphSeparatorCommand.cpp	2014-09-17 00:49:20 UTC (rev 173683)
+++ trunk/Source/WebCore/editing/InsertParagraphSeparatorCommand.cpp	2014-09-17 02:00:40 UTC (rev 173684)
@@ -267,7 +267,7 @@
             refNode = startBlock->firstChild();
         }
         else if (insertionPosition.deprecatedNode() == startBlock && nestNewBlock) {
-            refNode = startBlock->childNode(insertionPosition.deprecatedEditingOffset());
+            refNode = startBlock->traverseToChildAt(insertionPosition.deprecatedEditingOffset());
             ASSERT(refNode); // must be true or we'd be in the end of block case
         } else
             refNode = insertionPosition.deprecatedNode();

Modified: trunk/Source/WebCore/editing/TextIterator.cpp (173683 => 173684)


--- trunk/Source/WebCore/editing/TextIterator.cpp	2014-09-17 00:49:20 UTC (rev 173683)
+++ trunk/Source/WebCore/editing/TextIterator.cpp	2014-09-17 02:00:40 UTC (rev 173684)
@@ -193,7 +193,7 @@
 static Node* nextInPreOrderCrossingShadowBoundaries(Node& rangeEndContainer, int rangeEndOffset)
 {
     if (rangeEndOffset >= 0 && !rangeEndContainer.offsetInCharacters()) {
-        if (Node* next = rangeEndContainer.childNode(rangeEndOffset))
+        if (Node* next = rangeEndContainer.traverseToChildAt(rangeEndOffset))
             return next;
     }
     for (Node* node = &rangeEndContainer; node; node = node->parentOrShadowHostNode()) {
@@ -1111,7 +1111,7 @@
     if (node->offsetInCharacters())
         return node;
     
-    return node->childNode(textRange->startOffset());
+    return node->traverseToChildAt(textRange->startOffset());
 }
 
 // --------
@@ -1147,13 +1147,13 @@
 
     if (!startNode->offsetInCharacters()) {
         if (startOffset >= 0 && startOffset < static_cast<int>(startNode->countChildNodes())) {
-            startNode = startNode->childNode(startOffset);
+            startNode = startNode->traverseToChildAt(startOffset);
             startOffset = 0;
         }
     }
     if (!endNode->offsetInCharacters()) {
         if (endOffset > 0 && endOffset <= static_cast<int>(endNode->countChildNodes())) {
-            endNode = endNode->childNode(endOffset - 1);
+            endNode = endNode->traverseToChildAt(endOffset - 1);
             endOffset = lastOffsetInNode(endNode);
         }
     }

Modified: trunk/Source/WebCore/editing/VisibleUnits.cpp (173683 => 173684)


--- trunk/Source/WebCore/editing/VisibleUnits.cpp	2014-09-17 00:49:20 UTC (rev 173683)
+++ trunk/Source/WebCore/editing/VisibleUnits.cpp	2014-09-17 02:00:40 UTC (rev 173684)
@@ -1013,7 +1013,7 @@
 
     if (!root) {
         // FIXME: We need do the same in previousLinePosition.
-        Node* child = node->childNode(p.deprecatedEditingOffset());
+        Node* child = node->traverseToChildAt(p.deprecatedEditingOffset());
         node = child ? child : node->lastDescendant();
         Position position = nextRootInlineBoxCandidatePosition(node, visiblePosition, editableType);
         if (position.isNotNull()) {

Modified: trunk/Source/WebCore/editing/cocoa/HTMLConverter.mm (173683 => 173684)


--- trunk/Source/WebCore/editing/cocoa/HTMLConverter.mm	2014-09-17 00:49:20 UTC (rev 173683)
+++ trunk/Source/WebCore/editing/cocoa/HTMLConverter.mm	2014-09-17 02:00:40 UTC (rev 173684)
@@ -2569,7 +2569,7 @@
         int endOffset = currentTextRange->endOffset();
         
         if (startContainer == endContainer && (startOffset == endOffset - 1)) {
-            Node* node = startContainer->childNode(startOffset);
+            Node* node = startContainer->traverseToChildAt(startOffset);
             if (node && node->hasTagName(imgTag)) {
                 NSFileWrapper* fileWrapper = fileWrapperForElement(toElement(node));
                 NSTextAttachment* attachment = [[NSTextAttachment alloc] initWithFileWrapper:fileWrapper];

Modified: trunk/Source/WebCore/inspector/DOMPatchSupport.cpp (173683 => 173684)


--- trunk/Source/WebCore/inspector/DOMPatchSupport.cpp	2014-09-17 00:49:20 UTC (rev 173683)
+++ trunk/Source/WebCore/inspector/DOMPatchSupport.cpp	2014-09-17 02:00:40 UTC (rev 173684)
@@ -377,10 +377,11 @@
     }
 
     // 3. Insert missing nodes.
-    for (size_t i = 0; i < newMap.size(); ++i) {
+    Node* node = parentNode->firstChild();
+    for (unsigned i = 0; node && i < newMap.size(); ++i, node = node->nextSibling()) {
         if (newMap[i].first || merges.contains(newList[i].get()))
             continue;
-        if (!insertBeforeAndMarkAsUsed(parentNode, newList[i].get(), parentNode->childNode(i), ec))
+        if (!insertBeforeAndMarkAsUsed(parentNode, newList[i].get(), node, ec))
             return false;
     }
 
@@ -389,7 +390,7 @@
         if (!oldMap[i].first)
             continue;
         RefPtr<Node> node = oldMap[i].first->m_node;
-        Node* anchorNode = parentNode->childNode(oldMap[i].second);
+        Node* anchorNode = parentNode->traverseToChildAt(oldMap[i].second);
         if (node.get() == anchorNode)
             continue;
         if (node->hasTagName(bodyTag) || node->hasTagName(headTag))
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to