From 2b99c76052f7325b6aa3bb5dfb6b839d6c9a96e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Wed, 22 Mar 2017 14:38:33 +0100 Subject: [PATCH 1/2] Bug 1349553: Add a bit of debugging information to the preprocess_children stage. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit MozReview-Commit-ID: 7zv62MRX8dE Signed-off-by: Emilio Cobos Álvarez --- components/style/traversal.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/components/style/traversal.rs b/components/style/traversal.rs index 1b7c8042bae..767547f3a28 100644 --- a/components/style/traversal.rs +++ b/components/style/traversal.rs @@ -567,6 +567,7 @@ fn preprocess_children(traversal: &D, where E: TElement, D: DomTraversal { + trace!("preprocess_children: {:?}", element); // Loop over all the children. for child in element.as_node().children() { // FIXME(bholley): Add TElement::element_children instead of this. @@ -599,6 +600,8 @@ fn preprocess_children(traversal: &D, // Handle element snapshots and sibling restyle hints. let stylist = &traversal.shared_context().stylist; let later_siblings = restyle_data.compute_final_hint(child, stylist); + trace!(" > {:?} -> {:?}, later_siblings: {:?}", + child, restyle_data.hint, later_siblings); if later_siblings { propagated_hint.insert(&(RESTYLE_SELF | RESTYLE_DESCENDANTS).into()); } From ab2956a815c1a3f53cfa84cad9a4b9c02f10ed21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Wed, 22 Mar 2017 14:41:22 +0100 Subject: [PATCH 2/2] Bug 1349553: Account for negations of state-dependent selectors. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit MozReview-Commit-ID: VyHuxh9q5N Signed-off-by: Emilio Cobos Álvarez --- components/style/gecko/selector_parser.rs | 3 +++ components/style/restyle_hints.rs | 17 ++++++++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/components/style/gecko/selector_parser.rs b/components/style/gecko/selector_parser.rs index 3eccac4443c..232087df9ee 100644 --- a/components/style/gecko/selector_parser.rs +++ b/components/style/gecko/selector_parser.rs @@ -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>), } } diff --git a/components/style/restyle_hints.rs b/components/style/restyle_hints.rs index e51248b1b39..f0e13a9d8b9 100644 --- a/components/style/restyle_hints.rs +++ b/components/style/restyle_hints.rs @@ -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) -> 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) -> Element fn selector_to_state(sel: &SimpleSelector) -> 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 {