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

Bug 1349553: Account for negations of state-dependent selectors. #16093

Merged
merged 2 commits into from Mar 23, 2017
Merged
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

Prev

Bug 1349553: Account for negations of state-dependent selectors.

MozReview-Commit-ID: VyHuxh9q5N
Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
  • Loading branch information
emilio committed Mar 23, 2017
commit ab2956a815c1a3f53cfa84cad9a4b9c02f10ed21
@@ -154,6 +154,9 @@ macro_rules! pseudo_class_name {
$s_name(Box<[u16]>),
)*
/// The non-standard `:-moz-any` pseudo-class.
///
/// TODO(emilio): We disallow combinators and pseudos here, so we
/// should use SimpleSelector instead
MozAny(Vec<ComplexSelector<SelectorImpl>>),
}
}
@@ -358,7 +358,8 @@ impl<'a, E> Element for ElementWrapper<'a, E>
}
}

/// Returns the union of any `ElementState` flags for components of a `ComplexSelector`
/// Returns the union of any `ElementState` flags for components of a
/// `ComplexSelector`.
pub fn complex_selector_to_state(sel: &ComplexSelector<SelectorImpl>) -> ElementState {
sel.compound_selector.iter().fold(ElementState::empty(), |state, s| {
state | selector_to_state(s)
@@ -368,6 +369,11 @@ pub fn complex_selector_to_state(sel: &ComplexSelector<SelectorImpl>) -> Element
fn selector_to_state(sel: &SimpleSelector<SelectorImpl>) -> ElementState {
match *sel {
SimpleSelector::NonTSPseudoClass(ref pc) => SelectorImpl::pseudo_class_state_flag(pc),
SimpleSelector::Negation(ref negated) => {
negated.iter().fold(ElementState::empty(), |state, s| {
state | complex_selector_to_state(s)
})
}
_ => ElementState::empty(),
}
}
@@ -502,6 +508,15 @@ impl DependencySet {
if !sensitivities.attrs {
sensitivities.attrs = is_attr_selector(s);
}

// NOTE(emilio): I haven't thought this thoroughly, but we may
// not need to do anything for combinators inside negations.
//
// Or maybe we do, and need to call note_selector recursively
// here to account for them correctly, but keep the
// sensitivities of the parent?
//
// In any case, perhaps we should just drop it, see bug 1348802.
}
if !sensitivities.is_empty() {
self.add_dependency(Dependency {
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.