style: Don't use the current element info for cached validation data.

We can take it straight from the validation target.
This commit is contained in:
Emilio Cobos Álvarez 2017-07-13 15:36:59 +02:00
parent 36310e3b66
commit 62310d9bd5
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
3 changed files with 15 additions and 34 deletions

View file

@ -777,7 +777,7 @@ where
// This is only relevant for animations as of right now.
important_rules_changed = true;
let target = StyleSharingTarget::new(element);
let mut target = StyleSharingTarget::new(element);
match target.share_style_if_possible(context) {
StyleWasShared(index, styles) => {
context.thread_local.statistics.styles_shared += 1;
@ -791,29 +791,13 @@ where
StyleResolverForElement::new(element, context, RuleInclusion::All)
.resolve_style_with_default_parents();
// If we previously tried to match this element against the
// cache, the revalidation match results will already be
// cached. Otherwise we'll have None, and compute them later
// on-demand.
//
// If we do have the results, grab them here to satisfy the
// borrow checker.
let validation_data =
context.thread_local
.current_element_info
.as_mut().unwrap()
.validation_data
.take();
let dom_depth =
context.thread_local.bloom_filter.matching_depth();
context.thread_local
.style_sharing_candidate_cache
.insert_if_possible(
&element,
new_styles.primary(),
validation_data,
dom_depth
target.take_validation_data(),
context.thread_local.bloom_filter.matching_depth(),
);
new_styles