style: Make container queries check content-box size

They were checking the border-box size (with paddings and borders), but
https://drafts.csswg.org/css-contain-3/#size-container says it should
be the content-box size.

Differential Revision: https://phabricator.services.mozilla.com/D163784
This commit is contained in:
Oriol Brufau 2022-12-05 15:16:48 +00:00 committed by Martin Robinson
parent f11e232a53
commit 748dd1eae2
3 changed files with 8 additions and 5 deletions

View file

@ -944,7 +944,7 @@ pub trait TElement:
-> &<SelectorImpl as selectors::parser::SelectorImpl>::BorrowedNamespaceUrl;
/// Returns the size of the primary box of the element.
fn primary_box_size(&self) -> euclid::default::Size2D<app_units::Au>;
fn primary_content_box_size(&self) -> euclid::default::Size2D<app_units::Au>;
}
/// TNode and TElement aren't Send because we want to be careful and explicit

View file

@ -1041,7 +1041,7 @@ impl<'le> TElement for GeckoElement<'le> {
}
#[inline]
fn primary_box_size(&self) -> Size2D<Au> {
fn primary_content_box_size(&self) -> Size2D<Au> {
if !self.as_node().is_connected() {
return Size2D::zero();
}
@ -1058,7 +1058,10 @@ impl<'le> TElement for GeckoElement<'le> {
if frame.is_null() {
return Size2D::zero();
}
Size2D::new(Au((**frame).mRect.width), Au((**frame).mRect.height))
let mut width = 0;
let mut height = 0;
bindings::Gecko_ContentSize(*frame, &mut width, &mut height);
Size2D::new(Au(width), Au(height))
}
}

View file

@ -201,7 +201,7 @@ impl ContainerCondition {
}
}
let size = potential_container.primary_box_size();
let size = potential_container.primary_content_box_size();
let style = style.clone();
TraversalResult::Done(ContainerLookupResult {
element: potential_container,
@ -464,7 +464,7 @@ impl<'a> ContainerSizeQuery<'a> {
let box_style = style.get_box();
let container_type = box_style.clone_container_type();
let size = e.primary_box_size();
let size = e.primary_content_box_size();
match container_type {
ContainerType::Size=> {
TraversalResult::Done(