Bug 420351. Empty bullets cannot make a line non-empty. r+sr=dbaron

This commit is contained in:
roc+@cs.cmu.edu 2008-03-11 00:36:03 -07:00
parent e689157629
commit aeaf9bd3dc
6 changed files with 63 additions and 9 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,10 @@ 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;
PRBool isEmpty;
if (frameType) {
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 +893,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 +923,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 +1013,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

@ -0,0 +1,17 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>Testcase bug - List item marker takes up room now with list-style-type: none in strict mode</title>
<style>
div.li {
border: 1px solid red;
}
div.inside {
border: 1px solid black;
}
</style></head>
<body>
<ul><div class="li"><div class="inside">text</div></div></ul>
</body>
</html>

View File

@ -0,0 +1,19 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>Testcase bug - List item marker takes up room now with list-style-type: none in strict mode</title>
<style>
li{
list-style-type: none;
list-style-position: inside;
border: 1px solid red;
}
div {
border: 1px solid black;
}
</style></head>
<body>
<ul><li><div>text</div></li></ul>
</body>
</html>

View File

@ -751,3 +751,5 @@ 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