Try all continuations of the block when looking for a letter frame. b=408493 r+sr=bzbarsky a=blocking1.9

This commit is contained in:
mats.palmgren@bredband.net 2008-01-15 01:25:17 -08:00
Родитель a2cb4b68cf
Коммит b94c5271df
5 изменённых файлов: 79 добавлений и 18 удалений

Просмотреть файл

@ -12299,13 +12299,20 @@ nsCSSFrameConstructor::RemoveLetterFrames(nsPresContext* aPresContext,
aBlockFrame = aBlockFrame->GetFirstContinuation(); aBlockFrame = aBlockFrame->GetFirstContinuation();
PRBool stopLooking = PR_FALSE; PRBool stopLooking = PR_FALSE;
nsresult rv = RemoveFloatingFirstLetterFrames(aPresContext, aPresShell, nsresult rv;
aFrameManager, do {
aBlockFrame, &stopLooking); rv = RemoveFloatingFirstLetterFrames(aPresContext, aPresShell,
if (NS_SUCCEEDED(rv) && !stopLooking) { aFrameManager,
rv = RemoveFirstLetterFrames(aPresContext, aPresShell, aFrameManager, aBlockFrame, &stopLooking);
aBlockFrame, &stopLooking); if (NS_SUCCEEDED(rv) && !stopLooking) {
} rv = RemoveFirstLetterFrames(aPresContext, aPresShell, aFrameManager,
aBlockFrame, &stopLooking);
}
if (stopLooking) {
break;
}
aBlockFrame = aBlockFrame->GetNextContinuation();
} while (aBlockFrame);
return rv; return rv;
} }
@ -12316,22 +12323,28 @@ nsCSSFrameConstructor::RecoverLetterFrames(nsFrameConstructorState& aState,
{ {
aBlockFrame = aBlockFrame->GetFirstContinuation(); aBlockFrame = aBlockFrame->GetFirstContinuation();
nsresult rv = NS_OK;
aBlockFrame->AddStateBits(NS_BLOCK_HAS_FIRST_LETTER_STYLE);
nsIFrame* blockKids = aBlockFrame->GetFirstChild(nsnull);
nsIFrame* parentFrame = nsnull; nsIFrame* parentFrame = nsnull;
nsIFrame* textFrame = nsnull; nsIFrame* textFrame = nsnull;
nsIFrame* prevFrame = nsnull; nsIFrame* prevFrame = nsnull;
nsFrameItems letterFrames; nsFrameItems letterFrames;
PRBool stopLooking = PR_FALSE; PRBool stopLooking = PR_FALSE;
rv = WrapFramesInFirstLetterFrame(aState, aBlockFrame, aBlockFrame, blockKids, nsresult rv;
&parentFrame, &textFrame, &prevFrame, do {
letterFrames, &stopLooking); // XXX shouldn't this bit be set already (bug 408493), assert instead?
if (NS_FAILED(rv)) { aBlockFrame->AddStateBits(NS_BLOCK_HAS_FIRST_LETTER_STYLE);
return rv; rv = WrapFramesInFirstLetterFrame(aState, aBlockFrame, aBlockFrame,
} aBlockFrame->GetFirstChild(nsnull),
&parentFrame, &textFrame, &prevFrame,
letterFrames, &stopLooking);
if (NS_FAILED(rv)) {
return rv;
}
if (stopLooking) {
break;
}
aBlockFrame = aBlockFrame->GetNextContinuation();
} while (aBlockFrame);
if (parentFrame) { if (parentFrame) {
// Take the old textFrame out of the parents child list // Take the old textFrame out of the parents child list
::DeletingFrameSubtree(aState.mFrameManager, textFrame); ::DeletingFrameSubtree(aState.mFrameManager, textFrame);

Просмотреть файл

@ -0,0 +1,16 @@
<html>
<head>
<style type="text/css">
body { -moz-column-count: 2; }
span { white-space: pre; }
body:first-letter { }
</style>
</head>
<body onload="document.body.removeChild(document.body.lastChild);"><span>
</span>b</body>
</html>

Просмотреть файл

@ -0,0 +1,14 @@
<html>
<head>
<style type="text/css">
body { -moz-column-count: 2; }
body:first-letter { color:blue; font-size:400%; }
</style>
</head>
<body>T</body>
</html>

Просмотреть файл

@ -0,0 +1,16 @@
<html>
<head>
<style type="text/css">
body { -moz-column-count: 2; }
span { white-space: pre; }
body:first-letter { color:blue; font-size:400%; }
</style>
</head>
<body onload="var span=document.getElementById('span'); span.removeChild(span.lastChild);"><span id="span">T
</span>T</body>
</html>

Просмотреть файл

@ -626,6 +626,8 @@ random == 403134-1.html 403134-1-ref.html # bug 405377
== 407111-1.html 407111-1-ref.html == 407111-1.html 407111-1-ref.html
== 407227-1.html 407227-1-ref.html == 407227-1.html 407227-1-ref.html
== 407937-1.html 407937-1-ref.html == 407937-1.html 407937-1-ref.html
== 408493-1.html about:blank
== 408493-2.html 408493-2-ref.html
== 408656-1a.html 408656-1-ref.html == 408656-1a.html 408656-1-ref.html
== 408656-1b.html 408656-1-ref.html == 408656-1b.html 408656-1-ref.html
== 408656-1c.html 408656-1-ref.html == 408656-1c.html 408656-1-ref.html