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

@ -52,34 +52,34 @@ pub use self::GenericBoxShadow as BoxShadow;
ToShmem,
)]
#[repr(C, u8)]
pub enum GenericFilter<Angle, Factor, Length, Shadow, U> {
pub enum GenericFilter<Angle, NonNegativeFactor, ZeroToOneFactor, Length, Shadow, U> {
/// `blur(<length>)`
#[css(function)]
Blur(Length),
/// `brightness(<factor>)`
#[css(function)]
Brightness(Factor),
Brightness(NonNegativeFactor),
/// `contrast(<factor>)`
#[css(function)]
Contrast(Factor),
Contrast(NonNegativeFactor),
/// `grayscale(<factor>)`
#[css(function)]
Grayscale(Factor),
Grayscale(ZeroToOneFactor),
/// `hue-rotate(<angle>)`
#[css(function)]
HueRotate(Angle),
/// `invert(<factor>)`
#[css(function)]
Invert(Factor),
Invert(ZeroToOneFactor),
/// `opacity(<factor>)`
#[css(function)]
Opacity(Factor),
Opacity(ZeroToOneFactor),
/// `saturate(<factor>)`
#[css(function)]
Saturate(Factor),
Saturate(NonNegativeFactor),
/// `sepia(<factor>)`
#[css(function)]
Sepia(Factor),
Sepia(ZeroToOneFactor),
/// `drop-shadow(...)`
#[css(function)]
DropShadow(Shadow),