mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Bug 1374233 - Part 8: Implement ToAnimatedValue for BorderCornerRadius.
BorderCornerRadius should always be non-negative, so we can implemennt ToAnimatedValue for it directly, for properties: 1. border-{*}-radius 2. -moz-outline-{*}-radius MozReview-Commit-ID: HEbeHz9Hfkd
This commit is contained in:
parent
e72a0f126e
commit
b37f270c65
4 changed files with 33 additions and 10 deletions
|
@ -351,6 +351,20 @@ impl LengthOrPercentage {
|
|||
},
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns the clamped non-negative values.
|
||||
#[inline]
|
||||
pub fn clamp_to_non_negative(self) -> Self {
|
||||
match self {
|
||||
LengthOrPercentage::Length(length) => {
|
||||
LengthOrPercentage::Length(Au(::std::cmp::max(length.0, 0)))
|
||||
},
|
||||
LengthOrPercentage::Percentage(percentage) => {
|
||||
LengthOrPercentage::Percentage(Percentage(percentage.0.max(0.)))
|
||||
},
|
||||
_ => self
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Debug for LengthOrPercentage {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue