Bug 420351. Don't let empty list-bullets make a line non-empty. r+sr=dbaron

This commit is contained in:
roc+@cs.cmu.edu 2008-03-11 17:46:18 -07:00
parent e187655349
commit dc7c75d483
4 changed files with 29 additions and 11 deletions

View File

@ -120,6 +120,18 @@ nsBulletFrame::GetType() const
return nsGkAtoms::bulletFrame;
}
PRBool
nsBulletFrame::IsEmpty()
{
return IsSelfEmpty();
}
PRBool
nsBulletFrame::IsSelfEmpty()
{
return GetStyleList()->mListStyleType == NS_STYLE_LIST_STYLE_NONE;
}
NS_IMETHODIMP
nsBulletFrame::DidSetStyleContext()
{

View File

@ -101,6 +101,9 @@ public:
void PaintBullet(nsIRenderingContext& aRenderingContext, nsPoint aPt,
const nsRect& aDirtyRect);
virtual PRBool IsEmpty();
virtual PRBool IsSelfEmpty();
protected:
void GetDesiredSize(nsPresContext* aPresContext,

View File

@ -868,10 +868,12 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame,
// the float. At the same time, check if the frame has any non-collapsed-away
// content.
PRBool placedFloat = PR_FALSE;
PRBool hasNoncollapsedContent = PR_TRUE;
if (frameType) {
PRBool isEmpty;
if (!frameType) {
isEmpty = pfd->mFrame->IsEmpty();
} else {
if (nsGkAtoms::placeholderFrame == frameType) {
hasNoncollapsedContent = PR_FALSE;
isEmpty = PR_TRUE;
pfd->SetFlag(PFD_SKIPWHENTRIMMINGWHITESPACE, PR_TRUE);
nsIFrame* outOfFlowFrame = nsLayoutUtils::GetFloatFromPlaceholder(aFrame);
if (outOfFlowFrame) {
@ -893,9 +895,8 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame,
// Note non-empty text-frames for inline frame compatibility hackery
pfd->SetFlag(PFD_ISTEXTFRAME, PR_TRUE);
nsTextFrame* textFrame = static_cast<nsTextFrame*>(pfd->mFrame);
if (!textFrame->HasNoncollapsedCharacters()) {
hasNoncollapsedContent = PR_FALSE;
} else {
isEmpty = !textFrame->HasNoncollapsedCharacters();
if (!isEmpty) {
pfd->SetFlag(PFD_ISNONEMPTYTEXTFRAME, PR_TRUE);
nsIContent* content = textFrame->GetContent();
@ -924,13 +925,15 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame,
}
else if (nsGkAtoms::brFrame == frameType) {
pfd->SetFlag(PFD_SKIPWHENTRIMMINGWHITESPACE, PR_TRUE);
isEmpty = PR_FALSE;
} else {
if (nsGkAtoms::letterFrame==frameType) {
pfd->SetFlag(PFD_ISLETTERFRAME, PR_TRUE);
}
if (pfd->mSpan &&
!pfd->mSpan->mHasNonemptyContent && pfd->mFrame->IsSelfEmpty()) {
hasNoncollapsedContent = PR_FALSE;
if (pfd->mSpan) {
isEmpty = !pfd->mSpan->mHasNonemptyContent && pfd->mFrame->IsSelfEmpty();
} else {
isEmpty = pfd->mFrame->IsEmpty();
}
}
}
@ -1012,7 +1015,7 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame,
if (CanPlaceFrame(pfd, reflowState, notSafeToBreak, continuingTextRun,
savedOptionalBreakContent != nsnull, metrics,
aReflowStatus, &optionalBreakAfterFits)) {
if (hasNoncollapsedContent) {
if (!isEmpty) {
psd->mHasNonemptyContent = PR_TRUE;
}

View File

@ -752,6 +752,6 @@ random == 403134-1.html 403134-1-ref.html # bug 405377
== 419531-1.html 419531-1-ref.html
== 420069-1.html 420069-1-ref.html
== 420069-2.html 420069-2-ref.html
# == 420351-1.html 420351-1-ref.html
== 420351-1.html 420351-1-ref.html
== 421234-1.html 421234-1-ref.html
== 421419-1.html 421419-1-ref.html