mirror of
https://github.com/servo/servo.git
synced 2025-08-08 06:55:31 +01:00
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:
parent
189039bea5
commit
a19674a5a7
3 changed files with 5 additions and 3 deletions
|
@ -19,7 +19,7 @@ use std::f32::consts::PI;
|
||||||
/// range `[0.0, 1.0]`.
|
/// range `[0.0, 1.0]`.
|
||||||
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToAnimatedZero, ToAnimatedValue)]
|
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToAnimatedZero, ToAnimatedValue)]
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
pub struct RGBA {
|
pub struct AnimatedRGBA {
|
||||||
/// The red component.
|
/// The red component.
|
||||||
pub red: f32,
|
pub red: f32,
|
||||||
/// The green component.
|
/// The green component.
|
||||||
|
@ -30,6 +30,8 @@ pub struct RGBA {
|
||||||
pub alpha: f32,
|
pub alpha: f32,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
use self::AnimatedRGBA as RGBA;
|
||||||
|
|
||||||
const RAD_PER_DEG: f32 = PI / 180.0;
|
const RAD_PER_DEG: f32 = PI / 180.0;
|
||||||
const DEG_PER_RAD: f32 = 180.0 / PI;
|
const DEG_PER_RAD: f32 = 180.0 / PI;
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
//! Computed color values.
|
//! 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::animated::ToAnimatedValue;
|
||||||
use crate::values::generics::color::{GenericCaretColor, GenericColor, GenericColorOrAuto};
|
use crate::values::generics::color::{GenericCaretColor, GenericColor, GenericColorOrAuto};
|
||||||
use crate::values::computed::percentage::Percentage;
|
use crate::values::computed::percentage::Percentage;
|
||||||
|
|
|
@ -9,7 +9,7 @@ use style_traits::{CssWriter, ParseError, ToCss};
|
||||||
use crate::values::{Parse, ParserContext, Parser};
|
use crate::values::{Parse, ParserContext, Parser};
|
||||||
use crate::values::specified::percentage::ToPercentage;
|
use crate::values::specified::percentage::ToPercentage;
|
||||||
use crate::values::animated::ToAnimatedValue;
|
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
|
/// This struct represents a combined color from a numeric color and
|
||||||
/// the current foreground color (currentcolor keyword).
|
/// the current foreground color (currentcolor keyword).
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue