Closed Bug 295646 Opened 20 years ago Closed 20 years ago

Trailing whitespace is lost

Categories

(Core :: DOM: HTML Parser, defect)

x86
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: mrbkap, Assigned: mrbkap)

References

()

Details

Attachments

(1 file, 1 obsolete file)

Whitespace at the end of a document is chopped of because nobody bothers checking the scanner's mIncremental member and not returning kEOF if it's not incremental (as all of the other tokens do). Patch in a second.
Attached patch patch v1 (obsolete) — Splinter Review
This checks if we're really at the end of the document, and if we are, doesn't discard the trailing whitespace.
Attachment #184634 - Flags: superreview?(bzbarsky)
Attachment #184634 - Flags: review?(bzbarsky)
Status: NEW → ASSIGNED
Blocks: 295531
Comment on attachment 184634 [details] [diff] [review] patch v1 is haveCR guaranteed to have a non-bogus value even if nothing was consumed?
By the time we get to CWhitespaceToken::Consume(), we know that there is at least one whitespace char in the scanner. Therefore, the Peek() in nsScanner::ReadWhitespace() will succeed, and aHaveCR is set appropriately. I'll change ReadWhitespace() to make sure to initialize aHaveCR in the second iteration of this patch.
Attachment #184634 - Flags: superreview?(bzbarsky)
Attachment #184634 - Flags: review?(bzbarsky)
Attached patch patch v2Splinter Review
As it turns out, nsScanner::ReadWhitespace(), *does* initialize its out parameter. This patch also fixes CNewlineToken to not lose trailing newlines.
Attachment #184634 - Attachment is obsolete: true
Attachment #184700 - Flags: review?(rbs)
Comment on attachment 184700 [details] [diff] [review] patch v2 r+sr=bzbarsky
Attachment #184700 - Flags: superreview+
Attachment #184700 - Flags: review?(rbs)
Attachment #184700 - Flags: review+
Comment on attachment 184700 [details] [diff] [review] patch v2 This patch fixes a couple of problems with composer's Insert -> HTML, and also prevents the loss of trailing whitespace/newlines.
Attachment #184700 - Flags: approval1.8b3?
Comment on attachment 184700 [details] [diff] [review] patch v2 a=shaver
Attachment #184700 - Flags: approval1.8b3? → approval1.8b3+
Fix checked in.
Status: ASSIGNED → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: