mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-03 06:18:38 +09:00
Issue #2477 - Part 1: Implement a separate function for parsing pair box properties
This reuses existing logic from ParseGap.
This commit is contained in:
parent
b518af4d45
commit
1e73f1f2d2
1 changed files with 27 additions and 19 deletions
|
|
@ -1188,6 +1188,7 @@ protected:
|
|||
// Reused utility parsing routines
|
||||
void AppendValue(nsCSSPropertyID aPropID, const nsCSSValue& aValue);
|
||||
bool ParseBoxProperties(const nsCSSPropertyID aPropIDs[]);
|
||||
bool ParseBoxPairProperties(nsCSSPropertyID aStart, nsCSSPropertyID aEnd);
|
||||
bool ParseGroupedBoxProperty(int32_t aVariantMask,
|
||||
nsCSSValue& aValue,
|
||||
uint32_t aRestrictions);
|
||||
|
|
@ -10107,25 +10108,8 @@ CSSParserImpl::ParseGridArea()
|
|||
bool
|
||||
CSSParserImpl::ParseGap()
|
||||
{
|
||||
nsCSSValue first;
|
||||
if (ParseSingleTokenVariant(first, VARIANT_INHERIT, nullptr)) {
|
||||
AppendValue(eCSSProperty_row_gap, first);
|
||||
AppendValue(eCSSProperty_column_gap, first);
|
||||
return true;
|
||||
}
|
||||
if (ParseNonNegativeVariant(first, VARIANT_LPCALC, nullptr) !=
|
||||
CSSParseResult::Ok) {
|
||||
return false;
|
||||
}
|
||||
nsCSSValue second;
|
||||
auto result = ParseNonNegativeVariant(second, VARIANT_LPCALC, nullptr);
|
||||
if (result == CSSParseResult::Error) {
|
||||
return false;
|
||||
}
|
||||
AppendValue(eCSSProperty_row_gap, first);
|
||||
AppendValue(eCSSProperty_column_gap,
|
||||
result == CSSParseResult::NotFound ? first : second);
|
||||
return true;
|
||||
return ParseBoxPairProperties(eCSSProperty_row_gap,
|
||||
eCSSProperty_column_gap);
|
||||
}
|
||||
|
||||
// normal | [<number> <integer>?]
|
||||
|
|
@ -11448,6 +11432,30 @@ CSSParserImpl::ParseBoxProperties(const nsCSSPropertyID aPropIDs[])
|
|||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
CSSParserImpl::ParseBoxPairProperties(nsCSSPropertyID aStart, nsCSSPropertyID aEnd)
|
||||
{
|
||||
nsCSSValue first;
|
||||
if (ParseSingleTokenVariant(first, VARIANT_INHERIT, nullptr)) {
|
||||
AppendValue(aStart, first);
|
||||
AppendValue(aEnd, first);
|
||||
return true;
|
||||
}
|
||||
if (ParseNonNegativeVariant(first, VARIANT_LPCALC, nullptr) !=
|
||||
CSSParseResult::Ok) {
|
||||
return false;
|
||||
}
|
||||
nsCSSValue second;
|
||||
auto result = ParseNonNegativeVariant(second, VARIANT_LPCALC, nullptr);
|
||||
if (result == CSSParseResult::Error) {
|
||||
return false;
|
||||
}
|
||||
AppendValue(aStart, first);
|
||||
AppendValue(aEnd,
|
||||
result == CSSParseResult::NotFound ? first : second);
|
||||
return true;
|
||||
}
|
||||
|
||||
// Similar to ParseBoxProperties, except there is only one property
|
||||
// with the result as its value, not four.
|
||||
bool
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue