mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-05 07:18:39 +09:00
Issue #1585 - Replace node.rootNode with node.getRootNode()
This removes the (default disabled) node.rootNode readonly attribute and replaces it with a node.getRootNode() function per WhatWG spec discussion. Based on work by John Dai <jdai@mozilla.com>
This commit is contained in:
parent
7359f90456
commit
7900742344
9 changed files with 128 additions and 89 deletions
|
|
@ -107,6 +107,7 @@
|
|||
#include "GeometryUtils.h"
|
||||
#include "nsIAnimationObserver.h"
|
||||
#include "nsChildContentList.h"
|
||||
#include "mozilla/dom/NodeBinding.h"
|
||||
|
||||
#ifdef ACCESSIBILITY
|
||||
#include "mozilla/dom/AccessibleNode.h"
|
||||
|
|
@ -250,6 +251,30 @@ nsINode::GetTextEditorRootContent(nsIEditor** aEditor)
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
nsINode* nsINode::GetRootNode(const GetRootNodeOptions& aOptions)
|
||||
{
|
||||
if (aOptions.mComposed) {
|
||||
if (IsInComposedDoc() && GetComposedDoc()) {
|
||||
return OwnerDoc();
|
||||
}
|
||||
|
||||
nsINode* node = this;
|
||||
ShadowRoot* shadowRootParent = nullptr;
|
||||
while(node) {
|
||||
node = node->SubtreeRoot();
|
||||
shadowRootParent = ShadowRoot::FromNode(node);
|
||||
if (!shadowRootParent) {
|
||||
break;
|
||||
}
|
||||
node = shadowRootParent->GetHost();
|
||||
}
|
||||
|
||||
return node;
|
||||
}
|
||||
|
||||
return SubtreeRoot();
|
||||
}
|
||||
|
||||
nsINode*
|
||||
nsINode::SubtreeRoot() const
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue