mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
style: Don't optimize out recascading of children when becoming or stopping being display: contents.
Since they can change whether descendants get blockified. Differential Revision: https://phabricator.services.mozilla.com/D35818
This commit is contained in:
parent
1af30fa0c9
commit
4abfa1a2d8
1 changed files with 25 additions and 22 deletions
|
@ -503,32 +503,35 @@ trait PrivateMatchMethods: TElement {
|
||||||
let old_display = old_values.get_box().clone_display();
|
let old_display = old_values.get_box().clone_display();
|
||||||
let new_display = new_values.get_box().clone_display();
|
let new_display = new_values.get_box().clone_display();
|
||||||
|
|
||||||
// If we used to be a display: none element, and no longer are,
|
if old_display != new_display {
|
||||||
// our children need to be restyled because they're unstyled.
|
// If we used to be a display: none element, and no longer are, our
|
||||||
//
|
// children need to be restyled because they're unstyled.
|
||||||
// NOTE(emilio): Gecko has the special-case of -moz-binding, but
|
if old_display == Display::None {
|
||||||
// that gets handled on the frame constructor when processing
|
|
||||||
// the reframe, so no need to handle that here.
|
|
||||||
if old_display == Display::None && old_display != new_display {
|
|
||||||
return ChildCascadeRequirement::MustCascadeChildren;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Blockification of children may depend on our display value,
|
|
||||||
// so we need to actually do the recascade. We could potentially
|
|
||||||
// do better, but it doesn't seem worth it.
|
|
||||||
if old_display.is_item_container() != new_display.is_item_container() {
|
|
||||||
return ChildCascadeRequirement::MustCascadeChildren;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Line break suppression may also be affected if the display
|
|
||||||
// type changes from ruby to non-ruby.
|
|
||||||
#[cfg(feature = "gecko")]
|
|
||||||
{
|
|
||||||
if old_display.is_ruby_type() != new_display.is_ruby_type() {
|
|
||||||
return ChildCascadeRequirement::MustCascadeChildren;
|
return ChildCascadeRequirement::MustCascadeChildren;
|
||||||
}
|
}
|
||||||
|
// Blockification of children may depend on our display value,
|
||||||
|
// so we need to actually do the recascade. We could potentially
|
||||||
|
// do better, but it doesn't seem worth it.
|
||||||
|
if old_display.is_item_container() != new_display.is_item_container() {
|
||||||
|
return ChildCascadeRequirement::MustCascadeChildren;
|
||||||
|
}
|
||||||
|
// We may also need to blockify and un-blockify descendants if our
|
||||||
|
// display goes from / to display: contents, since the "layout
|
||||||
|
// parent style" changes.
|
||||||
|
if old_display.is_contents() || new_display.is_contents() {
|
||||||
|
return ChildCascadeRequirement::MustCascadeChildren;
|
||||||
|
}
|
||||||
|
// Line break suppression may also be affected if the display
|
||||||
|
// type changes from ruby to non-ruby.
|
||||||
|
#[cfg(feature = "gecko")]
|
||||||
|
{
|
||||||
|
if old_display.is_ruby_type() != new_display.is_ruby_type() {
|
||||||
|
return ChildCascadeRequirement::MustCascadeChildren;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Children with justify-items: auto may depend on our
|
// Children with justify-items: auto may depend on our
|
||||||
// justify-items property value.
|
// justify-items property value.
|
||||||
//
|
//
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue