Bug 868498. Don't reframe for changes between position:static and position:relative. r=heycam

This commit is contained in:
Robert O'Callahan 2013-07-16 08:58:52 -04:00
parent 160820c8f3
commit 019984039a

View File

@ -2213,18 +2213,34 @@ nsStyleDisplay::nsStyleDisplay(const nsStyleDisplay& aSource)
mPerspectiveOrigin[1] = aSource.mPerspectiveOrigin[1];
}
static uint8_t
MapRelativePositionToStatic(uint8_t aPositionValue)
{
return aPositionValue == NS_STYLE_POSITION_RELATIVE ?
NS_STYLE_POSITION_STATIC : aPositionValue;
}
nsChangeHint nsStyleDisplay::CalcDifference(const nsStyleDisplay& aOther) const
{
nsChangeHint hint = nsChangeHint(0);
// Changes between position:static and position:relative don't need
// to reconstruct frames.
if (!EqualURIs(mBinding, aOther.mBinding)
|| mPosition != aOther.mPosition
|| MapRelativePositionToStatic(mPosition) !=
MapRelativePositionToStatic(aOther.mPosition)
|| mDisplay != aOther.mDisplay
|| (mFloats == NS_STYLE_FLOAT_NONE) != (aOther.mFloats == NS_STYLE_FLOAT_NONE)
|| mOverflowX != aOther.mOverflowX
|| mOverflowY != aOther.mOverflowY
|| mResize != aOther.mResize)
|| mResize != aOther.mResize) {
NS_UpdateHint(hint, nsChangeHint_ReconstructFrame);
}
if (mPosition != aOther.mPosition) {
NS_UpdateHint(hint,
NS_CombineHint(nsChangeHint_NeedReflow, nsChangeHint_RepaintFrame));
}
if (mFloats != aOther.mFloats) {
// Changing which side we float on doesn't affect descendants directly