Trailing whitespace is lost

RESOLVED FIXED

Status

()

Core
HTML: Parser
RESOLVED FIXED
13 years ago
13 years ago

People

(Reporter: mrbkap, Assigned: mrbkap)

Tracking

Trunk
x86
Linux
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(URL)

Attachments

(1 attachment, 1 obsolete attachment)

(Assignee)

Description

13 years ago
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.
(Assignee)

Comment 1

13 years ago
Created attachment 184634 [details] [diff] [review]
patch v1

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)
(Assignee)

Updated

13 years ago
Status: NEW → ASSIGNED
(Assignee)

Updated

13 years ago
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?
(Assignee)

Comment 3

13 years ago
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.
(Assignee)

Updated

13 years ago
Attachment #184634 - Flags: superreview?(bzbarsky)
Attachment #184634 - Flags: review?(bzbarsky)
(Assignee)

Comment 4

13 years ago
Created attachment 184700 [details] [diff] [review]
patch v2

As it turns out, nsScanner::ReadWhitespace(), *does* initialize its out
parameter. This patch also fixes CNewlineToken to not lose trailing newlines.
(Assignee)

Updated

13 years ago
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+
(Assignee)

Comment 6

13 years ago
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+
(Assignee)

Comment 8

13 years ago
Fix checked in.
Status: ASSIGNED → RESOLVED
Last Resolved: 13 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.