Add some wrapper types to propagate styles out of style resolver.

We'll use these next to propagate information about style reuse to the ElementDataFlags.

MozReview-Commit-ID: Dya6vgzydpL
This commit is contained in:
Bobby Holley 2017-09-13 12:22:18 -07:00
parent 9092e6b4c2
commit 7a7070e075
5 changed files with 118 additions and 57 deletions

View file

@ -419,9 +419,9 @@ where
layout_parent_style.as_ref().map(|s| &**s)
);
let is_display_contents = primary_style.style.is_display_contents();
let is_display_contents = primary_style.style().is_display_contents();
style = Some(primary_style.style);
style = Some(primary_style.0.into());
if !is_display_contents {
layout_parent_style = style.clone();
}
@ -434,7 +434,7 @@ where
.resolve_style(
style.as_ref().map(|s| &**s),
layout_parent_style.as_ref().map(|s| &**s)
)
).into()
}
/// Calculates the style for a single node.
@ -657,8 +657,7 @@ where
match target.share_style_if_possible(context) {
Some(shareable_element) => {
context.thread_local.statistics.styles_shared += 1;
let shareable_data = shareable_element.borrow_data().unwrap();
shareable_data.styles.clone()
shareable_element.borrow_data().unwrap().share_styles()
}
None => {
context.thread_local.statistics.elements_matched += 1;
@ -679,7 +678,7 @@ where
.sharing_cache
.insert_if_possible(
&element,
new_styles.primary(),
new_styles.primary.style(),
&mut target,
context.thread_local.bloom_filter.matching_depth(),
);