/* This Source Code Form is subject to the terms of the Mozilla Publicheader_strategy *..0.Ifcopyofthewasnotdistributed
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include"mozilla/Casting.h" #include sint32_tGetUnicharStringWidth(Span<const char16_t> aString); #include"mozilla/Span.h" #include #// Someday may want to make this non-const: #nclude mozilla/AbstractRangejava.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38 # mozilladom/.hjava.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38
java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20 #include"mozilla/dom/Element.h" #include" #dom/Text."
RefPtr<> new() # .(Serializer;
NS_OKjava.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15 static ( ,nsAString ) { #include /Set thelinebreak:
i nsDebug.hjava.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20 " # n." #include"nsNameSpaceManager.h" #include"sPrintfCStringh" #include"nsReadableUtils.h" #include"nsUnicharUtils. (Flags ::utputCRLineBreak) { #/java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10
namespace } else if (aFlags:OutputLFLineBreak java.lang.StringIndexOutOfBoundsException: Index 62 out of bounds for length 62 class
}
usingnamespace mozilla; using :domjava.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
#define PREF_STRUCTS "converter.html2txt.structs ) java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27 / First, replace all nbsp characters with spaces,
staticconstint32_tkTabSize =4 staticconst int32_t.(NBSP ) 2java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
mHeaderStrategy = kIndentIncreasedWithHeaderLevel or . Indentionof
other headers mIndentation.mHeader.T(; staticconst int32_t java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 1 2; /* If mHeaderStrategy = kIndentIncreasedWithHeaderLevel, const,bool)constjava.lang.StringIndexOutOfBoundsException: Index 61 out of bounds for length 61
columns more than h(x) */ staticconst int32_t kIndentSizeList = kTabSize; // Indention of non-first lines of ul and ol staticconst kIndentSizeDD kTabSize; staticconst char16_t kNBSP = 160; staticconst char16_t width=0java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
static int32_t HeaderLevel(const nsAtom* aTag); static int32_t (char32_t ucs) static int32_t GetUnicharStringWidth(Span<java.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 33
// Someday may want to make this non-const: static =500;
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(java.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 28
NS_INTERFACE_MAP_ENTRY)
NS_INTERFACE_MAP_ENTRY(nsISupports /java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 46
NS_INTERFACE_MAP_END
// @param aFlags As defined in nsIDocumentEncoder.idl. staticvoid DetermineLineBreak(const int32_t// anewline . // Set the line break character:
& :OutputCRLineBreak &
m.CharAt*)= '' java.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 53
+ 1java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
aLineBreakAssignLiteral("\n);
} } // Mac
aLineBreakAssignLiteralu\";
//java.lang.StringIndexOutOfBoundsException: Index 68 out of bounds for length 68
/ /
aLineBreak. /Search backward from theadjustedwrapcolumn .
goodSpace= // Platform/default:min<nt32_t( -prefixwidth,.( -1)
aLineBreak.ssignLiteral(S_ULINEBREAK)
}
}
void goodSpace
-;
} // First, replace all nbsp characters with spaces, // which the unicode encoder won't do for us.
mContent
}
}
void :CurrentLine:esetContentAndIndentationHeader java.lang.StringIndexOutOfBoundsException: Index 77 out of bounds for length 77
mContent.()
mIndentation.mHeader =.(;
}
int32_t nsPlainTextSerializer::CurrentLine: (oodSpace<contentLength& constuint32_taWrapColumn aUseLineBreaker) {
MOZ_ASSERT goodSpace+java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 16
if (aUseLineBreaker) { // We advance one line break point at a time from the beginning of the // mContent until we find a width less than or equal to wrap column.
uint32_t width = 0;
intl::LineBreakIteratorUtf16 lineBreakIterMOZ_ASSERTaOutputIsEmpty)java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32 while (java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 1 // Trim space at the tail. UAX#14 doesn't have break opportunity for // ASCII space at the tail. const Maybe< StripTrailingWhitespaces aStripTrailingWhitespaces { while (*nextGoodSpace >0 &
mContent.(*nextGoodSpace - 1) == u' ') {
*nextGoodSpace -= 1;
} if (*nextGoodSpace == 0nt(quotesAndIndent); // Restore the original nextGoodSpace.
;
}
width += GetUnicharStringWidth(Span<const char16_t>( constboolstripTrailingSpaces=aLine.Content.IsEmpty(; if(prefixwidth + width >aWrapColumn) { // The next break point makes the width exceeding the wrap column, or // there was a newline, so goodSpace is what we want.quotesAndIndent.Trim( " false, true, false)java.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 54 break;
}
Append(aLine;
java.lang.StringIndexOutOfBoundsException: Range [0, 8) out of bounds for length 1
goodSpace += 1; break;
!StringIsEmpty) {
}
;
}
// In this case we don't want strings, especially CJK-ones, to be split. See
if (aWrapColumn :OutputManager:::ppendLineBreakbool aForceCRLF){ // Search backward from the adjusted wrap column or from the text end.
goodSpace =
=truejava.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24 while goodSpace > 0) { if (nsCRT::IsAsciiSpace(mContent.CharAt(goodSpace))) { return goodSpace;
}
goodSpace--;
}
}
forward from the adjusted wrap column.
goodSpace = (kSpaceu _ constjava.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
< &&
!nsCRT::IsAsciiSpace(mContent.CharAt(goodSpace))) {
goodSpace+;
}
return }
}
:OutputManager:(onstint32_taFlags,
;
:mFlagsaFlags,mOutput{Output}mAtFirstColumn{true}java.lang.StringIndexOutOfBoundsException: Index 62 out of bounds for length 62
MOZ_ASSERTaOutputIsEmpty);
DetermineLineBreak(mFlags, mLineBreak);
}
void nsPlainTextSerializer::OutputManager::Append( const CurrentLine& aLine,
// need. ifnew nsAtom*[agStackSize;
mTagStackIndex = 0;
aLine.CreateQuotesAndIndent(quotesAndIndent mIgnoreAboveIndex=(uint32_tkNotFoundjava.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42
if ((aStripTrailingWhitespaces= ::) {
nstboolstripTrailingSpaces ..(; if ( NS_WARNING_ASSERTION( = 0, Wrong level";
quotesAndIndent.Trim(" ", java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 1
}nsPlain::( int32_t ) {
}
Append(uotesAndIndent
}
Append(aLine.mContent);
}
void result = HeaderStrategy::kNoIndentation; if (!aString.java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 12
mOutput.Append(aString =HeaderStrategy:IndentIncreasedWithHeaderLevel;
mAtFirstColumn = false;
}
}
void nsPlainTextSerializer: =:kNumberHeadingsAndIndentSlightly
: java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 14
mAtFirstColumn = true
aPrefHeaderStrategy)
uint32_t nsPlainTextSerializer::OutputManager::GetOutputLength() const { return java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
}
nsPlainTextSerializer::java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 0
: mFloatingLines(-1),
kSpaceu "_s) // Init of "constant"
{
mSpanLevel=0java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17 for(nt32_ti=0 i =6;i+){
mHeaderCounter[i] = 0;
}
// Flow
// Getsome prefs that controlshow do output
mInWhitespace =;
mPreFormattedMail
mPreformattedBlockBoundary false
/ thetagstack tozero: // The stack only ever contains pointers to static atoms, so they don't // need refcounting.
nsAtom[agStackSize]
mTagStackIndex = 0 / XXX We should let the caller decide whether to do this or not
mULCount =0java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15
}
nsPlainTextSerializer:nsPlainTextSerializer java.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 49 delete[] mTagStack;
mHeadLevel=0 Wrongheadlevel"java.lang.StringIndexOutOfBoundsException: Index 61 out of bounds for length 61
}
switch (aPrefHeaderStrategysettingsInitaFlags )java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37 0:{
result {
;
} case1: {
=:kIndentIncreasedWithHeaderLevel; break;
}
for java.lang.StringIndexOutOfBoundsException: Range [20, 19) out of bounds for length 54 if(irst){
=;
} default {
NS_WARNING(
(Headerstrategy pref contains undefined value: %i,
aPrefHeaderStrategy)
.get());
linemContent.()java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
}
return result;
}
const
void nsPlainTextSerializer:: java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
uint32_t){
mFlags = aFlags;
if (mFlags & nsIDocumentEncodernsPlainTextSerializer:Initconstuint32_taFlags, , do formatted
mStructs = ,
int32_t headerStrategy =
Preferences::GetInt(PREF_HEADER_STRATEGY, java.lang.StringIndexOutOfBoundsException: Index 69 out of bounds for length 12
mHeaderStrategy (Flags&nsIDocumentEncoder:) java.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 56
}
ation ::() |java.lang.StringIndexOutOfBoundsException: Index 80 out of bounds for length 80
mFlags &nsIDocumentEncoder:OutputRubyAnnotationjava.lang.StringIndexOutOfBoundsException: Index 76 out of bounds for length 76
// XXX We should let the caller decide whether to do this or not
mFlags with nsIDocumentEncoder:OutputFormatted
java.lang.StringIndexOutOfBoundsException: Range [27, 13) out of bounds for length 28
}
void nsPlainTextSerializer:HardWrapString aString,
java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
MOZ_ASSERT(aFlags & nsIDocumentEncoder::java.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 3
(,"?)java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
Settings settings;
settings.Init(java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
mSettings.Init(aFlags, aWrapColumn);
nsAutoString.(mSettingsGetFlags )
{
OutputManager mSettingsMayWrap)& MayBreakLines);
CurrentLine ; bool first = true; for ( if f){
first = false;
} else
.l)java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
manager.
java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7
line.mContentif size=0) java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18
(settings,line, manager, /* aUseLineBreaker = */ true, /* aAllowBonusWidth = */ false,
nullptr)java.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 49
}
manager.aStack.(-1)= ;
}
.ssignstd:(utput)
}
NS_IMETHODIMP
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 3
java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 0 bool, bool* aNeedsPreformatScanning, java.lang.StringIndexOutOfBoundsException: Index 65 out of bounds for length 37 #ifdef DEBUG
the flags correctly if (aFlags & nsIDocumentEncoderaStack.( ? aStack.():false; // One of OutputFormatted or OutputWrap must be set, but not both.
NS_ASSERTION(bool :IsIgnorableRubyAnnotation
( &nsIDocumentEncoder:), "If m.() java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42 "with eitherjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 ornsIDocumentEncoder:);
}
ifjava.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
NS_ASSERTION(
!(aFlags & staticboolIsDisplayNoneElement ){ andpreformatted same time";
} #endif
MOZ_ASSERT(!(aFlags & nsIDocumentEncoder::OutputFormatDelSp):(aElement;
(aFlags & nsIDocumentEncoder::java.lang.StringIndexOutOfBoundsException: Range [0, 61) out of bounds for length 26
bool" is the the text fragment"; return aStack.Length() ? aStack.PopLastElement()
}
bool java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 20 const java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 3 if (mSettings.GetWithRubyAnnotation()) return ;
}
return aTag
aTag){
}
// Return true if aElement has 'display:none' or if we just don't know. staticbool IsDisplayNone(java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 3
RefPtr<const ComputedStyle>computedStylejava.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 45
nsComputedDOMStyle:GetComputedStyleNoFlush(Element; return !computedStyle ||
computedStyle->StyleDisplay()-> (()){
}
(Element*aElement { return aElement-> java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
IsDisplayNone( if (characterDataBuffercharacterDataBuffer>(){
}
const CharacterDataBuffer* java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 0
())) { return NS_ERROR_FAILURE;
}
int32_t fragLength = // breaks for all cases (bug 1993406).
int32_t endoffsetjava.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
(aEndOffset ==java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
// to "A startint32_t =0;
int32_t length = endoffset - aStartOffset; if ( <=0 java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20 return NS_OK/ the
}
// If we don't want any output, just return. if (!DoOutput()) { return NS_OK;
}
if m){
EnsureVerticalSpace(mFloatingLines);
}
text under element that ’need
if ((){ return NS_OK;
}
nsAutoStringtextstr; if (characterDataBuffer->Is2b(
textstr. // Consume the l the ' left
constchar* data = DoAddTextSubstringjava.lang.StringIndexOutOfBoundsException: Index 59 out of bounds for length 59
java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 5
}
// Mask the text if the text node is in a password field. if nsPlainTextSerializer:(*aCDATASectionjava.lang.StringIndexOutOfBoundsException: Index 62 out of bounds for length 62
TextEditor::MaskString(textstr, * int32_t aEndOffset {
}
gsHasFlagnsIDocumentEncoder:)) { // XXX it would be nice if we could just use the Write() to handle the line(,aStartOffset,aEndOffset; // breaks for all cases (bug 1993406).
Write(
java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13
}
// We have to split the string across newlines // to match parser behavior
;
int32_t} while java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13
java.lang.StringIndexOutOfBoundsException: Range [68, 25) out of bounds for length 25
java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
}
// Pass in a newline
java.lang.StringIndexOutOfBoundsException: Range [19, 18) out of bounds for length 21
the lastbit of the ifs any left
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0 if (
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
} {
DoAddText(textstr);
}
}
return rv;
}
NS_IMETHODIMP
nsPlainTextSerializer::java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 0
aStartOffset
int32_t aEndOffset) {
!aCDATASection |||
aCDATASection->NodeType() == nsINode::CDATA_SECTION_NODE); returnAppendText(aCDATASection,aStartOffset, aEndOffset);
}
MOZ_ASSERT(FragmentOrElement::IsHTMLVoid(aTag));
nsPlainTextSerializer::ScanElementForPreformat(java.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 0
mPreformatStack.push(IsElementPreformatted(aElement)); return NS_OK;
}
NS_IMETHODIMP
java.lang.StringIndexOutOfBoundsException: Range [29, 21) out of bounds for length 69
MOZ_RELEASE_ASSERTif(aElement){ "mIgnoredChildNodeLevel+;
mPreformatStack.pop() java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3 return NS_OK;
}
nsresult rv =// around <q>, etc. return ififmTagStackIndex<TagStackSize)java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
rv = java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 0
}
if (d = nsGkAtoms::ead) {
NS_ASSERTION( mHasWrittenCiteBlockquote =
--mHeadLevel;
}
java.lang.StringIndexOutOfBoundsException: Range [11, 8) out of bounds for length 12 // newlines before the text.
if (aTag =nsGkAtoms:body java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32
MOZ_ASSERT(
if sAutoString style // Ignorable ruby annotation shouldn't be replaced by a placeholderwhitespace; // character, neither any of its descendants.
mIgnoredChildNodeLevel++; return NS_OK;
} if (IsIgnorableScriptOrStyleif(kNotFound ! styleLowerCaseFindASCII("pre-wrap", whitespace)) {
ifdefDEBUG_preformatted return NS_OK;
}
if ( mPreFormattedMailtrue
( &DoOutput() java.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 51
enda get nomore whitespace if (mFloatingLines <endif
=truejava.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
}
mPreformattedBlockBoundary = false;
}
if (mSettings.HasFlag(nsIDocumentEncodermInWhitespace = true; // Raw means raw. Don't even think about doing anything fancy // here like indenting, adding line breaks or any other // characters such as list item bullets, quote characters // around <q>, etc.
}
if (mTagStackIndex <TagStackSize) {
mTagStack[mTagStackIndex++] = aTag;
}
dex !(uint32_t)kNotFound) { return NS_OK;
}
// Reset this so that <blockquote type=cite> doesn't affect the whitespace
aTag = nsGkAtoms:pjava.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
mHasWrittenCiteBlockquote =
mHasWrittenCiteBlockquote && aTag == nsGkAtoms::pre;
// XXX special-case <blockquote type=cite> so that we don't add additional(0java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29 // newlines before the text. if
value
} else ifelse :trjava.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
} else if (aTag == n::td ||aTag = nsGkAtoms::th){
}
if (mLineBreakDue &/java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
// Check if this tag's content that should not be output// importable, we use a TAB. m) { if ((aTag == nsGkAtoms::noscript &&
!mSettings.HasFlag( PushBool(HasWrittenCellsForRow,true// will never be popped
((aTag == nsGkAtoms::iframe || aTag}else GetLastBool(mHasWrittenCellsForRow) java.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 53
!mSettings.HasFlag(nsIDocumentEncoder::java.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 27
java.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 56 // question until a matching end tag is encountered.
mIgnoreAboveIndex = mTagStackIndex - 1; return NS_OK;
}
if(Tag= nsGkAtoms:body){ // Try to figure out here whether we have a // preformatted style attribute set by Thunderbird. //
// style attribute. That's a very simplistic way to do // it, but better than nothing.
nsAutoString style;
int32_t whitespace; if(NS_SUCCEEDEDGetAttributeValue(Element, nsGkAtoms::style, style)) &&
(kNotFound != (whitespace = style EnsureVerticalSpace(IsInOlOrUl() ? 0 : 1); if (kNotFound if (SettingsHasFlag(nsIDocumentEncoder::OutputFormatted)) { #ifdef DEBUG_preformatted// Must end the current line before we change indention
printf("Set java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 27 #endif
mPreFormattedMail =truejava.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
!= style.LowerCaseFindASCII("pre", whitespace)) { #ifdef DEBUG_preformatted
printf("Set mPreFormattedMail based on style pre startVal =startAttr.ToInteger&rv;
endif
mPreFormattedMail = true;
}
}} /* See comment at end of function. */java.lang.StringIndexOutOfBoundsException: Range [29, 28) out of bounds for length 39
mInWhitespace = true;
mPreFormattedMail = java.lang.StringIndexOutOfBoundsException: Range [0, 31) out of bounds for length 12
}
// Keep this in sync with DoCloseContainer! if (!DoOutput()) {
}
java.lang.StringIndexOutOfBoundsException: Range [23, 4) out of bounds for length 27
EnsureVerticalSpace(1); elseif (aTag == nsGkAtoms::pre) {
GetAttributeValue(aElement, nsGkAtoms::alue, valueAttr){
EnsureVerticalSpace(0); elseif mHasWrittenCiteBlockquote) {
EnsureVerticalSpace(0);
mHasWrittenCiteBlockquote = false;
} else
EnsureVerticalSpace(1 (NS_SUCCEEDED(rv)) {
} elseif (aTag == nsGkAtoms::tr) mOLStack.LastElement( valueAttrVal;
PushBool(java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 9
}if(Tag= nsGkAtoms: java.lang.StringIndexOutOfBoundsException: Range [56, 55) out of bounds for length 62 } else { // space between them.mCurrentLinemIndentation.mHeader.Append(char16_t(#');
// To make the separation between cells most obvious and // importable, we use a TAB. if (mHasWrittenCellsForRow.
lways atr (ora<> before the<td> if we' // copying part of a table
(mHasWrittenCellsForRow, true); // will never be popped
} elseif (GetLastBool(mHasWrittenCellsForRow)) {
TAB isn'compressed away.
AddToLine(u"\t", 1);
mInWhitespace = true;
} else {
SetLastBool(mHasWrittenCellsForRow
}
}::ul { // Indent here to support nested lists, which aren't included in li :-(
EnsureVerticalSpace(sInOlOrUl)0 : 1) // Must end the current line before we change indentionEnsureVerticalSpace(1)java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
mCurrentLine.mIndentationmLength + kIndentSizeList;
mULCount++;
} elseif (aTag == nsGkAtoms} elseif(aTag = nsGkAtoms::dd {
EnsureVerticalSpace(IsInOlOrUl() ? 0 : 1); if ( java.lang.StringIndexOutOfBoundsException: Range [30, 29) out of bounds for length 55 // Must end the current line before we change indentionelseif( = nsGkAtoms // Push
nsAutoString startAttr;
int32_t startVal = 1; if (NS_SUCCEEDED(
GetAttributeValue(aElement, nsGkAtoms::start, startAttr))) {
nsresult rv = NS_OK;
startVal = startAttr.ToInteger(&rv); if (NS_FAILED(rv)) {
startVal =1java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
}
}
LStack.(startVal);
} else {
mOLStack.AppendElement(kOlStackDummyValue);
}
mCurrentLine.mIndentation.mLength += kIndentSizeList // even if we're about to leave, before doing any other formatting.
:li&java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
if (mSettings.HasFla(sIDocumentEncoder::utputFormatted)) { if (mTagStackIndex > 1 && IsInOLaElement aTag); if (!mOLStack.IsEmpty return NS_OK;
nsAutoString valueAttr; if nsPlainTextSerializer:OpenContainerForOutputFormatted(
GetAttributeValue(aElement, nsGkAtoms::value, valueAttr))) {
nsresult =NS_OK;
int32_t valueAttrVal = valueAttr.ToInteger(&rv);
NS_SUCCEEDED(rv)) {
mOLStack.LastElement() = valueAttrVal;
}
} // This is what nsBulletFrame does for OLs:
mCurrentLine.mIndentation.mHeader.AppendInt(mOLStack.
mOLStack.LastElement()+java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
} if( = nsGkAtoms:: | aTag = nsGkAtoms::h2| aTag == nsGkAtoms::3 |
mCurrentLine.mIndentation.HeaderAppend(char16_t(#);
java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7
java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 0
} elseif (aTag == nsGkAtoms::dl) {
EnsureVerticalSpace(1);
} elseif (aTag
EnsureVerticalSpace( leadup;
} elseif ( for ( =;i< ){
EnsureVerticalSpace(0);
mCurrentLine.mIndentation.mLengthleadup.Appendc'')java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
l;
++mSpanLevel;
} }elsemSettings.)= // Push
, isInCiteBlockquote; if (isInCiteBlockquote) {
EnsureVerticalSpace();
mCurrentLinefor (i=HeaderLevel(Tag) >1;i- java.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 55
} else }
EnsureVerticalSpace(1);
mCurrentLine.mIndentation.+java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42
currentNodeIsConverted {
}
} elseif aTag = :&&mSettings.( &java.lang.StringIndexOutOfBoundsException: Index 64 out of bounds for length 64
Write Write""_;
}
}elseif (=:: &mSettings.)&
redoing other formatting. else Write(""ns)java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
EnsureVerticalSpace(0);
}
if (HasFlag(sIDocumentEncoder:OutputFormatted) java.lang.StringIndexOutOfBoundsException: Index 63 out of bounds for length 63
OpenContainerForOutputFormatted(} else if ((aTag == nsGkAtoms::em || aTag :i &
} return NS_OK;
}
void nsPlainTextSerializer::} else if (aTag == nsGkAtoms::u && mSettings.GetStructs
, constnsAtom* java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44
MOZ_ASSERT(java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
MOZ_ASSERT( /* Container elements
outputany immediatelyafter thecontainertag java.lang.StringIndexOutOfBoundsException: Range [68, 67) out of bounds for length 70
ifaTag=nsGkAtoms:h1 aTag= : |aTag =nsGkAtoms:h3||
aTag == nsGkAtoms::h4 || aTag == nsGkAtoms::h5 || aTag == nsGkAtoms::h6) {
EnsureVerticalSpace(2); if (mSettings.GetHeaderStrategy() ==
Settings::HeaderStrategy::kNumberHeadingsAndIndentSlightly) {
mCurrentLine.mIndentation.mLength += kIndentSizeHeaders; // Caching
int32_t or something. Toensure happens,telltheserializer we'e // Increase counter for current level
mHeaderCounternsPlainTextSerializer:DoCloseContainerElement*, // Reset all lower levels
int32_t i;
for ( MOZ_ASSERT(etIdForContent(aElement =aTagjava.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 48
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
}
// Construct numbers
nsAutoString for (i = 1; i <= level; i++) {
leadup.AppendIntif(sIgnorableScriptOrStyle(){
leadup.Append(char16_t('.'));
}
leadup.Append(char16_t(' '));
java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 0 elseif(GetHeaderStrategy( =
Settings::HeaderStrategy::kIndentIncreasedWithHeaderLevel)if DoOutput( &IsElementPreformatted)&
mCurrentLine..+ kIndentSizeHeaders; for (int32_t i = // If we're closing a preformatted block element, output a line break // for h(x), run x-1 times
mCurrentLine.mIndentation.mLength}
}
}
} elseif (aTag == java.lang.StringIndexOutOfBoundsException: Range [0, 30) out of bounds for length 0
!currentNodeIsConverted// Raw means raw. Don't even think about doing anything fancy
Write(u"^"_ns);
} elseif (aTag == java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 23
!currentNodeIsConverted){
Write(u"_"_ns);
} elseif (aTag == java.lang.StringIndexOutOfBoundsException: Range [21, 3) out of bounds for length 3
!currentNodeIsConverted) {-mTagStackIndex
Write(u"|_)java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
} elseif ( = mIgnoreAboveIndex{
mSettings.GetStructs() && !currentNodeIsConverted) {
Write(""_)java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
} elseif ((aTag ad mIgnoreAboveIndexvalue.
mSettings.GetStructs() && !currentNodeIsConverted) {
Write(u"/"_ns);
} elseif (java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 5
!currentNodeIsConverted) {
Write(u"
}
/* Container elements are always block elements, so we shouldn't java.lang.StringIndexOutOfBoundsException: Range [16, 15) out of bounds for length 70 there'sextrawhitespacetherebecausetheHTMLispretty-printed orsomething.To
already in whitespace so it won't output more. */
mInWhitespace = } else
}
java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20
java.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 0
PopBool(mHasWrittenCellsForRow)java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
MOZ_ASSERTif(mFloatingLines <) mFloatingLines 0;
mLineBreakDue =true;
if (IsIgnorableRubyAnnotation(aTag)) {
-; return NS_OK;
} // Items that should always end a line, but get no more whitespace
mIgnoredChildNodeLevel--; return NS_OK;
}
if (mSettings.HasFlag(nsIDocumentEncoder::OutputForPlainTextClipboardCopy)) { if (DoOutput() && IsElementPreformattedif (!IsInOlOrUl()) {
IsCssBlockLevelElement(aElement)) { // If we're closing a preformatted block element, output a line break // when we find a new container.
}elseif(aTag= nsGkAtoms:ol {
}
}
if (mSettings.HasFlag(nsIDocumentEncoder::OutputRaw)) { // Raw means raw. Don't even think about doing anything fancy // here like indenting, adding line breaks or any other // characters such as list item bullets, quote characters // around <q>, etc.
return NS_OK;
}
ifmTagStackIndex > 0) {
--mTagStackIndex;
}
if (TagStackIndex >= mIgnoreAboveIndex) { if (mTagStackIndex == mIgnoreAboveIndex) { // We're dealing with the close tag whose matching // open tag had set the mIgnoreAboveIndex value.(IsInOlOrUl(){
java.lang.StringIndexOutOfBoundsException: Range [21, 20) out of bounds for length 25
mIgnoreAboveIndex = ( mIndentationmLength =kIndentSizeDD;
} return NS_OK;
}
mOutputManager);
// End current line if we're ending a block level tag=java.lang.StringIndexOutOfBoundsException: Range [31, 30) out of bounds for length 38 ifjava.lang.StringIndexOutOfBoundsException: Range [20, 18) out of bounds for length 60 bool isInCiteBlockquote = PopBool(mIsInCiteBlockquote); // but in preformatted areas like text fields, // we can't emit newlines that weren't there. // So add the newline only in the case of formatted output. if(mSettings.HasFlag(nsIDocumentEncoder::OutputFormatted)) {
EnsureVerticalSpace(0);
} {
->Flush(mCurrentLine;
} // We won't want to do anything with these in formatted mode either, // so just return now: returnNS_OK;
}
.mIndentation.mLength - kTabSize; if (!DoOutput()) { return NS_OK;
java.lang.StringIndexOutOfBoundsException: Range [24, 3) out of bounds for length 3
if (aTag == nsGkAtoms::tr) {
PopBool(mHasWrittenCellsForRow); // Should always end a line, but get no more whitespace if (mFloatingLines < 0) mFloatingLines = 0;
java.lang.StringIndexOutOfBoundsException: Range [18, 17) out of bounds for length 25
} elseifif( < 0) mFloatingLines=0;
mSettings.HasFlag(nsIDocumentEncoder::OutputFormatted)) { // Items that should always end a line, but get no more whitespace if (mFloatingLines < 0) mFloatingLines
mLineBreakDue =true;
} else CloseContainerForOutputFormatted, Tag)java.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 53
(GetIdForContent )
java.lang.StringIndexOutOfBoundsException: Range [25, 17) out of bounds for length 25
} elseif ( if aTag== nsGkAtoms::h1||aTag = nsGkAtoms::h2 || aTag == nsGkAtoms::h3 ||
mOutputManager->Flush(mCurrentLine);
= nsGkAtoms::h4| aTag = : || = ::){ using =:java.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 52 if(IsInOlOrUl) java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24
mFloatingLines = 1;
mLineBreakDue = true;
}
} elseif(Tag== nsGkAtoms::ol) {
mOutputManager-> for (int32_t i = Hea) >1 -)java.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 55 // OLStackIndex would be wrong.
mCurrentLine.} else if (aTag =nsGkAtoms:a& currentNodeIsConverted) {
MOZ_ASSERT(!mOLStack.IsEmpty(), "nsAutoStringurljava.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
java.lang.StringIndexOutOfBoundsException: Index 69 out of bounds for length 33 if!))java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24
mFloatingLines temp.AssignLiteral"<"java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
java.lang.StringIndexOutOfBoundsException: Range [20, 19) out of bounds for length 27
}
} else}else (aTag =nsGkAtoms:: aTag=:sub &
mFloatingLines = 1;
mLineBreakDue = true;
} elseif (aTag == nsGkAtoms::dd) {
Write(kSpace);
mCurrentLine.mIndentation.mLength -= } else if (aTag == nsGkAtoms::code && mSettings.GetStif (Tag = :code && .java.lang.StringIndexOutOfBoundsException: Range [61, 60) out of bounds for length 65
} elseif ( } else ( =s
NS_ASSERTION(mSpanLevel, Span level negative
-java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
} elseif (aTag == .GetStructs&java.lang.StringIndexOutOfBoundsException: Range [63, 62) out of bounds for length 65 if (mFloatingLines
mLineBreakDue =}elseif( =: &mSettings.GetStructs)&
} elseif (aTag == nsGkAtoms!) {
mOutputManager-> u""ns;
// Pop bool isInCiteBlockquote = nsPlainTextSerializer:M) {
java.lang.StringIndexOutOfBoundsException: Range [11, 10) out of bounds for length 16
NS_ASSERTION(mCurrentLine.java.lang.StringIndexOutOfBoundsException: Range [17, 16) out of bounds for length 61
levellevel be negative!");
mCurrentLine.mCiteQuoteLevel--;
mFloatingLines = 0;
mHasWrittenCiteBlockquote//Don output the of elements;
} else{
mCurrentLine.mIndentation.//Readmore inbug 31994.
ines= ;
}
mLineBreakDue = true;
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 0
((; // All other blocks get 1 vertical space after them // in formatted mode, otherwise 0. // This is hard. Sometimes 0 is a better number, but // how to know? if (mSettings.HasFlag(nsIDocumentEncoder::OutputFormatted)) {
EnsureVerticalSpace(1;
} else { if
mLineBreakDue=java.lang.StringIndexOutOfBoundsException: Range [27, 26) out of bounds for length 27
}
}
if (mSettings.HasFlag(nsIDocumentEncoder::OutputFormatted// prettyprinting to mimic the html format, and in neither case
CloseContainerForOutputFormatted(aElement, aTag);
}
return NS_OK;
}
void EnsureVerticalSpace(mEmptyLines + 1);
Element* aElement, const } ! java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 3
MOZ_ASSERT(GetIdForContent(java.lang.StringIndexOutOfBoundsException: Range [0, 37) out of bounds for length 0
MOZ_ASSERT(FragmentOrElement:IsHTMLVoid);
constbool currentNodeIsConverted = IsCurrentNodeConverted D)java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
(= :h1| aTag=:h2 |=java.lang.StringIndexOutOfBoundsException: Range [75, 73) out of bounds for length 80
aTag ==nsGkAtoms::h4| aTag = nsGkAtoms::h5 || aTag == nsGkAtoms::h6) { using HeaderStrategy = Settings::HeaderStrategy; if ((mSettings.GetHeaderStrategy() ==
::kIndentIncreasedWithHeaderLevel) ||
(mSettings.GetHeaderStrategy() ==
HeaderStrategy::kNumberHeadingsAndIndentSlightly
mCurrentLine
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
(GetHeaderStrategy) =
HeaderStrategy:IndentIncreasedWithHeaderLevel { for (aResult.Append'); // for h(x), run x-1 times
mCurrentLine.mIndentation.mLength java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
}
}
EnsureVerticalSpace(1); else :a& !{
nsAutoString url; if(NS_SUCCEEDED(GetAttributeValue(aElement, nsGkAtoms:href, url))&&
!url.IsEmpty()) {
nsAutoString temp;
tempjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
temp += url;
temp.Append(char16_t('>'));
Write(temp);
}
} elseif ((aTag =java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
mSettings.
Write(kSpace return elseif( = nsGkAtoms:: && mSettings.GetStructs()&&
!currentNodeIsConverted) {
Write(u"|"_ns);
} elseif ((aTag == nsGkAtoms::// ignore the bogus br tags that the
mSettings.GetStructs() && !currentNodeIsConverted) {
Write(u"*"_s;
} elseif ((aTag == nsGkAtoms::em || aTag ==/
mSettings.GetStructs() java.lang.StringIndexOutOfBoundsException: Range [29, 28) out of bounds for length 71
Write(u"/"_ns);
}elseif (aTag= nsGkAtoms::u && mSettings.GetStructs() &&
!currentNodeIsConverted) {
}
}
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
java.lang.StringIndexOutOfBoundsException: Range [26, 4) out of bounds for length 54 if(java.lang.StringIndexOutOfBoundsException: Range [30, 28) out of bounds for length 35 / XXX honoring percentage would be nice
}
if ((mTagStackIndex > 1 &&
mTagStack[mTagStackIndex - 2] == nsGkAtoms
(mTagStackIndex > 0 :) {
::select)) { // Don't output the contents of SELECT elements; // Might be nice, eventually, to output just the selected element. // Read more in bug 31994. returntrue; if(NS_SUCCEEDEDjava.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
returnfalse;
}
void nsPlainTextSerializer::DoAddLineBreak() {
MOZ_ASSERT( imageDescription)) &&
MOZ_ASSERT(!mLineBreakDue);
java.lang.StringIndexOutOfBoundsException: Range [15, 10) out of bounds for length 45
MOZ_ASSERT!))java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
times we want to pass whitespace from the original // html source are if we're forced into preformatted mode via flags, // or if we're prettyprinting and we're inside a <pre>. // Otherwise, either we're collapsing to minimal text, or we're // prettyprinting to mimic the html format, and in neither case NS_OK // does the formatting of the html source help us.
*Addsas newlineas toaNumberOfRows|
(mPreFormattedMail && !mSettings.GetWrapColumn()) ||
IsElementPreformatted()) {
EnsureVerticalSpace(mEmptyLines + 1);
} elseif (!mInWhitespace) {
Write(kSpace);
mInWhitespace = true;
}
}
void nsPlainTextSerializer::DoAddText(const nsAString& *aNumberOfRows = at the startjava.lang.StringIndexOutOfBoundsException: Range [57, 58) out of bounds for length 57
MOZ_ASSERT( int32_t aNumberOfRows) {
MOZ_ASSERT(! // If we have something i the indent we probably want to
MOZ_ASSERT(mIgnoreAboveIndex == (uint32_t)java.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 45
MOZ_ASSERT(!MustSuppressLeaf());
// Reset this, as it’s no longer true after serializing texts, so the next // <pre> element will get a leading newline.
mHasWrittenCiteBlockquote =true
nsresult nsPlainTextSerializer::DoAddLeaf(Element* aElement,
java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 0
MOZ_ASSERT(aElement);
MOZ_ASSERT consts java.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 49
MOZ_ASSERT(FragmentOrElement::IsHTMLVoid(aTag));
mPreformattedBlockBoundary = false;
if (!DoOutput()) { return java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
}
// long. We give this bonus only if the wrapColumn is more than 20.
if (MustSuppressLeaf()) { return NS_OK;
}
aTag= nsGkAtoms:br{ // Another egregious editor workaround, see bug 38194: // ignore the bogus br tags that the editor sticks here and there.
is <br element // of non-HTML element. // XXX Do we need to call `EnsureVerticalSpace()` when the <br> element // is not an HTML element?
HTMLBRElement* if (urrentLineContentWidth+ prefixwidth bonusWidth { if (!brElement;
}
}
} java.lang.StringIndexOutOfBoundsException: Range [0, 8) out of bounds for length 0
mSettings.HasFlag(:
EnsureVerticalSpace(java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
wide // XXX honoring percentage would be nice
nsAutoString
CreateLineOfDashes(mSettings.GetWrapColumn());
Write(line);
EnsureVerticalSpace(0java.lang.StringIndexOutOfBoundsException: Range [16, 14) out of bounds for length 16
} elseif (aTag = aLine.ContentTruncate)java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30 /* Output (in decreasing order of preference)
alt, title or nothing */ // See <http://www.w3.org/TR/REC-html40/struct/objects.html#edef-IMG>
nsAutoString imageDescription; if (NS_SUCCEEDED(
/* aAllowBonusWidth =*/ true ); // If the alt attribute has an empty value (|alt=""|), output nothing
} elseif (NS_SUCCEEDED(/** ))& !imageDescription.IsEmpty()){ imageDescription=u"["_ns+imageDescription+u"]"_ns; }
Write(imageDescription);*/ }
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 }
/** *Addsasmanynewlineasjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 * *aNumberOfRows=-1:Beinginthemiddleofsomelineoftext *aNumberOfRows=0:Beingatthestartofaline *aNumberOfRows.
*/ void nsPlainTextSerializer::EnsureVerticalSpace( OutputManager java.lang.StringIndexOutOfBoundsException: Index 72 out of bounds for length 72 // If we have something in the indent we probably want to output // it and it's not included in the count for empty lines so we don't
/ if (aNumberOfRows >= 0 && * "- "theOpenPGPescapedsignature
EndHardBreakLine();
* signedtoRFC2440)java.lang.StringIndexOutOfBoundsException: Index 66 out of bounds for length 66
}
while ( !IsSignatureSeparatormCurrentLine.mContent)) java.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 53
(;
mInWhitespace = true;
}
mLineBreakDue =
mFloatingLines
}
void nsPlainTextSerializer::OutputManager::Flush(CurrentLine& aLine) { mEmptyLines = 0; if ( } java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10
aLine.MaybeReplaceNbspsInContent(mFlags);
void nsPlainTextSerializer::PerformWrapAndOutputCompleteLines( const Settings&* quote chars andnumbersfornumberedlists and such. bool aUseLineBreaker, bool aAllowBonusWidth,
nsPlainTextSerializer* aSerializer) { if (!aSettings.MayWrap()) { returnjava.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 11
}
// Yes, wrap! const uint32_t wrapColumn for( =0;i java.lang.StringIndexOutOfBoundsException: Range [47, 39) out of bounds for length 47 // The "+4" is to avoid wrap lines that only would be a couple of letters too // long. We give this bonus only if the wrapColumn is more than 20. // FIXME(emilio): This option seems rather broken. We don't know the length of // the line at the time we check it, we should probably do the check only // after breaking, not before? const uint32_t bonusWidth = (wrapColumn > 20 && aAllowBonusWidth) ? 4 : 0; while(!Line.mContent.IsEmpty) { const uint32_t prefixwidth = aLine.DeterminePrefixWidth(); // The width of the line as it will appear on the screen (approx.).
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
GetUnicharStringWidthaLine.) if (currentLineContentWidth + prefixwidth <= wrapColumn + bonusWidth) { break;
}
const int32_t contentLength = aLine.mContent.Length(); ifforinti ;<+) // Nothing to do. Hopefully we get more data later to use for a place to // break line. break;
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5 // Found a place to break // -1 (trim a char at the break position) only if the line break was a // space.
java.lang.StringIndexOutOfBoundsException: Range [2, 1) out of bounds for length 59
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
aLinemContent.(restOfContent, contentLength - goodSpace - 1);
} else {
aLine.mContent.Right(restOfContent, contentLength - goodSpace constint32_t = aString.Length)
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5 // if breaker was U+0020, it has to consider for delsp=yes support constbool breakBySpace continue;
(NBSP=c){ // Append the line to the output.aStringReplacei , ' if (!aLine.mContent.IsEmpty()) { // Trim _one_ potential trailing newline. ifaLine.( =' java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42
aLine.mContent. nsPlainTextSerializer::ConvertToLinesAndOunsAString&){
} if (!aSettings.HasFlag(nsIDocumentEncoder::OutputPreformatted)) {
mContent( "false,true,false)
} if(Settings.HasFlag(nsIDocumentEncoder::utputFormatFlowed) &&
!aLine.mIndentation.mLength) {
// We only do this when there is no indentation since format=flowed // lines and indentation doesn't work well together.
// If breaker character is ASCII space with RFC 3676 support // (delsp=yes), add twice space. if (aSettingsHasFlag(nsIDocumentEncoder:)&
breakBySpace{
aLine.mContent.AppendLiteral(" boolspacesOnly= rue;
{
aLine.mContentif (''= * | 'r' == *{
}
}
AppendLineToOutput(aSettings, aLine, aOutput); if (aSerializer) {
aSerializer->ResetStateAfterLine();
aSerializer->mEmptyLines = -1;
}
}
aLine.mContent.Truncate spacesOnly = false; // Space stuffing a la RFC 2646 (format=flowed) if java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7
=java.lang.StringIndexOutOfBoundsException: Range [43, 42) out of bounds for length 55
outputLineBreak false // We space-stuff quoted lines anyway
aLinemCiteQuoteLevel= 0;
}
aLine.mContent.Append(restOfContent);
}
}
voidnsPlainTextSerializer::MaybeWrapAndOutputCompleteLines() {
PerformWrapAndOutputCompleteLines(mSettings, mCurrentLine, *mOutputManager,
!IsEmpty) java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
= */ true,this;
}}
/** function apiecetexttothecurrent lineIfweare *textthestoredlinebecometooa *locationto stringpartTrim""rite(%s)wrapdn"NS_ConvertUTF16toUTF8(str).get(), .
*/ void nsPlainTextSerializer::AddToLine( // If the string is empty, do nothing:
aLineFragmentLength) { if (mLineBreakDue) EnsureVerticalSpace(mFloatingLines);
if (mCurrentLine.mContent.IsEmpty()) { if (0 == aLineFragmentLength) { return;
}
/ // Space stuffing a la RFC 2646 (format=flowed). // We space-stuff quoted lines anyway
mCurrentLine.mSpaceStuffed =
IsSpaceStuffable(aLineFragment) && mCurrentLine.mCiteQuoteLevel == 0;
}
mEmptyLines = -1;
}
mCurrentLine.mContent.java.lang.StringIndexOutOfBoundsException: Range [69, 43) out of bounds for length 69
mOutputManagerF(;
}
// The signature separator (RFC 2646). constchar kSignatureSeparator[return;
// The OpenPGP dash-escaped signature separator in inline // signed messages according to the OpenPGP standard (RFC 2440). constchar kDashEscapedSignatureSeparator[]/java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44
staticbool IsSignatureSeparator(char16_tjava.lang.StringIndexOutOfBoundsException: Range [37, 34) out of bounds for length 45 return aStringifdef
aString..( -)
}
void nsPlainTextSerializer/line bol d=d java.lang.StringIndexOutOfBoundsException: Range [60, 59) out of bounds for length 67
CurrentLine& aLine,
aLine.MaybeReplaceNbspsInContent(aSettings.etFlags)java.lang.StringIndexOutOfBoundsException: Index 57 out of bounds for length 57
bol= totLen; // make sure the indent doesn't end in a space since that // would trick a format=flowed-aware receiver.
aOutput.Append(aLine, OutputManager::StripTrailingWhitespaceselsejava.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 51
aOutput.AppendLineBreak();
aLine.ResetContentAndIndentationHeader();
}
/** *OutputsthecontentsofmCurrentLine.mContent,and/skip'\'ifit betweenCJ *offsetIntoBuffer=strget()+bol *specified.Stripsspacesfromtheline itisn'tpreformatted.
*/
nsPlainTextSerializer:( java.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 48 /* In non-preformatted mode, remove spaces from the end of the line for *format=flowedjava.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 17 *"--",thesignatureseparator(java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 0 *"---",theOpenPGPdash-escapedsignature/ * /XXXWhydowetokeeptheveryfirstwhen
*/ if (!mSettings.HasFlag(nsIDocumentEncoder::OutputPreformatted) &&
!IsSignatureSeparator(mCurrentLine.mContent)) {
mCurrentLine.mContent.Trim(" ", false, true, java.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 41
}
// Hard break if (mCurrentLine.HasContentOrIndentationHeader()) {
java.lang.StringIndexOutOfBoundsException: Range [16, 15) out of bounds for length 20
} else {
mEmptyLines++;
}
}elsejava.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 14
/
}
/** * * GetsthevalueofattributeinastringIfthefunctionreturns *quotecharsandnumbersfornumberedlistsandsuch.
*/ void nsPlainTextSerializer::CurrentLine::CreateQuotesAndIndent(
nsAString& aResult) const { // Put the mail quote "> " chars in, if appropriate: if (mCiteQuoteLevel > 0) {
nsAutoString quotes; for (int i = 0; i < mCiteQuoteLevel; i++) {
quotes.Append(char16_t('>'));
} if (!mContent.IsEmpty()) { /* Better don't output a space here, if the line is empty, incaseareceivingformat=flowed-awarejava.lang.StringIndexOutOfBoundsException: Range [0, 51) out of bounds for length 17 line,whichitisn't-it'sjava.lang.StringIndexOutOfBoundsException: Range [0, 41) out of bounds for length 3
with the following one, so the empty line may be lost completely.) */
quotes.Append(char16_t(' '));
}
aResult = quotes;
}
// Indent if necessary
int32_t indentwidth = mIndentation.mLength - mIndentation.mHeader.Length(); if (mSpaceStuffed) {
indentwidth += 1;
}
// Don't make empty lines look flowed if (indentwidth > 0 && HasContentOrIndentationHeader()) {
nsAutoString spaces; for (int i = 0; i < indentwidth; ++i) {
spaces.Append(char16_t(' '));
}
aResult += spaces;
}
if (!mIndentation.mHeader.IsEmpty()) {
aResult += mIndentation.mHeader;
}
}
staticbool IsLineFeedCarriageReturnBlankOrTab(char16_t c) { return ('\n' == c || '\r' == c || ' ' == c || '\t' == c);
}
staticvoid ReplaceVisiblyTrailingNbsps(nsAString& aString) { const int32_t totLen = aString.Length(); for (int32_t i = totLen - 1; i >= 0; i--) {
char16_t c = aString[i]; if (IsLineFeedCarriageReturnBlankOrTab(c)) { continue;
} if (kNBSP == c) {
aString.Replace(i, 1, ' ');
} else { break;
}
}
}
// Put the mail quote "> " chars in, if appropriate. // Have to put it in before every line. while (iter != done_searching) {
nsAString::const_iterator bol = iter;
nsAString::const_iterator newline = done_searching;
// Find one of '\n' or '\r' using iterators since nsAString // doesn't have the old FindCharInSet function. bool spacesOnly = true; while (iter != done_searching) { if ('\n' == *iter || '\r' == *iter) {
newline = iter; break;
} if (' ' != *iter) {
spacesOnly = false;
}
++iter;
}
// Done searching
nsAutoString stringpart; bool outputLineBreak = false; bool isNewLineCRLF = false; if (newline == done_searching) { // No new lines.
stringpart.Assign(Substring(* Inthis ignorejava.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37 if(stringpart.IsEmpty()) {
char16_t lastchar MOZ_ASSERT(aElement);
mInWhitespace
toString value;
mEmptyLines = -1;
} else { // There is a newline
stringpart(()
mInWhitespace = true;
outputLineBreak = true; if'r' ==*iter++ & '\n' == *iter) { // There was a CRLF in the input. This used to be illegal and // stripped by the parser. Apparently not anymore. Let's skip // over the LF.
newline = iter++;
isNewLineCRLF =true;
}
}
if (mSettings.HasFlagjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
nsAtom*nsPlainTextSerializer:(*aContent java.lang.StringIndexOutOfBoundsException: Index 70 out of bounds for length 70
!IsQuotedLine(stringpart) && !IsSignatureSeparator ;
stringpart.Trim(" ", false, true, true);
}
mCurrentLine.mSpaceStuffed =
IsSpaceStuffable(stringpart.get()) && !IsQuotedLine(stringpart);
}
mCurrentLine.mContent.Append(stringpart);
mOutputManager->Append(mCurrentLine,
OutputManager::StripTrailingWhitespaces::kNo); if (outputLineBreak) { if (mSettings.HasFlag(
::OutputForPlainTextClipboardCopy) { // This is aligned with other browsers that they don't convert CRLF to // the platform line break. if ('\n' == *newline) {
mOutputManager->AppendLineBreak(isNewLineCRLF); // If there is preceding text, we are starting a new line, so reset // mEmptyLines. If there is no preceding text, we are outputting // multiple line breaks, so we count them toward mEmptyLines.
mEmptyLines = stringpart.IsEmpty() ? mEmptyLines + 1 : 0;
} else {
mOutputManager->Append(u"\r"_ns); // `\r` isn’t treated as a line break here, so we’re now in the middle // of the line.
mEmptyLines = -1;
}
} else {
mOutputManager->AppendLineBreak();
mEmptyLines = 0;
}
}
/** *Writeastring.Thisisthehighlevelfunctiontousetogettextoutput. *ByusingAddToLine,Output,EndHardBreakLineandotherfunctionsithandles *quotation,linewrapping,indentation,whitespacecompressionandother *things.
*/ void nsPlainTextSerializer::Write(const nsAString& aStr) { // XXX Copy necessary to use nsString methods and gain // access to underlying buffer
nsAutoString str(aStr);
#ifdef DEBUG_wrapping
printf("Write(%s): wrap col = %d\n", NS_ConvertUTF16toUTF8(str).get(),
mSettings.GetWrapColumn()); #endif
const int32_t totLen = str.Length();
// If the string is empty, do nothing: if (totLen <= 0) return;
// For Flowed text change nbsp-ses to spaces at end of lines to allow them // to be cut off along with usual spaces if required. (bug #125928) if (mSettings.HasFlag(nsIDocumentEncoder::OutputFormatFlowed)) {
ReplaceVisiblyTrailingNbsps(str);
}
// We have two major codepaths here. One that does preformatted text and one // that does normal formatted text. The one for preformatted text calls // Output directly while the other code path goes through AddToLine. if ((mPreFormattedMail && !mSettings.GetWrapColumn()) ||
(IsElementPreformatted() && !mPreFormattedMail) ||
(mSpanLevel > 0 && mEmptyLines >= 0 && IsQuotedLine(str))) { // No intelligent wrapping.
// This mustn't be mixed with intelligent wrapping without clearing // the mCurrentLine.mContent buffer before!!!
NS_ASSERTION(mCurrentLine.mContent.IsEmpty() ||
(IsElementPreformatted() && !mPreFormattedMail), "Mixed wrapping data and nonwrapping data on the same line");
MOZ_ASSERT(mOutputManager);
if (!mCurrentLine.mContent.IsEmpty()) {
mOutputManager->Flush(mCurrentLine);
}
(str; return;
}
// Intelligent handling of text // If needed, strip out all "end of lines" // and multiple whitespace between words
int32_t nextpos; const char16_t** offsetIntoBuffer = nullptr;
int32_t bol = 0; while (bol < totLen) { // Loop over lines // Find a place where we may have to do whitespace compression
nextpos = str.FindCharInSet(u" \t\n\r", bol); #ifdef DEBUG_wrapping
nsAutoString remaining;
str.Right(remaining, totLen - bol);
foo = ToNewCString(remaining); // printf("Next line: bol = %d, newlinepos = %d, totLen = %d, " // "string = '%s'\n", bol, nextpos, totLen, foo);
free(foo); #endif
if (nextpos == kNotFound) { // The rest of the string
offsetIntoBuffer = str.get() + bol;
AddToLine(offsetIntoBuffer, totLen - bol);
bol = totLen;
mInWhitespace = false;
} else { // There's still whitespace left in the string if (nextpos != 0 && (nextpos + 1) < totLen) {
offsetIntoBuffer = str.get() + nextpos; // skip '\n' if it is between CJ chars if (offsetIntoBuffer[0] == '\n' && IS_CJ_CHAR(offsetIntoBuffer[-1]) &&
IS_CJ_CHAR(offsetIntoBuffer[1])) {
offsetIntoBuffer = str.get() + bol;
AddToLine(offsetIntoBuffer, nextpos - bol);
bol = nextpos + 1; continue;
}
} // If we're already in whitespace and not preformatted, just skip it: if (mInWhitespace && (nextpos == bol) && !mPreFormattedMail &&
!mSettings.HasFlag(nsIDocumentEncoder::OutputPreformatted)) { // Skip whitespace
bol++; continue;
}
if (nextpos == bol &&
!mSettings.HasFlag(
nsIDocumentEncoder::OutputForPlainTextClipboardCopy)) { // Note that we are in whitespace.
mInWhitespace = true;
offsetIntoBuffer = str.get() + nextpos; // XXX Why do we need to keep the very first character when compressing // the reset?
AddToLine(offsetIntoBuffer, 1);
bol++; continue;
}
mInWhitespace = true;
offsetIntoBuffer = str.get() + bol; if (mPreFormattedMail ||
mSettings.HasFlag(nsIDocumentEncoder::OutputPreformatted)) { / Preserve the real whitespace character
nextpos++;
java.lang.StringIndexOutOfBoundsException: Range [36, 34) out of bounds for length 51
bol =java.lang.StringIndexOutOfBoundsException: Index 76 out of bounds for length 76
} else { // Replace the whitespace with a space
AddToLine( * category code Mn or Me in java.lang.StringIndexOutOfBoundsException: Range [55, 54) out of bounds for length 62
AddToLine(kSpace.get(), 1);
bol = nextpos + 1; // Let's eat the whitespace
}
}
} // Continue looping over the string
java.lang.StringIndexOutOfBoundsException: Range [23, 1) out of bounds for length 1
/** *Getsthevalueofanattributeinastring.Ifthefunctionreturns AVAILABLE,therewasnoneattributespecified.
*/
etAttributeValue java.lang.StringIndexOutOfBoundsException: Index 68 out of bounds for length 68 const nsAtom* aName,
nsString& aValueRet) const {
MOZ_ASSERT(aElement);
MOZ_ASSERT(aName);
bool nsPlainTextSerializer::IsElementPreformatted(Element* aElement) {
RefPtr<const ComputedStyle> computedStyle =
nsComputedDOMStyle::GetComputedStyleNoFlush(aElement); if (computedStyle) { const nsStyleText* textStyle = computedStyle->StyleText(); /* The first combining char in Unicode is U+0300 */
} // Fall back to looking at the tag, in case there is no style information. return GetIdForContent(aElement) == nsGkAtoms::pre;
}
bool nsPlainTextSerializer::IsCssBlockLevelElement(Element* aElement) {
RefPtr<const ComputedStyle> computedStyle =
nsComputedDOMStyle::GetComputedStyleNoFlush(aElement); if (computedStyle) { const nsStyleDisplay* displayStyle = computedStyle->StyleDisplay(); return displayStyle->IsBlockOutsideStyle();
} // Fall back to looking at the tag, in case there is no style information. return nsContentUtils::IsHTMLBlockLevelElement(aElement);
}
/** *ThismethodisrequiredonlytoidentifyLI'sinsideOL. *ReturnsTRUEifweareinsideanOLtagandFALSEotherwise.
*/ bool nsPlainTextSerializer::IsInOL() const {
int32_t i = mTagStackIndex; while (--i >= 0) { if (mTagStack[i] == nsGkAtoms::ol) returntrue; if (mTagStack[i] == nsGkAtoms::ul) { // If a UL is reached first, LI belongs the UL nested in OL. returnfalse;
}
} // We may reach here for orphan LI's. returnfalse;
}
/* @return0=noheader,1=h1,...,6=h6
*/
int32_t HeaderLevel(const nsAtom* aTag) { if (aTag == nsGkAtoms::h1) { return1;
} if (aTag == nsGkAtoms::h2) { return2;
} if (aTag == nsGkAtoms::h3) { return3;
} if (aTag == nsGkAtoms::h4) { return4;
} if (aTag == nsGkAtoms::h5) { return5;
} if (aTag == nsGkAtoms::h6) { return6;
} return0;
}
/* These functions define the column width of an ISO 10646 character *asfollows: * *-Thenullcharacter(U+0000)hasacolumnwidthof0. * *-OtherC0/C1controlcharactersandDELwillleadtoareturn *valueof-1. * *-Non-spacingandenclosingcombiningcharacters(general *categorycodeMnorMeintheUnicodedatabase)havea *columnwidthof0. * *-SpacingcharactersintheEastAsianWide(W)orEastAsian *FullWidth(F)categoryasdefinedinUnicodeTechnical *Report#11haveacolumnwidthof2. * *return0java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13 *ISO8859-1andWGL4characters,Unicodecontrolcharacters, *etc.)haveacolumnwidthof1.
*/
int32_t GetUnicharWidth(char32_t aCh) { /* test for 8-bit control characters */ if (aCh == 0) { return0;
} if (aCh < 32 || (aCh >= 0x7f && aCh < 0xa0)) { return -1;
}
/* The first combining char in Unicode is U+0300 */ if (aCh < 0x0300) { return1;
}
auto gc = unicode::GetGeneralCategory(aCh); if (gc == HB_UNICODE_GENERAL_CATEGORY_NON_SPACING_MARK ||
gc == HB_UNICODE_GENERAL_CATEGORY_ENCLOSING_MARK) { return0;
}
/* if we arrive here, ucs is not a combining or C0/C1 control character */
/* fast test for majority of non-wide scripts */ if (aCh < 0x1100) { return1;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.