mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-22 01:35:35 +00:00
Bug 1144096 part 20 - [css-grid] Sanity check our child lists before starting a Reflow (DEBUG only). r=dholbert
This commit is contained in:
parent
d44ff85401
commit
8a0ee1c101
@ -4954,7 +4954,7 @@ nsGridContainerFrame::Reflow(nsPresContext* aPresContext,
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
SanityCheckAnonymousGridItems();
|
||||
SanityCheckGridItemsBeforeReflow();
|
||||
#endif // DEBUG
|
||||
|
||||
const nsStylePosition* stylePos = aReflowState.mStylePosition;
|
||||
@ -5296,8 +5296,46 @@ nsGridContainerFrame::SetInitialChildList(ChildListID aListID,
|
||||
}
|
||||
|
||||
void
|
||||
nsGridContainerFrame::SanityCheckAnonymousGridItems() const
|
||||
nsGridContainerFrame::SanityCheckGridItemsBeforeReflow() const
|
||||
{
|
||||
ChildListIDs absLists = kAbsoluteList | kFixedList |
|
||||
kOverflowContainersList | kExcessOverflowContainersList;
|
||||
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()),
|
||||
"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");
|
||||
}
|
||||
}
|
||||
}
|
||||
// If we have a prev-in-flow, each of its children's next-in-flow
|
||||
// should be one of our children or be null.
|
||||
const auto pif = static_cast<nsGridContainerFrame*>(GetPrevInFlow());
|
||||
if (pif) {
|
||||
const nsFrameList* oc =
|
||||
GetPropTableFrames(OverflowContainersProperty());
|
||||
const nsFrameList* eoc =
|
||||
GetPropTableFrames(ExcessOverflowContainersProperty());
|
||||
const nsFrameList* pifEOC =
|
||||
pif->GetPropTableFrames(ExcessOverflowContainersProperty());
|
||||
for (const nsIFrame* child : pif->GetChildList(kPrincipalList)) {
|
||||
const nsIFrame* childNIF = child->GetNextInFlow();
|
||||
MOZ_ASSERT(!childNIF || mFrames.ContainsFrame(childNIF) ||
|
||||
(pifEOC && pifEOC->ContainsFrame(childNIF)) ||
|
||||
(oc && oc->ContainsFrame(childNIF)) ||
|
||||
(eoc && eoc->ContainsFrame(childNIF)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -162,7 +162,7 @@ protected:
|
||||
void MergeSortedExcessOverflowContainers(nsFrameList& aList);
|
||||
|
||||
#ifdef DEBUG
|
||||
void SanityCheckAnonymousGridItems() const;
|
||||
void SanityCheckGridItemsBeforeReflow() const;
|
||||
#endif // DEBUG
|
||||
|
||||
private:
|
||||
|
Loading…
Reference in New Issue
Block a user