summaryrefslogtreecommitdiffstats
path: root/WebCore/page/SpatialNavigation.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'WebCore/page/SpatialNavigation.cpp')
-rw-r--r--WebCore/page/SpatialNavigation.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/WebCore/page/SpatialNavigation.cpp b/WebCore/page/SpatialNavigation.cpp
index 58b70e4..e748d12 100644
--- a/WebCore/page/SpatialNavigation.cpp
+++ b/WebCore/page/SpatialNavigation.cpp
@@ -546,4 +546,24 @@ bool isScrollableContainerNode(Node* node)
return false;
}
+bool isNodeDeepDescendantOfDocument(Node* node, Document* baseDocument)
+{
+ if (!node || !baseDocument)
+ return false;
+
+ bool descendant = baseDocument == node->document();
+
+ Element* currentElement = static_cast<Element*>(node);
+ while (!descendant) {
+ Element* documentOwner = currentElement->document()->ownerElement();
+ if (!documentOwner)
+ break;
+
+ descendant = documentOwner->document() == baseDocument;
+ currentElement = documentOwner;
+ }
+
+ return descendant;
+}
+
} // namespace WebCore