style: Add computed value ZeroToOneNumber.

Correctly handle clamping to 1 behavior of grayscale(),
invert(), opacity() and sepia().

Differential Revision: https://phabricator.services.mozilla.com/D35509
This commit is contained in:
violet 2019-06-23 23:01:47 +00:00 committed by Emilio Cobos Álvarez
parent 9939c1ee07
commit 2fba62aba9
No known key found for this signature in database
GPG key ID: E1152D0994E4BF8A
6 changed files with 132 additions and 73 deletions

View file

@ -8,7 +8,7 @@ use crate::values::computed::color::Color;
use crate::values::computed::length::{Length, NonNegativeLength};
#[cfg(feature = "gecko")]
use crate::values::computed::url::ComputedUrl;
use crate::values::computed::{Angle, NonNegativeNumber};
use crate::values::computed::{Angle, ZeroToOneNumber, NonNegativeNumber};
use crate::values::generics::effects::BoxShadow as GenericBoxShadow;
use crate::values::generics::effects::Filter as GenericFilter;
use crate::values::generics::effects::SimpleShadow as GenericSimpleShadow;
@ -21,12 +21,12 @@ pub type BoxShadow = GenericBoxShadow<Color, Length, NonNegativeLength, Length>;
/// A computed value for a single `filter`.
#[cfg(feature = "gecko")]
pub type Filter =
GenericFilter<Angle, NonNegativeNumber, NonNegativeLength, SimpleShadow, ComputedUrl>;
GenericFilter<Angle, NonNegativeNumber, ZeroToOneNumber, NonNegativeLength, SimpleShadow, ComputedUrl>;
/// A computed value for a single `filter`.
#[cfg(feature = "servo")]
pub type Filter =
GenericFilter<Angle, NonNegativeNumber, NonNegativeLength, Impossible, Impossible>;
GenericFilter<Angle, NonNegativeNumber, ZeroToOneNumber, NonNegativeLength, Impossible, Impossible>;
/// A computed value for the `drop-shadow()` filter.
pub type SimpleShadow = GenericSimpleShadow<Color, Length, NonNegativeLength>;