diff --git a/layout/base/nsCSSFrameConstructor.cpp b/layout/base/nsCSSFrameConstructor.cpp index 20177d7fb55..35fa0e5711e 100644 --- a/layout/base/nsCSSFrameConstructor.cpp +++ b/layout/base/nsCSSFrameConstructor.cpp @@ -12299,13 +12299,20 @@ nsCSSFrameConstructor::RemoveLetterFrames(nsPresContext* aPresContext, aBlockFrame = aBlockFrame->GetFirstContinuation(); PRBool stopLooking = PR_FALSE; - nsresult rv = RemoveFloatingFirstLetterFrames(aPresContext, aPresShell, - aFrameManager, - aBlockFrame, &stopLooking); - if (NS_SUCCEEDED(rv) && !stopLooking) { - rv = RemoveFirstLetterFrames(aPresContext, aPresShell, aFrameManager, - aBlockFrame, &stopLooking); - } + nsresult rv; + do { + rv = RemoveFloatingFirstLetterFrames(aPresContext, aPresShell, + aFrameManager, + aBlockFrame, &stopLooking); + if (NS_SUCCEEDED(rv) && !stopLooking) { + rv = RemoveFirstLetterFrames(aPresContext, aPresShell, aFrameManager, + aBlockFrame, &stopLooking); + } + if (stopLooking) { + break; + } + aBlockFrame = aBlockFrame->GetNextContinuation(); + } while (aBlockFrame); return rv; } @@ -12316,22 +12323,28 @@ nsCSSFrameConstructor::RecoverLetterFrames(nsFrameConstructorState& aState, { aBlockFrame = aBlockFrame->GetFirstContinuation(); - nsresult rv = NS_OK; - - aBlockFrame->AddStateBits(NS_BLOCK_HAS_FIRST_LETTER_STYLE); - - nsIFrame* blockKids = aBlockFrame->GetFirstChild(nsnull); nsIFrame* parentFrame = nsnull; nsIFrame* textFrame = nsnull; nsIFrame* prevFrame = nsnull; nsFrameItems letterFrames; PRBool stopLooking = PR_FALSE; - rv = WrapFramesInFirstLetterFrame(aState, aBlockFrame, aBlockFrame, blockKids, - &parentFrame, &textFrame, &prevFrame, - letterFrames, &stopLooking); - if (NS_FAILED(rv)) { - return rv; - } + nsresult rv; + do { + // XXX shouldn't this bit be set already (bug 408493), assert instead? + aBlockFrame->AddStateBits(NS_BLOCK_HAS_FIRST_LETTER_STYLE); + 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) { // Take the old textFrame out of the parents child list ::DeletingFrameSubtree(aState.mFrameManager, textFrame); diff --git a/layout/reftests/bugs/408493-1.html b/layout/reftests/bugs/408493-1.html new file mode 100644 index 00000000000..23bac854544 --- /dev/null +++ b/layout/reftests/bugs/408493-1.html @@ -0,0 +1,16 @@ + + + + + + + +b + + diff --git a/layout/reftests/bugs/408493-2-ref.html b/layout/reftests/bugs/408493-2-ref.html new file mode 100644 index 00000000000..6fe209b5e65 --- /dev/null +++ b/layout/reftests/bugs/408493-2-ref.html @@ -0,0 +1,14 @@ + + + + + + +T + + diff --git a/layout/reftests/bugs/408493-2.html b/layout/reftests/bugs/408493-2.html new file mode 100644 index 00000000000..f18c80ec66d --- /dev/null +++ b/layout/reftests/bugs/408493-2.html @@ -0,0 +1,16 @@ + + + + + + +T +T + + diff --git a/layout/reftests/bugs/reftest.list b/layout/reftests/bugs/reftest.list index 09925c62ee0..6ef143947c3 100644 --- a/layout/reftests/bugs/reftest.list +++ b/layout/reftests/bugs/reftest.list @@ -626,6 +626,8 @@ random == 403134-1.html 403134-1-ref.html # bug 405377 == 407111-1.html 407111-1-ref.html == 407227-1.html 407227-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-1b.html 408656-1-ref.html == 408656-1c.html 408656-1-ref.html