style: Don't simplify percentages that resolve to lengths in min/max/clamp

Those can't be ordered at specified / computed value time, since the
percentage basis could be negative.

Needs tests of course, running through try atm.

Differential Revision: https://phabricator.services.mozilla.com/D115591
This commit is contained in:
Emilio Cobos Álvarez 2023-05-21 22:00:09 +02:00 committed by Oriol Brufau
parent 204cb7a9c0
commit 908c952ab0
2 changed files with 8 additions and 15 deletions

View file

@ -107,8 +107,12 @@ impl PartialOrd for Leaf {
}
match (self, other) {
// NOTE: Percentages can't be compared reasonably here because the
// percentage basis might be negative, see bug 1709018.
// Conveniently, we only use this for <length-percentage> (for raw
// percentages, we go through resolve()).
(&Percentage(..), &Percentage(..)) => None,
(&Length(ref one), &Length(ref other)) => one.partial_cmp(other),
(&Percentage(ref one), &Percentage(ref other)) => one.partial_cmp(other),
(&Angle(ref one), &Angle(ref other)) => one.degrees().partial_cmp(&other.degrees()),
(&Time(ref one), &Time(ref other)) => one.seconds().partial_cmp(&other.seconds()),
(&Number(ref one), &Number(ref other)) => one.partial_cmp(other),