mirror of
https://github.com/servo/servo.git
synced 2025-08-11 16:35:33 +01:00
Replace Au with CSSPixelLength in CalcLengthOrPercentage.
We replace Au with CSSPixelLength for the length part of computed::CalcLengthOrPercentage. Therefore, it would be easier to use CSSPixelLength for all other LengthOrPercentage{*} types.
This commit is contained in:
parent
a949e2a057
commit
535c1e3c6f
13 changed files with 99 additions and 117 deletions
|
@ -203,14 +203,15 @@ impl<S: Side> ToComputedValue for PositionComponent<S> {
|
|||
match length.to_computed_value(context) {
|
||||
ComputedLengthOrPercentage::Length(length) => {
|
||||
ComputedLengthOrPercentage::Calc(
|
||||
CalcLengthOrPercentage::new(-length, Some(Percentage::hundred())))
|
||||
CalcLengthOrPercentage::new((-length).into(), Some(Percentage::hundred())))
|
||||
},
|
||||
ComputedLengthOrPercentage::Percentage(p) => {
|
||||
ComputedLengthOrPercentage::Percentage(Percentage(1.0 - p.0))
|
||||
},
|
||||
ComputedLengthOrPercentage::Calc(calc) => {
|
||||
let p = Percentage(1. - calc.percentage.map_or(0., |p| p.0));
|
||||
ComputedLengthOrPercentage::Calc(CalcLengthOrPercentage::new(-calc.unclamped_length(), Some(p)))
|
||||
let l = -calc.unclamped_length();
|
||||
ComputedLengthOrPercentage::Calc(CalcLengthOrPercentage::new(l, Some(p)))
|
||||
},
|
||||
}
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue