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

Speed up stylist rebuilds #16659

Merged
merged 5 commits into from Apr 30, 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

Clean up note_selector a bit and stop handling combinators in two pla…

…ces.

MozReview-Commit-ID: HhVi72K4yp0
  • Loading branch information
bholley committed Apr 29, 2017
commit b4a2e2f17c4618f03cfe7d6654c3332b1309a426
@@ -18,7 +18,7 @@ use selectors::{Element, MatchAttr};
use selectors::matching::{ElementSelectorFlags, StyleRelations};
use selectors::matching::matches_selector;
use selectors::parser::{AttrSelector, Combinator, Component, Selector};
use selectors::parser::{SelectorInner, SelectorIter, SelectorMethods};
use selectors::parser::{SelectorInner, SelectorMethods};
use selectors::visitor::SelectorVisitor;
use std::clone::Clone;

@@ -482,27 +482,13 @@ struct Dependency {
/// of them is sensitive to attribute or state changes.
struct SensitivitiesVisitor {
sensitivities: Sensitivities,
hint: RestyleHint,
}

impl SelectorVisitor for SensitivitiesVisitor {
type Impl = SelectorImpl;

fn visit_complex_selector(&mut self,
_: SelectorIter<SelectorImpl>,
combinator: Option<Combinator>) -> bool {
self.hint |= combinator_to_restyle_hint(combinator);

true
}

fn visit_simple_selector(&mut self, s: &Component<SelectorImpl>) -> bool {
self.sensitivities.states.insert(selector_to_state(s));

if !self.sensitivities.attrs {
self.sensitivities.attrs = is_attr_selector(s);
}

self.sensitivities.attrs |= is_attr_selector(s);
true
}
}
@@ -547,9 +533,9 @@ impl DependencySet {
while let Some(current) = next.take() {
// Set up our visitor.
let mut visitor = SensitivitiesVisitor {
sensitivities: Sensitivities::new(),
hint: combinator_to_restyle_hint(combinator),
sensitivities: Sensitivities::new()
};
let mut hint = combinator_to_restyle_hint(combinator);

if is_pseudo_element {
// TODO(emilio): use more fancy restyle hints to avoid restyling
@@ -560,7 +546,7 @@ impl DependencySet {
// restyle_descendants to handle all of them (::before and
// ::after, because we find them in the subtree, and other lazy
// pseudos for the same reason).
visitor.hint |= RESTYLE_SELF | RESTYLE_DESCENDANTS;
hint |= RESTYLE_SELF | RESTYLE_DESCENDANTS;
is_pseudo_element = false;
}

@@ -584,7 +570,7 @@ impl DependencySet {
if !visitor.sensitivities.is_empty() {
self.add_dependency(Dependency {
sensitivities: visitor.sensitivities,
hint: visitor.hint,
hint: hint,
selector: SelectorInner::new(current),
})
}
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.