Closed Bug 56921 Opened 24 years ago Closed 16 years ago

HTML output makes lines too long

Categories

(Core :: DOM: Serializers, defect, P2)

defect

Tracking

()

RESOLVED FIXED
mozilla1.2alpha

People

(Reporter: akkzilla, Assigned: t_mutreja)

References

Details

(Keywords: helpwanted, Whiteboard: [correctness][serializer])

Split off from bug 56833: The nsHTMLContentSerializer makes its lines too long -- set the wrap column to 72, and make some output, and observe that almost all lines are longer than 72 columns. The old code, in nsHTMLContentSinkStream, was at least closer to right (there were no known bugs filed against it).
Blocks: 57891
No longer blocks: 57891
Akkana, this bug should be assigned to whomever owns the serializers, and that isn't me.
Assignee: jst → akkana
Anthony owns them now. Johnny, it was assigned to you because you replaced the old wrapping code with new code, and I thought maybe you had a reason for that. If not, maybe we can just plug the old code from nsHTMLContentSinkStream.cpp back in, since it wrapped at the right place.
Assignee: akkana → anthonyd
Vidur wrote the new code and IIRC the reason for changing the linewrapping code was due to performance problems in the old code combined with the fact that the new code needed to use the new string API's (nsAWritableString n' friends) in stead of nsString. If it's possible to lift code from the old code with todays nsAxxxString API's then do so, but the change was sertainly done for a reason...
setting to 0.9. anthonyd
Status: NEW → ASSIGNED
Target Milestone: --- → mozilla0.9
does this affect mail compose?
It affects all html source that's saved, including html mail compose. It doesn't affect how the html renders, only the source.
pushing off so anthony has realistic moz 0.9 buglist
Target Milestone: mozilla0.9 → mozilla0.9.1
moving to mozilla 1.0 milestone resetting to platform/OS All
Keywords: helpwanted
OS: Linux → All
Hardware: PC → All
Target Milestone: mozilla0.9.1 → mozilla1.0
Whiteboard: [correctness][serializer]
--> kin
Assignee: anthonyd → kin
Status: ASSIGNED → NEW
--> DOM to Text Conversion default owner
Assignee: kin → harishd
Priority: P3 → --
Target Milestone: mozilla1.0 → ---
--> peterv. Our new serializer guru.
Assignee: harishd → peterv
Priority: -- → P2
Target Milestone: --- → mozilla0.9.9
-> tanu who is helping out on serializer bug fixing.
Assignee: peterv → tmutreja
While reviewing the fix for bug 85184 I noticed the problem that causes this bug: this line (line 581 after the patch in 85184): indx = aStr.FindChar(PRUnichar(' '), strOffset + leftInLine); starts at the character of the input string that would match the wrap column in the output string, then searches forward from there to find the next space. So of course the lines are always longer than the wrap column. It needs to start at the wrap column and search backward for the next space (with error clauses to search forward only in the case where there is no space and it has to make its lines too long). Also, it should probably use the nsLineBreaker class rather than just looking for spaces. For examples that do the right thing (and unfortunately have much more complicated code) see nsPlainTextSerializer.cpp starting at line 1180, or the rewrap code in nsInternetCiter. (nsPlainTextSerializer is probably the better example and has been much more thoroughly tested.)
TFV-->1.1
Target Milestone: mozilla0.9.9 → mozilla1.1
Status: NEW → ASSIGNED
Target Milestone: mozilla1.1 → mozilla1.0
Moving Netscape owned 0.9.9 and 1.0 bugs that don't have an nsbeta1, nsbeta1+, topembed, topembed+, Mozilla0.9.9+ or Mozilla1.0+ keyword. Please send any questions or feedback about this to adt@netscape.com. You can search for "Moving bugs not scheduled for a project" to quickly delete this bugmail.
Target Milestone: mozilla1.0 → mozilla1.2
See also bug 200582, which covers a similar problem in the same code when wrapping japanese or other non-ascii text.
Depends on: 422403
My current patch for bug 422403 (not yet landed) provides a better wrapping.
The issue is almost fixed by bug 422403. There are still some case where we cannot wrap at the specified column number. However I think we can close this bug since the serializer do a better job.
Status: ASSIGNED → RESOLVED
Closed: 16 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.