Make AnimationValue have the same variants as PropertyDeclaration

By making AnimationValue have the same representation as PropertyDeclaration
and Void variants for non-animatable properties, we know by constructions
that all properties have the same discriminant in both.
This commit is contained in:
Anthony Ramine 2018-02-09 22:34:59 +01:00
parent 6b1a74672d
commit 79775541f2
7 changed files with 58 additions and 35 deletions

View file

@ -60,6 +60,7 @@ extern crate string_cache;
extern crate url;
#[cfg(feature = "webrender_api")]
extern crate webrender_api;
extern crate void;
#[cfg(feature = "servo")]
extern crate xml5ever;
@ -67,6 +68,7 @@ use std::hash::{BuildHasher, Hash};
use std::mem::size_of;
use std::ops::Range;
use std::os::raw::c_void;
use void::Void;
/// A C function that takes a pointer to a heap allocation and returns its size.
type VoidPtrToSizeFn = unsafe extern "C" fn(ptr: *const c_void) -> usize;
@ -746,6 +748,13 @@ impl MallocSizeOf for selectors::parser::AncestorHashes {
}
}
impl MallocSizeOf for Void {
#[inline]
fn size_of(&self, _ops: &mut MallocSizeOfOps) -> usize {
void::unreachable(*self)
}
}
#[cfg(feature = "servo")]
impl<Static: string_cache::StaticAtomSet> MallocSizeOf for string_cache::Atom<Static> {
fn size_of(&self, _ops: &mut MallocSizeOfOps) -> usize {