From 9241b52e997ba3b8f42c460c7cc050258026f1cc Mon Sep 17 00:00:00 2001 From: "bzbarsky%mit.edu" Date: Thu, 20 Apr 2006 19:00:33 +0000 Subject: [PATCH] Treat terminal newlines in preformatted text like we treat
when inserting frames into a block. Bug 310087, r+sr=roc git-svn-id: svn://10.0.0.236/trunk@194984 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/layout/generic/nsBlockFrame.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/mozilla/layout/generic/nsBlockFrame.cpp b/mozilla/layout/generic/nsBlockFrame.cpp index 2892359d105..de7075f6091 100644 --- a/mozilla/layout/generic/nsBlockFrame.cpp +++ b/mozilla/layout/generic/nsBlockFrame.cpp @@ -5422,9 +5422,16 @@ nsBlockFrame::AddFrames(nsIFrame* aFrameList, PRBool isBlock = nsLineLayout::TreatFrameAsBlock(newFrame); // If the frame is a block frame, or if there is no previous line or if the - // previous line is a block line or ended with a
then make a new line. + // previous line is a block line we need to make a new line. We also make + // a new line, as an optimization, in the two cases we know we'll need it: + // if the previous line ended with a
or has significant whitespace and + // ended in a newline. if (isBlock || prevSibLine == end_lines() || prevSibLine->IsBlock() || - (aPrevSibling && aPrevSibling->GetType() == nsLayoutAtoms::brFrame)) { + (aPrevSibling && + (aPrevSibling->GetType() == nsLayoutAtoms::brFrame || + (aPrevSibling->GetType() == nsLayoutAtoms::textFrame && + aPrevSibling->GetStyleText()->WhiteSpaceIsSignificant() && + aPrevSibling->HasTerminalNewline())))) { // Create a new line for the frame and add its line to the line // list. nsLineBox* line = NS_NewLineBox(presShell, newFrame, 1, isBlock);