mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
style: CSS comp funcs should handle NaN contagiously
If NaN is given as any input to CSS comp funcs (min/max/clamp), it should return NaN. Does not cover simplification (see Bug 1820412). Adjusted WPT test expectations, 18 newly pass. 🎉 Differential Revision: https://phabricator.services.mozilla.com/D171659
This commit is contained in:
parent
191c7cdb78
commit
d2217be803
1 changed files with 16 additions and 0 deletions
|
@ -449,8 +449,19 @@ impl<L: CalcNodeLeaf> CalcNode<L> {
|
|||
},
|
||||
Self::MinMax(ref nodes, op) => {
|
||||
let mut result = nodes[0].resolve_internal(leaf_to_output_fn)?;
|
||||
|
||||
if result.is_nan() {
|
||||
return Ok(result);
|
||||
}
|
||||
|
||||
for node in nodes.iter().skip(1) {
|
||||
let candidate = node.resolve_internal(leaf_to_output_fn)?;
|
||||
|
||||
if candidate.is_nan() {
|
||||
result = candidate;
|
||||
break;
|
||||
}
|
||||
|
||||
let candidate_wins = match op {
|
||||
MinMaxOp::Min => candidate < result,
|
||||
MinMaxOp::Max => candidate > result,
|
||||
|
@ -477,6 +488,11 @@ impl<L: CalcNodeLeaf> CalcNode<L> {
|
|||
if result < min {
|
||||
result = min
|
||||
}
|
||||
|
||||
if min.is_nan() || center.is_nan() || max.is_nan() {
|
||||
result = <O as Float>::nan();
|
||||
}
|
||||
|
||||
result
|
||||
},
|
||||
Self::Round {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue