mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
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:
parent
f11e232a53
commit
748dd1eae2
3 changed files with 8 additions and 5 deletions
|
@ -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
|
||||
|
|
|
@ -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))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue