diff options
Diffstat (limited to 'Source/WebCore/dom/Node.cpp')
-rw-r--r-- | Source/WebCore/dom/Node.cpp | 59 |
1 files changed, 0 insertions, 59 deletions
diff --git a/Source/WebCore/dom/Node.cpp b/Source/WebCore/dom/Node.cpp index ba9886615..34495b5c7 100644 --- a/Source/WebCore/dom/Node.cpp +++ b/Source/WebCore/dom/Node.cpp @@ -938,65 +938,6 @@ bool Node::containsIncludingHostElements(const Node* node) const #endif } -static inline Node* ancestor(Node* node, unsigned depth) -{ - for (unsigned i = 0; i < depth; ++i) - node = node->parentNode(); - return node; -} - -Node* commonAncestor(Node& thisNode, Node& otherNode) -{ - unsigned thisDepth = 0; - for (auto node = &thisNode; node; node = node->parentNode()) { - if (node == &otherNode) - return node; - thisDepth++; - } - unsigned otherDepth = 0; - for (auto node = &otherNode; node; node = node->parentNode()) { - if (node == &thisNode) - return &thisNode; - otherDepth++; - } - - Node* thisAncestor = &thisNode; - Node* otherAncestor = &otherNode; - if (thisDepth > otherDepth) - thisAncestor = ancestor(thisAncestor, thisDepth - otherDepth); - else if (otherDepth > thisDepth) - otherAncestor = ancestor(otherAncestor, otherDepth - thisDepth); - - for (; thisAncestor; thisAncestor = thisAncestor->parentNode()) { - if (thisAncestor == otherAncestor) - return thisAncestor; - otherAncestor = otherAncestor->parentNode(); - } - ASSERT(!otherAncestor); - return nullptr; -} - -Node* commonAncestorCrossingShadowBoundary(Node& node, Node& other) -{ - if (&node == &other) - return &node; - - Element* shadowHost = node.shadowHost(); - // FIXME: This test might be wrong for user-authored shadow trees. - if (shadowHost && shadowHost == other.shadowHost()) - return shadowHost; - - TreeScope* scope = commonTreeScope(&node, &other); - if (!scope) - return nullptr; - - Node* parentNode = scope->ancestorInThisScope(&node); - ASSERT(parentNode); - Node* parentOther = scope->ancestorInThisScope(&other); - ASSERT(parentOther); - return commonAncestor(*parentNode, *parentOther); -} - Node* Node::pseudoAwarePreviousSibling() const { Element* parentOrHost = is<PseudoElement>(*this) ? downcast<PseudoElement>(*this).hostElement() : parentElement(); |