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:
Emilio Cobos Álvarez 2019-07-01 21:39:47 +00:00
parent 1af30fa0c9
commit 4abfa1a2d8
No known key found for this signature in database
GPG key ID: E1152D0994E4BF8A

View file

@ -503,23 +503,24 @@ trait PrivateMatchMethods: TElement {
let old_display = old_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,
// our children need to be restyled because they're unstyled.
//
// NOTE(emilio): Gecko has the special-case of -moz-binding, but
// 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 {
if old_display != new_display {
// If we used to be a display: none element, and no longer are, our
// children need to be restyled because they're unstyled.
if old_display == Display::None {
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")]
@ -528,6 +529,8 @@ trait PrivateMatchMethods: TElement {
return ChildCascadeRequirement::MustCascadeChildren;
}
}
}
// Children with justify-items: auto may depend on our
// justify-items property value.