Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

style: Avoid hashing hashes. #18011

Merged
merged 1 commit into from Aug 8, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions components/style/gecko/data.rs
Expand Up @@ -7,7 +7,6 @@
use Atom;
use atomic_refcell::{AtomicRef, AtomicRefCell, AtomicRefMut};
use dom::TElement;
use fnv::FnvHashMap;
use gecko::rules::{CounterStyleRule, FontFaceRule};
use gecko_bindings::bindings::{self, RawServoStyleSet};
use gecko_bindings::structs::{ServoStyleSheet, StyleSheetInfo, ServoStyleSheetInner};
Expand All @@ -17,6 +16,7 @@ use gecko_bindings::sugar::ownership::{HasArcFFI, HasBoxFFI, HasFFI, HasSimpleFF
use invalidation::media_queries::{MediaListKey, ToMediaListKey};
use media_queries::{Device, MediaList};
use properties::ComputedValues;
use selector_map::PrecomputedHashMap;
use servo_arc::Arc;
use shared_lock::{Locked, StylesheetGuards, SharedRwLockReadGuard};
use stylesheet_set::StylesheetSet;
Expand Down Expand Up @@ -124,7 +124,7 @@ pub struct PerDocumentStyleDataImpl {
pub font_faces: Vec<(Arc<Locked<FontFaceRule>>, Origin)>,

/// Map for effective counter style rules.
pub counter_styles: FnvHashMap<Atom, Arc<Locked<CounterStyleRule>>>,
pub counter_styles: PrecomputedHashMap<Atom, Arc<Locked<CounterStyleRule>>>,
}

/// The data itself is an `AtomicRefCell`, which guarantees the proper semantics
Expand All @@ -143,7 +143,7 @@ impl PerDocumentStyleData {
stylist: Stylist::new(device, quirks_mode.into()),
stylesheets: StylesheetSet::new(),
font_faces: vec![],
counter_styles: FnvHashMap::default(),
counter_styles: PrecomputedHashMap::default(),
}))
}

Expand Down
8 changes: 4 additions & 4 deletions components/style/stylist.rs
Expand Up @@ -22,7 +22,7 @@ use properties::{AnimationRules, PropertyDeclarationBlock};
use properties::INHERIT_ALL;
use properties::IS_LINK;
use rule_tree::{CascadeLevel, RuleTree, StyleSource};
use selector_map::{SelectorMap, SelectorMapEntry};
use selector_map::{PrecomputedHashMap, SelectorMap, SelectorMapEntry};
use selector_parser::{SelectorImpl, PerPseudoElementMap, PseudoElement};
use selectors::attr::NamespaceConstraint;
use selectors::bloom::BloomFilter;
Expand Down Expand Up @@ -98,7 +98,7 @@ pub struct Stylist {
rule_tree: RuleTree,

/// A map with all the animations indexed by name.
animations: FnvHashMap<Atom, KeyframesAnimation>,
animations: PrecomputedHashMap<Atom, KeyframesAnimation>,

/// Applicable declarations for a given non-eagerly cascaded pseudo-element.
/// These are eagerly computed once, and then used to resolve the new
Expand Down Expand Up @@ -168,7 +168,7 @@ pub struct ExtraStyleData<'a> {
/// A list of effective font-face rules and their origin.
pub font_faces: &'a mut Vec<(Arc<Locked<FontFaceRule>>, Origin)>,
/// A map of effective counter-style rules.
pub counter_styles: &'a mut FnvHashMap<Atom, Arc<Locked<CounterStyleRule>>>,
pub counter_styles: &'a mut PrecomputedHashMap<Atom, Arc<Locked<CounterStyleRule>>>,
}

#[cfg(feature = "gecko")]
Expand Down Expand Up @@ -1329,7 +1329,7 @@ impl Stylist {

/// Returns the map of registered `@keyframes` animations.
#[inline]
pub fn animations(&self) -> &FnvHashMap<Atom, KeyframesAnimation> {
pub fn animations(&self) -> &PrecomputedHashMap<Atom, KeyframesAnimation> {
&self.animations
}

Expand Down