Issue #3109 - Use CSS' internal length clamp value instead.

This commit is contained in:
Moonchild 2026-05-29 23:53:22 +02:00 committed by wuggy
commit 6e43835b34

View file

@ -1788,6 +1788,29 @@ SetFactor(const nsCSSValue& aValue, float& aField, RuleNodeCacheConditions& aCon
}
return;
case eCSSUnit_Calc: {
RuleNodeReduceNumberCalcOps ops;
aField = css::ComputeCalc(aValue, ops);
if (mozilla::IsNaN(aField)) {
aField = 0.0f;
}
if (aFlags & SETFCT_POSITIVE) {
NS_ASSERTION(aField >= 0.0f, "negative value for positive-only property");
if (aField < 0.0f) {
aField = 0.0f;
}
}
if (aFlags & SETFCT_OPACITY) {
if (aField < 0.0f) {
aField = 0.0f;
}
if (aField > 1.0f) {
aField = 1.0f;
}
}
return;
}
case eCSSUnit_Inherit:
aConditions.SetUncacheable();
aField = aParentValue;
@ -8130,6 +8153,7 @@ nsRuleNode::ComputeBorderData(void* aStartStruct,
{
const nsCSSPropertyID* subprops =
nsCSSProps::SubpropertyEntryFor(eCSSProperty_border_radius);
const float RADIUS_MAX = 17895697; // CSS length clamp value
NS_FOR_CSS_FULL_CORNERS(corner) {
int cx = FullToHalfCorner(corner, false);
int cy = FullToHalfCorner(corner, true);