mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
style: Extract {animated,computed}::Color common parts.
Extract the common parts of `animated::Color` and `computed::Color` out into `generics::color::Color<T>` that is generic over the type of RGBA color. Bug: 1465307 Reviewed-by: xidorn MozReview-Commit-ID: EymSr7aqnAP
This commit is contained in:
parent
314b14d46e
commit
5f74a15f38
7 changed files with 122 additions and 146 deletions
|
@ -18,6 +18,7 @@ use style_traits::{CssType, CssWriter, KeywordsCollectFn, ParseError, StyleParse
|
|||
use style_traits::{SpecifiedValueInfo, ToCss, ValueParseErrorKind};
|
||||
use super::AllowQuirks;
|
||||
use values::computed::{Color as ComputedColor, Context, ToComputedValue};
|
||||
use values::generics::color::Color as GenericColor;
|
||||
use values::specified::calc::CalcNode;
|
||||
|
||||
/// Specified color value
|
||||
|
@ -384,9 +385,9 @@ impl ToComputedValue for Color {
|
|||
|
||||
fn from_computed_value(computed: &ComputedColor) -> Self {
|
||||
match *computed {
|
||||
ComputedColor::Numeric(color) => Color::rgba(color),
|
||||
ComputedColor::Foreground => Color::currentcolor(),
|
||||
ComputedColor::Complex(..) => Color::Complex(*computed),
|
||||
GenericColor::Numeric(color) => Color::rgba(color),
|
||||
GenericColor::Foreground => Color::currentcolor(),
|
||||
GenericColor::Complex(..) => Color::Complex(*computed),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue