Separate revalidation checking from attribute sensitivity checking.

The current code is busted because:
* It unconditionally flags for revalidation if the sensitivities are not yet
  sensitive to attributes.
* It uses is_attr_selector, despite the fact that ID and Class are both handled
  by the style sharing cache and should not trigger revalidation.

MozReview-Commit-ID: C7d8QrdKcFm
This commit is contained in:
Bobby Holley 2017-04-24 12:21:47 -07:00
parent ab3f5b0d9f
commit dd4575c23a

View file

@ -420,11 +420,17 @@ fn is_attr_selector(sel: &Component<SelectorImpl>) -> bool {
/// Whether a selector containing this simple selector needs to be explicitly
/// matched against both the style sharing cache entry and the candidate.
///
///
/// We use this for selectors that can have different matching behavior between
/// siblings that are otherwise identical as far as the cache is concerned.
fn needs_cache_revalidation(sel: &Component<SelectorImpl>) -> bool {
match *sel {
Component::AttrExists(_) |
Component::AttrEqual(_, _, _) |
Component::AttrIncludes(_, _) |
Component::AttrDashMatch(_, _) |
Component::AttrPrefixMatch(_, _) |
Component::AttrSubstringMatch(_, _) |
Component::AttrSuffixMatch(_, _) |
Component::Empty |
Component::FirstChild |
Component::LastChild |
@ -529,7 +535,6 @@ impl SelectorVisitor for SensitivitiesVisitor {
if !self.sensitivities.attrs {
self.sensitivities.attrs = is_attr_selector(s);
self.needs_revalidation = true;
}
if !self.needs_revalidation {