mirror of
https://github.com/servo/servo.git
synced 2025-08-07 06:25:32 +01:00
Auto merge of #17628 - hiikezoe:restyle-damage, r=heycam
Return no damage if there is no display property changes <!-- Please describe your changes on the following line: --> https://bugzilla.mozilla.org/show_bug.cgi?id=1374175 --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/17628) <!-- Reviewable:end -->
This commit is contained in:
commit
ba2a6c1727
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)
|
||||
}
|
||||
|
||||
let new_style_is_display_none =
|
||||
new_values.get_box().clone_display() == display::T::none;
|
||||
let old_style_is_display_none =
|
||||
old_values.get_box().clone_display() == display::T::none;
|
||||
let new_display = new_values.get_box().clone_display();
|
||||
let old_display = old_values.get_box().clone_display();
|
||||
|
||||
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
|
||||
// find a style context.
|
||||
|
@ -1610,11 +1611,20 @@ pub trait MatchMethods : TElement {
|
|||
StyleChange::Unchanged)
|
||||
}
|
||||
|
||||
// Something else. Be conservative for now.
|
||||
warn!("Reframing due to lack of old style source: {:?}, pseudo: {:?}",
|
||||
self, pseudo);
|
||||
// Something else. Be conservative for now.
|
||||
StyleDifference::new(RestyleDamage::reconstruct(), StyleChange::Changed)
|
||||
// If we are changing display property we need to accumulate
|
||||
// reconstruction damage for the change.
|
||||
// FIXME: Bug 1378972: This is a workaround for bug 1374175, we should
|
||||
// generate more accurate restyle damage in fallback cases.
|
||||
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.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue