diff --git a/layout/generic/DetailsFrame.cpp b/layout/generic/DetailsFrame.cpp index 768d99917832..a12211c18ea6 100644 --- a/layout/generic/DetailsFrame.cpp +++ b/layout/generic/DetailsFrame.cpp @@ -68,20 +68,7 @@ DetailsFrame::SetInitialChildList(ChildListID aListID, nsFrameList& aChildList) } #ifdef DEBUG - for (nsIFrame* child : aChildList) { - HTMLSummaryElement* summary = - HTMLSummaryElement::FromContent(child->GetContent()); - - if (child == aChildList.FirstChild()) { - if (summary && summary->IsMainSummary()) { - break; - } - } else { - MOZ_ASSERT(!summary || !summary->IsMainSummary(), - "Rest of the children are neither summary elements nor" - "the main summary!"); - } - } + CheckValidMainSummary(aChildList); #endif } @@ -89,6 +76,27 @@ DetailsFrame::SetInitialChildList(ChildListID aListID, nsFrameList& aChildList) nsBlockFrame::SetInitialChildList(aListID, aChildList); } +#ifdef DEBUG +void +DetailsFrame::CheckValidMainSummary(const nsFrameList& aFrameList) const +{ + for (nsIFrame* child : aFrameList) { + HTMLSummaryElement* summary = + HTMLSummaryElement::FromContent(child->GetContent()); + + if (child == aFrameList.FirstChild()) { + if (summary && summary->IsMainSummary()) { + break; + } + } else { + NS_ASSERTION(!summary || !summary->IsMainSummary(), + "Rest of the children are either not summary element " + "or are not the main summary!"); + } + } +} +#endif + void DetailsFrame::DestroyFrom(nsIFrame* aDestructRoot) { diff --git a/layout/generic/DetailsFrame.h b/layout/generic/DetailsFrame.h index 2a9a517f7000..435019195dfc 100644 --- a/layout/generic/DetailsFrame.h +++ b/layout/generic/DetailsFrame.h @@ -38,6 +38,12 @@ public: } #endif +#ifdef DEBUG + // Check the frame of the main summary element is the first child in the frame + // list. + void CheckValidMainSummary(const nsFrameList& aFrameList) const; +#endif + void SetInitialChildList(ChildListID aListID, nsFrameList& aChildList) override;