WebCore:
authorjusting <justing@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 23 Sep 2006 00:14:55 +0000 (00:14 +0000)
committerjusting <justing@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 23 Sep 2006 00:14:55 +0000 (00:14 +0000)
        Reviewed by darin

        <http://bugzilla.opendarwin.org/show_bug.cgi?id=8029>
        Rename Node::isAncestor and RenderObject::hasAncestor to isDescendantOf

        * dom/Document.cpp:
        (WebCore::Document::clearSelectionIfNeeded):
        * dom/Element.cpp:
        (WebCore::Element::contains):
        * dom/Node.cpp:
        (WebCore::Node::traverseNextNode):
        (WebCore::Node::traverseNextSibling):
        (WebCore::Node::traversePreviousNodePostOrder):
        (WebCore::Node::checkAddChild):
        (WebCore::Node::isDescendantOf):
        * dom/Node.h:
        * dom/NodeIterator.cpp:
        (WebCore::NodeIterator::notifyBeforeNodeRemoval):
        * editing/ApplyStyleCommand.cpp:
        (WebCore::ApplyStyleCommand::applyBlockStyle):
        (WebCore::ApplyStyleCommand::applyRelativeFontStyleChange):
        (WebCore::ApplyStyleCommand::applyInlineStyle):
        (WebCore::ApplyStyleCommand::pushDownTextDecorationStyleAroundNode):
        * editing/CompositeEditCommand.cpp:
        (WebCore::CompositeEditCommand::mergeIdenticalElements):
        (WebCore::CompositeEditCommand::moveParagraphContentsToNewBlockIfNecessary):
        * editing/DeleteSelectionCommand.cpp:
        (WebCore::updatePositionForNodeRemoval):
        (WebCore::DeleteSelectionCommand::handleGeneralDelete):
        (WebCore::DeleteSelectionCommand::mergeParagraphs):
        * editing/FormatBlockCommand.cpp:
        (WebCore::FormatBlockCommand::doApply):
        * editing/IndentOutdentCommand.cpp:
        (WebCore::enclosingListOrBlockquote):
        * editing/Selection.cpp:
        (WebCore::Selection::validate):
        * editing/SelectionController.cpp:
        (WebCore::SelectionController::nodeWillBeRemoved):
        * editing/TextIterator.cpp:
        (WebCore::SimplifiedBackwardsTextIterator::advance):
        * editing/VisiblePosition.cpp:
        (WebCore::VisiblePosition::next):
        (WebCore::VisiblePosition::previous):
        (WebCore::VisiblePosition::canonicalPosition):
        (WebCore::isFirstVisiblePositionInNode):
        (WebCore::isLastVisiblePositionInNode):
        * editing/htmlediting.cpp:
        (WebCore::firstEditablePositionAfterPositionInRoot):
        (WebCore::lastEditablePositionBeforePositionInRoot):
        (WebCore::enclosingNodeWithTag):
        (WebCore::enclosingList):
        (WebCore::enclosingListChild):
        * editing/markup.cpp:
        (WebCore::createMarkup):

WebKitTools:

        Reviewed by darin

        * Scripts/do-webcore-rename:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@16538 268f45cc-cd09-0410-ab3c-d52691b4dbfc

24 files changed:
WebCore/ChangeLog
WebCore/dom/Document.cpp
WebCore/dom/Element.cpp
WebCore/dom/Node.cpp
WebCore/dom/Node.h
WebCore/dom/NodeIterator.cpp
WebCore/editing/ApplyStyleCommand.cpp
WebCore/editing/CompositeEditCommand.cpp
WebCore/editing/DeleteSelectionCommand.cpp
WebCore/editing/FormatBlockCommand.cpp
WebCore/editing/IndentOutdentCommand.cpp
WebCore/editing/Selection.cpp
WebCore/editing/SelectionController.cpp
WebCore/editing/TextIterator.cpp
WebCore/editing/VisiblePosition.cpp
WebCore/editing/htmlediting.cpp
WebCore/editing/markup.cpp
WebCore/rendering/RenderBlock.cpp
WebCore/rendering/RenderFlexibleBox.cpp
WebCore/rendering/RenderLayer.cpp
WebCore/rendering/RenderObject.cpp
WebCore/rendering/RenderObject.h
WebKitTools/ChangeLog
WebKitTools/Scripts/do-webcore-rename

index 0f890aa202ad86ca75c560815c702f93cbbfcabd..421cd527719a973fc8a24ee8ab1340bc412880e1 100644 (file)
@@ -1,3 +1,60 @@
+2006-09-22  Justin Garcia  <justin.garcia@apple.com>
+
+        Reviewed by darin
+
+        <http://bugzilla.opendarwin.org/show_bug.cgi?id=8029>
+        Rename Node::isAncestor and RenderObject::hasAncestor to isDescendantOf
+
+        * dom/Document.cpp:
+        (WebCore::Document::clearSelectionIfNeeded):
+        * dom/Element.cpp:
+        (WebCore::Element::contains):
+        * dom/Node.cpp:
+        (WebCore::Node::traverseNextNode):
+        (WebCore::Node::traverseNextSibling):
+        (WebCore::Node::traversePreviousNodePostOrder):
+        (WebCore::Node::checkAddChild):
+        (WebCore::Node::isDescendantOf):
+        * dom/Node.h:
+        * dom/NodeIterator.cpp:
+        (WebCore::NodeIterator::notifyBeforeNodeRemoval):
+        * editing/ApplyStyleCommand.cpp:
+        (WebCore::ApplyStyleCommand::applyBlockStyle):
+        (WebCore::ApplyStyleCommand::applyRelativeFontStyleChange):
+        (WebCore::ApplyStyleCommand::applyInlineStyle):
+        (WebCore::ApplyStyleCommand::pushDownTextDecorationStyleAroundNode):
+        * editing/CompositeEditCommand.cpp:
+        (WebCore::CompositeEditCommand::mergeIdenticalElements):
+        (WebCore::CompositeEditCommand::moveParagraphContentsToNewBlockIfNecessary):
+        * editing/DeleteSelectionCommand.cpp:
+        (WebCore::updatePositionForNodeRemoval):
+        (WebCore::DeleteSelectionCommand::handleGeneralDelete):
+        (WebCore::DeleteSelectionCommand::mergeParagraphs):
+        * editing/FormatBlockCommand.cpp:
+        (WebCore::FormatBlockCommand::doApply):
+        * editing/IndentOutdentCommand.cpp:
+        (WebCore::enclosingListOrBlockquote):
+        * editing/Selection.cpp:
+        (WebCore::Selection::validate):
+        * editing/SelectionController.cpp:
+        (WebCore::SelectionController::nodeWillBeRemoved):
+        * editing/TextIterator.cpp:
+        (WebCore::SimplifiedBackwardsTextIterator::advance):
+        * editing/VisiblePosition.cpp:
+        (WebCore::VisiblePosition::next):
+        (WebCore::VisiblePosition::previous):
+        (WebCore::VisiblePosition::canonicalPosition):
+        (WebCore::isFirstVisiblePositionInNode):
+        (WebCore::isLastVisiblePositionInNode):
+        * editing/htmlediting.cpp:
+        (WebCore::firstEditablePositionAfterPositionInRoot):
+        (WebCore::lastEditablePositionBeforePositionInRoot):
+        (WebCore::enclosingNodeWithTag):
+        (WebCore::enclosingList):
+        (WebCore::enclosingListChild):
+        * editing/markup.cpp:
+        (WebCore::createMarkup):
+
 2006-09-22  Timothy Hatcher  <timothy@apple.com>
 
         Reviewed by Darin.
index d9668e38afe18200da3126ee7f67bb6cb743a1a3..d2f61c077586de0286190d27bddf45000d40e619 100644 (file)
@@ -2174,7 +2174,7 @@ void Document::clearSelectionIfNeeded(Node *newFocusNode)
     // Clear the selection when changing the focus node to null or to a node that is not 
     // contained by the current selection.
     Node *startContainer = frame()->selectionController()->start().node();
-    if (!newFocusNode || (startContainer && startContainer != newFocusNode && !(startContainer->isAncestor(newFocusNode)) && startContainer->shadowAncestorNode() != newFocusNode))
+    if (!newFocusNode || (startContainer && startContainer != newFocusNode && !(startContainer->isDescendantOf(newFocusNode)) && startContainer->shadowAncestorNode() != newFocusNode))
         frame()->selectionController()->clear();
 }
 
index a7ee2c7116850049dcee2280ffd60ba41d864743..7edbf68c94960cf2bef1ed725819f6b93513abdf 100644 (file)
@@ -492,7 +492,7 @@ bool Element::contains(const Node* node) const
 {
     if (!node)
         return false;
-    return this == node || node->isAncestor(this);
+    return this == node || node->isDescendantOf(this);
 }
 
 void Element::createAttributeMap() const
index df30291499814c59d5936e35ae6248e9e3161200..9c418ac63126e71ba3847e6d4f1fb802b7fa92dd 100644 (file)
@@ -441,20 +441,20 @@ Node *Node::childNode(unsigned /*index*/) const
 Node *Node::traverseNextNode(const Node *stayWithin) const
 {
     if (firstChild()) {
-        assert(!stayWithin || firstChild()->isAncestor(stayWithin));
+        assert(!stayWithin || firstChild()->isDescendantOf(stayWithin));
         return firstChild();
     }
     if (this == stayWithin)
         return 0;
     if (nextSibling()) {
-        assert(!stayWithin || nextSibling()->isAncestor(stayWithin));
+        assert(!stayWithin || nextSibling()->isDescendantOf(stayWithin));
         return nextSibling();
     }
     const Node *n = this;
     while (n && !n->nextSibling() && (!stayWithin || n->parentNode() != stayWithin))
         n = n->parentNode();
     if (n) {
-        assert(!stayWithin || !n->nextSibling() || n->nextSibling()->isAncestor(stayWithin));
+        assert(!stayWithin || !n->nextSibling() || n->nextSibling()->isDescendantOf(stayWithin));
         return n->nextSibling();
     }
     return 0;
@@ -465,14 +465,14 @@ Node *Node::traverseNextSibling(const Node *stayWithin) const
     if (this == stayWithin)
         return 0;
     if (nextSibling()) {
-        assert(!stayWithin || nextSibling()->isAncestor(stayWithin));
+        assert(!stayWithin || nextSibling()->isDescendantOf(stayWithin));
         return nextSibling();
     }
     const Node *n = this;
     while (n && !n->nextSibling() && (!stayWithin || n->parentNode() != stayWithin))
         n = n->parentNode();
     if (n) {
-        assert(!stayWithin || !n->nextSibling() || n->nextSibling()->isAncestor(stayWithin));
+        assert(!stayWithin || !n->nextSibling() || n->nextSibling()->isDescendantOf(stayWithin));
         return n->nextSibling();
     }
     return 0;
@@ -494,20 +494,20 @@ Node *Node::traversePreviousNode(const Node *stayWithin) const
 Node *Node::traversePreviousNodePostOrder(const Node *stayWithin) const
 {
     if (lastChild()) {
-        assert(!stayWithin || lastChild()->isAncestor(stayWithin));
+        assert(!stayWithin || lastChild()->isDescendantOf(stayWithin));
         return lastChild();
     }
     if (this == stayWithin)
         return 0;
     if (previousSibling()) {
-        assert(!stayWithin || previousSibling()->isAncestor(stayWithin));
+        assert(!stayWithin || previousSibling()->isDescendantOf(stayWithin));
         return previousSibling();
     }
     const Node *n = this;
     while (n && !n->previousSibling() && (!stayWithin || n->parentNode() != stayWithin))
         n = n->parentNode();
     if (n) {
-        assert(!stayWithin || !n->previousSibling() || n->previousSibling()->isAncestor(stayWithin));
+        assert(!stayWithin || !n->previousSibling() || n->previousSibling()->isDescendantOf(stayWithin));
         return n->previousSibling();
     }
     return 0;
@@ -583,7 +583,7 @@ void Node::checkAddChild(Node *newChild, ExceptionCode& ec)
     // newChild node, or if the node to append is one of this node's ancestors.
 
     // check for ancestor/same node
-    if (newChild == this || isAncestor(newChild)) {
+    if (newChild == this || isDescendantOf(newChild)) {
         ec = HIERARCHY_REQUEST_ERR;
         return;
     }
@@ -612,7 +612,7 @@ void Node::checkAddChild(Node *newChild, ExceptionCode& ec)
     }
 }
 
-bool Node::isAncestor(const Node *other) const
+bool Node::isDescendantOf(const Node *other) const
 {
     // Return true if other is an ancestor of this, otherwise false
     if (!other)
index 869d2448cc0b951185db8a509f308ad536eadab4..f1624aa081c796d1aa94c10bbaeeb6debda79ed1 100644 (file)
@@ -323,7 +323,7 @@ public:
     void setRenderer(RenderObject* renderer) { m_renderer = renderer; }
     
     void checkSetPrefix(const AtomicString& prefix, ExceptionCode&);
-    bool isAncestor(const Node*) const;
+    bool isDescendantOf(const Node*) const;
 
     // These two methods are mutually exclusive.  The former is used to do strict error-checking
     // when adding children via the public DOM API (e.g., appendChild()).  The latter is called only when parsing, 
index 331b45083704548f81402ccc9c5c63bb3cb21aa8..a8b380127623521ee9529df0d2f7dee2126b8554 100644 (file)
@@ -116,10 +116,10 @@ void NodeIterator::notifyBeforeNodeRemoval(Node* removedNode)
 {
     // Iterator is not affected if the removed node is the reference node and is the root.
     // or if removed node is not the reference node, or the ancestor of the reference node.
-    if (!removedNode || removedNode == root() || !removedNode->isAncestor(root()))
+    if (!removedNode || removedNode == root() || !removedNode->isDescendantOf(root()))
         return;
     bool willRemoveReferenceNode = removedNode == referenceNode();
-    bool willRemoveReferenceNodeAncestor = referenceNode() && referenceNode()->isAncestor(removedNode);
+    bool willRemoveReferenceNodeAncestor = referenceNode() && referenceNode()->isDescendantOf(removedNode);
     if (!willRemoveReferenceNode && !willRemoveReferenceNodeAncestor)
         return;
 
@@ -129,7 +129,7 @@ void NodeIterator::notifyBeforeNodeRemoval(Node* removedNode)
             // Move out from under the node being removed if the reference node is
             // a descendant of the node being removed.
             if (willRemoveReferenceNodeAncestor) {
-                while (node && node->isAncestor(removedNode))
+                while (node && node->isDescendantOf(removedNode))
                     node = findNextNode(node);
             }
             if (node)
@@ -140,7 +140,7 @@ void NodeIterator::notifyBeforeNodeRemoval(Node* removedNode)
                 // Move out from under the node being removed if the reference node is
                 // a descendant of the node being removed.
                 if (willRemoveReferenceNodeAncestor) {
-                    while (node && node->isAncestor(removedNode))
+                    while (node && node->isDescendantOf(removedNode))
                         node = findPreviousNode(node);
                 }
                 if (node) {
@@ -158,7 +158,7 @@ void NodeIterator::notifyBeforeNodeRemoval(Node* removedNode)
             // Move out from under the node being removed if the reference node is
             // a descendant of the node being removed.
             if (willRemoveReferenceNodeAncestor) {
-                while (node && node->isAncestor(removedNode))
+                while (node && node->isDescendantOf(removedNode))
                     node = findPreviousNode(node);
             }
             if (node)
@@ -168,7 +168,7 @@ void NodeIterator::notifyBeforeNodeRemoval(Node* removedNode)
             // Move out from under the node being removed if the reference node is
             // a descendant of the node being removed.
             if (willRemoveReferenceNodeAncestor) {
-                while (node && node->isAncestor(removedNode))
+                while (node && node->isDescendantOf(removedNode))
                     node = findPreviousNode(node);
             }
             if (node)
index 5071cb4e272b805dd54003ee123a5a2a2b4fe336..ef0f143c00e867d8118f0c7cc852d929e498bcae 100644 (file)
@@ -379,7 +379,7 @@ void ApplyStyleCommand::applyBlockStyle(CSSMutableStyleDeclaration *style)
     // If the end node is before the start node (can only happen if the end node is
     // an ancestor of the start node), we gather nodes up to the next sibling of the end node
     Node *beyondEnd;
-    if (start.node()->isAncestor(end.node()))
+    if (start.node()->isDescendantOf(end.node()))
         beyondEnd = end.node()->traverseNextSibling();
     else
         beyondEnd = end.node()->traverseNextNode();
@@ -479,7 +479,7 @@ void ApplyStyleCommand::applyRelativeFontStyleChange(CSSMutableStyleDeclaration
     // If the end node is before the start node (can only happen if the end node is
     // an ancestor of the start node), we gather nodes up to the next sibling of the end node
     Node *beyondEnd;
-    if (start.node()->isAncestor(end.node()))
+    if (start.node()->isDescendantOf(end.node()))
         beyondEnd = end.node()->traverseNextSibling();
     else
         beyondEnd = end.node()->traverseNextNode();
@@ -621,7 +621,7 @@ void ApplyStyleCommand::applyInlineStyle(CSSMutableStyleDeclaration *style)
         endNode = end.node()->lastDescendant();
     // If the end node is an ancestor of the start node then a pre-order
     // traversal will never reach it.  Adjust it so that this won't happen.
-    if (node->isAncestor(endNode))
+    if (node->isDescendantOf(endNode))
         endNode = endNode->lastDescendant();
     
     if (node == endNode) {
@@ -867,7 +867,7 @@ void ApplyStyleCommand::pushDownTextDecorationStyleAroundNode(Node *node, const
 
                 if (node == child) {
                     nextCurrent = child;
-                } else if (node->isAncestor(child)) {
+                } else if (node->isDescendantOf(child)) {
                     applyTextDecorationStyle(child, decoration.get());
                     nextCurrent = child;
                 } else {
index 4d9c967f3ae77b4000cb2a0761f9492ff2d1acd9..2e3ed9a2d31fec4cf41148e3919b4c53f694b574 100644 (file)
@@ -228,7 +228,7 @@ void CompositeEditCommand::splitElement(Element* element, Node* atChild)
 
 void CompositeEditCommand::mergeIdenticalElements(Element* first, Element* second)
 {
-    ASSERT(!first->isAncestor(second) && second != first);
+    ASSERT(!first->isDescendantOf(second) && second != first);
     if (first->nextSibling() != second) {
         removeNode(second);
         insertNodeAfter(second, first);
@@ -518,7 +518,7 @@ void CompositeEditCommand::moveParagraphContentsToNewBlockIfNecessary(const Posi
     // Perform some checks to see if we need to perform work in this function.
     if (isBlock(paragraphStart.node())) {
         if (isBlock(end.node())) {
-            if (!end.node()->isAncestor(paragraphStart.node())) {
+            if (!end.node()->isDescendantOf(paragraphStart.node())) {
                 // If the paragraph end is a descendant of paragraph start, then we need to run
                 // the rest of this function. If not, we can bail here.
                 return;
@@ -527,7 +527,7 @@ void CompositeEditCommand::moveParagraphContentsToNewBlockIfNecessary(const Posi
         else if (enclosingBlock(end.node()) != paragraphStart.node()) {
             // The visibleEnd.  It must be an ancestor of the paragraph start.
             // We can bail as we have a full block to work with.
-            ASSERT(paragraphStart.node()->isAncestor(enclosingBlock(end.node())));
+            ASSERT(paragraphStart.node()->isDescendantOf(enclosingBlock(end.node())));
             return;
         }
         else if (isEndOfDocument(visibleEnd)) {
index a9de108c6d75fca391a030c5f3e93bbf252d15e8..5e8f6a6ed05b53ad30c7930ed4240b87f72739b8 100644 (file)
@@ -212,7 +212,7 @@ static void updatePositionForNodeRemoval(Node* node, Position& position)
         return;
     if (node->parent() == position.node() && node->nodeIndex() < (unsigned)position.offset())
         position = Position(position.node(), position.offset() - 1);
-    if (position.node() == node || position.node()->isAncestor(node))
+    if (position.node() == node || position.node()->isDescendantOf(node))
         position = positionBeforeNode(node);
 }
 
@@ -333,7 +333,7 @@ void DeleteSelectionCommand::handleGeneralDelete()
             if (Range::compareBoundaryPoints(Position(node, 0), m_downstreamEnd) >= 0) {
                 // traverseNextSibling just blew past the end position, so stop deleting
                 node = 0;
-            } else if (!m_downstreamEnd.node()->isAncestor(node)) {
+            } else if (!m_downstreamEnd.node()->isDescendantOf(node)) {
                 Node *nextNode = node->traverseNextSibling();
                 // if we just removed a node from the end container, update end position so the
                 // check above will work
@@ -353,14 +353,14 @@ void DeleteSelectionCommand::handleGeneralDelete()
             }
         }
         
-        if (m_downstreamEnd.node() != startNode && !m_upstreamStart.node()->isAncestor(m_downstreamEnd.node()) && m_downstreamEnd.node()->inDocument() && m_downstreamEnd.offset() >= m_downstreamEnd.node()->caretMinOffset()) {
+        if (m_downstreamEnd.node() != startNode && !m_upstreamStart.node()->isDescendantOf(m_downstreamEnd.node()) && m_downstreamEnd.node()->inDocument() && m_downstreamEnd.offset() >= m_downstreamEnd.node()->caretMinOffset()) {
             if (m_downstreamEnd.offset() >= maxDeepOffset(m_downstreamEnd.node())) {
                 // need to delete whole node
                 // we can get here if this is the last node in the block
                 // remove an ancestor of m_downstreamEnd.node(), and thus m_downstreamEnd.node() itself
                 if (!m_upstreamStart.node()->inDocument() ||
                     m_upstreamStart.node() == m_downstreamEnd.node() ||
-                    m_upstreamStart.node()->isAncestor(m_downstreamEnd.node())) {
+                    m_upstreamStart.node()->isDescendantOf(m_downstreamEnd.node())) {
                     m_upstreamStart = Position(m_downstreamEnd.node()->parentNode(), m_downstreamEnd.node()->nodeIndex());
                 }
                 
@@ -375,7 +375,7 @@ void DeleteSelectionCommand::handleGeneralDelete()
                     }
                 } else {
                     int offset = 0;
-                    if (m_upstreamStart.node()->isAncestor(m_downstreamEnd.node())) {
+                    if (m_upstreamStart.node()->isDescendantOf(m_downstreamEnd.node())) {
                         Node *n = m_upstreamStart.node();
                         while (n && n->parentNode() != m_downstreamEnd.node())
                             n = n->parentNode();
@@ -430,7 +430,7 @@ void DeleteSelectionCommand::mergeParagraphs()
     VisiblePosition mergeDestination(m_upstreamStart);
     
     // We need to merge into m_upstreamStart's block, but it's been emptied out and collapsed by deletion.
-    if (!mergeDestination.deepEquivalent().node()->isAncestor(m_upstreamStart.node()->enclosingBlockFlowElement())) {
+    if (!mergeDestination.deepEquivalent().node()->isDescendantOf(m_upstreamStart.node()->enclosingBlockFlowElement())) {
         insertNodeAt(createBreakElement(document()).get(), m_upstreamStart.node(), m_upstreamStart.offset());
         mergeDestination = VisiblePosition(m_upstreamStart);
     }
index 9bd8efc88fd579c337967a5b14ce3e0d1f5bc934..d5a2bdba20df118c3c069dff5de1848fb98005ae 100644 (file)
@@ -97,12 +97,12 @@ void FormatBlockCommand::doApply()
     RefPtr<Node> placeholder = createBreakElement(document());
     
     Node* root = endingSelection().start().node()->rootEditableElement();
-    if (refNode == root || root->isAncestor(refNode))
+    if (refNode == root || root->isDescendantOf(refNode))
         refNode = paragraphStart.deepEquivalent().node();
     
     Position upstreamStart = paragraphStart.deepEquivalent().upstream();
     if ((validBlockTag(refNode->nodeName().lower()) && paragraphStart == blockStart && paragraphEnd == blockEnd) ||
-        !upstreamStart.node()->isAncestor(root))
+        !upstreamStart.node()->isDescendantOf(root))
         // Already in a valid block tag that only contains the current paragraph, so we can swap with the new tag
         insertNodeBefore(blockNode.get(), refNode);
     else {
index bde239f05bb1bf7f55119e63086015e49521629d..b0e3cab9c591d1f76e958fec19a9cf8f76156a2c 100644 (file)
@@ -50,7 +50,7 @@ static Node* enclosingListOrBlockquote(Node* node)
         return 0;
     Node* root = (node->inDocument()) ? node->rootEditableElement() : highestAncestor(node);
     ASSERT(root);
-    for (Node* n = node->parentNode(); n && (n == root || n->isAncestor(root)); n = n->parentNode())
+    for (Node* n = node->parentNode(); n && (n == root || n->isDescendantOf(root)); n = n->parentNode())
         if (n->hasTagName(ulTag) || n->hasTagName(olTag) || n->hasTagName(blockquoteTag))
             return n;
             
index 1ae680c3faf986a0a6b1b468247c9ec9a731ad81..98fcc987b0e952993cf32d48c0c9dda7898f2fcf 100644 (file)
@@ -278,7 +278,7 @@ void Selection::validate()
             else {
                 m_end = startOfNextParagraph.deepEquivalent();
                 // Stay within enclosing node, e.g. do not span end of table.
-                if (visibleParagraphEnd.deepEquivalent().node()->isAncestor(m_end.node()))
+                if (visibleParagraphEnd.deepEquivalent().node()->isDescendantOf(m_end.node()))
                     m_end = visibleParagraphEnd.deepEquivalent();
             }
             break;
index b67c975e765e308373471bee125337890de5c2b4..839d6f0416ac8dcfb1679031db946dc685d9df7e 100644 (file)
@@ -140,10 +140,10 @@ void SelectionController::nodeWillBeRemoved(Node *node)
     Node* start = m_sel.start().node();
     Node* end = m_sel.end().node();
     
-    bool baseRemoved = node == base || (base && base->isAncestor(node));
-    bool extentRemoved = node == extent || (extent && extent->isAncestor(node));
-    bool startRemoved = node == start || (start && start->isAncestor(node));
-    bool endRemoved = node == end || (end && end->isAncestor(node));
+    bool baseRemoved = node == base || (base && base->isDescendantOf(node));
+    bool extentRemoved = node == extent || (extent && extent->isDescendantOf(node));
+    bool startRemoved = node == start || (start && start->isDescendantOf(node));
+    bool endRemoved = node == end || (end && end->isDescendantOf(node));
     
     bool clearRenderTreeSelection = false;
     bool clearDOMTreeSelection = false;
index cc97735cac4e1df522d9eef439f0ce832a47ff41..642a6190b41055ac7496ce1ae98ede6f94884b83 100644 (file)
@@ -656,7 +656,7 @@ void SimplifiedBackwardsTextIterator::advance()
             Node *block = m_node->enclosingBlockFlowElement();
             if (block) {
                 Node *nextBlock = next->enclosingBlockFlowElement();
-                if (nextBlock && nextBlock->isAncestor(block))
+                if (nextBlock && nextBlock->isDescendantOf(block))
                     emitNewline();
             }
         }
index e63d7190a043da7509e013d63231a291ea2ad1e6..ae61d31f66cab9ac2ba257dd9b5a7602d3a31dd6 100644 (file)
@@ -69,7 +69,7 @@ VisiblePosition VisiblePosition::next(bool stayInEditableContent) const
     
     Node* highestRoot = highestEditableRoot(deepEquivalent());
     
-    if (!next.deepEquivalent().node()->isAncestor(highestRoot))
+    if (!next.deepEquivalent().node()->isDescendantOf(highestRoot))
         return VisiblePosition();
 
     if (highestEditableRoot(next.deepEquivalent()) == highestRoot)
@@ -105,7 +105,7 @@ VisiblePosition VisiblePosition::previous(bool stayInEditableContent) const
     
     Node* highestRoot = highestEditableRoot(deepEquivalent());
     
-    if (!prev.deepEquivalent().node()->isAncestor(highestRoot))
+    if (!prev.deepEquivalent().node()->isDescendantOf(highestRoot))
         return VisiblePosition();
         
     if (highestEditableRoot(prev.deepEquivalent()) == highestRoot)
@@ -166,8 +166,8 @@ Position VisiblePosition::canonicalPosition(const Position& position)
 
     // The new position should be in the same block flow element. Favor that.
     Node *originalBlock = node->enclosingBlockFlowElement();
-    bool nextIsOutsideOriginalBlock = !nextNode->isAncestor(originalBlock) && nextNode != originalBlock;
-    bool prevIsOutsideOriginalBlock = !prevNode->isAncestor(originalBlock) && prevNode != originalBlock;
+    bool nextIsOutsideOriginalBlock = !nextNode->isDescendantOf(originalBlock) && nextNode != originalBlock;
+    bool prevIsOutsideOriginalBlock = !prevNode->isDescendantOf(originalBlock) && prevNode != originalBlock;
     if (nextIsOutsideOriginalBlock && !prevIsOutsideOriginalBlock)
         return prev;
         
@@ -271,11 +271,11 @@ bool isFirstVisiblePositionInNode(const VisiblePosition &visiblePosition, const
     if (visiblePosition.isNull())
         return false;
     
-    if (!visiblePosition.deepEquivalent().node()->isAncestor(node))
+    if (!visiblePosition.deepEquivalent().node()->isDescendantOf(node))
         return false;
         
     VisiblePosition previous = visiblePosition.previous();
-    return previous.isNull() || !previous.deepEquivalent().node()->isAncestor(node);
+    return previous.isNull() || !previous.deepEquivalent().node()->isDescendantOf(node);
 }
 
 bool isLastVisiblePositionInNode(const VisiblePosition &visiblePosition, const Node *node)
@@ -283,11 +283,11 @@ bool isLastVisiblePositionInNode(const VisiblePosition &visiblePosition, const N
     if (visiblePosition.isNull())
         return false;
     
-    if (!visiblePosition.deepEquivalent().node()->isAncestor(node))
+    if (!visiblePosition.deepEquivalent().node()->isDescendantOf(node))
         return false;
                 
     VisiblePosition next = visiblePosition.next();
-    return next.isNull() || !next.deepEquivalent().node()->isAncestor(node);
+    return next.isNull() || !next.deepEquivalent().node()->isDescendantOf(node);
 }
 
 }  // namespace WebCore
index dd74731b2d4c9592107bc32301c0e70bf0d310d9..9cb1aa444be8a07ac76bf96c00f590f1bda186d7 100644 (file)
@@ -246,7 +246,7 @@ VisiblePosition firstEditablePositionAfterPositionInRoot(const Position& positio
         return VisiblePosition(Position(highestRoot, 0));
 
     Position p = nextVisuallyDistinctCandidate(position);
-    while (p.isNotNull() && !isEditablePosition(p) && p.node()->isAncestor(highestRoot))
+    while (p.isNotNull() && !isEditablePosition(p) && p.node()->isDescendantOf(highestRoot))
         p = isAtomicNode(p.node()) ? positionAfterNode(p.node()) : nextVisuallyDistinctCandidate(p);
 
     return VisiblePosition(p);
@@ -258,7 +258,7 @@ VisiblePosition lastEditablePositionBeforePositionInRoot(const Position& positio
         return VisiblePosition(Position(highestRoot, maxDeepOffset(highestRoot)));
     
     Position p = previousVisuallyDistinctCandidate(position);
-    while (p.isNotNull() && !isEditablePosition(p) && p.node()->isAncestor(highestRoot))
+    while (p.isNotNull() && !isEditablePosition(p) && p.node()->isDescendantOf(highestRoot))
         p = isAtomicNode(p.node()) ? positionBeforeNode(p.node()) : previousVisuallyDistinctCandidate(p);
 
     return VisiblePosition(p);
@@ -542,7 +542,7 @@ Node* enclosingNodeWithTag(Node* node, const QualifiedName& tagName)
         return 0;
     Node* root = (node->inDocument()) ? node->rootEditableElement() : highestAncestor(node);
     ASSERT(root);
-    for (Node* n = node->parentNode(); n && (n == root || n->isAncestor(root)); n = n->parentNode())
+    for (Node* n = node->parentNode(); n && (n == root || n->isDescendantOf(root)); n = n->parentNode())
         if (n->hasTagName(tagName))
             return n;
             
@@ -567,7 +567,7 @@ Node* enclosingList(Node* node)
         return 0;
     Node* root = (node->inDocument()) ? node->rootEditableElement() : highestAncestor(node);
     ASSERT(root);
-    for (Node* n = node->parentNode(); n && (n == root || n->isAncestor(root)); n = n->parentNode())
+    for (Node* n = node->parentNode(); n && (n == root || n->isDescendantOf(root)); n = n->parentNode())
         if (n->hasTagName(ulTag) || n->hasTagName(olTag))
             return n;
             
@@ -582,7 +582,7 @@ Node* enclosingListChild (Node *node)
     // will appear visually as a list item (but without a list marker)
     Node* root = (node->inDocument()) ? node->rootEditableElement() : highestAncestor(node);
     ASSERT(root);
-    for (Node *n = node; n && n->parentNode() && (n == root || n->isAncestor(root)); n = n->parentNode()) {
+    for (Node *n = node; n && n->parentNode() && (n == root || n->isDescendantOf(root)); n = n->parentNode()) {
         if (n->hasTagName(liTag) || isListElement(n->parentNode()))
             return n;
     }
index b35d86904d0801b986eddf3db876e80a352bb697..1d76b2c4bab59d8fbede899ebcbe7a36240320f3 100644 (file)
@@ -377,7 +377,7 @@ DeprecatedString createMarkup(const Range *range, Vector<Node*>* nodes, EAnnotat
                     // Close up the ancestors.
                     do {
                         Node *ancestor = ancestorsToClose.last();
-                        if (next != pastEnd && next->isAncestor(ancestor))
+                        if (next != pastEnd && next->isDescendantOf(ancestor))
                             break;
                         // Not at the end of the range, close ancestors up to sibling of next node.
                         markups.append(endMarkup(ancestor));
@@ -389,13 +389,13 @@ DeprecatedString createMarkup(const Range *range, Vector<Node*>* nodes, EAnnotat
                 // Surround the currently accumulated markup with markup for ancestors we never opened as we leave the subtree(s) rooted at those ancestors.
                 Node* nextParent = next ? next->parentNode() : 0;
                 if (next != pastEnd && n != nextParent) {
-                    Node* lastAncestorClosedOrSelf = n->isAncestor(lastClosed) ? lastClosed : n;
+                    Node* lastAncestorClosedOrSelf = n->isDescendantOf(lastClosed) ? lastClosed : n;
                     for (Node *parent = lastAncestorClosedOrSelf->parent(); parent != 0 && parent != nextParent; parent = parent->parentNode()) {
                         // All ancestors that aren't in the ancestorsToClose list should either be a) unrendered:
                         if (!parent->renderer())
                             continue;
                         // or b) ancestors that we never encountered during a pre-order traversal starting at startNode:
-                        ASSERT(startNode->isAncestor(parent));
+                        ASSERT(startNode->isDescendantOf(parent));
                         markups.prepend(startMarkup(parent, range, annotate, defaultStyle.get()));
                         markups.append(endMarkup(parent));
                         if (nodes)
index a6bef477399bfae9e7658db367345be053be5460..fd72b889025651696235e5e78315332f35f794d3 100644 (file)
@@ -545,7 +545,7 @@ void RenderBlock::layoutBlock(bool relayoutChildren)
     // Update our scroll information if we're overflow:auto/scroll/hidden now that we know if
     // we overflow or not.
     RenderObject* flexbox = view()->flexBoxInFirstLayout();
-    if (hasOverflowClip() && !(flexbox && flexbox != this && hasAncestor(flexbox)))
+    if (hasOverflowClip() && !(flexbox && flexbox != this && isDescendantOf(flexbox)))
         m_layer->updateScrollInfoAfterLayout();
 
     // Repaint with our new bounds if they are different from our old bounds.
@@ -1219,7 +1219,7 @@ void RenderBlock::repaintOverhangingFloats(bool paintAllDescendants)
             // Only repaint the object if it is overhanging, is not in its own layer, and
             // is our responsibility to paint (noPaint isn't set). When paintAllDescendants is true, the latter
             // condition is replaced with being a descendant of us.
-            if (r->endY > m_height && (paintAllDescendants && r->node->hasAncestor(this) || !r->noPaint) && !r->node->layer()) {                
+            if (r->endY > m_height && (paintAllDescendants && r->node->isDescendantOf(this) || !r->noPaint) && !r->node->layer()) {                
                 r->node->repaint();
                 r->node->repaintOverhangingFloats();
             }
@@ -1804,7 +1804,7 @@ void RenderBlock::removePositionedObjects(RenderBlock* o)
     
     DeprecatedPtrListIterator<RenderObject> it(*m_positionedObjects);
     while (it.current()) {
-        if (!o || it.current()->hasAncestor(o)) {
+        if (!o || it.current()->isDescendantOf(o)) {
             if (o)
                 it.current()->setChildNeedsLayout(true, false);
             m_positionedObjects->removeRef(it.current());
index 6a8529da1e86afe4a420c93e7b3d1f220c276008..5415e8ba933e1ee081180c198a75a7989a7f3fa3 100644 (file)
@@ -321,7 +321,7 @@ void RenderFlexibleBox::layoutBlock(bool relayoutChildren)
     // Update our scrollbars if we're overflow:auto/scroll/hidden now that we know if
     // we overflow or not.
     RenderObject* flexbox = view()->flexBoxInFirstLayout();
-    if (hasOverflowClip() && !(flexbox && flexbox != this && hasAncestor(flexbox)))
+    if (hasOverflowClip() && !(flexbox && flexbox != this && isDescendantOf(flexbox)))
         m_layer->updateScrollInfoAfterLayout();
 
     // Repaint with our new bounds if they are different from our old bounds.
index 4aa29432e7305eb77b53d7c1dfe315600a9b9e7d..e19d2507c52123c1224ab53b9436b9ccf26d93a8 100644 (file)
@@ -1297,7 +1297,7 @@ RenderLayer::paintLayer(RenderLayer* rootLayer, GraphicsContext* p,
     // Else, our renderer tree may or may not contain the painting root, so we pass that root along
     // so it will be tested against as we decend through the renderers.
     RenderObject *paintingRootForRenderer = 0;
-    if (paintingRoot && !m_object->hasAncestor(paintingRoot))
+    if (paintingRoot && !m_object->isDescendantOf(paintingRoot))
         paintingRootForRenderer = paintingRoot;
     
     // We want to paint our layer, but only if we intersect the damage rect.
index 21b9947a7bb56f8addf366041c81f69b446d2b97..e4bd2b6801ead2ebca6b5eec1f433d0295e1fbc1 100644 (file)
@@ -191,7 +191,7 @@ RenderObject::~RenderObject()
 #endif
 }
 
-bool RenderObject::hasAncestor(const RenderObject *obj) const
+bool RenderObject::isDescendantOf(const RenderObject *obj) const
 {
     for (const RenderObject *r = this; r; r = r->m_parent)
         if (r == obj)
index 6316b40ea0ee5789c8adefce69f5b7516648d0de..44443bc1fc15953dc60048c2e60da4b8a47091c0 100644 (file)
@@ -129,7 +129,7 @@ public:
     virtual ~RenderObject();
 
     RenderObject *parent() const { return m_parent; }
-    bool hasAncestor(const RenderObject *obj) const;
+    bool isDescendantOf(const RenderObject *obj) const;
 
     RenderObject *previousSibling() const { return m_previous; }
     RenderObject *nextSibling() const { return m_next; }
index a8514e9e22519120840896630860f4a26ba466d0..9a3ac4e39191d1b6b4142f2c2753c3fa06e5d8e6 100644 (file)
@@ -1,3 +1,9 @@
+2006-09-22  Justin Garcia  <justin.garcia@apple.com>
+
+        Reviewed by darin
+
+        * Scripts/do-webcore-rename:
+
 2006-09-21  Timothy Hatcher  <timothy@apple.com>
 
         Reviewed by Adam.
index 433e55ca9708cb90ec3c11d4d5ae3f67f52ba609..d797d487312615a2cd3d6c87e3c2a811d9373a16 100755 (executable)
@@ -133,7 +133,6 @@ my %renames = (
     "StreamingTextDecoderICU_H" => "TextCodecICU_h",
     "Decoder" => "TextResourceDecoder",
     "Decoder_h" => "TextResourceDecoder_h",
-    "isAncestor" => "hasAncestor",
 );
 
 # rename files