mirror of
https://github.com/servo/servo.git
synced 2025-08-12 08:55:32 +01:00
style: Simplify calc expressions earlier.
This simplifies a bit the code, and guarantees that all calc()s have percentages and lengths. I also wanted to remove unclamped_length() / specified_percentage() (for the same reason as the above patch), but they're needed for animations for now. When I implement min() / max() for <length-percentage> they'll be fixed. Differential Revision: https://phabricator.services.mozilla.com/D60194
This commit is contained in:
parent
5237d4fac8
commit
16e5331950
7 changed files with 67 additions and 140 deletions
|
@ -7,6 +7,7 @@
|
|||
use super::{Animate, Procedure};
|
||||
use crate::values::computed::length::LengthPercentage;
|
||||
use crate::values::computed::Percentage;
|
||||
use style_traits::values::specified::AllowedNumericType;
|
||||
|
||||
/// <https://drafts.csswg.org/css-transitions/#animtype-lpcalc>
|
||||
impl Animate for LengthPercentage {
|
||||
|
@ -27,8 +28,8 @@ impl Animate for LengthPercentage {
|
|||
let percentage =
|
||||
animate_percentage_half(self.specified_percentage(), other.specified_percentage())?;
|
||||
|
||||
// Gets clamped as needed after the animation, so no need to specify any
|
||||
// particular AllowedNumericType.
|
||||
Ok(LengthPercentage::new_calc(length, percentage))
|
||||
// Gets clamped as needed after the animation if needed, so no need to
|
||||
// specify any particular AllowedNumericType.
|
||||
Ok(LengthPercentage::new_calc(length, percentage, AllowedNumericType::All))
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue