зеркало из https://github.com/mozilla/pjs.git
52042: "Escape" classes inserted by our TXT recognizer(s) by prepending "moz-"
39771: * -> <b> (not <strong>), / -> <i> (not <em>) 18427, Step 1: Add |class=moz-text-html | to wrapping <div>, so users can add rules specific to HTML msgs to their user stylesheets (e.g. to ignore certain formatting). r=rhp Updating msg body UA stylesheets r=a=alecf
This commit is contained in:
Родитель
4035afe779
Коммит
b0cf1263da
|
@ -472,8 +472,8 @@ PRBool nsHTMLToTXTSinkStream::IsConverted(const nsIParserNode& aNode)
|
|||
NS_SUCCEEDED(rv)
|
||||
&&
|
||||
(
|
||||
value.EqualsWithConversion("txt", PR_TRUE, 3) ||
|
||||
value.EqualsWithConversion("\"txt", PR_TRUE, 4)
|
||||
value.EqualsWithConversion("moz-txt", PR_TRUE, 7) ||
|
||||
value.EqualsWithConversion("\"moz-txt", PR_TRUE, 8)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
@ -908,8 +908,8 @@ nsHTMLToTXTSinkStream::AddLeaf(const nsIParserNode& aNode)
|
|||
}
|
||||
else if (type == eHTMLTag_text)
|
||||
{
|
||||
/* Check, if some other MUA (e.g. 4.x) recognized the URL in
|
||||
plain text and inserted an <a> element. If yes, output only once. */
|
||||
/* Check, if some other MUA (e.g. 4.x) recognized the URI in
|
||||
plain text and inserted an <a> element. If yes, output URI only once. */
|
||||
if (!mURL.IsEmpty() && mURL == text)
|
||||
mURL.Truncate();
|
||||
if (
|
||||
|
@ -1797,4 +1797,3 @@ PRInt32 unicharwidth(const PRUnichar* pwcs, PRInt32 n)
|
|||
|
||||
return width;
|
||||
}
|
||||
|
||||
|
|
|
@ -65,12 +65,12 @@ MimeInlineTextHTML_parse_begin (MimeObject *obj)
|
|||
PRInt32 fontSize; // default font size
|
||||
if (NS_SUCCEEDED(GetMailNewsFont(obj, PR_FALSE, fontName, sizeof(fontName), &fontSize)))
|
||||
{
|
||||
PR_snprintf(buf, 256, "<div style=\"font-family: %s; font-size: %dpx;\">", (const char *) fontName, fontSize);
|
||||
PR_snprintf(buf, 256, "<div class=\"moz-text-html\" style=\"font-family: %s; font-size: %dpx;\">", (const char *) fontName, fontSize);
|
||||
status = MimeObject_write(obj, buf, nsCRT::strlen(buf), PR_FALSE);
|
||||
}
|
||||
else
|
||||
{
|
||||
status = MimeObject_write(obj, "<div>", 5, PR_FALSE);
|
||||
status = MimeObject_write(obj, "<div class=\"moz-text-html\">", 27, PR_FALSE);
|
||||
}
|
||||
if(status<0) return status;
|
||||
}
|
||||
|
|
|
@ -168,7 +168,7 @@ MimeInlineTextPlainFlowed_parse_begin (MimeObject *obj)
|
|||
/* 4.x' editor can't break <div>s (e.g. to interleave comments).
|
||||
We'll add the class to the <blockquote type=cite> later. */
|
||||
{
|
||||
nsCAutoString openingDiv("<div class=\"text-flowed\"");
|
||||
nsCAutoString openingDiv("<div class=\"moz-text-flowed\"");
|
||||
// We currently have to add formatting here. :-(
|
||||
if (!plainHTML && !fontstyle.IsEmpty())
|
||||
{
|
||||
|
@ -230,12 +230,12 @@ MimeInlineTextPlainFlowed_parse_eof (MimeObject *obj, PRBool abort_p)
|
|||
}
|
||||
|
||||
if (exdata->isSig && !quoting) {
|
||||
status = MimeObject_write(obj, "</div>", 6, PR_FALSE); // txt-sig
|
||||
status = MimeObject_write(obj, "</div>", 6, PR_FALSE); // .moz-txt-sig
|
||||
if (status<0) goto EarlyOut;
|
||||
}
|
||||
if (!quoting) // HACK (see above)
|
||||
{
|
||||
status = MimeObject_write(obj, "</div>", 6, PR_FALSE); // text-flowed
|
||||
status = MimeObject_write(obj, "</div>", 6, PR_FALSE); // .moz-text-flowed
|
||||
if (status<0) goto EarlyOut;
|
||||
}
|
||||
|
||||
|
@ -406,8 +406,8 @@ MimeInlineTextPlainFlowed_parse_line (char *line, PRInt32 length, MimeObject *ob
|
|||
preface += "-- <br>";
|
||||
} else {
|
||||
exdata->isSig = PR_TRUE;
|
||||
preface +=
|
||||
"<div class=\"txt-sig\"><span class=\"txt-tag\">-- <br></span>";
|
||||
preface += "<div class=\"moz-txt-sig\"><span class=\"moz-txt-tag\">"
|
||||
"-- <br></span>";
|
||||
}
|
||||
} else {
|
||||
Line_convert_whitespace(lineResult, PR_FALSE /* Allow wraps */,
|
||||
|
|
|
@ -189,7 +189,7 @@ MimeInlineTextPlain_parse_begin (MimeObject *obj)
|
|||
/* 4.x' editor can't break <div>s (e.g. to interleave comments).
|
||||
We'll add the class to the <blockquote type=cite> later. */
|
||||
{
|
||||
openingDiv = "<div class=\"text-plain\"";
|
||||
openingDiv = "<div class=\"moz-text-plain\"";
|
||||
if (!plainHTML)
|
||||
{
|
||||
if (obj->options->wrap_long_lines_p)
|
||||
|
@ -249,14 +249,15 @@ MimeInlineTextPlain_parse_eof (MimeObject *obj, PRBool abort_p)
|
|||
MimeInlineTextPlain *text = (MimeInlineTextPlain *) obj;
|
||||
if (text->mIsSig && !quoting)
|
||||
{
|
||||
status = MimeObject_write(obj, "</div>", 6, PR_FALSE); // .txt-sig
|
||||
status = MimeObject_write(obj, "</div>", 6, PR_FALSE); // .moz-txt-sig
|
||||
if (status < 0) return status;
|
||||
}
|
||||
status = MimeObject_write(obj, "</pre>", 6, PR_FALSE);
|
||||
if (status < 0) return status;
|
||||
if (!quoting)
|
||||
{
|
||||
status = MimeObject_write(obj, "</div>", 6, PR_FALSE); // .text-plain
|
||||
status = MimeObject_write(obj, "</div>", 6, PR_FALSE);
|
||||
// .moz-text-plain
|
||||
if (status < 0) return status;
|
||||
}
|
||||
|
||||
|
@ -382,8 +383,8 @@ MimeInlineTextPlain_parse_line (char *line, PRInt32 length, MimeObject *obj)
|
|||
// Write plain text quoting tags
|
||||
if (logicalLineStart != 0 && !(plainHTML && text->mBlockquoting))
|
||||
{
|
||||
if (!quoting)
|
||||
prefaceResultStr += "<span class=txt-citetags>";
|
||||
if (!plainHTML)
|
||||
prefaceResultStr += "<span class=\"moz-txt-citetags\">";
|
||||
|
||||
nsAutoString citeTagsSource;
|
||||
lineSourceStr.Mid(citeTagsSource, 0, logicalLineStart);
|
||||
|
@ -406,7 +407,7 @@ MimeInlineTextPlain_parse_line (char *line, PRInt32 length, MimeObject *obj)
|
|||
|
||||
prefaceResultStr += citeTagsResultCStr;
|
||||
Recycle(citeTagsResultCStr);
|
||||
if (!quoting)
|
||||
if (!plainHTML)
|
||||
prefaceResultStr += "</span>";
|
||||
}
|
||||
|
||||
|
@ -419,7 +420,7 @@ MimeInlineTextPlain_parse_line (char *line, PRInt32 length, MimeObject *obj)
|
|||
{
|
||||
text->mIsSig = PR_TRUE;
|
||||
if (!quoting)
|
||||
prefaceResultStr += "<div class=txt-sig>";
|
||||
prefaceResultStr += "<div class=\"moz-txt-sig\">";
|
||||
}
|
||||
|
||||
/* This is the main TXT to HTML conversion:
|
||||
|
|
|
@ -38,9 +38,6 @@
|
|||
|
||||
static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID);
|
||||
|
||||
//#define DEBUG_BenB
|
||||
//#define DEBUG_BenB_Perf
|
||||
|
||||
#ifdef DEBUG_BenB_Perf
|
||||
#include "prtime.h"
|
||||
#include "prinrval.h"
|
||||
|
@ -50,7 +47,6 @@ const PRFloat64 growthRate = 1.2;
|
|||
|
||||
// Escape Char will take ch, escape it and append the result to
|
||||
// aStringToAppendTo
|
||||
|
||||
void
|
||||
mozTXTToHTMLConv::EscapeChar(const PRUnichar ch, nsString& aStringToAppendTo)
|
||||
{
|
||||
|
@ -377,7 +373,7 @@ mozTXTToHTMLConv::CheckURLAndCreateHTML(
|
|||
// Real work
|
||||
if (NS_SUCCEEDED(rv) && uri)
|
||||
{
|
||||
outputHTML.AssignWithConversion("<a class=\"txt-link txt-link-");
|
||||
outputHTML.AssignWithConversion("<a class=\"moz-txt-link-");
|
||||
switch(mode)
|
||||
{
|
||||
case RFC1738:
|
||||
|
@ -594,7 +590,7 @@ mozTXTToHTMLConv::StructPhraseHit(const PRUnichar * aInString, PRInt32 aInString
|
|||
aOutString.AppendWithConversion(tagHTML);
|
||||
aOutString.AppendWithConversion(' ');
|
||||
aOutString.AppendWithConversion(attributeHTML);
|
||||
aOutString.AppendWithConversion("><span class=txt-tag>");
|
||||
aOutString.AppendWithConversion("><span class=\"moz-txt-tag\">");
|
||||
aOutString.AppendWithConversion(tagTXT);
|
||||
aOutString.AppendWithConversion("</span>");
|
||||
return PR_TRUE;
|
||||
|
@ -605,7 +601,7 @@ mozTXTToHTMLConv::StructPhraseHit(const PRUnichar * aInString, PRInt32 aInString
|
|||
&& ItMatchesDelimited(aInString, aInStringLength, tagTXT, aTagTXTLen, LT_ALPHA, LT_DELIMITER))
|
||||
{
|
||||
openTags--;
|
||||
aOutString.AppendWithConversion("<span class=txt-tag>");
|
||||
aOutString.AppendWithConversion("<span class=\"moz-txt-tag\">");
|
||||
aOutString.AppendWithConversion(tagTXT);
|
||||
aOutString.AppendWithConversion("</span></");
|
||||
aOutString.AppendWithConversion(tagHTML);
|
||||
|
@ -685,13 +681,13 @@ mozTXTToHTMLConv::GlyphHit(const PRUnichar * aInString, PRInt32 aInLength, PRBoo
|
|||
)
|
||||
&&
|
||||
(
|
||||
SmilyHit(aInString, aInLength, col0, ":-)", 3, "<img src=\"chrome://messenger/skin/smile.gif\" alt=\":-)\" class=txt-smily height=17 width=17 align=ABSCENTER>", outputHTML, glyphTextLen) ||
|
||||
SmilyHit(aInString, aInLength, col0, ":)", 2, "<img src=\"chrome://messenger/skin/smile.gif\" alt=\":)\" class=txt-smily height=17 width=17 align=ABSCENTER>", outputHTML, glyphTextLen) ||
|
||||
SmilyHit(aInString, aInLength, col0, ":-(", 3, "<img src=\"chrome://messenger/skin/frown.gif\" alt=\":-(\" class=txt-smily height=17 width=17 align=ABSCENTER>", outputHTML, glyphTextLen) ||
|
||||
SmilyHit(aInString, aInLength, col0, ":(", 2, "<img src=\"chrome://messenger/skin/frown.gif\" alt=\":(\" class=txt-smily height=17 width=17 align=ABSCENTER>", outputHTML, glyphTextLen) ||
|
||||
SmilyHit(aInString, aInLength, col0, ";-)", 3, "<img src=\"chrome://messenger/skin/wink.gif\" alt=\";-)\" class=txt-smily height=17 width=17 align=ABSCENTER>", outputHTML, glyphTextLen) ||
|
||||
SmilyHit(aInString, aInLength, col0, ";)", 2, "<img src=\"chrome://messenger/skin/wink.gif\" alt=\";)\" class=txt-smily height=17 width=17 align=ABSCENTER>", outputHTML, glyphTextLen) ||
|
||||
SmilyHit(aInString, aInLength, col0, ";-P", 3, "<img src=\"chrome://messenger/skin/sick.gif\" alt=\";-P\" class=txt-smily height=17 width=17 align=ABSCENTER>", outputHTML, glyphTextLen)
|
||||
SmilyHit(aInString, aInLength, col0, ":-)", 3, "<img src=\"chrome://messenger/skin/smile.gif\" alt=\":-)\" class=\"moz-txt-smily\" height=17 width=17 align=ABSCENTER>", outputHTML, glyphTextLen) ||
|
||||
SmilyHit(aInString, aInLength, col0, ":)", 2, "<img src=\"chrome://messenger/skin/smile.gif\" alt=\":)\" class=\"moz-txt-smily\" height=17 width=17 align=ABSCENTER>", outputHTML, glyphTextLen) ||
|
||||
SmilyHit(aInString, aInLength, col0, ":-(", 3, "<img src=\"chrome://messenger/skin/frown.gif\" alt=\":-(\" class=\"moz-txt-smily\" height=17 width=17 align=ABSCENTER>", outputHTML, glyphTextLen) ||
|
||||
SmilyHit(aInString, aInLength, col0, ":(", 2, "<img src=\"chrome://messenger/skin/frown.gif\" alt=\":(\" class=\"moz-txt-smily\" height=17 width=17 align=ABSCENTER>", outputHTML, glyphTextLen) ||
|
||||
SmilyHit(aInString, aInLength, col0, ";-)", 3, "<img src=\"chrome://messenger/skin/wink.gif\" alt=\";-)\" class=\"moz-txt-smily\" height=17 width=17 align=ABSCENTER>", outputHTML, glyphTextLen) ||
|
||||
SmilyHit(aInString, aInLength, col0, ";)", 2, "<img src=\"chrome://messenger/skin/wink.gif\" alt=\";)\" class=\"moz-txt-smily\" height=17 width=17 align=ABSCENTER>", outputHTML, glyphTextLen) ||
|
||||
SmilyHit(aInString, aInLength, col0, ";-P", 3, "<img src=\"chrome://messenger/skin/sick.gif\" alt=\";-P\" class=\"moz-txt-smily\" height=17 width=17 align=ABSCENTER>", outputHTML, glyphTextLen)
|
||||
)
|
||||
)
|
||||
{
|
||||
|
@ -711,13 +707,13 @@ mozTXTToHTMLConv::GlyphHit(const PRUnichar * aInString, PRInt32 aInLength, PRBoo
|
|||
)
|
||||
&&
|
||||
(
|
||||
SmilyHit(aInString, aInLength, PR_FALSE, ":-)", 3, "<img src=\"chrome://messenger/skin/smile.gif\" alt=\":-)\" class=txt-smily height=17 width=17 align=ABSCENTER>", outputHTML, glyphTextLen) ||
|
||||
SmilyHit(aInString, aInLength, PR_FALSE, ":)", 2, "<img src=\"chrome://messenger/skin/smile.gif\" alt=\":)\" class=txt-smily height=17 width=17 align=ABSCENTER>", outputHTML, glyphTextLen) ||
|
||||
SmilyHit(aInString, aInLength, PR_FALSE, ":-(", 3, "<img src=\"chrome://messenger/skin/frown.gif\" alt=\":-(\" class=txt-smily height=17 width=17 align=ABSCENTER>", outputHTML, glyphTextLen) ||
|
||||
SmilyHit(aInString, aInLength, PR_FALSE, ":(", 2, "<img src=\"chrome://messenger/skin/frown.gif\" alt=\":(\" class=txt-smily height=17 width=17 align=ABSCENTER>", outputHTML, glyphTextLen) ||
|
||||
SmilyHit(aInString, aInLength, PR_FALSE, ";-)", 3, "<img src=\"chrome://messenger/skin/wink.gif\" alt=\";-)\" class=txt-smily height=17 width=17 align=ABSCENTER>", outputHTML, glyphTextLen) ||
|
||||
SmilyHit(aInString, aInLength, PR_FALSE, ";)", 2, "<img src=\"chrome://messenger/skin/wink.gif\" alt=\";)\" class=txt-smily height=17 width=17 align=ABSCENTER>", outputHTML, glyphTextLen) ||
|
||||
SmilyHit(aInString, aInLength, PR_FALSE, ";-P", 3, "<img src=\"chrome://messenger/skin/sick.gif\" alt=\";-P\" class=txt-smily height=17 width=17 align=ABSCENTER>", outputHTML, glyphTextLen)
|
||||
SmilyHit(aInString, aInLength, PR_FALSE, ":-)", 3, "<img src=\"chrome://messenger/skin/smile.gif\" alt=\":-)\" class=\"moz-txt-smily\" height=17 width=17 align=ABSCENTER>", outputHTML, glyphTextLen) ||
|
||||
SmilyHit(aInString, aInLength, PR_FALSE, ":)", 2, "<img src=\"chrome://messenger/skin/smile.gif\" alt=\":)\" class=\"moz-txt-smily\" height=17 width=17 align=ABSCENTER>", outputHTML, glyphTextLen) ||
|
||||
SmilyHit(aInString, aInLength, PR_FALSE, ":-(", 3, "<img src=\"chrome://messenger/skin/frown.gif\" alt=\":-(\" class=\"moz-txt-smily\" height=17 width=17 align=ABSCENTER>", outputHTML, glyphTextLen) ||
|
||||
SmilyHit(aInString, aInLength, PR_FALSE, ":(", 2, "<img src=\"chrome://messenger/skin/frown.gif\" alt=\":(\" class=\"moz-txt-smily\" height=17 width=17 align=ABSCENTER>", outputHTML, glyphTextLen) ||
|
||||
SmilyHit(aInString, aInLength, PR_FALSE, ";-)", 3, "<img src=\"chrome://messenger/skin/wink.gif\" alt=\";-)\" class=\"moz-txt-smily\" height=17 width=17 align=ABSCENTER>", outputHTML, glyphTextLen) ||
|
||||
SmilyHit(aInString, aInLength, PR_FALSE, ";)", 2, "<img src=\"chrome://messenger/skin/wink.gif\" alt=\";)\" class=\"moz-txt-smily\" height=17 width=17 align=ABSCENTER>", outputHTML, glyphTextLen) ||
|
||||
SmilyHit(aInString, aInLength, PR_FALSE, ";-P", 3, "<img src=\"chrome://messenger/skin/sick.gif\" alt=\";-P\" class=\"moz-txt-smily\" height=17 width=17 align=ABSCENTER>", outputHTML, glyphTextLen)
|
||||
)
|
||||
)
|
||||
{
|
||||
|
@ -770,7 +766,7 @@ mozTXTToHTMLConv::GlyphHit(const PRUnichar * aInString, PRInt32 aInLength, PRBoo
|
|||
|
||||
outputHTML.Truncate();
|
||||
outputHTML += text0;
|
||||
outputHTML.AppendWithConversion("<sup class=txt-sup>");
|
||||
outputHTML.AppendWithConversion("<sup class=\"moz-txt-sup\">");
|
||||
|
||||
aOutputString.Append(outputHTML);
|
||||
aOutputString.Append(&aInString[2], delimPos - 2);
|
||||
|
@ -892,19 +888,6 @@ mozTXTToHTMLConv::ScanTXT(const PRUnichar * aInString, PRInt32 aInStringLength,
|
|||
PRBool doURLs = whattodo & kURLs;
|
||||
PRBool doGlyphSubstitution = whattodo & kGlyphSubstitution;
|
||||
PRBool doStructPhrase = whattodo & kStructPhrase;
|
||||
// DEBUG_BenB_Perf
|
||||
//doURLs = PR_FALSE;
|
||||
//doGlyphSubstitution = PR_FALSE;
|
||||
//doStructPhrase = PR_FALSE;
|
||||
|
||||
#ifdef DEBUG_BenB
|
||||
{
|
||||
printf("ScanTXT orginal: ");
|
||||
nsCString tmp;
|
||||
tmp.AssignWithConversion(aInString);
|
||||
printf(tmp.ToNewCString());
|
||||
}
|
||||
#endif
|
||||
|
||||
MOZ_TIMER_START(mScanTXTTimer);
|
||||
|
||||
|
@ -941,34 +924,35 @@ mozTXTToHTMLConv::ScanTXT(const PRUnichar * aInString, PRInt32 aInStringLength,
|
|||
{
|
||||
case '*':
|
||||
if (StructPhraseHit(newOffset, newLength, i == 0,
|
||||
"*", 1, "strong", "class=txt-star",
|
||||
"*", 1, "b", "class=\"moz-txt-star\"",
|
||||
aOutString, structPhrase_strong))
|
||||
{
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
case '_':
|
||||
if (StructPhraseHit(newOffset, newLength, i == 0,
|
||||
"_", 1, "span" /* <u> is deprecated */, "class=txt-underscore",
|
||||
aOutString, structPhrase_underline))
|
||||
{
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
case '/':
|
||||
if (StructPhraseHit(newOffset, newLength, i == 0,
|
||||
"/", 1, "em", "class=txt-slash",
|
||||
"/", 1, "i", "class=\"moz-txt-slash\"",
|
||||
aOutString, structPhrase_italic))
|
||||
{
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
case '_':
|
||||
if (StructPhraseHit(newOffset, newLength, i == 0,
|
||||
"_", 1, "span" /* <u> is deprecated */,
|
||||
"class=\"moz-txt-underscore\"",
|
||||
aOutString, structPhrase_underline))
|
||||
{
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
case '|':
|
||||
if (StructPhraseHit(newOffset, newLength, i == 0,
|
||||
"|", 1, "code", "class=txt-verticalline",
|
||||
"|", 1, "code", "class=\"moz-txt-verticalline\"",
|
||||
aOutString, structPhrase_code))
|
||||
{
|
||||
i++;
|
||||
|
@ -1022,16 +1006,6 @@ mozTXTToHTMLConv::ScanTXT(const PRUnichar * aInString, PRInt32 aInStringLength,
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef DEBUG_BenB
|
||||
{
|
||||
printf("ScanTXT result: ");
|
||||
nsCString tmp;
|
||||
tmp.AssignWithConversion(aOutString);
|
||||
printf(tmp.ToNewCString());
|
||||
printf("\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
MOZ_TIMER_STOP(mScanTXTTimer);
|
||||
}
|
||||
|
||||
|
@ -1043,15 +1017,6 @@ mozTXTToHTMLConv::ScanHTML(nsString& aInString, PRUint32 whattodo, nsString &aOu
|
|||
PRInt32 lengthOfInString = aInString.Length();
|
||||
const PRUnichar * uniBuffer = aInString.GetUnicode();
|
||||
|
||||
#ifdef DEBUG_BenB
|
||||
{
|
||||
printf("ScanHTML orginal: ");
|
||||
nsCString tmp;
|
||||
tmp.AssignWithConversion(aInString);
|
||||
printf(tmp.ToNewCString());
|
||||
printf("\n");
|
||||
}
|
||||
#endif
|
||||
#ifdef DEBUG_BenB_Perf
|
||||
PRTime parsing_start = PR_IntervalNow();
|
||||
#endif
|
||||
|
@ -1098,15 +1063,6 @@ mozTXTToHTMLConv::ScanHTML(nsString& aInString, PRUint32 whattodo, nsString &aOu
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef DEBUG_BenB
|
||||
{
|
||||
printf("ScanHTML result: ");
|
||||
nsCString tmp;
|
||||
tmp.AssignWithConversion(aOutString);
|
||||
printf(tmp.ToNewCString());
|
||||
printf("\n");
|
||||
}
|
||||
#endif
|
||||
#ifdef DEBUG_BenB_Perf
|
||||
printf("ScanHTML time: %d ms\n", PR_IntervalToMilliseconds(PR_IntervalNow() - parsing_start));
|
||||
#endif
|
||||
|
|
|
@ -472,8 +472,8 @@ PRBool nsHTMLToTXTSinkStream::IsConverted(const nsIParserNode& aNode)
|
|||
NS_SUCCEEDED(rv)
|
||||
&&
|
||||
(
|
||||
value.EqualsWithConversion("txt", PR_TRUE, 3) ||
|
||||
value.EqualsWithConversion("\"txt", PR_TRUE, 4)
|
||||
value.EqualsWithConversion("moz-txt", PR_TRUE, 7) ||
|
||||
value.EqualsWithConversion("\"moz-txt", PR_TRUE, 8)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
@ -908,8 +908,8 @@ nsHTMLToTXTSinkStream::AddLeaf(const nsIParserNode& aNode)
|
|||
}
|
||||
else if (type == eHTMLTag_text)
|
||||
{
|
||||
/* Check, if some other MUA (e.g. 4.x) recognized the URL in
|
||||
plain text and inserted an <a> element. If yes, output only once. */
|
||||
/* Check, if some other MUA (e.g. 4.x) recognized the URI in
|
||||
plain text and inserted an <a> element. If yes, output URI only once. */
|
||||
if (!mURL.IsEmpty() && mURL == text)
|
||||
mURL.Truncate();
|
||||
if (
|
||||
|
@ -1797,4 +1797,3 @@ PRInt32 unicharwidth(const PRUnichar* pwcs, PRInt32 n)
|
|||
|
||||
return width;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,83 +0,0 @@
|
|||
/*
|
||||
* These are the style attributes for the XUL display.
|
||||
*/
|
||||
window { overflow: auto; }
|
||||
mailheader { display: block; }
|
||||
mailattachcount { display: none; }
|
||||
|
||||
box[name=header-attachment] { background-color: #EFEFEF; border: 0px solid #EFEFEF; border-left-width: 4px; }
|
||||
box[name=header-part1] { background-color: #EFEFEF; border: 0px solid #EFEFEF; border-left-width: 4px; }
|
||||
box[name=header-part2] { background-color: #DEDEDE; border: 0px solid #DEDEDE; border-left-width: 4px; }
|
||||
box[name=header-part3] { background-color: #DEDEDE; border: 0px solid #DEDEDE; border-left-width: 4px; }
|
||||
box[name=header-seamonkey] { background-color: #DEDEDE; border: 0px solid #DEDEDE; border-left-width: 4px; }
|
||||
|
||||
headerdisplayname { font-weight: bold; white-space: pre; }
|
||||
header { text-align: left; }
|
||||
|
||||
menubar[name=attachment-menubar] { background-color: #EFEFEF; border: 0px solid #EFEFEF; }
|
||||
menu[name=attachment-menu] { background-color: #EFEFEF; border: 0px solid #EFEFEF; }
|
||||
|
||||
/*
|
||||
* For printing/HTML display...
|
||||
*/
|
||||
table[name=header-part1] { background-color: #EFEFEF; border: 0px solid #EFEFEF; border-left-width: 4px; }
|
||||
table[name=header-part2] { background-color: #DEDEDE; border: 0px solid #DEDEDE; border-left-width: 4px; }
|
||||
table[name=header-part3] { background-color: #DEDEDE; border: 0px solid #DEDEDE; border-left-width: 4px; }
|
||||
div.headerdisplayname { font-weight: bold; white-space: pre; display: inline; }
|
||||
|
||||
body {
|
||||
background-color: white;
|
||||
}
|
||||
|
||||
|
||||
|
||||
.text-flowed tt {
|
||||
font-family: inherit;
|
||||
}
|
||||
.text-flowed blockquote {
|
||||
margin: 0em 0em;
|
||||
border-color: black;
|
||||
}
|
||||
|
||||
/* Anyhow, the <div class=txt-sig> doesn't inherit whitespace setting from
|
||||
its parent pre, but from its ancestor .text-plain. */
|
||||
.text-plain {
|
||||
white-space: -moz-pre-wrap;
|
||||
}
|
||||
.text-plain[wrap=false] {
|
||||
white-space: pre;
|
||||
}
|
||||
.text-plain pre {
|
||||
font-family: inherit;
|
||||
white-space: inherit;
|
||||
margin: inherit;
|
||||
}
|
||||
/* That's how it should really be
|
||||
.text-plain pre {
|
||||
font-family: inherit;
|
||||
margin: inherit;
|
||||
}
|
||||
.text-plain[wrap=false] pre {
|
||||
white-space: pre;
|
||||
}
|
||||
*/
|
||||
.text-plain[graphical-quote=false] blockquote {
|
||||
padding-left: inherit;
|
||||
border-left: inherit;
|
||||
margin: 0em 0em;
|
||||
}
|
||||
.text-plain[graphical-quote=true] blockquote {
|
||||
margin: 0em 0em;
|
||||
border-width: medium;
|
||||
border-color: black;
|
||||
}
|
||||
.text-plain[graphical-quote=true] .txt-citetags {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.txt-sig, .signature {
|
||||
color: gray;
|
||||
}
|
||||
.txt-sig > a, .signature > a {
|
||||
color: 7777FF /* light blue */;
|
||||
}
|
|
@ -31,53 +31,42 @@ body {
|
|||
|
||||
|
||||
|
||||
.text-flowed tt {
|
||||
font-family: inherit;
|
||||
}
|
||||
.text-flowed blockquote {
|
||||
margin: 0em 0em;
|
||||
border-color: black;
|
||||
.moz-text-flowed blockquote {
|
||||
margin: inherit;
|
||||
border-width: medium;
|
||||
border-color: gray;
|
||||
}
|
||||
|
||||
/* Anyhow, the <div class=txt-sig> doesn't inherit whitespace setting from
|
||||
its parent pre, but from its ancestor .text-plain. */
|
||||
.text-plain {
|
||||
.moz-text-plain pre {
|
||||
font-family: inherit;
|
||||
margin: inherit;
|
||||
}
|
||||
.moz-text-plain[wrap=true] {
|
||||
white-space: -moz-pre-wrap;
|
||||
}
|
||||
.text-plain[wrap=false] {
|
||||
.moz-text-plain[wrap=false] {
|
||||
white-space: pre;
|
||||
}
|
||||
.text-plain pre {
|
||||
font-family: inherit;
|
||||
white-space: inherit;
|
||||
margin: inherit;
|
||||
.moz-text-plain[wrap=flow] .moz-txt-sig {
|
||||
white-space: -moz-pre-wrap;
|
||||
}
|
||||
/* That's how it should really be
|
||||
.text-plain pre {
|
||||
font-family: inherit;
|
||||
margin: inherit;
|
||||
}
|
||||
.text-plain[wrap=false] pre {
|
||||
white-space: pre;
|
||||
}
|
||||
*/
|
||||
.text-plain[graphical-quote=false] blockquote {
|
||||
.moz-text-plain[graphical-quote=false] blockquote {
|
||||
padding-left: inherit;
|
||||
border-left: inherit;
|
||||
margin: 0em 0em;
|
||||
margin: inherit;
|
||||
}
|
||||
.text-plain[graphical-quote=true] blockquote {
|
||||
margin: 0em 0em;
|
||||
.moz-text-plain[graphical-quote=true] blockquote {
|
||||
margin: inherit;
|
||||
border-width: medium;
|
||||
border-color: black;
|
||||
border-color: gray;
|
||||
}
|
||||
.text-plain[graphical-quote=true] .txt-citetags {
|
||||
.moz-text-plain[graphical-quote=true] .moz-txt-citetags {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.txt-sig, .signature {
|
||||
.moz-txt-sig, .moz-signature {
|
||||
color: gray;
|
||||
}
|
||||
.txt-sig > a, .signature > a {
|
||||
.moz-txt-sig > a, .moz-signature > a {
|
||||
color: 7777FF /* light blue */;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче