Bug 457398. Don't treat empty lines as the first line for text-indent or first-letter/first-line purposes. r+sr=dbaron

This commit is contained in:
Robert O'Callahan 2008-11-27 10:44:47 -08:00
parent 273958bb45
commit 8ff4467f78
7 changed files with 58 additions and 1 deletions

View File

@ -3375,6 +3375,8 @@ nsBlockFrame::DoReflowInlineFrames(nsBlockReflowState& aState,
impactedByFloats,
PR_FALSE /*XXX isTopOfPage*/);
aState.SetFlag(BRS_LINE_LAYOUT_EMPTY, PR_FALSE);
// XXX Unfortunately we need to know this before reflowing the first
// inline frame in the line. FIX ME.
if ((0 == aLineLayout.GetLineNumber()) &&
@ -3462,6 +3464,8 @@ nsBlockFrame::DoReflowInlineFrames(nsBlockReflowState& aState,
}
}
aState.SetFlag(BRS_LINE_LAYOUT_EMPTY, aLineLayout.LineIsEmpty());
// We only need to backup if the line isn't going to be reflowed again anyway
PRBool needsBackup = aLineLayout.NeedsBackup() &&
(lineReflowStatus == LINE_REFLOW_STOP || lineReflowStatus == LINE_REFLOW_OK);

View File

@ -58,6 +58,9 @@
#define BRS_HAVELINEADJACENTTOTOP 0x00000020
// Set when the block has the equivalent of NS_BLOCK_SPACE_MGR
#define BRS_SPACE_MGR 0x00000040
// Set when nsLineLayout::LineIsEmpty was true at the end of reflowing
// the current line
#define BRS_LINE_LAYOUT_EMPTY 0x00000080
#define BRS_ISOVERFLOWCONTAINER 0x00000100
#define BRS_LASTFLAG BRS_ISOVERFLOWCONTAINER
@ -164,7 +167,11 @@ public:
void RecoverStateFrom(nsLineList::iterator aLine, nscoord aDeltaY);
void AdvanceToNextLine() {
mLineNumber++;
if (GetFlag(BRS_LINE_LAYOUT_EMPTY)) {
SetFlag(BRS_LINE_LAYOUT_EMPTY, PR_FALSE);
} else {
mLineNumber++;
}
}
PRBool IsImpactedByFloat() const;

View File

@ -0,0 +1,11 @@
<!DOCTYPE HTML>
<html>
<head><style>
span { color: green; }
</style></head>
<body>
<div><span>T</span>est</div>
<div style="float:left; width:100px; height:200px; background:yellow;"></div>
<div style="clear:both"><span>T</span>est</div>
</body>
</html>

View File

@ -0,0 +1,11 @@
<!DOCTYPE HTML>
<html>
<head><style>
div::first-letter { color: green; }
</style></head>
<body>
<div style="width:0"> <span></span>Test</div>
<span style="float:left; width:100px; height:200px; background:yellow;"></span>
<div style="width:0"> <span></span>Test</div>
</body>
</html>

View File

@ -0,0 +1,11 @@
<!DOCTYPE HTML>
<html>
<head><style>
span { display:inline-block; width:20px; }
</style></head>
<body>
<div><span></span>Test</div>
<div style="float:left; width:100px; height:200px; background:yellow;"></div>
<div style="clear:both"><span></span>Test</div>
</body>
</html>

View File

@ -0,0 +1,11 @@
<!DOCTYPE HTML>
<html>
<head><style>
div { text-indent:20px; }
</style></head>
<body>
<div style="width:0"> <span></span>Test</div>
<span style="float:left; width:100px; height:200px; background:yellow;"></span>
<div style="width:0"> <span></span>Test</div>
</body>
</html>

View File

@ -950,6 +950,8 @@ fails == 441259-2.html 441259-2-ref.html # bug 441400
fails-if(MOZ_WIDGET_TOOLKIT=="cocoa") == 456147.xul 456147-ref.html # bug 456147, but not caused by it
== 456330-1.gif 456330-1-ref.png
== 456484-1.html 456484-1-ref.html
== 457398-1.html 457398-1-ref.html
== 457398-2.html 457398-2-ref.html
== 458487-1a.html 458487-1-ref.html
== 458487-1b.html 458487-1-ref.html
== 458487-1c.html 458487-1-ref.html