mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-22 23:27:30 +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
|
// Reused utility parsing routines
|
||||||
void AppendValue(nsCSSPropertyID aPropID, const nsCSSValue& aValue);
|
void AppendValue(nsCSSPropertyID aPropID, const nsCSSValue& aValue);
|
||||||
bool ParseBoxProperties(const nsCSSPropertyID aPropIDs[]);
|
bool ParseBoxProperties(const nsCSSPropertyID aPropIDs[]);
|
||||||
|
bool ParseBoxPairProperties(nsCSSPropertyID aStart, nsCSSPropertyID aEnd);
|
||||||
bool ParseGroupedBoxProperty(int32_t aVariantMask,
|
bool ParseGroupedBoxProperty(int32_t aVariantMask,
|
||||||
nsCSSValue& aValue,
|
nsCSSValue& aValue,
|
||||||
uint32_t aRestrictions);
|
uint32_t aRestrictions);
|
||||||
|
|
@ -10107,25 +10108,8 @@ CSSParserImpl::ParseGridArea()
|
||||||
bool
|
bool
|
||||||
CSSParserImpl::ParseGap()
|
CSSParserImpl::ParseGap()
|
||||||
{
|
{
|
||||||
nsCSSValue first;
|
return ParseBoxPairProperties(eCSSProperty_row_gap,
|
||||||
if (ParseSingleTokenVariant(first, VARIANT_INHERIT, nullptr)) {
|
eCSSProperty_column_gap);
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// normal | [<number> <integer>?]
|
// normal | [<number> <integer>?]
|
||||||
|
|
@ -11448,6 +11432,30 @@ CSSParserImpl::ParseBoxProperties(const nsCSSPropertyID aPropIDs[])
|
||||||
return true;
|
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
|
// Similar to ParseBoxProperties, except there is only one property
|
||||||
// with the result as its value, not four.
|
// with the result as its value, not four.
|
||||||
bool
|
bool
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue