mirror of
https://github.com/servo/servo.git
synced 2025-07-22 23:03:42 +01:00
Bug 1349553: Account for negations of state-dependent selectors.
MozReview-Commit-ID: VyHuxh9q5N Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
This commit is contained in:
parent
2b99c76052
commit
ab2956a815
2 changed files with 19 additions and 1 deletions
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue