From ee69e990d5f60a7f1badbfbd12607a7c82fea673 Mon Sep 17 00:00:00 2001 From: "sharparrow1%yahoo.com" Date: Tue, 17 Jul 2007 21:29:19 +0000 Subject: [PATCH] Bug 388438: Incorrect interpretation of LFCR after opening tag. r=mrbkap, sr=jst. --- parser/htmlparser/src/nsHTMLTokens.cpp | 35 ++++++++------------------ 1 file changed, 10 insertions(+), 25 deletions(-) diff --git a/parser/htmlparser/src/nsHTMLTokens.cpp b/parser/htmlparser/src/nsHTMLTokens.cpp index 8fccfe1eb79..84b31f95245 100644 --- a/parser/htmlparser/src/nsHTMLTokens.cpp +++ b/parser/htmlparser/src/nsHTMLTokens.cpp @@ -1568,36 +1568,21 @@ CNewlineToken::Consume(PRUnichar aChar, nsScanner& aScanner, PRInt32 aFlag) * a line feed ( ), or a carriage return/line feed pair. * All line breaks constitute white space." */ - PRUnichar theChar; - nsresult result = aScanner.Peek(theChar); - if (NS_OK == result) { - switch(aChar) { - case kNewLine: - if (kCR == theChar) { - result = aScanner.GetChar(theChar); - } - break; - - case kCR: - // Convert CRLF into just CR - if (kNewLine == theChar) { - result = aScanner.GetChar(theChar); - } - break; - - default: - break; + nsresult rv = NS_OK; + if (aChar == kCR) { + PRUnichar theChar; + rv = aScanner.Peek(theChar); + if (theChar == kNewLine) { + rv = aScanner.GetChar(theChar); + } else if (rv == kEOF && !aScanner.IsIncremental()) { + // Make sure we don't lose information about this trailing newline. + rv = NS_OK; } } - if (result == kEOF && !aScanner.IsIncremental()) { - // Make sure we don't lose information about this trailing newline. - result = NS_OK; - } - mNewlineCount = 1; - return result; + return rv; } CAttributeToken::CAttributeToken()