Auto merge of #17444 - hiikezoe:fnv-hashmap-for-animation, r=emilio

Use FnvHashmap instead of HashMap for AnimationValueMap.

<!-- Please describe your changes on the following line: -->
https://bugzilla.mozilla.org/show_bug.cgi?id=1374842

---
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/17444)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2017-06-22 02:22:34 -07:00 committed by GitHub
commit bd2df70c3c
2 changed files with 3 additions and 3 deletions

View file

@ -616,7 +616,7 @@ fn get_animation_rule(element: &GeckoElement,
-> Option<Arc<Locked<PropertyDeclarationBlock>>> { -> Option<Arc<Locked<PropertyDeclarationBlock>>> {
use gecko_bindings::sugar::ownership::HasSimpleFFI; use gecko_bindings::sugar::ownership::HasSimpleFFI;
// Also, we should try to reuse the PDB, to avoid creating extra rule nodes. // Also, we should try to reuse the PDB, to avoid creating extra rule nodes.
let mut animation_values = AnimationValueMap::new(); let mut animation_values = AnimationValueMap::default();
if unsafe { Gecko_GetAnimationRule(element.0, if unsafe { Gecko_GetAnimationRule(element.0,
cascade_level, cascade_level,
AnimationValueMap::as_ffi_mut(&mut animation_values)) } { AnimationValueMap::as_ffi_mut(&mut animation_values)) } {

View file

@ -30,7 +30,7 @@ use properties::longhands::visibility::computed_value::T as Visibility;
use selectors::parser::SelectorParseError; use selectors::parser::SelectorParseError;
use smallvec::SmallVec; use smallvec::SmallVec;
use std::cmp; use std::cmp;
#[cfg(feature = "gecko")] use std::collections::HashMap; #[cfg(feature = "gecko")] use fnv::FnvHashMap;
use style_traits::ParseError; use style_traits::ParseError;
use super::ComputedValues; use super::ComputedValues;
use values::{Auto, CSSFloat, CustomIdent, Either}; use values::{Auto, CSSFloat, CustomIdent, Either};
@ -440,7 +440,7 @@ impl AnimatedProperty {
/// This HashMap stores the values that are the last AnimationValue to be /// This HashMap stores the values that are the last AnimationValue to be
/// composed for each TransitionProperty. /// composed for each TransitionProperty.
#[cfg(feature = "gecko")] #[cfg(feature = "gecko")]
pub type AnimationValueMap = HashMap<AnimatableLonghand, AnimationValue>; pub type AnimationValueMap = FnvHashMap<AnimatableLonghand, AnimationValue>;
#[cfg(feature = "gecko")] #[cfg(feature = "gecko")]
unsafe impl HasFFI for AnimationValueMap { unsafe impl HasFFI for AnimationValueMap {
type FFIType = RawServoAnimationValueMap; type FFIType = RawServoAnimationValueMap;