From ea28ffcd73473646defd2eca87a131209c2798db Mon Sep 17 00:00:00 2001 From: "akkana%netscape.com" Date: Fri, 5 May 2000 23:20:49 +0000 Subject: [PATCH] 38194: screen out moz br, which was producing an extra newline in textareas git-svn-id: svn://10.0.0.236/trunk@68460 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/htmlparser/src/nsHTMLToTXTSinkStream.cpp | 8 ++++++-- mozilla/parser/htmlparser/src/nsHTMLToTXTSinkStream.cpp | 8 ++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/mozilla/htmlparser/src/nsHTMLToTXTSinkStream.cpp b/mozilla/htmlparser/src/nsHTMLToTXTSinkStream.cpp index faa2b66e281..5b5742c10a5 100644 --- a/mozilla/htmlparser/src/nsHTMLToTXTSinkStream.cpp +++ b/mozilla/htmlparser/src/nsHTMLToTXTSinkStream.cpp @@ -811,8 +811,12 @@ nsHTMLToTXTSinkStream::AddLeaf(const nsIParserNode& aNode) } else if (type == eHTMLTag_br) { - // Do this even if we're not doing formatted output: - EnsureVerticalSpace(mEmptyLines+1); + // Another egregious editor workaround, see bug 38194: + // ignore the bogus br tags that the editor sticks here and there. + nsAutoString typeAttr; + if (NS_FAILED(GetValueOfAttribute(aNode, "type", typeAttr)) + || !typeAttr.EqualsWithConversion("_moz")) + EnsureVerticalSpace(mEmptyLines+1); } else if (type == eHTMLTag_whitespace) { diff --git a/mozilla/parser/htmlparser/src/nsHTMLToTXTSinkStream.cpp b/mozilla/parser/htmlparser/src/nsHTMLToTXTSinkStream.cpp index faa2b66e281..5b5742c10a5 100644 --- a/mozilla/parser/htmlparser/src/nsHTMLToTXTSinkStream.cpp +++ b/mozilla/parser/htmlparser/src/nsHTMLToTXTSinkStream.cpp @@ -811,8 +811,12 @@ nsHTMLToTXTSinkStream::AddLeaf(const nsIParserNode& aNode) } else if (type == eHTMLTag_br) { - // Do this even if we're not doing formatted output: - EnsureVerticalSpace(mEmptyLines+1); + // Another egregious editor workaround, see bug 38194: + // ignore the bogus br tags that the editor sticks here and there. + nsAutoString typeAttr; + if (NS_FAILED(GetValueOfAttribute(aNode, "type", typeAttr)) + || !typeAttr.EqualsWithConversion("_moz")) + EnsureVerticalSpace(mEmptyLines+1); } else if (type == eHTMLTag_whitespace) {