diff --git a/layout/base/nsCSSFrameConstructor.cpp b/layout/base/nsCSSFrameConstructor.cpp index f167c8c9905d..d883b6f06ec0 100644 --- a/layout/base/nsCSSFrameConstructor.cpp +++ b/layout/base/nsCSSFrameConstructor.cpp @@ -9868,14 +9868,12 @@ nsCSSFrameConstructor::CreateNeededAnonFlexOrGridItems( return; } - nsIAtom* containerType = aParentFrame->GetType(); const bool isWebkitBox = nsFlexContainerFrame::IsLegacyBox(aParentFrame); FCItemIterator iter(aItems); do { // Advance iter past children that don't want to be wrapped - if (iter.SkipItemsThatDontNeedAnonFlexOrGridItem(aState, containerType, - isWebkitBox)) { + if (iter.SkipItemsThatDontNeedAnonFlexOrGridItem(aState, isWebkitBox)) { // Hit the end of the items without finding any remaining children that // need to be wrapped. We're finished! return; @@ -9898,9 +9896,7 @@ nsCSSFrameConstructor::CreateNeededAnonFlexOrGridItems( bool hitEnd = afterWhitespaceIter.SkipWhitespace(aState); bool nextChildNeedsAnonItem = !hitEnd && - afterWhitespaceIter.item().NeedsAnonFlexOrGridItem(aState, - containerType, - isWebkitBox); + afterWhitespaceIter.item().NeedsAnonFlexOrGridItem(aState, isWebkitBox); if (!nextChildNeedsAnonItem) { // There's nothing after the whitespace that we need to wrap, so we @@ -9914,8 +9910,7 @@ nsCSSFrameConstructor::CreateNeededAnonFlexOrGridItems( // we jump back to the beginning of the loop to skip over that child // (and anything else non-wrappable after it) MOZ_ASSERT(!iter.IsDone() && - !iter.item().NeedsAnonFlexOrGridItem(aState, containerType, - isWebkitBox), + !iter.item().NeedsAnonFlexOrGridItem(aState, isWebkitBox), "hitEnd and/or nextChildNeedsAnonItem lied"); continue; } @@ -9925,15 +9920,14 @@ nsCSSFrameConstructor::CreateNeededAnonFlexOrGridItems( // anonymous flex/grid item. Now we see how many children after it also want // to be wrapped in an anonymous flex/grid item. FCItemIterator endIter(iter); // iterator to find the end of the group - endIter.SkipItemsThatNeedAnonFlexOrGridItem(aState, containerType, - isWebkitBox); + endIter.SkipItemsThatNeedAnonFlexOrGridItem(aState, isWebkitBox); NS_ASSERTION(iter != endIter, "Should've had at least one wrappable child to seek past"); // Now, we create the anonymous flex or grid item to contain the children // between |iter| and |endIter|. - nsIAtom* pseudoType = containerType == nsGkAtoms::flexContainerFrame ? + nsIAtom* pseudoType = (aParentFrame->GetType() == nsGkAtoms::flexContainerFrame) ? nsCSSAnonBoxes::anonymousFlexItem : nsCSSAnonBoxes::anonymousGridItem; nsStyleContext* parentStyle = aParentFrame->StyleContext(); nsIContent* parentContent = aParentFrame->GetContent(); @@ -12171,11 +12165,9 @@ nsCSSFrameConstructor::WipeContainingBlock(nsFrameConstructorState& aState, // Check if we're adding to-be-wrapped content right *after* an existing // anonymous flex or grid item (which would need to absorb this content). - nsIAtom* containerType = aFrame->GetType(); const bool isWebkitBox = nsFlexContainerFrame::IsLegacyBox(aFrame); if (aPrevSibling && IsAnonymousFlexOrGridItem(aPrevSibling) && - iter.item().NeedsAnonFlexOrGridItem(aState, containerType, - isWebkitBox)) { + iter.item().NeedsAnonFlexOrGridItem(aState, isWebkitBox)) { RecreateFramesForContent(aFrame->GetContent(), true, REMOVE_FOR_RECONSTRUCTION, nullptr); return true; @@ -12187,8 +12179,7 @@ nsCSSFrameConstructor::WipeContainingBlock(nsFrameConstructorState& aState, // Jump to the last entry in the list iter.SetToEnd(); iter.Prev(); - if (iter.item().NeedsAnonFlexOrGridItem(aState, containerType, - isWebkitBox)) { + if (iter.item().NeedsAnonFlexOrGridItem(aState, isWebkitBox)) { RecreateFramesForContent(aFrame->GetContent(), true, REMOVE_FOR_RECONSTRUCTION, nullptr); return true; @@ -12216,7 +12207,6 @@ nsCSSFrameConstructor::WipeContainingBlock(nsFrameConstructorState& aState, nsIFrame* containerFrame = aFrame->GetParent(); const bool isWebkitBox = nsFlexContainerFrame::IsLegacyBox(containerFrame); if (!iter.SkipItemsThatNeedAnonFlexOrGridItem(aState, - containerFrame->GetType(), isWebkitBox)) { // We hit something that _doesn't_ need an anonymous flex item! // Rebuild the flex container to bust it out. @@ -12675,7 +12665,6 @@ Iterator::SkipItemsNotWantingParentType(ParentType aParentType) bool nsCSSFrameConstructor::FrameConstructionItem:: NeedsAnonFlexOrGridItem(const nsFrameConstructorState& aState, - nsIAtom* aContainerType, bool aIsWebkitBox) { if (mFCData->mBits & FCDATA_IS_LINE_PARTICIPANT) { @@ -12696,12 +12685,10 @@ inline bool nsCSSFrameConstructor::FrameConstructionItemList:: Iterator::SkipItemsThatNeedAnonFlexOrGridItem( const nsFrameConstructorState& aState, - nsIAtom* aContainerType, bool aIsWebkitBox) { NS_PRECONDITION(!IsDone(), "Shouldn't be done yet"); - while (item().NeedsAnonFlexOrGridItem(aState, aContainerType, - aIsWebkitBox)) { + while (item().NeedsAnonFlexOrGridItem(aState, aIsWebkitBox)) { Next(); if (IsDone()) { return true; @@ -12714,12 +12701,10 @@ inline bool nsCSSFrameConstructor::FrameConstructionItemList:: Iterator::SkipItemsThatDontNeedAnonFlexOrGridItem( const nsFrameConstructorState& aState, - nsIAtom* aContainerType, bool aIsWebkitBox) { NS_PRECONDITION(!IsDone(), "Shouldn't be done yet"); - while (!(item().NeedsAnonFlexOrGridItem(aState, aContainerType, - aIsWebkitBox))) { + while (!(item().NeedsAnonFlexOrGridItem(aState, aIsWebkitBox))) { Next(); if (IsDone()) { return true; diff --git a/layout/base/nsCSSFrameConstructor.h b/layout/base/nsCSSFrameConstructor.h index 346d73f13c28..7d1b8d42fffe 100644 --- a/layout/base/nsCSSFrameConstructor.h +++ b/layout/base/nsCSSFrameConstructor.h @@ -956,14 +956,14 @@ private: // Return whether the iterator is done after doing that. // The iterator must not be done when this is called. inline bool SkipItemsThatNeedAnonFlexOrGridItem( - const nsFrameConstructorState& aState, nsIAtom* aContainerType, + const nsFrameConstructorState& aState, bool aIsWebkitBox); // Skip to the first frame that is a non-replaced inline or is // positioned. Return whether the iterator is done after doing that. // The iterator must not be done when this is called. inline bool SkipItemsThatDontNeedAnonFlexOrGridItem( - const nsFrameConstructorState& aState, nsIAtom* aContainerType, + const nsFrameConstructorState& aState, bool aIsWebkitBox); // Skip over all items that do not want a ruby parent. Return whether @@ -1099,7 +1099,6 @@ private: // but we use different rules for what gets wrapped. The aIsWebkitBox // parameter here tells us whether to use those different rules.) bool NeedsAnonFlexOrGridItem(const nsFrameConstructorState& aState, - nsIAtom* aContainerType, bool aIsWebkitBox); // Don't call this unless the frametree really depends on the answer!