From 16aea1a321645976b5c859dcc5ec8ccce9afae49 Mon Sep 17 00:00:00 2001 From: Margareta Eliza Balazs Date: Wed, 28 Feb 2018 12:25:31 +0200 Subject: [PATCH] Backed out changeset 283b2a4cb219 (bug 1422653) for bustage in /builds/worker/workspace/build/src/layout/base/nsCSSFrameConstructor.cpp:6840:26 on a CLOSED TREE --- dom/base/ChildIterator.cpp | 39 ++++++++++++++++---------------------- dom/base/ChildIterator.h | 31 +++++++++++------------------- 2 files changed, 27 insertions(+), 43 deletions(-) diff --git a/dom/base/ChildIterator.cpp b/dom/base/ChildIterator.cpp index 058e4b4aa450..1929a05d1b3e 100644 --- a/dom/base/ChildIterator.cpp +++ b/dom/base/ChildIterator.cpp @@ -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 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 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 diff --git a/dom/base/ChildIterator.h b/dom/base/ChildIterator.h index be95b8a54eee..2b20b4e12e71 100644 --- a/dom/base/ChildIterator.h +++ b/dom/base/ChildIterator.h @@ -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 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; }; /**