mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-05 07:18:39 +09:00
Issue #1783 - Part 1: Move GetNodeDepth to ResizeObserver.cpp
GetNodeDepth() is a specialized version for ResizeObserver to get the depth of a node across Shadow DOM. It's better to have this in ResizeObserver.cpp instead of the generic ContentUtils. Also updated the function to bypass the shadow root itself and not count it because ResizeObserver doesn't observe the shadow root and only needs the relative depths among all observed targets. IOW we use the flattened tree here.
This commit is contained in:
parent
d1a537b9cf
commit
51d3f2d2f3
3 changed files with 33 additions and 27 deletions
|
|
@ -9781,17 +9781,3 @@ nsContentUtils::GetClosestNonNativeAnonymousAncestor(Element* aElement)
|
|||
}
|
||||
return e;
|
||||
}
|
||||
|
||||
/* 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;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue