aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2017-06-17 06:20:45 -0700
committerGitHub <noreply@github.com>2017-06-17 06:20:45 -0700
commitc5433277b44467ccbfd00024000ded5769157e3c (patch)
treefb434c92881f9d0c109146e6dac68272a9fbf583
parenteffd6f2f877e767352b45fc35c8066a56c1612b7 (diff)
parent61a4ba3e79d5ecd860326adccb99d1c0e5908f79 (diff)
downloadservo-c5433277b44467ccbfd00024000ded5769157e3c.tar.gz
servo-c5433277b44467ccbfd00024000ded5769157e3c.zip
Auto merge of #17384 - emilio:stylist-attr-dep, r=nox
style: Clean up some stylist code and make it slightly more efficient. <!-- 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/17384) <!-- Reviewable:end -->
-rw-r--r--components/style/stylist.rs17
1 files changed, 6 insertions, 11 deletions
diff --git a/components/style/stylist.rs b/components/style/stylist.rs
index a5a6313b3f2..c205703a0db 100644
--- a/components/style/stylist.rs
+++ b/components/style/stylist.rs
@@ -549,7 +549,7 @@ impl Stylist {
if *local_name == local_name!("style") {
self.style_attribute_dependency
} else {
- self.attribute_dependencies.might_contain(local_name)
+ self.attribute_dependencies.might_contain_hash(local_name.get_hash())
}
}
@@ -1169,7 +1169,7 @@ impl Stylist {
/// of our rule maps.
#[inline]
pub fn may_have_rules_for_id(&self, id: &Atom) -> bool {
- self.mapped_ids.might_contain(id)
+ self.mapped_ids.might_contain_hash(id.get_hash())
}
/// Return whether the device is dirty, that is, whether the screen size or
@@ -1304,16 +1304,11 @@ impl<'a> SelectorVisitor for AttributeAndStateDependencyVisitor<'a> {
fn visit_attribute_selector(&mut self, _ns: &NamespaceConstraint<&Namespace>,
name: &LocalName, lower_name: &LocalName)
-> bool {
- #[cfg(feature = "servo")]
- let style_lower_name = local_name!("style");
- #[cfg(feature = "gecko")]
- let style_lower_name = atom!("style");
-
- if *lower_name == style_lower_name {
+ if *lower_name == local_name!("style") {
*self.style_attribute_dependency = true;
} else {
- self.attribute_dependencies.insert(&name);
- self.attribute_dependencies.insert(&lower_name);
+ self.attribute_dependencies.insert_hash(name.get_hash());
+ self.attribute_dependencies.insert_hash(lower_name.get_hash());
}
true
}
@@ -1337,7 +1332,7 @@ impl<'a> SelectorVisitor for MappedIdVisitor<'a> {
/// We just want to insert all the ids we find into mapped_ids.
fn visit_simple_selector(&mut self, s: &Component<SelectorImpl>) -> bool {
if let Component::ID(ref id) = *s {
- self.mapped_ids.insert(id);
+ self.mapped_ids.insert_hash(id.get_hash());
}
true
}