style: Re-evaluate container queries when container gets display:contents

Differential Revision: https://phabricator.services.mozilla.com/D164234
This commit is contained in:
Oriol Brufau 2022-12-14 01:55:11 +00:00 committed by Martin Robinson
parent cd50d30c31
commit c4b8e451ed
4 changed files with 20 additions and 4 deletions

View file

@ -981,6 +981,13 @@ pub trait MatchMethods: TElement {
// Stopped being a size container. Re-evaluate container queries and units on all our descendants.
// Changes into and between different size containment is handled in `UpdateContainerQueryStyles`.
restyle_requirement = ChildRestyleRequirement::MustMatchDescendants;
} else if old_container_type.is_size_container_type() &&
!old_primary_style.is_display_contents() &&
new_primary_style.is_display_contents()
{
// Also re-evaluate when a container gets 'display: contents', since size queries will now evaluate to unknown.
// Other displays like 'inline' will keep generating a box, so they are handled in `UpdateContainerQueryStyles`.
restyle_requirement = ChildRestyleRequirement::MustMatchDescendants;
}
restyle_requirement = cmp::max(