mirror of
https://github.com/servo/servo.git
synced 2025-06-20 23:28:59 +01:00
Use IntermediateColor for caret-color.
This commit is contained in:
parent
5834577157
commit
486578fe74
2 changed files with 42 additions and 3 deletions
|
@ -404,8 +404,8 @@ impl AnimationValue {
|
|||
AnimationValue::${prop.camel_case}(ref from) => {
|
||||
PropertyDeclaration::${prop.camel_case}(
|
||||
% if prop.boxed:
|
||||
Box::new(longhands::${prop.ident}::SpecifiedValue::from_computed_value(from)))
|
||||
% else:
|
||||
Box::new(
|
||||
% endif
|
||||
longhands::${prop.ident}::SpecifiedValue::from_computed_value(
|
||||
% if prop.is_animatable_with_computed_value:
|
||||
from
|
||||
|
@ -413,6 +413,8 @@ impl AnimationValue {
|
|||
&from.into()
|
||||
% endif
|
||||
))
|
||||
% if prop.boxed:
|
||||
)
|
||||
% endif
|
||||
}
|
||||
% endif
|
||||
|
@ -2136,6 +2138,43 @@ impl Interpolate for IntermediateRGBA {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a> From<<&'a Either<CSSParserColor, Auto>> for Either<IntermediateColor, Auto> {
|
||||
fn from(from: &Either<CSSParserColor, Auto>) -> Either<IntermediateColor, Auto> {
|
||||
match *from {
|
||||
Either::First(ref from) =>
|
||||
match *from {
|
||||
CSSParserColor::RGBA(ref color) =>
|
||||
Either::First(IntermediateColor::IntermediateRGBA(
|
||||
IntermediateRGBA::new(color.red_f32(),
|
||||
color.green_f32(),
|
||||
color.blue_f32(),
|
||||
color.alpha_f32()))),
|
||||
CSSParserColor::CurrentColor =>
|
||||
Either::First(IntermediateColor::CurrentColor),
|
||||
},
|
||||
Either::Second(Auto) => Either::Second(Auto),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> From<<&'a Either<IntermediateColor, Auto>> for Either<CSSParserColor, Auto> {
|
||||
fn from(from: &Either<IntermediateColor, Auto>) -> Either<CSSParserColor, Auto> {
|
||||
match *from {
|
||||
Either::First(ref from) =>
|
||||
match *from {
|
||||
IntermediateColor::IntermediateRGBA(ref color) =>
|
||||
Either::First(CSSParserColor::RGBA(RGBA::from_floats(color.red,
|
||||
color.green,
|
||||
color.blue,
|
||||
color.alpha))),
|
||||
IntermediateColor::CurrentColor =>
|
||||
Either::First(CSSParserColor::CurrentColor),
|
||||
},
|
||||
Either::Second(Auto) => Either::Second(Auto),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// We support ComputeDistance for an API in gecko to test the transition per property.
|
||||
impl ComputeDistance for AnimationValue {
|
||||
|
|
|
@ -177,6 +177,6 @@ ${helpers.predefined_type("caret-color",
|
|||
"ColorOrAuto",
|
||||
"Either::Second(Auto)",
|
||||
spec="https://drafts.csswg.org/css-ui/#caret-color",
|
||||
animation_value_type="ComputedValue",
|
||||
animation_value_type="Either<IntermediateColor, Auto>",
|
||||
boxed=True,
|
||||
products="gecko")}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue