diff --git a/components/style/matching.rs b/components/style/matching.rs index 2eed53e29b2..f62c8cbbdfb 100644 --- a/components/style/matching.rs +++ b/components/style/matching.rs @@ -970,6 +970,15 @@ pub trait MatchMethods: TElement { None => return ChildRestyleRequirement::MustCascadeChildren, }; + let old_container_type = old_primary_style.clone_container_type(); + let new_container_type = new_primary_style.clone_container_type(); + if old_container_type != new_container_type && !new_container_type.is_size_container_type() + { + // 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; + } + restyle_requirement = cmp::max( restyle_requirement, self.accumulate_damage_for(