mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-08 10:44:56 +00:00
Bug 1860205 - Swap Up/Down rounding strategy when negating a Round calc node. r=firefox-style-system-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D192742
This commit is contained in:
parent
8c314b4aff
commit
092e43b900
@ -566,10 +566,23 @@ impl<L: CalcNodeLeaf> CalcNode<L> {
|
||||
}
|
||||
},
|
||||
CalcNode::Round {
|
||||
ref mut strategy,
|
||||
ref mut value,
|
||||
ref mut step,
|
||||
..
|
||||
} => {
|
||||
match *strategy {
|
||||
RoundingStrategy::Nearest => {
|
||||
// Nearest is tricky because we'd have to swap the
|
||||
// behavior at the half-way point from using the upper
|
||||
// to lower bound.
|
||||
// Simpler to just wrap self in a negate node.
|
||||
wrap_self_in_negate(self);
|
||||
return;
|
||||
},
|
||||
RoundingStrategy::Up => *strategy = RoundingStrategy::Down,
|
||||
RoundingStrategy::Down => *strategy = RoundingStrategy::Up,
|
||||
RoundingStrategy::ToZero => (),
|
||||
}
|
||||
value.negate();
|
||||
step.negate();
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user