Issue #1826 - Support calc() in media queries

This commit is contained in:
Basilisk-Dev 2026-05-05 21:18:24 -04:00 • committed by EAZYBLACK
commit adde59de74
3 changed files with 14 additions and 5 deletions

View file

@ -310,7 +310,8 @@ nsMediaExpression::Matches(nsPresContext *aPresContext,
case nsMediaFeature::eLength:
{
NS_ASSERTION(actual.IsLengthUnit(), "bad actual value");
NS_ASSERTION(required.IsLengthUnit(), "bad required value");
NS_ASSERTION(required.IsLengthUnit() || required.IsCalcUnit(),
"bad required value");
nscoord actualCoord = nsRuleNode::CalcLengthWithInitialFont(
aPresContext, actual);
nscoord requiredCoord = nsRuleNode::CalcLengthWithInitialFont(
@ -649,7 +650,8 @@ nsMediaQuery::AppendToString(nsAString& aString) const
}
switch (feature->mValueType) {
case nsMediaFeature::eLength:
NS_ASSERTION(expr.mValue.IsLengthUnit(), "bad unit");
NS_ASSERTION(expr.mValue.IsLengthUnit() || expr.mValue.IsCalcUnit(),
"bad unit");
// Use 'width' as a property that takes length values
// written in the normal way.
expr.mValue.AppendToString(eCSSProperty_width, aString,