diff options
author | athenian200 <athenian200@outlook.com> | 2020-09-30 14:05:56 -0500 |
---|---|---|
committer | athenian200 <athenian200@outlook.com> | 2020-09-30 14:09:10 -0500 |
commit | b8c604196b1737c3a49041bc4dfd24355d8d392e (patch) | |
tree | 252a1344eee839f1cade3d3e6d7bb4ccff072ed7 | |
parent | bc531bfbbaf0da9069b87b02d55190c80275e21b (diff) | |
download | uxp-b8c604196b1737c3a49041bc4dfd24355d8d392e.tar.gz |
Issue #1647 - Followup: Remove excessive VARIANT_OPACITY statements.
I got very anxious about making sure I included VARIANT_OPACITY in all the places VARIANT_NUMBER was included to make sure it couldn't possibly break unexpectedly, and that led to me accidentally breaking a mechanism that prevented percentages from serializing as numbers in other parts of the code. It was a total accident, and these additions were unnecessary. Basically, the situation is that there was one part of the code where it determines what's allowed for the flex statement (and possibly other statements) by checking whether it got stored as a "number", and basically only disallows percentages if it attempted to store/serialize them as percentages.
However, it only got to that part of the code because I accidentally allowed VARIANT_OPACITY as a valid way for certain tokens to parse where it wasn't necessary. If it tries to parse it that way under very specific circumstances... percentages will be marked valid and fed through the system as numbers rather than being rejected and not serialized at all, because the check to disallow percentages there relied on them being stored as percentages.
It's a really weird thing to have a problem with in a lot of ways, because if percentages aren't allowed in a field, you would think people wouldn't try to use them there, much less depend on the broken behavior that results from them not parsing as a related value.
-rw-r--r-- | layout/inspector/inDOMUtils.cpp | 2 | ||||
-rw-r--r-- | layout/style/nsCSSParser.cpp | 12 |
2 files changed, 7 insertions, 7 deletions
diff --git a/layout/inspector/inDOMUtils.cpp b/layout/inspector/inDOMUtils.cpp index a28b35ef8f..800201ce21 100644 --- a/layout/inspector/inDOMUtils.cpp +++ b/layout/inspector/inDOMUtils.cpp @@ -842,7 +842,7 @@ PropertySupportsVariant(nsCSSPropertyID aPropertyID, uint32_t aVariant) case eCSSProperty_grid_row_end: case eCSSProperty_font_weight: case eCSSProperty_initial_letter: - supported = VARIANT_NUMBER | VARIANT_OPACITY; + supported = VARIANT_NUMBER; break; default: diff --git a/layout/style/nsCSSParser.cpp b/layout/style/nsCSSParser.cpp index 755a1eac7d..0f1b04a178 100644 --- a/layout/style/nsCSSParser.cpp +++ b/layout/style/nsCSSParser.cpp @@ -1299,7 +1299,7 @@ protected: } bool ParseNonNegativeNumber(nsCSSValue& aValue) { - return ParseSingleTokenNonNegativeVariant(aValue, VARIANT_NUMBER | VARIANT_OPACITY, nullptr); + return ParseSingleTokenNonNegativeVariant(aValue, VARIANT_NUMBER, nullptr); } // Helpers for some common ParseSingleTokenOneOrLargerVariant calls. @@ -1309,7 +1309,7 @@ protected: } bool ParseOneOrLargerNumber(nsCSSValue& aValue) { - return ParseSingleTokenOneOrLargerVariant(aValue, VARIANT_NUMBER | VARIANT_OPACITY, nullptr); + return ParseSingleTokenOneOrLargerVariant(aValue, VARIANT_NUMBER, nullptr); } // http://dev.w3.org/csswg/css-values/#custom-idents @@ -8483,7 +8483,7 @@ CSSParserImpl::ParseImageRect(nsCSSValue& aImage) break; } - static const int32_t VARIANT_SIDE = VARIANT_NUMBER | VARIANT_PERCENT | VARIANT_OPACITY; + static const int32_t VARIANT_SIDE = VARIANT_NUMBER | VARIANT_PERCENT; if (!ParseSingleTokenNonNegativeVariant(top, VARIANT_SIDE, nullptr) || !ExpectSymbol(',', true) || !ParseSingleTokenNonNegativeVariant(right, VARIANT_SIDE, nullptr) || @@ -10892,7 +10892,7 @@ CSSParserImpl::ParseWebkitGradientColorStop(nsCSSValueGradient* aGradient) if (mToken.mIdent.LowerCaseEqualsLiteral("color-stop")) { // Parse stop location, followed by comma. if (!ParseSingleTokenVariant(stop->mLocation, - VARIANT_NUMBER | VARIANT_PERCENT | VARIANT_OPACITY, + VARIANT_NUMBER | VARIANT_PERCENT, nullptr) || !ExpectSymbol(',', true)) { SkipUntil(')'); // Skip to end of color-stop(...) expression. @@ -16055,7 +16055,7 @@ static bool GetFunctionParseInformation(nsCSSKeyword aToken, {VARIANT_LBCALC, VARIANT_LBCALC, VARIANT_LBCALC}, {VARIANT_ANGLE_OR_ZERO}, {VARIANT_ANGLE_OR_ZERO, VARIANT_ANGLE_OR_ZERO}, - {VARIANT_NUMBER|VARIANT_OPACITY}, + {VARIANT_NUMBER}, {VARIANT_LENGTH|VARIANT_NONNEGATIVE_DIMENSION}, {VARIANT_LB|VARIANT_NONNEGATIVE_DIMENSION}, {VARIANT_NUMBER, VARIANT_NUMBER}, @@ -17637,7 +17637,7 @@ CSSParserImpl::ParseScrollSnapPoints(nsCSSValue& aValue, nsCSSPropertyID aPropID nsCSSKeywords::LookupKeyword(mToken.mIdent) == eCSSKeyword_repeat) { nsCSSValue lengthValue; if (ParseNonNegativeVariant(lengthValue, - VARIANT_LENGTH | VARIANT_PERCENT | VARIANT_OPACITY | VARIANT_CALC, + VARIANT_LENGTH | VARIANT_PERCENT | VARIANT_CALC, nullptr) != CSSParseResult::Ok) { REPORT_UNEXPECTED(PEExpectedNonnegativeNP); SkipUntil(')'); |