Backed out changeset 283b2a4cb219 (bug 1422653) for bustage in /builds/worker/workspace/build/src/layout/base/nsCSSFrameConstructor.cpp:6840:26 on a CLOSED TREE

This commit is contained in:
Margareta Eliza Balazs 2018-02-28 12:25:31 +02:00
parent ded0553ffd
commit 16aea1a321
2 changed files with 27 additions and 43 deletions

View File

@ -124,7 +124,6 @@ void
FlattenedChildIterator::Init(bool aIgnoreXBL)
{
if (aIgnoreXBL) {
mXBLInvolved = Some(false);
return;
}
@ -133,7 +132,7 @@ FlattenedChildIterator::Init(bool aIgnoreXBL)
if (mParent->IsElement()) {
if (ShadowRoot* shadow = mParent->AsElement()->GetShadowRoot()) {
mParent = shadow;
mXBLInvolved = Some(true);
mXBLInvolved = true;
return;
}
}
@ -144,31 +143,25 @@ FlattenedChildIterator::Init(bool aIgnoreXBL)
if (binding) {
MOZ_ASSERT(binding->GetAnonymousContent());
mParent = binding->GetAnonymousContent();
mXBLInvolved = Some(true);
}
}
bool
FlattenedChildIterator::ComputeWhetherXBLIsInvolved() const
{
MOZ_ASSERT(mXBLInvolved.isNothing());
// We set mXBLInvolved to true if either the node we're iterating has a
// binding with content attached to it (in which case it is handled in Init),
// or the node is generated XBL content and has an <xbl:children> child.
if (!mParent->GetBindingParent()) {
return false;
mXBLInvolved = true;
}
for (nsIContent* child = mParent->GetFirstChild();
child;
child = child->GetNextSibling()) {
if (child->NodeInfo()->Equals(nsGkAtoms::children, kNameSpaceID_XBL)) {
MOZ_ASSERT(child->GetBindingParent());
return true;
// We set mXBLInvolved to true if either:
// - The node we're iterating has a binding with content attached to it.
// - The node is generated XBL content and has an <xbl:children> child.
//
// FIXME(emilio): This is very slow :(
if (!mXBLInvolved && mParent->GetBindingParent()) {
for (nsIContent* child = mParent->GetFirstChild();
child;
child = child->GetNextSibling()) {
if (child->NodeInfo()->Equals(nsGkAtoms::children, kNameSpaceID_XBL)) {
MOZ_ASSERT(child->GetBindingParent());
mXBLInvolved = true;
break;
}
}
}
return false;
}
bool

View File

@ -134,6 +134,7 @@ public:
explicit FlattenedChildIterator(const nsIContent* aParent,
bool aStartAtBeginning = true)
: ExplicitChildIterator(aParent, aStartAtBeginning)
, mXBLInvolved(false)
, mOriginalContent(aParent)
{
Init(false);
@ -141,30 +142,20 @@ public:
FlattenedChildIterator(FlattenedChildIterator&& aOther)
: ExplicitChildIterator(Move(aOther))
, mOriginalContent(aOther.mOriginalContent)
, mXBLInvolved(aOther.mXBLInvolved)
, mOriginalContent(aOther.mOriginalContent)
{}
FlattenedChildIterator(const FlattenedChildIterator& aOther)
: ExplicitChildIterator(aOther)
, mOriginalContent(aOther.mOriginalContent)
, mXBLInvolved(aOther.mXBLInvolved)
, mOriginalContent(aOther.mOriginalContent)
{}
bool XBLInvolved() {
if (mXBLInvolved.isNothing()) {
mXBLInvolved = Some(ComputeWhetherXBLIsInvolved());
}
return *mXBLInvolved;
}
bool XBLInvolved() { return mXBLInvolved; }
const nsIContent* Parent() const { return mOriginalContent; }
private:
bool ComputeWhetherXBLIsInvolved() const;
void Init(bool aIgnoreXBL);
protected:
/**
* This constructor is a hack to help AllChildrenIterator which sometimes
@ -173,20 +164,20 @@ protected:
FlattenedChildIterator(const nsIContent* aParent, uint32_t aFlags,
bool aStartAtBeginning = true)
: ExplicitChildIterator(aParent, aStartAtBeginning)
, mXBLInvolved(false)
, mOriginalContent(aParent)
{
bool ignoreXBL = aFlags & nsIContent::eAllButXBL;
Init(ignoreXBL);
}
const nsIContent* mOriginalContent;
void Init(bool aIgnoreXBL);
private:
// For certain optimizations, nsCSSFrameConstructor needs to know if the child
// list of the element that we're iterating matches its .childNodes.
//
// This is lazily computed when asked for it.
Maybe<bool> mXBLInvolved;
// For certain optimizations, nsCSSFrameConstructor needs to know if the
// child list of the element that we're iterating matches its .childNodes.
bool mXBLInvolved;
const nsIContent* mOriginalContent;
};
/**