diff options
Diffstat (limited to 'dom/base/nsContentUtils.cpp')
-rw-r--r-- | dom/base/nsContentUtils.cpp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/dom/base/nsContentUtils.cpp b/dom/base/nsContentUtils.cpp index 1a3f5b5ca..ffe50a015 100644 --- a/dom/base/nsContentUtils.cpp +++ b/dom/base/nsContentUtils.cpp @@ -9843,4 +9843,18 @@ nsContentUtils::IsLocalRefURL(const nsString& aString) } return false; -}
\ No newline at end of file +} + +/* static */ uint32_t +nsContentUtils::GetNodeDepth(nsINode* aNode) +{ + uint32_t depth = 1; + + MOZ_ASSERT(aNode, "Node shouldn't be null"); + + while ((aNode = aNode->GetParentNode())) { + ++depth; + } + + return depth; +} |