Bug 1415683 - Make nsGridContainerFrame aware of the ::backdrop placeholder list. r=dholbert
MozReview-Commit-ID: KtOTmQSYgAn
--- a/layout/generic/ViewportFrame.cpp
+++ b/layout/generic/ViewportFrame.cpp
@@ -164,16 +164,19 @@ ViewportFrame::BuildDisplayListForTopLay
if (!(frame->GetStateBits() & NS_FRAME_OUT_OF_FLOW)) {
MOZ_ASSERT(!elem->GetParent()->IsHTMLElement(), "HTML element "
"should always be out-of-flow if in the top layer");
continue;
}
if (nsIFrame* backdropPh =
frame->GetChildList(kBackdropList).FirstChild()) {
MOZ_ASSERT(backdropPh->IsPlaceholderFrame());
+ MOZ_ASSERT(!backdropPh->GetNextSibling(), "more than one ::backdrop?");
+ MOZ_ASSERT(backdropPh->HasAnyStateBits(NS_FRAME_FIRST_REFLOW),
+ "did you intend to reflow ::backdrop placeholders?");
nsIFrame* backdropFrame =
static_cast<nsPlaceholderFrame*>(backdropPh)->GetOutOfFlowFrame();
MOZ_ASSERT(backdropFrame);
BuildDisplayListForTopLayerFrame(aBuilder, backdropFrame, aList);
}
BuildDisplayListForTopLayerFrame(aBuilder, frame, aList);
}
}
--- a/layout/generic/nsGridContainerFrame.cpp
+++ b/layout/generic/nsGridContainerFrame.cpp
@@ -6460,16 +6460,19 @@ nsGridContainerFrame::InsertFrames(Child
}
void
nsGridContainerFrame::RemoveFrame(ChildListID aListID, nsIFrame* aOldFrame)
{
#ifdef DEBUG
ChildListIDs supportedLists =
kAbsoluteList | kFixedList | kPrincipalList | kNoReflowPrincipalList;
+ // We don't handle the kBackdropList frames in any way, but it only contains
+ // a placeholder for ::backdrop which is OK to not reflow (for now anyway).
+ supportedLists |= kBackdropList;
MOZ_ASSERT(supportedLists.Contains(aListID), "unexpected child list");
// Note that kPrincipalList doesn't mean aOldFrame must be on that list.
// It can also be on kOverflowList, in which case it might be a pushed
// item, and if it's the only pushed item our DID_PUSH_ITEMS bit will lie.
if (aListID == kPrincipalList && !aOldFrame->GetPrevInFlow()) {
// Since the bit may lie, set the mDidPushItemsBitMayLie value to true for
// ourself and for all our contiguous previous-in-flow nsGridContainerFrames.
@@ -6679,16 +6682,19 @@ nsGridContainerFrame::GetFrameName(nsASt
void
nsGridContainerFrame::NoteNewChildren(ChildListID aListID,
const nsFrameList& aFrameList)
{
#ifdef DEBUG
ChildListIDs supportedLists =
kAbsoluteList | kFixedList | kPrincipalList | kNoReflowPrincipalList;
+ // We don't handle the kBackdropList frames in any way, but it only contains
+ // a placeholder for ::backdrop which is OK to not reflow (for now anyway).
+ supportedLists |= kBackdropList;
MOZ_ASSERT(supportedLists.Contains(aListID), "unexpected child list");
#endif
nsIPresShell* shell = PresShell();
for (auto pif = GetPrevInFlow(); pif; pif = pif->GetPrevInFlow()) {
if (aListID == kPrincipalList) {
pif->AddStateBits(NS_STATE_GRID_DID_PUSH_ITEMS);
}
@@ -6798,18 +6804,23 @@ nsGridContainerFrame::FindLastItemInGrid
return result;
}
#ifdef DEBUG
void
nsGridContainerFrame::SetInitialChildList(ChildListID aListID,
nsFrameList& aChildList)
{
+#ifdef DEBUG
ChildListIDs supportedLists = kAbsoluteList | kFixedList | kPrincipalList;
+ // We don't handle the kBackdropList frames in any way, but it only contains
+ // a placeholder for ::backdrop which is OK to not reflow (for now anyway).
+ supportedLists |= kBackdropList;
MOZ_ASSERT(supportedLists.Contains(aListID), "unexpected child list");
+#endif
return nsContainerFrame::SetInitialChildList(aListID, aChildList);
}
void
nsGridContainerFrame::SanityCheckGridItemsBeforeReflow() const
{
ChildListIDs absLists = kAbsoluteList | kFixedList |
@@ -6817,17 +6828,18 @@ nsGridContainerFrame::SanityCheckGridIte
ChildListIDs itemLists = kPrincipalList | kOverflowList;
for (const nsIFrame* f = this; f; f = f->GetNextInFlow()) {
MOZ_ASSERT(!f->HasAnyStateBits(NS_STATE_GRID_DID_PUSH_ITEMS),
"At start of reflow, we should've pulled items back from all "
"NIFs and cleared NS_STATE_GRID_DID_PUSH_ITEMS in the process");
for (nsIFrame::ChildListIterator childLists(f);
!childLists.IsDone(); childLists.Next()) {
if (!itemLists.Contains(childLists.CurrentID())) {
- MOZ_ASSERT(absLists.Contains(childLists.CurrentID()),
+ MOZ_ASSERT(absLists.Contains(childLists.CurrentID()) ||
+ childLists.CurrentID() == kBackdropList,
"unexpected non-empty child list");
continue;
}
for (auto child : childLists.CurrentList()) {
MOZ_ASSERT(f == this || child->GetPrevInFlow(),
"all pushed items must be pulled up before reflow");
}
}