mirror of
https://github.com/servo/servo.git
synced 2025-08-05 05:30:08 +01:00
Return no damage if there is no display property changes
This commit is contained in:
parent
585468da9a
commit
342b7f7698
1 changed files with 19 additions and 9 deletions
|
@ -1560,10 +1560,11 @@ pub trait MatchMethods : TElement {
|
||||||
return RestyleDamage::compute_style_difference(source, new_values)
|
return RestyleDamage::compute_style_difference(source, new_values)
|
||||||
}
|
}
|
||||||
|
|
||||||
let new_style_is_display_none =
|
let new_display = new_values.get_box().clone_display();
|
||||||
new_values.get_box().clone_display() == display::T::none;
|
let old_display = old_values.get_box().clone_display();
|
||||||
let old_style_is_display_none =
|
|
||||||
old_values.get_box().clone_display() == display::T::none;
|
let new_style_is_display_none = new_display == display::T::none;
|
||||||
|
let old_style_is_display_none = old_display == display::T::none;
|
||||||
|
|
||||||
// If there's no style source, that likely means that Gecko couldn't
|
// If there's no style source, that likely means that Gecko couldn't
|
||||||
// find a style context.
|
// find a style context.
|
||||||
|
@ -1610,11 +1611,20 @@ pub trait MatchMethods : TElement {
|
||||||
StyleChange::Unchanged)
|
StyleChange::Unchanged)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Something else. Be conservative for now.
|
// If we are changing display property we need to accumulate
|
||||||
warn!("Reframing due to lack of old style source: {:?}, pseudo: {:?}",
|
// reconstruction damage for the change.
|
||||||
self, pseudo);
|
// FIXME: Bug 1378972: This is a workaround for bug 1374175, we should
|
||||||
// Something else. Be conservative for now.
|
// generate more accurate restyle damage in fallback cases.
|
||||||
StyleDifference::new(RestyleDamage::reconstruct(), StyleChange::Changed)
|
let needs_reconstruction = new_display != old_display;
|
||||||
|
let damage = if needs_reconstruction {
|
||||||
|
RestyleDamage::reconstruct()
|
||||||
|
} else {
|
||||||
|
RestyleDamage::empty()
|
||||||
|
};
|
||||||
|
// We don't really know if there was a change in any style (since we
|
||||||
|
// didn't actually call compute_style_difference) but we return
|
||||||
|
// StyleChange::Changed conservatively.
|
||||||
|
StyleDifference::new(damage, StyleChange::Changed)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Performs the cascade for the element's eager pseudos.
|
/// Performs the cascade for the element's eager pseudos.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue