servo: Merge #17628 - Return no damage if there is no display property changes (from hiikezoe:restyle-damage); r=heycam

<!-- 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

Source-Repo: https://github.com/servo/servo
Source-Revision: ba2a6c17270f6d4b5bffef6c1a745f0817006289

--HG--
extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear
extra : subtree_revision : c903efaa497818403d321d86afeb32da6a791554
This commit is contained in:
Hiroyuki Ikezoe 2017-07-06 17:20:38 -07:00
Родитель 675b7da4ed
Коммит a0dcb2d5b7
1 изменённых файлов: 19 добавлений и 9 удалений

Просмотреть файл

@ -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.