mirror of
https://github.com/servo/servo.git
synced 2025-08-15 02:15:33 +01:00
style: Cleanup the animated value setup.
We have three different enums to represent slightly different things. Reuse them properly, and kill some code in the animated_properties module while at it. MozReview-Commit-ID: 5ZAly8f4lWy Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
This commit is contained in:
parent
0212c5d230
commit
3215e36b5b
12 changed files with 571 additions and 689 deletions
|
@ -4,13 +4,23 @@
|
|||
|
||||
use cssparser::SourceLocation;
|
||||
use servo_arc::Arc;
|
||||
use style::properties::{PropertyDeclaration, PropertyDeclarationBlock, Importance};
|
||||
use style::properties::animated_properties::AnimatableLonghand;
|
||||
use style::properties::{LonghandId, LonghandIdSet, PropertyDeclaration, PropertyDeclarationBlock, Importance};
|
||||
use style::shared_lock::SharedRwLock;
|
||||
use style::stylesheets::keyframes_rule::{Keyframe, KeyframesAnimation, KeyframePercentage, KeyframeSelector};
|
||||
use style::stylesheets::keyframes_rule::{KeyframesStep, KeyframesStepValue};
|
||||
use style::values::specified::{LengthOrPercentageOrAuto, NoCalcLength};
|
||||
|
||||
macro_rules! longhand_set {
|
||||
($($word:ident),+) => {{
|
||||
let mut set = LonghandIdSet::new();
|
||||
$(
|
||||
set.insert(LonghandId::$word);
|
||||
)+
|
||||
set
|
||||
}}
|
||||
}
|
||||
|
||||
|
||||
#[test]
|
||||
fn test_empty_keyframe() {
|
||||
let shared_lock = SharedRwLock::new();
|
||||
|
@ -20,7 +30,7 @@ fn test_empty_keyframe() {
|
|||
&shared_lock.read());
|
||||
let expected = KeyframesAnimation {
|
||||
steps: vec![],
|
||||
properties_changed: vec![],
|
||||
properties_changed: LonghandIdSet::new(),
|
||||
vendor_prefix: None,
|
||||
};
|
||||
|
||||
|
@ -43,7 +53,7 @@ fn test_no_property_in_keyframe() {
|
|||
&shared_lock.read());
|
||||
let expected = KeyframesAnimation {
|
||||
steps: vec![],
|
||||
properties_changed: vec![],
|
||||
properties_changed: LonghandIdSet::new(),
|
||||
vendor_prefix: None,
|
||||
};
|
||||
|
||||
|
@ -106,7 +116,7 @@ fn test_missing_property_in_initial_keyframe() {
|
|||
declared_timing_function: false,
|
||||
},
|
||||
],
|
||||
properties_changed: vec![AnimatableLonghand::Width, AnimatableLonghand::Height],
|
||||
properties_changed: longhand_set!(Width, Height),
|
||||
vendor_prefix: None,
|
||||
};
|
||||
|
||||
|
@ -169,7 +179,7 @@ fn test_missing_property_in_final_keyframe() {
|
|||
declared_timing_function: false,
|
||||
},
|
||||
],
|
||||
properties_changed: vec![AnimatableLonghand::Width, AnimatableLonghand::Height],
|
||||
properties_changed: longhand_set!(Width, Height),
|
||||
vendor_prefix: None,
|
||||
};
|
||||
|
||||
|
@ -234,7 +244,7 @@ fn test_missing_keyframe_in_both_of_initial_and_final_keyframe() {
|
|||
declared_timing_function: false,
|
||||
}
|
||||
],
|
||||
properties_changed: vec![AnimatableLonghand::Width, AnimatableLonghand::Height],
|
||||
properties_changed: longhand_set!(Width, Height),
|
||||
vendor_prefix: None,
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue