Fix dirty reflows of bullets to deal with an empty first line (whitespace

followed by block) in the parent block.  Bug 206602, r+sr=dbaron
This commit is contained in:
bzbarsky%mit.edu 2004-04-13 01:38:10 +00:00
parent 3387854a78
commit b5aa006eb5
4 changed files with 46 additions and 28 deletions

View File

@ -5937,10 +5937,27 @@ nsBlockFrame::ReflowDirtyChild(nsIPresShell* aPresShell, nsIFrame* aChild)
}
}
// Mark the line containing the child frame dirty.
line_iterator fline = FindLineFor(aChild);
if (fline != end_lines())
MarkLineDirty(fline);
if (aChild == mBullet && HaveOutsideBullet()) {
// The bullet lives in the first line, unless the first line has
// height 0 and there is a second line, in which case it lives
// in the second line.
line_iterator bulletLine = begin_lines();
if (bulletLine != end_lines() && bulletLine->mBounds.height == 0 &&
bulletLine != mLines.back()) {
bulletLine = bulletLine.next();
}
if (bulletLine != end_lines()) {
MarkLineDirty(bulletLine);
}
// otherwise we have an empty line list, and ReflowDirtyLines
// will handle reflowing the bullet.
} else {
// Mark the line containing the child frame dirty.
line_iterator fline = FindLineFor(aChild);
if (fline != end_lines())
MarkLineDirty(fline);
}
}
// Either generate a reflow command to reflow the dirty child or

View File

@ -1697,16 +1697,8 @@ NS_IMETHODIMP nsBulletFrame::OnStartContainer(imgIRequest *aRequest,
if (shell) {
NS_ASSERTION(mParent, "No parent to pass the reflow request up to.");
if (mParent) {
// Reflow the first child of the parent not the bullet frame.
// The bullet frame is not in a line list so marking it dirty
// has no effect. The reflowing of the bullet frame is done
// indirectly.
nsIFrame* frame = mParent->GetFirstChild(nsnull);
NS_ASSERTION(frame, "No frame to mark dirty for bullet frame.");
if (frame) {
frame->AddStateBits(NS_FRAME_IS_DIRTY);
mParent->ReflowDirtyChild(shell, frame);
}
mState |= NS_FRAME_IS_DIRTY;
mParent->ReflowDirtyChild(shell, this);
}
}
}

View File

@ -5937,10 +5937,27 @@ nsBlockFrame::ReflowDirtyChild(nsIPresShell* aPresShell, nsIFrame* aChild)
}
}
// Mark the line containing the child frame dirty.
line_iterator fline = FindLineFor(aChild);
if (fline != end_lines())
MarkLineDirty(fline);
if (aChild == mBullet && HaveOutsideBullet()) {
// The bullet lives in the first line, unless the first line has
// height 0 and there is a second line, in which case it lives
// in the second line.
line_iterator bulletLine = begin_lines();
if (bulletLine != end_lines() && bulletLine->mBounds.height == 0 &&
bulletLine != mLines.back()) {
bulletLine = bulletLine.next();
}
if (bulletLine != end_lines()) {
MarkLineDirty(bulletLine);
}
// otherwise we have an empty line list, and ReflowDirtyLines
// will handle reflowing the bullet.
} else {
// Mark the line containing the child frame dirty.
line_iterator fline = FindLineFor(aChild);
if (fline != end_lines())
MarkLineDirty(fline);
}
}
// Either generate a reflow command to reflow the dirty child or

View File

@ -1697,16 +1697,8 @@ NS_IMETHODIMP nsBulletFrame::OnStartContainer(imgIRequest *aRequest,
if (shell) {
NS_ASSERTION(mParent, "No parent to pass the reflow request up to.");
if (mParent) {
// Reflow the first child of the parent not the bullet frame.
// The bullet frame is not in a line list so marking it dirty
// has no effect. The reflowing of the bullet frame is done
// indirectly.
nsIFrame* frame = mParent->GetFirstChild(nsnull);
NS_ASSERTION(frame, "No frame to mark dirty for bullet frame.");
if (frame) {
frame->AddStateBits(NS_FRAME_IS_DIRTY);
mParent->ReflowDirtyChild(shell, frame);
}
mState |= NS_FRAME_IS_DIRTY;
mParent->ReflowDirtyChild(shell, this);
}
}
}