Bug 1369037 - Make the assertions about NS_FRAME_PART_OF_IBSPLIT stricter and update the associated frame properties in nsContainerFrame::DestroyFrom instead of nsFrame::DestroyFrom. r=jfkthame

MozReview-Commit-ID: G8NQ70xzkQU
This commit is contained in:
Mats Palmgren 2017-05-31 21:29:49 +02:00
Родитель 26214cbd6f
Коммит 6a061ca6cf
4 изменённых файлов: 34 добавлений и 24 удалений

Просмотреть файл

@ -512,7 +512,11 @@ ReparentFrames(nsCSSFrameConstructor* aFrameConstructor,
static inline bool
IsFramePartOfIBSplit(nsIFrame* aFrame)
{
return (aFrame->GetStateBits() & NS_FRAME_PART_OF_IBSPLIT) != 0;
bool result = (aFrame->GetStateBits() & NS_FRAME_PART_OF_IBSPLIT) != 0;
MOZ_ASSERT(!result || static_cast<nsBlockFrame*>(do_QueryFrame(aFrame)) ||
static_cast<nsInlineFrame*>(do_QueryFrame(aFrame)),
"only block/inline frames can have NS_FRAME_PART_OF_IBSPLIT");
return result;
}
static nsContainerFrame* GetIBSplitSibling(nsIFrame* aFrame)

Просмотреть файл

@ -222,6 +222,32 @@ nsContainerFrame::DestroyFrom(nsIFrame* aDestructRoot)
// Destroy frames on the principal child list.
mFrames.DestroyFramesFrom(aDestructRoot);
// If we have any IB split siblings, clear their references to us.
if (HasAnyStateBits(NS_FRAME_PART_OF_IBSPLIT)) {
// Delete previous sibling's reference to me.
nsIFrame* prevSib = GetProperty(nsIFrame::IBSplitPrevSibling());
if (prevSib) {
NS_WARNING_ASSERTION(
this == prevSib->GetProperty(nsIFrame::IBSplitSibling()),
"IB sibling chain is inconsistent");
prevSib->DeleteProperty(nsIFrame::IBSplitSibling());
}
// Delete next sibling's reference to me.
nsIFrame* nextSib = GetProperty(nsIFrame::IBSplitSibling());
if (nextSib) {
NS_WARNING_ASSERTION(
this == nextSib->GetProperty(nsIFrame::IBSplitPrevSibling()),
"IB sibling chain is inconsistent");
nextSib->DeleteProperty(nsIFrame::IBSplitPrevSibling());
}
#ifdef DEBUG
// This is just so we can assert it's not set in nsFrame::DestroyFrom.
RemoveStateBits(NS_FRAME_PART_OF_IBSPLIT);
#endif
}
// Destroy frames on the auxiliary frame lists and delete the lists.
nsPresContext* pc = PresContext();
nsIPresShell* shell = pc->PresShell();

Просмотреть файл

@ -712,6 +712,8 @@ nsFrame::DestroyFrom(nsIFrame* aDestructRoot)
"Frames should be removed before destruction.");
NS_ASSERTION(aDestructRoot, "Must specify destruct root");
MOZ_ASSERT(!HasAbsolutelyPositionedChildren());
MOZ_ASSERT(!HasAnyStateBits(NS_FRAME_PART_OF_IBSPLIT),
"NS_FRAME_PART_OF_IBSPLIT set on non-nsContainerFrame?");
nsSVGEffects::InvalidateDirectRenderingObservers(this);
@ -738,28 +740,6 @@ nsFrame::DestroyFrom(nsIFrame* aDestructRoot)
}
}
// If we have any IB split siblings, clear their references to us.
// (Note: This has to happen before we clear our Properties() table.)
if (mState & NS_FRAME_PART_OF_IBSPLIT) {
// Delete previous sibling's reference to me.
nsIFrame* prevSib = GetProperty(nsIFrame::IBSplitPrevSibling());
if (prevSib) {
NS_WARNING_ASSERTION(
this == prevSib->GetProperty(nsIFrame::IBSplitSibling()),
"IB sibling chain is inconsistent");
prevSib->DeleteProperty(nsIFrame::IBSplitSibling());
}
// Delete next sibling's reference to me.
nsIFrame* nextSib = GetProperty(nsIFrame::IBSplitSibling());
if (nextSib) {
NS_WARNING_ASSERTION(
this == nextSib->GetProperty(nsIFrame::IBSplitPrevSibling()),
"IB sibling chain is inconsistent");
nextSib->DeleteProperty(nsIFrame::IBSplitPrevSibling());
}
}
bool isPrimaryFrame = (mContent && mContent->GetPrimaryFrame() == this);
if (isPrimaryFrame) {
// This needs to happen before we clear our Properties() table.

Просмотреть файл

@ -140,7 +140,7 @@ FRAME_STATE_BIT(Generic, 14, NS_FRAME_INDEPENDENT_SELECTION)
// If this bit is set, the frame is part of the mangled frame hierarchy
// that results when an inline has been split because of a nested block.
// See the comments in nsCSSFrameConstructor::ConstructInline for
// more details.
// more details. (this is only set on nsBlockFrame/nsInlineFrame frames)
FRAME_STATE_BIT(Generic, 15, NS_FRAME_PART_OF_IBSPLIT)
// If this bit is set, then transforms (e.g. CSS or SVG transforms) are allowed