Bug 1041512 - Mark intrinsic widths dirty on a style change even if the frame hasn't had its first reflow yet. r=dbaron

This commit is contained in:
Cameron McCormack
2014-09-17 10:40:11 +10:00
parent 21b8c0bd79
commit 72c8556198
3 changed files with 26 additions and 16 deletions

View File

@@ -501,11 +501,6 @@ RestyleManager::RecomputePosition(nsIFrame* aFrame)
void
RestyleManager::StyleChangeReflow(nsIFrame* aFrame, nsChangeHint aHint)
{
// If the frame hasn't even received an initial reflow, then don't
// send it a style-change reflow!
if (aFrame->GetStateBits() & NS_FRAME_FIRST_REFLOW)
return;
nsIPresShell::IntrinsicDirty dirtyType;
if (aHint & nsChangeHint_ClearDescendantIntrinsics) {
NS_ASSERTION(aHint & nsChangeHint_ClearAncestorIntrinsics,
@@ -518,18 +513,23 @@ RestyleManager::StyleChangeReflow(nsIFrame* aFrame, nsChangeHint aHint)
}
nsFrameState dirtyBits;
if (aHint & nsChangeHint_NeedDirtyReflow) {
if (aFrame->GetStateBits() & NS_FRAME_FIRST_REFLOW) {
dirtyBits = nsFrameState(0);
} else if (aHint & nsChangeHint_NeedDirtyReflow) {
dirtyBits = NS_FRAME_IS_DIRTY;
} else {
dirtyBits = NS_FRAME_HAS_DIRTY_CHILDREN;
}
// If we're not going to clear any intrinsic sizes on the frames, and
// there are no dirty bits to set, then there's nothing to do.
if (dirtyType == nsIPresShell::eResize && !dirtyBits)
return;
do {
mPresContext->PresShell()->FrameNeedsReflow(aFrame, dirtyType, dirtyBits);
aFrame = nsLayoutUtils::GetNextContinuationOrIBSplitSibling(aFrame);
} while (aFrame);
return;
}
void