mirror of
https://github.com/servo/servo.git
synced 2025-08-02 20:20:14 +01:00
style: Let aspect-ratio (css-sizing-4) support 'auto | <ratio>'.
In order to test its parsing and serialization, we expose it but protect it behind a pref. Besides, I would like to drop layout.css.aspect-ratio-number.enabled in the next patch because the spec has been updated. It seems we don't have to keep this pref and we should always use Number. Differential Revision: https://phabricator.services.mozilla.com/D74955
This commit is contained in:
parent
bd23e05c47
commit
fc9321bb23
8 changed files with 185 additions and 18 deletions
|
@ -272,3 +272,26 @@ where
|
|||
<Self as num_traits::Zero>::is_zero(self)
|
||||
}
|
||||
}
|
||||
|
||||
/// A trait pretty much similar to num_traits::One, but without the need of
|
||||
/// implementing `Mul`.
|
||||
pub trait One {
|
||||
/// Reutrns the one value.
|
||||
fn one() -> Self;
|
||||
|
||||
/// Returns whether this value is one.
|
||||
fn is_one(&self) -> bool;
|
||||
}
|
||||
|
||||
impl<T> One for T
|
||||
where
|
||||
T: num_traits::One + PartialEq,
|
||||
{
|
||||
fn one() -> Self {
|
||||
<Self as num_traits::One>::one()
|
||||
}
|
||||
|
||||
fn is_one(&self) -> bool {
|
||||
*self == One::one()
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue