style: Add a clone helper that works regardless of whether the property is logical.

Bug: 1473793
Reviewed-by: heycam
This commit is contained in:
Emilio Cobos Álvarez 2018-07-06 05:08:03 +02:00
parent 769188ddbb
commit 263d4258ea
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
2 changed files with 21 additions and 17 deletions

View file

@ -207,8 +207,8 @@ impl AnimatedProperty {
% for prop in data.longhands:
% if prop.animatable:
LonghandId::${prop.camel_case} => {
let old_computed = old_style.get_${prop.style_struct.ident.strip("_")}().clone_${prop.ident}();
let new_computed = new_style.get_${prop.style_struct.ident.strip("_")}().clone_${prop.ident}();
let old_computed = old_style.clone_${prop.ident}();
let new_computed = new_style.clone_${prop.ident}();
AnimatedProperty::${prop.camel_case}(
% if prop.is_animatable_with_computed_value:
old_computed,
@ -546,15 +546,13 @@ impl AnimationValue {
/// Get an AnimationValue for an AnimatableLonghand from a given computed values.
pub fn from_computed_values(
property: LonghandId,
computed_values: &ComputedValues
style: &ComputedValues,
) -> Option<Self> {
Some(match property {
% for prop in data.longhands:
% if prop.animatable:
LonghandId::${prop.camel_case} => {
let computed = computed_values
.get_${prop.style_struct.ident.strip("_")}()
.clone_${prop.ident}();
let computed = style.clone_${prop.ident}();
AnimationValue::${prop.camel_case}(
% if prop.is_animatable_with_computed_value:
computed