Bug 1649121: part 72) Rename mEndNodes to mInclusiveAncestorsOfEndContainer. r=masayuki

Differential Revision: https://phabricator.services.mozilla.com/D84834
This commit is contained in:
Mirko Brodesser 2020-08-10 12:54:02 +00:00
parent 70847b14fc
commit 1f712acadc
2 changed files with 7 additions and 6 deletions

View File

@ -782,12 +782,12 @@ nsresult ContentSubtreeIterator::Init(const RawRangeBoundary& aStartBoundary,
}
void ContentSubtreeIterator::CacheInclusiveAncestorsOfEndContainer() {
mEndNodes.Clear();
mInclusiveAncestorsOfEndContainer.Clear();
nsINode* const endContainer = mRange->GetEndContainer();
nsIContent* endNode =
endContainer->IsContent() ? endContainer->AsContent() : nullptr;
while (endNode) {
mEndNodes.AppendElement(endNode);
mInclusiveAncestorsOfEndContainer.AppendElement(endNode);
endNode = endNode->GetParent();
}
}
@ -980,7 +980,7 @@ void ContentSubtreeIterator::Next() {
nsINode* nextNode = ContentIteratorBase::GetNextSibling(mCurNode);
NS_ASSERTION(nextNode, "No next sibling!?! This could mean deadlock!");
int32_t i = mEndNodes.IndexOf(nextNode);
int32_t i = mInclusiveAncestorsOfEndContainer.IndexOf(nextNode);
while (i != -1) {
// as long as we are finding ancestors of the endpoint of the range,
// dive down into their children
@ -991,7 +991,7 @@ void ContentSubtreeIterator::Next() {
// down the child chain to the bottom without finding an interior node,
// then the previous node should have been the last, which was
// was tested at top of routine.
i = mEndNodes.IndexOf(nextNode);
i = mInclusiveAncestorsOfEndContainer.IndexOf(nextNode);
}
mCurNode = nextNode;
@ -1004,7 +1004,7 @@ void ContentSubtreeIterator::Next() {
void ContentSubtreeIterator::Prev() {
// Prev should be optimized to use the mStartNodes, just as Next
// uses mEndNodes.
// uses mInclusiveAncestorsOfEndContainer.
if (mIsDone || !mCurNode) {
return;
}

View File

@ -258,7 +258,8 @@ class ContentSubtreeIterator final : public ContentIteratorBase {
RefPtr<nsRange> mRange;
AutoTArray<nsIContent*, 8> mEndNodes;
// See <https://dom.spec.whatwg.org/#concept-tree-inclusive-ancestor>.
AutoTArray<nsIContent*, 8> mInclusiveAncestorsOfEndContainer;
};
inline void ImplCycleCollectionTraverse(