mirror of
https://github.com/servo/servo.git
synced 2025-06-21 07:38: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) => {
|
AnimationValue::${prop.camel_case}(ref from) => {
|
||||||
PropertyDeclaration::${prop.camel_case}(
|
PropertyDeclaration::${prop.camel_case}(
|
||||||
% if prop.boxed:
|
% if prop.boxed:
|
||||||
Box::new(longhands::${prop.ident}::SpecifiedValue::from_computed_value(from)))
|
Box::new(
|
||||||
% else:
|
% endif
|
||||||
longhands::${prop.ident}::SpecifiedValue::from_computed_value(
|
longhands::${prop.ident}::SpecifiedValue::from_computed_value(
|
||||||
% if prop.is_animatable_with_computed_value:
|
% if prop.is_animatable_with_computed_value:
|
||||||
from
|
from
|
||||||
|
@ -413,6 +413,8 @@ impl AnimationValue {
|
||||||
&from.into()
|
&from.into()
|
||||||
% endif
|
% endif
|
||||||
))
|
))
|
||||||
|
% if prop.boxed:
|
||||||
|
)
|
||||||
% endif
|
% endif
|
||||||
}
|
}
|
||||||
% 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.
|
/// We support ComputeDistance for an API in gecko to test the transition per property.
|
||||||
impl ComputeDistance for AnimationValue {
|
impl ComputeDistance for AnimationValue {
|
||||||
|
|
|
@ -177,6 +177,6 @@ ${helpers.predefined_type("caret-color",
|
||||||
"ColorOrAuto",
|
"ColorOrAuto",
|
||||||
"Either::Second(Auto)",
|
"Either::Second(Auto)",
|
||||||
spec="https://drafts.csswg.org/css-ui/#caret-color",
|
spec="https://drafts.csswg.org/css-ui/#caret-color",
|
||||||
animation_value_type="ComputedValue",
|
animation_value_type="Either<IntermediateColor, Auto>",
|
||||||
boxed=True,
|
boxed=True,
|
||||||
products="gecko")}
|
products="gecko")}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue