aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--components/style/sharing/mod.rs10
-rw-r--r--components/style/traversal.rs28
2 files changed, 20 insertions, 18 deletions
diff --git a/components/style/sharing/mod.rs b/components/style/sharing/mod.rs
index d795966fc5d..a9ea5f615b8 100644
--- a/components/style/sharing/mod.rs
+++ b/components/style/sharing/mod.rs
@@ -82,6 +82,7 @@ use smallvec::SmallVec;
use std::marker::PhantomData;
use std::mem;
use std::ops::Deref;
+use style_resolver::PrimaryStyle;
use stylist::Stylist;
mod checks;
@@ -549,10 +550,15 @@ impl<E: TElement> StyleSharingCache<E> {
pub fn insert_if_possible(
&mut self,
element: &E,
- style: &ComputedValues,
+ style: &PrimaryStyle,
validation_data_holder: Option<&mut StyleSharingTarget<E>>,
dom_depth: usize,
) {
+ if style.0.reused_via_rule_node {
+ debug!("Failing to insert into the cached: this was a cached style");
+ return;
+ }
+
let parent = match element.traversal_parent() {
Some(element) => element,
None => {
@@ -585,7 +591,7 @@ impl<E: TElement> StyleSharingCache<E> {
//
// These are things we don't check in the candidate match because they
// are either uncommon or expensive.
- let box_style = style.get_box();
+ let box_style = style.style().get_box();
if box_style.specifies_transitions() {
debug!("Failing to insert to the cache: transitions");
return;
diff --git a/components/style/traversal.rs b/components/style/traversal.rs
index a5ddb33749e..20386d754b4 100644
--- a/components/style/traversal.rs
+++ b/components/style/traversal.rs
@@ -678,14 +678,12 @@ where
resolver.resolve_style_with_default_parents()
};
- if !new_styles.primary.0.reused_via_rule_node {
- context.thread_local.sharing_cache.insert_if_possible(
- &element,
- new_styles.primary.style(),
- Some(&mut target),
- traversal_data.current_dom_depth,
- );
- }
+ context.thread_local.sharing_cache.insert_if_possible(
+ &element,
+ &new_styles.primary,
+ Some(&mut target),
+ traversal_data.current_dom_depth,
+ );
new_styles
}
@@ -725,14 +723,12 @@ where
resolver.cascade_styles_with_default_parents(cascade_inputs)
};
- if !new_styles.primary.0.reused_via_rule_node {
- context.thread_local.sharing_cache.insert_if_possible(
- &element,
- new_styles.primary.style(),
- None,
- traversal_data.current_dom_depth,
- );
- }
+ context.thread_local.sharing_cache.insert_if_possible(
+ &element,
+ &new_styles.primary,
+ None,
+ traversal_data.current_dom_depth,
+ );
new_styles
}