Bug 1579355: part 2) Declare more methods const. r=hsivonen

Differential Revision: https://phabricator.services.mozilla.com/D44959

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Mirko Brodesser 2019-09-09 09:03:39 +00:00
Родитель dd25c52bd1
Коммит 4c489da90e
2 изменённых файлов: 10 добавлений и 10 удалений

Просмотреть файл

@ -749,7 +749,7 @@ nsresult nsPlainTextSerializer::DoOpenContainer(nsAtom* aTag) {
//////////////////////////////////////////////////////////////
// Push on stack
bool currentNodeIsConverted = IsCurrentNodeConverted();
const bool currentNodeIsConverted = IsCurrentNodeConverted();
if (aTag == nsGkAtoms::h1 || aTag == nsGkAtoms::h2 || aTag == nsGkAtoms::h3 ||
aTag == nsGkAtoms::h4 || aTag == nsGkAtoms::h5 || aTag == nsGkAtoms::h6) {
@ -966,7 +966,7 @@ nsresult nsPlainTextSerializer::DoCloseContainer(nsAtom* aTag) {
//////////////////////////////////////////////////////////////
// Pop the currentConverted stack
bool currentNodeIsConverted = IsCurrentNodeConverted();
const bool currentNodeIsConverted = IsCurrentNodeConverted();
if (aTag == nsGkAtoms::h1 || aTag == nsGkAtoms::h2 || aTag == nsGkAtoms::h3 ||
aTag == nsGkAtoms::h4 || aTag == nsGkAtoms::h5 || aTag == nsGkAtoms::h6) {
@ -1008,7 +1008,7 @@ nsresult nsPlainTextSerializer::DoCloseContainer(nsAtom* aTag) {
return NS_OK;
}
bool nsPlainTextSerializer::MustSuppressLeaf() {
bool nsPlainTextSerializer::MustSuppressLeaf() const {
if (mIgnoredChildNodeLevel > 0) {
return true;
}
@ -1704,7 +1704,7 @@ void nsPlainTextSerializer::Write(const nsAString& aStr) {
* NS_ERROR_NOT_AVAILABLE, there was none such attribute specified.
*/
nsresult nsPlainTextSerializer::GetAttributeValue(nsAtom* aName,
nsString& aValueRet) {
nsString& aValueRet) const {
if (mElement) {
if (mElement->GetAttr(kNameSpaceID_None, aName, aValueRet)) {
return NS_OK;
@ -1718,7 +1718,7 @@ nsresult nsPlainTextSerializer::GetAttributeValue(nsAtom* aName,
* Returns true, if the element was inserted by Moz' TXT->HTML converter.
* In this case, we should ignore it.
*/
bool nsPlainTextSerializer::IsCurrentNodeConverted() {
bool nsPlainTextSerializer::IsCurrentNodeConverted() const {
nsAutoString value;
nsresult rv = GetAttributeValue(nsGkAtoms::_class, value);
return (NS_SUCCEEDED(rv) && (value.EqualsIgnoreCase("moz-txt", 7) ||
@ -1765,7 +1765,7 @@ bool nsPlainTextSerializer::IsCssBlockLevelElement(Element* aElement) {
* This method is required only to identify LI's inside OL.
* Returns TRUE if we are inside an OL tag and FALSE otherwise.
*/
bool nsPlainTextSerializer::IsInOL() {
bool nsPlainTextSerializer::IsInOL() const {
int32_t i = mTagStackIndex;
while (--i >= 0) {
if (mTagStack[i] == nsGkAtoms::ol) return true;

Просмотреть файл

@ -86,7 +86,7 @@ class nsPlainTextSerializer final : public nsIContentSerializer {
private:
~nsPlainTextSerializer();
nsresult GetAttributeValue(nsAtom* aName, nsString& aValueRet);
nsresult GetAttributeValue(nsAtom* aName, nsString& aValueRet) const;
void AddToLine(const char16_t* aStringToAdd, int32_t aLength);
void EndLine(bool softlinebreak, bool aBreakBySpace = false);
void EnsureVerticalSpace(int32_t noOfRows);
@ -98,9 +98,9 @@ class nsPlainTextSerializer final : public nsIContentSerializer {
// be preserved according to its style or because it's a `<pre>`
// element.
bool IsElementPreformatted() const;
bool IsInOL();
bool IsCurrentNodeConverted();
bool MustSuppressLeaf();
bool IsInOL() const;
bool IsCurrentNodeConverted() const;
bool MustSuppressLeaf() const;
/**
* Returns the local name of the element as an atom if the element is an