Fix for bug 170058: Body as "Plain Text" has no linebreaks and is displayed in variable font width

r=BenB, sr=bienvenu
This commit is contained in:
ere%atp.fi 2002-10-03 19:41:59 +00:00
parent 8e992f87ae
commit 2311a0b84b

View File

@ -94,9 +94,14 @@ MimeInlineTextHTMLAsPlaintext_parse_eof (MimeObject *obj, PRBool abort_p)
{
if (obj->closed_p)
return 0;
int status = ((MimeObjectClass*)&MIME_SUPERCLASS)->parse_eof(obj, abort_p);
// This is a hack. We need to call parse_eof() of the super class to flush out any buffered data.
// We can't call it yet for our direct super class, because it would "close" the output
// (write tags such as </pre> and </div>). We'll do that after parsing the buffer.
int status = ((MimeObjectClass*)&MIME_SUPERCLASS)->superclass->parse_eof(obj, abort_p);
if (status < 0)
return status;
MimeInlineTextHTMLAsPlaintext *textHTMLPlain =
(MimeInlineTextHTMLAsPlaintext *) obj;
@ -124,6 +129,16 @@ MimeInlineTextHTMLAsPlaintext_parse_eof (MimeObject *obj, PRBool abort_p)
cb.Truncate();
if (status < 0)
return status;
// Second part of the flush hack. Pretend obj wasn't closed yet, so that our super class
// gets a chance to write the closing.
PRBool save_closed_p = obj->closed_p;
obj->closed_p = PR_FALSE;
status = ((MimeObjectClass*)&MIME_SUPERCLASS)->parse_eof(obj, abort_p);
// Restore closed_p.
obj->closed_p = save_closed_p;
return status;
}