зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1579355: part 3) Remove `nsPlainTextSerializer::mURL`. r=hsivonen
Less state allows simpler reasoning about `nsPlainTextSerializer`. Differential Revision: https://phabricator.services.mozilla.com/D44960 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
4c489da90e
Коммит
b01a7275d1
|
@ -782,12 +782,6 @@ nsresult nsPlainTextSerializer::DoOpenContainer(nsAtom* aTag) {
|
|||
mCurrentLine.mIndentation.mWidth += kIndentIncrementHeaders;
|
||||
}
|
||||
}
|
||||
} else if (aTag == nsGkAtoms::a && !currentNodeIsConverted) {
|
||||
nsAutoString url;
|
||||
if (NS_SUCCEEDED(GetAttributeValue(nsGkAtoms::href, url)) &&
|
||||
!url.IsEmpty()) {
|
||||
mURL = url;
|
||||
}
|
||||
} else if (aTag == nsGkAtoms::sup && mSettings.GetStructs() &&
|
||||
!currentNodeIsConverted) {
|
||||
Write(NS_LITERAL_STRING("^"));
|
||||
|
@ -980,14 +974,16 @@ nsresult nsPlainTextSerializer::DoCloseContainer(nsAtom* aTag) {
|
|||
}
|
||||
}
|
||||
EnsureVerticalSpace(1);
|
||||
} else if (aTag == nsGkAtoms::a && !currentNodeIsConverted &&
|
||||
!mURL.IsEmpty()) {
|
||||
nsAutoString temp;
|
||||
temp.AssignLiteral(" <");
|
||||
temp += mURL;
|
||||
temp.Append(char16_t('>'));
|
||||
Write(temp);
|
||||
mURL.Truncate();
|
||||
} else if (aTag == nsGkAtoms::a && !currentNodeIsConverted) {
|
||||
nsAutoString url;
|
||||
if (NS_SUCCEEDED(GetAttributeValue(nsGkAtoms::href, url)) &&
|
||||
!url.IsEmpty()) {
|
||||
nsAutoString temp;
|
||||
temp.AssignLiteral(" <");
|
||||
temp += url;
|
||||
temp.Append(char16_t('>'));
|
||||
Write(temp);
|
||||
}
|
||||
} else if ((aTag == nsGkAtoms::sup || aTag == nsGkAtoms::sub) &&
|
||||
mSettings.GetStructs() && !currentNodeIsConverted) {
|
||||
Write(kSpace);
|
||||
|
@ -1063,12 +1059,6 @@ void nsPlainTextSerializer::DoAddText(bool aIsLineBreak,
|
|||
return;
|
||||
}
|
||||
|
||||
/* Check, if we are in a link (symbolized with mURL containing the URL)
|
||||
and the text is equal to the URL. In that case we don't want to output
|
||||
the URL twice so we scrap the text in mURL. */
|
||||
if (!mURL.IsEmpty() && mURL.Equals(aText)) {
|
||||
mURL.Truncate();
|
||||
}
|
||||
Write(aText);
|
||||
}
|
||||
|
||||
|
|
|
@ -314,7 +314,6 @@ class nsPlainTextSerializer final : public nsIContentSerializer {
|
|||
|
||||
bool mPreformattedBlockBoundary;
|
||||
|
||||
nsString mURL;
|
||||
int32_t mHeaderCounter[7]; /* For header-numbering:
|
||||
Number of previous headers of
|
||||
the same depth and in the same
|
||||
|
|
Загрузка…
Ссылка в новой задаче