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; return mChild;
} }
void FlattenedChildIterator::Init(bool aIgnoreXBL) { void FlattenedChildIterator::Init() {
if (aIgnoreXBL) { if (!mParent->IsElement()) {
// TODO(emilio): I think it probably makes sense to only allow constructing
// FlattenedChildIterators with Element.
return; return;
} }
if (ShadowRoot* shadow = mParent->AsElement()->GetShadowRoot()) {
// TODO(emilio): I think it probably makes sense to only allow constructing mParent = shadow;
// FlattenedChildIterators with Element. mShadowDOMInvolved = true;
if (mParent->IsElement()) { return;
if (ShadowRoot* shadow = mParent->AsElement()->GetShadowRoot()) { }
mParent = shadow; if (mParentAsSlot) {
mShadowDOMInvolved = true; mShadowDOMInvolved = true;
return;
}
if (mParentAsSlot) {
mShadowDOMInvolved = true;
return;
}
} }
} }

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

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

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

@ -116,48 +116,28 @@ class nsIContent : public nsINode {
* *
* @note the result children order is * @note the result children order is
* 1. :before generated node * 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 * 3. native anonymous nodes
* 4. :after generated node * 4. :after generated node
*/ */
eAllChildren = 0, eAllChildren = 0,
/** /**
* All XBL explicit children of the node (see * Skip native anonymous content created for placeholder of HTML input.
* 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
*/ */
eAllButXBL = 1, eSkipPlaceholderContent = 1 << 0,
/**
* Skip native anonymous content created for placeholder of HTML input,
* used in conjunction with eAllChildren or eAllButXBL.
*/
eSkipPlaceholderContent = 2,
/** /**
* Skip native anonymous content created by ancestor frames of the root * Skip native anonymous content created by ancestor frames of the root
* element's primary frame, such as scrollbar elements created by the root * element's primary frame, such as scrollbar elements created by the root
* scroll frame. * scroll frame.
*/ */
eSkipDocumentLevelNativeAnonymousContent = 4, eSkipDocumentLevelNativeAnonymousContent = 1 << 1,
}; };
/** /**
* Return either the XBL explicit children of the node or the XBL flattened * Return the flattened tree children of the node, depending on the filter, as
* tree children of the node, depending on the filter, as well as * well as native anonymous children.
* 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.
*/ */
virtual already_AddRefed<nsINodeList> GetChildren(uint32_t aFilter) = 0; virtual already_AddRefed<nsINodeList> GetChildren(uint32_t aFilter) = 0;