style: Use style interpolation code for gradients

This ensures they're clamped on Animated -> sRGB conversion, and in the
future we'll have to implement different color spaces so we'll need to
use it anyways.

Differential Revision: https://phabricator.services.mozilla.com/D149792
This commit is contained in:
Emilio Cobos Álvarez 2022-06-22 23:02:34 +00:00 committed by Martin Robinson
parent 189039bea5
commit a19674a5a7
3 changed files with 5 additions and 3 deletions

View file

@ -19,7 +19,7 @@ use std::f32::consts::PI;
/// range `[0.0, 1.0]`.
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToAnimatedZero, ToAnimatedValue)]
#[repr(C)]
pub struct RGBA {
pub struct AnimatedRGBA {
/// The red component.
pub red: f32,
/// The green component.
@ -30,6 +30,8 @@ pub struct RGBA {
pub alpha: f32,
}
use self::AnimatedRGBA as RGBA;
const RAD_PER_DEG: f32 = PI / 180.0;
const DEG_PER_RAD: f32 = 180.0 / PI;

View file

@ -4,7 +4,7 @@
//! Computed color values.
use crate::values::animated::color::RGBA as AnimatedRGBA;
use crate::values::animated::color::AnimatedRGBA;
use crate::values::animated::ToAnimatedValue;
use crate::values::generics::color::{GenericCaretColor, GenericColor, GenericColorOrAuto};
use crate::values::computed::percentage::Percentage;

View file

@ -9,7 +9,7 @@ use style_traits::{CssWriter, ParseError, ToCss};
use crate::values::{Parse, ParserContext, Parser};
use crate::values::specified::percentage::ToPercentage;
use crate::values::animated::ToAnimatedValue;
use crate::values::animated::color::RGBA as AnimatedRGBA;
use crate::values::animated::color::AnimatedRGBA;
/// This struct represents a combined color from a numeric color and
/// the current foreground color (currentcolor keyword).