Bug 1707448 - Remove unused eAllButXBL flag. r=smaug

Differential Revision: https://phabricator.services.mozilla.com/D127539
This commit is contained in:
Emilio Cobos Álvarez 2021-10-05 14:54:47 +00:00
Родитель 95449daa6d
Коммит ebd53300c5
3 изменённых файлов: 24 добавлений и 60 удалений

Просмотреть файл

@ -79,23 +79,19 @@ nsIContent* ExplicitChildIterator::GetNextChild() {
return mChild;
}
void FlattenedChildIterator::Init(bool aIgnoreXBL) {
if (aIgnoreXBL) {
void FlattenedChildIterator::Init() {
if (!mParent->IsElement()) {
// TODO(emilio): I think it probably makes sense to only allow constructing
// FlattenedChildIterators with Element.
return;
}
// TODO(emilio): I think it probably makes sense to only allow constructing
// FlattenedChildIterators with Element.
if (mParent->IsElement()) {
if (ShadowRoot* shadow = mParent->AsElement()->GetShadowRoot()) {
mParent = shadow;
mShadowDOMInvolved = true;
return;
}
if (mParentAsSlot) {
mShadowDOMInvolved = true;
return;
}
if (ShadowRoot* shadow = mParent->AsElement()->GetShadowRoot()) {
mParent = shadow;
mShadowDOMInvolved = true;
return;
}
if (mParentAsSlot) {
mShadowDOMInvolved = true;
}
}

Просмотреть файл

@ -115,32 +115,20 @@ class FlattenedChildIterator : public ExplicitChildIterator {
bool aStartAtBeginning = true)
: ExplicitChildIterator(aParent, aStartAtBeginning),
mOriginalContent(aParent) {
Init(false);
Init();
}
bool ShadowDOMInvolved() { return mShadowDOMInvolved; }
const nsIContent* Parent() const { return mOriginalContent; }
private:
void Init(bool aIgnoreXBL);
protected:
/**
* This constructor is a hack to help AllChildrenIterator which sometimes
* doesn't want to consider XBL.
*/
FlattenedChildIterator(const nsIContent* aParent, uint32_t aFlags,
bool aStartAtBeginning = true)
: ExplicitChildIterator(aParent, aStartAtBeginning),
mOriginalContent(aParent) {
bool ignoreXBL = aFlags & nsIContent::eAllButXBL;
Init(ignoreXBL);
}
const nsIContent* mOriginalContent;
private:
void Init();
// For certain optimizations, nsCSSFrameConstructor needs to know if the child
// list of the element that we're iterating matches its .childNodes.
bool mShadowDOMInvolved = false;
@ -148,9 +136,9 @@ class FlattenedChildIterator : public ExplicitChildIterator {
/**
* AllChildrenIterator traverses the children of an element including before /
* after content and optionally XBL children. The iterator can be initialized
* to start at the end by providing false for aStartAtBeginning in order to
* start iterating in reverse from the last child.
* after content and shadow DOM. The iterator can be initialized to start at
* the end by providing false for aStartAtBeginning in order to start iterating
* in reverse from the last child.
*
* Note: it assumes that no mutation of the DOM or frame tree takes place during
* iteration, and will break horribly if that is not true.
@ -159,7 +147,7 @@ class AllChildrenIterator : private FlattenedChildIterator {
public:
AllChildrenIterator(const nsIContent* aNode, uint32_t aFlags,
bool aStartAtBeginning = true)
: FlattenedChildIterator(aNode, aFlags, aStartAtBeginning),
: FlattenedChildIterator(aNode, aStartAtBeginning),
mAnonKidsIdx(aStartAtBeginning ? UINT32_MAX : 0),
mFlags(aFlags),
mPhase(aStartAtBeginning ? eAtBegin : eAtEnd) {}

Просмотреть файл

@ -116,48 +116,28 @@ class nsIContent : public nsINode {
*
* @note the result children order is
* 1. :before generated node
* 2. XBL flattened tree children of this node
* 2. Shadow DOM flattened tree children of this node
* 3. native anonymous nodes
* 4. :after generated node
*/
eAllChildren = 0,
/**
* All XBL explicit children of the node (see
* http://www.w3.org/TR/xbl/#explicit3 ), as well as :before and :after
* anonymous content and native anonymous children.
*
* @note the result children order is
* 1. :before generated node
* 2. XBL explicit children of the node
* 3. native anonymous nodes
* 4. :after generated node
* Skip native anonymous content created for placeholder of HTML input.
*/
eAllButXBL = 1,
/**
* Skip native anonymous content created for placeholder of HTML input,
* used in conjunction with eAllChildren or eAllButXBL.
*/
eSkipPlaceholderContent = 2,
eSkipPlaceholderContent = 1 << 0,
/**
* Skip native anonymous content created by ancestor frames of the root
* element's primary frame, such as scrollbar elements created by the root
* scroll frame.
*/
eSkipDocumentLevelNativeAnonymousContent = 4,
eSkipDocumentLevelNativeAnonymousContent = 1 << 1,
};
/**
* Return either the XBL explicit children of the node or the XBL flattened
* tree children of the node, depending on the filter, as well as
* native anonymous children.
*
* @note calling this method with eAllButXBL will return children that are
* also in the eAllButXBL and eAllChildren child lists of other descendants
* of this node in the tree, but those other nodes cannot be reached from the
* eAllButXBL child list.
* Return the flattened tree children of the node, depending on the filter, as
* well as native anonymous children.
*/
virtual already_AddRefed<nsINodeList> GetChildren(uint32_t aFilter) = 0;