layout: Add initial support for row height distribution (#31421)

This change adds a version of row height distribution that follows the
distribtuion algorithm used for tables in Blink's LayoutNG. This is just
an intermediate step toward implementing a distribution algorithm for
both rows and columns more similar to Layout NG.

The CSS Table 3 specification is often wrong with regard to web
compatability, which is why we have abandoned it in favor of the Layout
NG algorithm for row height distribution.  this work.

Co-authored-by: Oriol Brufau <obrufau@igalia.com>
This commit is contained in:
Martin Robinson 2024-02-29 13:12:54 +01:00 committed by GitHub
parent 31cfaf290d
commit 127aa657c2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
49 changed files with 591 additions and 302 deletions

View file

@ -24,13 +24,6 @@ pub(crate) struct ContentSizes {
/// <https://drafts.csswg.org/css-sizing/#intrinsic-sizes>
impl ContentSizes {
pub fn zero() -> Self {
Self {
min_content: Au::zero(),
max_content: Au::zero(),
}
}
pub fn map(&self, f: impl Fn(Au) -> Au) -> Self {
Self {
min_content: f(self.min_content),
@ -57,6 +50,19 @@ impl ContentSizes {
}
}
impl Zero for ContentSizes {
fn zero() -> Self {
Self {
min_content: Au::zero(),
max_content: Au::zero(),
}
}
fn is_zero(&self) -> bool {
self.min_content.is_zero() && self.max_content.is_zero()
}
}
impl Add for ContentSizes {
type Output = Self;