style: Remove some unneeded indirection.

All TElement's implement Copy, and are just pointers, so the double indirection
is stupid.

I'm going to try to see if removing this double-indirection fixes some
selector-matching performance, and this is a trivial pre-requisite while I wait
for Talos results.
This commit is contained in:
Emilio Cobos Álvarez 2018-01-10 03:46:54 +01:00
parent bfc91c5e12
commit 8f6455b9df
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
5 changed files with 37 additions and 40 deletions

View file

@ -398,22 +398,20 @@ pub trait ThreadSafeLayoutElement
&style_pseudo,
Some(data.styles.primary()),
CascadeFlags::empty(),
&ServoMetricsProvider)
.clone()
&ServoMetricsProvider,
)
}
PseudoElementCascadeType::Lazy => {
context.stylist
.lazily_compute_pseudo_element_style(
&context.guards,
unsafe { &self.unsafe_get() },
&style_pseudo,
RuleInclusion::All,
data.styles.primary(),
/* is_probe = */ false,
&ServoMetricsProvider,
/* matching_func = */ None)
.unwrap()
.clone()
context.stylist.lazily_compute_pseudo_element_style(
&context.guards,
unsafe { self.unsafe_get() },
&style_pseudo,
RuleInclusion::All,
data.styles.primary(),
/* is_probe = */ false,
&ServoMetricsProvider,
/* matching_func = */ None,
).unwrap()
}
}
}
@ -424,7 +422,7 @@ pub trait ThreadSafeLayoutElement
fn selected_style(&self) -> Arc<ComputedValues> {
let data = self.style_data();
data.styles.pseudos
.get(&PseudoElement::Selection).map(|s| s)
.get(&PseudoElement::Selection)
.unwrap_or(data.styles.primary())
.clone()
}