aboutsummaryrefslogtreecommitdiffstats
path: root/components
diff options
context:
space:
mode:
authorEmilio Cobos Álvarez <emilio@crisal.io>2017-09-14 11:56:45 +0200
committerEmilio Cobos Álvarez <emilio@crisal.io>2017-09-14 11:56:45 +0200
commit158aa0ffdf52255439088526da9963a8dc5c2fe0 (patch)
treeaabc4fa7418c7c4789f03999b379435745613298 /components
parent2908c6a266aa61535c12f1b332cb5e0985dad88f (diff)
downloadservo-158aa0ffdf52255439088526da9963a8dc5c2fe0.tar.gz
servo-158aa0ffdf52255439088526da9963a8dc5c2fe0.zip
style: Move the check into insert_if_possible.
Diffstat (limited to 'components')
-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
}