Bug 1560055 part 7. Remove now-unused percentage handling in ParseHTMLInteger. r=mccr8

All callers treat '%' being found the same as not having consumed all the input,
so we can just stop consuming it.

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Boris Zbarsky 2019-06-28 17:39:52 +00:00
Родитель 9abd9bd6cd
Коммит b9289cedad
4 изменённых файлов: 7 добавлений и 18 удалений

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

@ -33,7 +33,6 @@ static bool ParseInteger(const nsAString& aString, int32_t& aInt) {
return !(parseResult &
(nsContentUtils::eParseHTMLInteger_Error |
nsContentUtils::eParseHTMLInteger_DidNotConsumeAllInput |
nsContentUtils::eParseHTMLInteger_IsPercent |
nsContentUtils::eParseHTMLInteger_NonStandard));
}

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

@ -1383,7 +1383,6 @@ bool nsAttrValue::ParseIntWithBounds(const nsAString& aString, int32_t aMin,
val = std::min(val, aMax);
bool nonStrict =
(val != originalVal) ||
(result & nsContentUtils::eParseHTMLInteger_IsPercent) ||
(result & nsContentUtils::eParseHTMLInteger_NonStandard) ||
(result & nsContentUtils::eParseHTMLInteger_DidNotConsumeAllInput);
@ -1409,8 +1408,7 @@ void nsAttrValue::ParseIntWithFallback(const nsAString& aString,
nonStrict = true;
}
if ((result & nsContentUtils::eParseHTMLInteger_IsPercent) ||
(result & nsContentUtils::eParseHTMLInteger_NonStandard) ||
if ((result & nsContentUtils::eParseHTMLInteger_NonStandard) ||
(result & nsContentUtils::eParseHTMLInteger_DidNotConsumeAllInput)) {
nonStrict = true;
}
@ -1426,7 +1424,6 @@ void nsAttrValue::ParseClampedNonNegativeInt(const nsAString& aString,
nsContentUtils::ParseHTMLIntegerResultFlags result;
int32_t val = nsContentUtils::ParseHTMLInteger(aString, &result);
bool nonStrict =
(result & nsContentUtils::eParseHTMLInteger_IsPercent) ||
(result & nsContentUtils::eParseHTMLInteger_NonStandard) ||
(result & nsContentUtils::eParseHTMLInteger_DidNotConsumeAllInput);
@ -1461,7 +1458,6 @@ bool nsAttrValue::ParseNonNegativeIntValue(const nsAString& aString) {
}
bool nonStrict =
(result & nsContentUtils::eParseHTMLInteger_IsPercent) ||
(result & nsContentUtils::eParseHTMLInteger_NonStandard) ||
(result & nsContentUtils::eParseHTMLInteger_DidNotConsumeAllInput);
@ -1480,7 +1476,6 @@ bool nsAttrValue::ParsePositiveIntValue(const nsAString& aString) {
}
bool nonStrict =
(result & nsContentUtils::eParseHTMLInteger_IsPercent) ||
(result & nsContentUtils::eParseHTMLInteger_NonStandard) ||
(result & nsContentUtils::eParseHTMLInteger_DidNotConsumeAllInput);

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

@ -1182,10 +1182,6 @@ int32_t nsContentUtils::ParseHTMLInteger(const nsAString& aValue,
break;
}
foundValue = true;
} else if (*iter == char16_t('%')) {
++iter;
result |= eParseHTMLInteger_IsPercent;
break;
} else {
break;
}

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

@ -601,17 +601,16 @@ class nsContentUtils {
enum ParseHTMLIntegerResultFlags {
eParseHTMLInteger_NoFlags = 0,
eParseHTMLInteger_IsPercent = 1 << 0,
// eParseHTMLInteger_NonStandard is set if the string representation of the
// integer was not the canonical one (e.g. had extra leading '+' or '0').
eParseHTMLInteger_NonStandard = 1 << 1,
eParseHTMLInteger_DidNotConsumeAllInput = 1 << 2,
eParseHTMLInteger_NonStandard = 1 << 0,
eParseHTMLInteger_DidNotConsumeAllInput = 1 << 1,
// Set if one or more error flags were set.
eParseHTMLInteger_Error = 1 << 3,
eParseHTMLInteger_ErrorNoValue = 1 << 4,
eParseHTMLInteger_ErrorOverflow = 1 << 5,
eParseHTMLInteger_Error = 1 << 2,
eParseHTMLInteger_ErrorNoValue = 1 << 3,
eParseHTMLInteger_ErrorOverflow = 1 << 4,
// Use this flag to detect the difference between overflow and underflow
eParseHTMLInteger_Negative = 1 << 6,
eParseHTMLInteger_Negative = 1 << 5,
};
static int32_t ParseHTMLInteger(const nsAString& aValue,
ParseHTMLIntegerResultFlags* aResult);