mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 05:41:12 +00:00
Bug 495663 - Count newlines correctly if we have an alternate ending position. r+sr=sicking
This commit is contained in:
parent
984f190863
commit
7b882b1cc1
@ -775,6 +775,7 @@ CTextToken::ConsumeParsedCharacterData(PRBool aDiscardFirstNewline,
|
||||
|
||||
nsScannerIterator currPos, endPos, altEndPos;
|
||||
PRUint32 truncPos = 0;
|
||||
PRInt32 truncNewlineCount = 0;
|
||||
aScanner.CurrentPosition(currPos);
|
||||
aScanner.EndReading(endPos);
|
||||
|
||||
@ -839,6 +840,7 @@ CTextToken::ConsumeParsedCharacterData(PRBool aDiscardFirstNewline,
|
||||
// We ran out of room looking for a </title>. Go back to the first
|
||||
// place that looked like a tag and use that as our stopping point.
|
||||
theContent.writable().Truncate(truncPos);
|
||||
mNewlineCount = truncNewlineCount;
|
||||
aScanner.SetPosition(altEndPos, PR_FALSE, PR_TRUE);
|
||||
}
|
||||
// else we take everything we consumed.
|
||||
@ -857,6 +859,7 @@ CTextToken::ConsumeParsedCharacterData(PRBool aDiscardFirstNewline,
|
||||
// Keep this position in case we need it for later.
|
||||
altEndPos = currPos;
|
||||
truncPos = theContent.str().Length();
|
||||
truncNewlineCount = mNewlineCount;
|
||||
}
|
||||
|
||||
if (Distance(currPos, endPos) >= termStrLen) {
|
||||
|
Loading…
Reference in New Issue
Block a user