Closed Bug 103833 Opened 23 years ago Closed 20 years ago

[FIX]no newline with preformatted text when there is quotation mark at the end of the line

Categories

(Core :: DOM: HTML Parser, defect, P2)

x86
Linux
defect

Tracking

()

RESOLVED FIXED
mozilla1.8alpha1

People

(Reporter: schulz, Assigned: bzbarsky)

References

()

Details

(Keywords: testcase)

Attachments

(2 files)

From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.4) Gecko/20010913
BuildID:    2001091311

In the page at http://www.newsaktuell.be/en/story.htx?nr=200001868 there is a
preformatted text with a fixed line length (69 characters).
Mozilla takes the line following an line with ending on a quotation mark and put
it on the same line (see middle of the page).
The problem can also reproduced with Netscape 6.1 on Linux and WinNT.

Reproducible: Always
Steps to Reproduce:
1.load URL http://www.newsaktuell.be/en/story.htx?nr=200001868
2.
3.
Looks like " eats the following ^M

Over to parser.
Assignee: attinasi → harishd
Status: UNCONFIRMED → NEW
Component: Layout → Parser
Ever confirmed: true
QA Contact: petersen → moied
Attached file Testcase
Status: NEW → ASSIGNED
Keywords: testcase
Priority: -- → P3
Target Milestone: --- → mozilla0.9.8
--> m1.0
Target Milestone: mozilla0.9.8 → mozilla1.0
mass move to 1.1
Target Milestone: mozilla1.0 → mozilla1.1
[was 1.1alpha]
Target Milestone: mozilla1.1alpha → Future
Attached patch FixSplinter Review
Assignee: harishd → bzbarsky
Comment on attachment 146386 [details] [diff] [review]
Fix

So the deal here is that ReadWhitespace() will just leave a lone \r as is, and
the caller (CWhitespaceToken::Consume()) will strip out \r's.

I decided to do this instead of appending on every \n or \r (which would allow
caller to not strip), because I suspect this is faster for pages using \r\n or
\n as newline separator....
Attachment #146386 - Flags: superreview?(peterv)
Attachment #146386 - Flags: review?(choess)
Priority: P3 → P2
Summary: no newline with preformatted text when there is quotation mark at the end of the line → [FIX]no newline with preformatted text when there is quotation mark at the end of the line
Target Milestone: Future → mozilla1.8alpha
Comment on attachment 146386 [details] [diff] [review]
Fix

> Index: htmlparser/src/nsScanner.cpp
> ===================================================================

>    while(!done && current != end) {
>      switch(theChar) {
>        case '\n':
>        case '\r': ++aNewlinesSkipped;
> -      case ' ' :
> -      case '\b':
> -      case '\t':
>          {

Maybe move |++aNewlinesSkipped;| inside the brace?

I don't know much about this code, but couldn't you just replace that lone CR
with an LF?

It's a bit of a shame that the two ReadWhitespace functions now have different
behaviour.
Attachment #146386 - Flags: superreview?(peterv) → superreview+
> Maybe move |++aNewlinesSkipped;| inside the brace?

Will do.

> couldn't you just replace that lone CR with an LF?

Yes, but the iterator math needed to make sure this is done right didn't seem
worth the trouble...

> It's a bit of a shame that the two ReadWhitespace functions now have different
> behaviour.

The other function just sets iterators, so the only way to change its behavior
would be to actually modify the underying scanner buffer.... that seemed scary.
Frankly, we should write a separate view source tokenizer (been talked about
much) and remove that other function from here.
Attachment #146386 - Flags: review?(choess) → review+
Checked in.
Status: ASSIGNED → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
*** Bug 150981 has been marked as a duplicate of this bug. ***
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: