mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
Make AnimationValue::id be just a pointer cast 🐉🐲
Now that PropertyDeclaration and AnimationValue have the same discriminants, that means the trick found in PropertyDeclaration::id can be done in AnimationValue::id.
This commit is contained in:
parent
79775541f2
commit
921d1aeeba
2 changed files with 5 additions and 3 deletions
|
@ -58,9 +58,9 @@ extern crate smallvec;
|
|||
extern crate string_cache;
|
||||
#[cfg(feature = "url")]
|
||||
extern crate url;
|
||||
extern crate void;
|
||||
#[cfg(feature = "webrender_api")]
|
||||
extern crate webrender_api;
|
||||
extern crate void;
|
||||
#[cfg(feature = "servo")]
|
||||
extern crate xml5ever;
|
||||
|
||||
|
|
|
@ -364,7 +364,8 @@ pub enum AnimationValue {
|
|||
impl AnimationValue {
|
||||
/// Returns the longhand id this animated value corresponds to.
|
||||
pub fn id(&self) -> LonghandId {
|
||||
match *self {
|
||||
let id = unsafe { *(self as *const _ as *const LonghandId) };
|
||||
debug_assert_eq!(id, match *self {
|
||||
% for prop in data.longhands:
|
||||
% if prop.animatable:
|
||||
AnimationValue::${prop.camel_case}(..) => LonghandId::${prop.camel_case},
|
||||
|
@ -372,7 +373,8 @@ impl AnimationValue {
|
|||
AnimationValue::${prop.camel_case}(void) => void::unreachable(void),
|
||||
% endif
|
||||
% endfor
|
||||
}
|
||||
});
|
||||
id
|
||||
}
|
||||
|
||||
/// "Uncompute" this animation value in order to be used inside the CSS
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue