зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1578149: part 5) Bundle resetting `mIndentation.mHeader` and `mCurrentLineContent`. r=hsivonen
Depends on D44349 Differential Revision: https://phabricator.services.mozilla.com/D44350 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
00a969bc92
Коммит
3cae23189b
|
@ -1127,6 +1127,13 @@ void nsPlainTextSerializer::EnsureVerticalSpace(int32_t noOfRows) {
|
||||||
mFloatingLines = -1;
|
mFloatingLines = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void nsPlainTextSerializer::ResetCurrentLineContentAndIndentationHeader() {
|
||||||
|
mCurrentLineContent.mValue.Truncate();
|
||||||
|
mCurrentLineContent.mWidth = 0;
|
||||||
|
|
||||||
|
mIndentation.mHeader.Truncate();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This empties the current line cache without adding a NEWLINE.
|
* This empties the current line cache without adding a NEWLINE.
|
||||||
* Should not be used if line wrapping is of importance since
|
* Should not be used if line wrapping is of importance since
|
||||||
|
@ -1143,14 +1150,12 @@ void nsPlainTextSerializer::FlushLine() {
|
||||||
nsAutoString quotesAndIndent;
|
nsAutoString quotesAndIndent;
|
||||||
CreateQuotesAndIndent(
|
CreateQuotesAndIndent(
|
||||||
quotesAndIndent); // XXX: Should we always do this? Bug?
|
quotesAndIndent); // XXX: Should we always do this? Bug?
|
||||||
mIndentation.mHeader.Truncate();
|
|
||||||
mOutputManager->Append(quotesAndIndent);
|
mOutputManager->Append(quotesAndIndent);
|
||||||
}
|
}
|
||||||
|
|
||||||
mCurrentLineContent.MaybeReplaceNbsps();
|
mCurrentLineContent.MaybeReplaceNbsps();
|
||||||
mOutputManager->Append(mCurrentLineContent.mValue);
|
mOutputManager->Append(mCurrentLineContent.mValue);
|
||||||
mCurrentLineContent.mValue.Truncate();
|
ResetCurrentLineContentAndIndentationHeader();
|
||||||
mCurrentLineContent.mWidth = 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1406,7 +1411,6 @@ void nsPlainTextSerializer::EndLine(bool aSoftlinebreak, bool aBreakBySpace) {
|
||||||
const bool stripTrailingSpaces = mCurrentLineContent.mValue.IsEmpty();
|
const bool stripTrailingSpaces = mCurrentLineContent.mValue.IsEmpty();
|
||||||
nsAutoString quotesAndIndent;
|
nsAutoString quotesAndIndent;
|
||||||
CreateQuotesAndIndent(quotesAndIndent);
|
CreateQuotesAndIndent(quotesAndIndent);
|
||||||
mIndentation.mHeader.Truncate();
|
|
||||||
|
|
||||||
if (stripTrailingSpaces) {
|
if (stripTrailingSpaces) {
|
||||||
quotesAndIndent.Trim(" ", false, true, false);
|
quotesAndIndent.Trim(" ", false, true, false);
|
||||||
|
@ -1418,8 +1422,7 @@ void nsPlainTextSerializer::EndLine(bool aSoftlinebreak, bool aBreakBySpace) {
|
||||||
mCurrentLineContent.MaybeReplaceNbsps();
|
mCurrentLineContent.MaybeReplaceNbsps();
|
||||||
mOutputManager->Append(mCurrentLineContent.mValue);
|
mOutputManager->Append(mCurrentLineContent.mValue);
|
||||||
mOutputManager->AppendLineBreak();
|
mOutputManager->AppendLineBreak();
|
||||||
mCurrentLineContent.mValue.Truncate();
|
ResetCurrentLineContentAndIndentationHeader();
|
||||||
mCurrentLineContent.mWidth = 0;
|
|
||||||
mInWhitespace = true;
|
mInWhitespace = true;
|
||||||
mLineBreakDue = false;
|
mLineBreakDue = false;
|
||||||
mFloatingLines = -1;
|
mFloatingLines = -1;
|
||||||
|
@ -1584,7 +1587,6 @@ void nsPlainTextSerializer::Write(const nsAString& aStr) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mCurrentLineContent.mValue.Truncate();
|
|
||||||
if (mSettings.HasFlag(nsIDocumentEncoder::OutputFormatFlowed)) {
|
if (mSettings.HasFlag(nsIDocumentEncoder::OutputFormatFlowed)) {
|
||||||
if ((outputLineBreak || !spacesOnly) && // bugs 261467,125928
|
if ((outputLineBreak || !spacesOnly) && // bugs 261467,125928
|
||||||
!IsQuotedLine(stringpart) && !stringpart.EqualsLiteral("-- ") &&
|
!IsQuotedLine(stringpart) && !stringpart.EqualsLiteral("-- ") &&
|
||||||
|
@ -1598,7 +1600,6 @@ void nsPlainTextSerializer::Write(const nsAString& aStr) {
|
||||||
if (outputQuotes) {
|
if (outputQuotes) {
|
||||||
nsAutoString quotesAndIndent;
|
nsAutoString quotesAndIndent;
|
||||||
CreateQuotesAndIndent(quotesAndIndent);
|
CreateQuotesAndIndent(quotesAndIndent);
|
||||||
mIndentation.mHeader.Truncate();
|
|
||||||
mOutputManager->Append(quotesAndIndent);
|
mOutputManager->Append(quotesAndIndent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1610,9 +1611,9 @@ void nsPlainTextSerializer::Write(const nsAString& aStr) {
|
||||||
if (outputLineBreak) {
|
if (outputLineBreak) {
|
||||||
mOutputManager->AppendLineBreak();
|
mOutputManager->AppendLineBreak();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
mCurrentLineContent.mValue.Truncate();
|
ResetCurrentLineContentAndIndentationHeader();
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef DEBUG_wrapping
|
#ifdef DEBUG_wrapping
|
||||||
printf("No wrapping: newline is %d, totLen is %d\n", newline, totLen);
|
printf("No wrapping: newline is %d, totLen is %d\n", newline, totLen);
|
||||||
|
|
|
@ -90,6 +90,9 @@ class nsPlainTextSerializer final : public nsIContentSerializer {
|
||||||
void AddToLine(const char16_t* aStringToAdd, int32_t aLength);
|
void AddToLine(const char16_t* aStringToAdd, int32_t aLength);
|
||||||
void EndLine(bool softlinebreak, bool aBreakBySpace = false);
|
void EndLine(bool softlinebreak, bool aBreakBySpace = false);
|
||||||
void EnsureVerticalSpace(int32_t noOfRows);
|
void EnsureVerticalSpace(int32_t noOfRows);
|
||||||
|
|
||||||
|
void ResetCurrentLineContentAndIndentationHeader();
|
||||||
|
|
||||||
void FlushLine();
|
void FlushLine();
|
||||||
void CreateQuotesAndIndent(nsAString& aResult) const;
|
void CreateQuotesAndIndent(nsAString& aResult) const;
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче