зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1304441 Part 2 - Extract main summary checking code to a function. r=bz
* Change the assertion to non-fatal to make it easier to debug. * Change the wording per bug 1304441 comment 11. MozReview-Commit-ID: 1UJXhC4qkrx
This commit is contained in:
Родитель
8ccd148e08
Коммит
4dc7ab9b9e
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче