mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
style: Massage the resolver code so it's cleaner and prevents the problem.
This way all the borrows stay in the sharing code, and prevents an extra borrow on a cache hit, which is not a big deal but nice.
This commit is contained in:
parent
36fed07b1c
commit
891bc7d174
6 changed files with 119 additions and 119 deletions
|
@ -421,7 +421,7 @@ where
|
|||
|
||||
let is_display_contents = primary_style.style().is_display_contents();
|
||||
|
||||
style = Some(primary_style.0.into());
|
||||
style = Some(primary_style.style.0);
|
||||
if !is_display_contents {
|
||||
layout_parent_style = style.clone();
|
||||
}
|
||||
|
@ -659,9 +659,9 @@ where
|
|||
// Now that our bloom filter is set up, try the style sharing
|
||||
// cache.
|
||||
match target.share_style_if_possible(context) {
|
||||
Some(shareable_element) => {
|
||||
Some(shared_styles) => {
|
||||
context.thread_local.statistics.styles_shared += 1;
|
||||
shareable_element.borrow_data().unwrap().share_styles()
|
||||
shared_styles
|
||||
}
|
||||
None => {
|
||||
context.thread_local.statistics.elements_matched += 1;
|
||||
|
@ -738,7 +738,7 @@ where
|
|||
// number of eventual styles, but would potentially miss out on various
|
||||
// opportunities for skipping selector matching, which could hurt
|
||||
// performance.
|
||||
if !new_styles.primary.0.reused_via_rule_node {
|
||||
if !new_styles.primary.reused_via_rule_node {
|
||||
context.thread_local.sharing_cache.insert_if_possible(
|
||||
&element,
|
||||
&new_styles.primary,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue