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

@ -63,6 +63,7 @@ use crate::shared_lock::{Locked, SharedRwLock};
use crate::string_cache::{Atom, Namespace, WeakAtom, WeakNamespace};
use crate::stylist::CascadeData;
use crate::values::{AtomIdent, AtomString};
use crate::values::computed::Display;
use crate::CaseSensitivityExt;
use crate::LocalName;
use app_units::Au;
@ -1036,7 +1037,14 @@ impl<'le> TElement for GeckoElement<'le> {
}
#[inline]
fn query_container_size(&self) -> Size2D<Option<Au>> {
fn query_container_size(&self, display: &Display) -> Size2D<Option<Au>> {
// If an element gets 'display: contents' and its nsIFrame has not been removed yet,
// Gecko_GetQueryContainerSize will not notice that it can't have size containment.
// Other cases like 'display: inline' will be handled once the new nsIFrame is created.
if display.is_contents() {
return Size2D::new(None, None);
}
let mut width = -1;
let mut height = -1;
unsafe {