Bug 508900. Fix assertion due to us not unsetting all the bits we should unset. r=dbaron

This commit is contained in:
Boris Zbarsky 2009-08-10 10:54:21 -04:00
Родитель d0e2627d8f
Коммит 0f75be802d
2 изменённых файлов: 22 добавлений и 7 удалений

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

@ -1080,6 +1080,10 @@ CaptureChange(nsStyleContext* aOldContext, nsStyleContext* aNewContext,
nsChangeHint aChangeToAssume)
{
nsChangeHint ourChange = aOldContext->CalcStyleDifference(aNewContext);
NS_ASSERTION(!(ourChange & nsChangeHint_ReflowFrame) ||
(ourChange & nsChangeHint_NeedReflow),
"Reflow hint bits set without actually asking for a reflow");
NS_UpdateHint(ourChange, aChangeToAssume);
if (NS_UpdateHint(aMinChange, ourChange)) {
aChangeList->AppendChange(aFrame, aContent, ourChange);
@ -1103,14 +1107,22 @@ nsFrameManager::ReResolveStyleContext(nsPresContext *aPresContext,
nsChangeHint aMinChange,
PRBool aFireAccessibilityEvents)
{
// If aMinChange doesn't include nsChangeHint_NeedDirtyReflow, clear out the
// nsChangeHint_NeedReflow bit from it, so that we'll make sure to append a
// change to the list for ourselves if we need a reflow. Need this because
// the parent may or may not actually end up reflowing us otherwise. This
// works because any reflow hint will include nsChangeHint_NeedReflow, which
// will be missing from aMinChange.
if (!NS_IsHintSubset(nsChangeHint_NeedDirtyReflow, aMinChange)) {
aMinChange = NS_SubtractHint(aMinChange, nsChangeHint_NeedReflow);
// If aMinChange doesn't include nsChangeHint_NeedDirtyReflow, clear out
// all the reflow change bits from it, so that we'll make sure to append a
// change to the list for ourselves if we need a reflow. We need this
// because the parent may or may not actually end up reflowing us
// otherwise.
aMinChange = NS_SubtractHint(aMinChange, nsChangeHint_ReflowFrame);
} else if (!NS_IsHintSubset(nsChangeHint_ClearDescendantIntrinsics,
aMinChange)) {
// If aMinChange doesn't include nsChangeHint_ClearDescendantIntrinsics,
// clear out the nsChangeHint_ClearAncestorIntrinsics flag, since it's
// possible that we had some random ancestor that cleared ancestor
// intrinsic widths, but we still need to clear intrinsic widths on frames
// that are our ancestors but its descendants.
aMinChange =
NS_SubtractHint(aMinChange, nsChangeHint_ClearAncestorIntrinsics);
}
// It would be nice if we could make stronger assertions here; they

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

@ -94,6 +94,9 @@ nsStyleChangeList::AppendChange(nsIFrame* aFrame, nsIContent* aContent, nsChange
"must have content");
NS_ASSERTION(!aContent || aContent->IsNodeOfType(nsINode::eELEMENT),
"Shouldn't be trying to restyle non-elements directly");
NS_ASSERTION(!(aHint & nsChangeHint_ReflowFrame) ||
(aHint & nsChangeHint_NeedReflow),
"Reflow hint bits set without actually asking for a reflow");
if ((0 < mCount) && (aHint & nsChangeHint_ReconstructFrame)) { // filter out all other changes for same content
if (aContent) {