mirror of
https://github.com/servo/servo.git
synced 2025-08-09 07:25:35 +01:00
Refactor how calc() clamping is done on computed values (fixes #15296)
This commit is contained in:
parent
f935f2da01
commit
d0b9bd9c64
13 changed files with 173 additions and 154 deletions
|
@ -234,19 +234,14 @@ impl<S: Side> ToComputedValue for PositionComponent<S> {
|
|||
PositionComponent::Side(ref keyword, Some(ref length)) if !keyword.is_start() => {
|
||||
match length.to_computed_value(context) {
|
||||
ComputedLengthOrPercentage::Length(length) => {
|
||||
ComputedLengthOrPercentage::Calc(CalcLengthOrPercentage {
|
||||
length: -length,
|
||||
percentage: Some(1.0),
|
||||
})
|
||||
ComputedLengthOrPercentage::Calc(CalcLengthOrPercentage::new(-length, Some(1.0)))
|
||||
},
|
||||
ComputedLengthOrPercentage::Percentage(p) => {
|
||||
ComputedLengthOrPercentage::Percentage(1.0 - p)
|
||||
},
|
||||
ComputedLengthOrPercentage::Calc(calc) => {
|
||||
ComputedLengthOrPercentage::Calc(CalcLengthOrPercentage {
|
||||
length: -calc.length,
|
||||
percentage: Some(1.0 - calc.percentage.unwrap_or(0.)),
|
||||
})
|
||||
let p = 1. - calc.percentage.unwrap_or(0.);
|
||||
ComputedLengthOrPercentage::Calc(CalcLengthOrPercentage::new(-calc.length(), Some(p)))
|
||||
},
|
||||
}
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue