diff --git a/components/style/hash.rs b/components/style/hash.rs index 305357a85b2..3a2d95404a1 100644 --- a/components/style/hash.rs +++ b/components/style/hash.rs @@ -9,19 +9,26 @@ use fnv; +// #[cfg(feature = "gecko")] +// pub use hashglobe::hash_map::HashMap; +// #[cfg(feature = "gecko")] +// pub use hashglobe::hash_set::HashSet; #[cfg(feature = "gecko")] -pub use hashglobe::hash_map::HashMap; +pub use hashglobe::order::HashMap; #[cfg(feature = "gecko")] -pub use hashglobe::hash_set::HashSet; +pub use hashglobe::order::HashSet; #[cfg(feature = "servo")] pub use hashglobe::fake::{HashMap, HashSet}; + /// Appropriate reexports of hash_map types pub mod map { + // #[cfg(feature = "gecko")] + // pub use hashglobe::hash_map::{Entry, Iter}; #[cfg(feature = "gecko")] - pub use hashglobe::hash_map::{Entry, Iter}; + pub use hashglobe::order::{Entry, MapIter as Iter}; #[cfg(feature = "servo")] pub use std::collections::hash_map::{Entry, Iter}; } diff --git a/components/style/invalidation/element/invalidation_map.rs b/components/style/invalidation/element/invalidation_map.rs index 854d0189610..05c67bcc383 100644 --- a/components/style/invalidation/element/invalidation_map.rs +++ b/components/style/invalidation/element/invalidation_map.rs @@ -273,7 +273,7 @@ impl InvalidationMap { for class in compound_visitor.classes { self.class_to_selector - .entry(class, quirks_mode) + .try_entry(class, quirks_mode)? .or_insert_with(SmallVec::new) .try_push(Dependency { selector: selector.clone(), @@ -283,7 +283,7 @@ impl InvalidationMap { for id in compound_visitor.ids { self.id_to_selector - .entry(id, quirks_mode) + .try_entry(id, quirks_mode)? .or_insert_with(SmallVec::new) .try_push(Dependency { selector: selector.clone(), diff --git a/components/style/selector_map.rs b/components/style/selector_map.rs index 0678f0ec922..e9ed6ce3536 100644 --- a/components/style/selector_map.rs +++ b/components/style/selector_map.rs @@ -512,19 +512,12 @@ impl MaybeCaseInsensitiveHashMap { MaybeCaseInsensitiveHashMap(PrecomputedHashMap::default()) } - /// HashMap::entry - pub fn entry(&mut self, mut key: Atom, quirks_mode: QuirksMode) -> hash_map::Entry { - if quirks_mode == QuirksMode::Quirks { - key = key.to_ascii_lowercase() - } - self.0.entry(key) - } - /// HashMap::try_entry + #[cfg(not(feature = "gecko"))] pub fn try_entry( &mut self, mut key: Atom, - quirks_mode: QuirksMode + quirks_mode: QuirksMode, ) -> Result, FailedAllocationError> { if quirks_mode == QuirksMode::Quirks { key = key.to_ascii_lowercase() @@ -532,6 +525,22 @@ impl MaybeCaseInsensitiveHashMap { self.0.try_entry(key) } + /// HashMap::try_entry + /// + /// FIXME(emilio): Remove the extra Entry parameter and unify when ordermap + /// 0.4 is released. + #[cfg(feature = "gecko")] + pub fn try_entry( + &mut self, + mut key: Atom, + quirks_mode: QuirksMode, + ) -> Result>, FailedAllocationError> { + if quirks_mode == QuirksMode::Quirks { + key = key.to_ascii_lowercase() + } + self.0.try_entry(key) + } + /// HashMap::iter pub fn iter(&self) -> hash_map::Iter { self.0.iter()