зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1827856 - Improve docs of IsInSameAnonymousTree. r=smaug
Depends on D175353 Differential Revision: https://phabricator.services.mozilla.com/D175354
This commit is contained in:
Родитель
339529a536
Коммит
8f59e7e0f8
|
@ -5793,23 +5793,23 @@ bool nsContentUtils::HasNonEmptyTextContent(
|
|||
|
||||
/* static */
|
||||
bool nsContentUtils::IsInSameAnonymousTree(const nsINode* aNode,
|
||||
const nsIContent* aContent) {
|
||||
const nsINode* aOtherNode) {
|
||||
MOZ_ASSERT(aNode, "Must have a node to work with");
|
||||
MOZ_ASSERT(aContent, "Must have a content to work with");
|
||||
MOZ_ASSERT(aOtherNode, "Must have a content to work with");
|
||||
|
||||
if (aNode->IsInNativeAnonymousSubtree() !=
|
||||
aContent->IsInNativeAnonymousSubtree()) {
|
||||
const bool anon = aNode->IsInNativeAnonymousSubtree();
|
||||
if (anon != aOtherNode->IsInNativeAnonymousSubtree()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (aNode->IsInNativeAnonymousSubtree()) {
|
||||
return aContent->GetClosestNativeAnonymousSubtreeRoot() ==
|
||||
if (anon) {
|
||||
return aOtherNode->GetClosestNativeAnonymousSubtreeRoot() ==
|
||||
aNode->GetClosestNativeAnonymousSubtreeRoot();
|
||||
}
|
||||
|
||||
// FIXME: This doesn't deal with disconnected nodes whatsoever, but it didn't
|
||||
// use to either. Maybe that's fine.
|
||||
return aNode->GetContainingShadow() == aContent->GetContainingShadow();
|
||||
return aNode->GetContainingShadow() == aOtherNode->GetContainingShadow();
|
||||
}
|
||||
|
||||
/* static */
|
||||
|
|
|
@ -1118,11 +1118,8 @@ class nsContentUtils {
|
|||
static bool IsInPrivateBrowsing(nsILoadGroup* aLoadGroup);
|
||||
|
||||
/**
|
||||
* If aNode is not an element, return true exactly when aContent's binding
|
||||
* parent is null.
|
||||
*
|
||||
* If aNode is an element, return true exactly when aContent's binding parent
|
||||
* is the same as aNode's.
|
||||
* Returns whether a node is in the same tree as another one, accounting for
|
||||
* anonymous roots.
|
||||
*
|
||||
* This method is particularly useful for callers who are trying to ensure
|
||||
* that they are working with a non-anonymous descendant of a given node. If
|
||||
|
@ -1132,7 +1129,7 @@ class nsContentUtils {
|
|||
* Both arguments to this method must be non-null.
|
||||
*/
|
||||
static bool IsInSameAnonymousTree(const nsINode* aNode,
|
||||
const nsIContent* aContent);
|
||||
const nsINode* aOtherNode);
|
||||
|
||||
/*
|
||||
* Traverse the parent chain from aElement up to aStop, and return true if
|
||||
|
|
Загрузка…
Ссылка в новой задаче