layout: Collect both start and end baselines for fragments (#31230)

This change starts collecting the starting baseline set for fragments,
which is necessary for some layout modes (flex and tables, namely) as
well as being important for the implementation of `align-items`. In
addition, it converts baseline measurement to use `Au` everywhere.

Co-authored-by: Oriol Brufau <obrufau@igalia.com>
This commit is contained in:
Martin Robinson 2024-02-05 19:06:05 +01:00 committed by GitHub
parent 28bde741ed
commit 7f13316f24
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 112 additions and 101 deletions

View file

@ -12,7 +12,7 @@ use style::values::generics::length::GenericLengthPercentageOrAuto::{Auto, Lengt
use super::{Table, TableSlot, TableSlotCell};
use crate::context::LayoutContext;
use crate::formatting_contexts::IndependentLayout;
use crate::formatting_contexts::{Baselines, IndependentLayout};
use crate::fragment_tree::{BoxFragment, CollapsedBlockMargins, Fragment};
use crate::geom::{LogicalRect, LogicalSides, LogicalVec2};
use crate::positioned::{PositioningContext, PositioningContextLength};
@ -1105,7 +1105,7 @@ impl Table {
IndependentLayout {
fragments,
content_block_size,
last_inflow_baseline_offset: None,
baselines: Baselines::default(),
}
}
}
@ -1167,11 +1167,8 @@ impl TableSlotCell {
layout.border,
LogicalSides::zero(), /* margin */
None, /* clearance */
layout
.layout
.last_inflow_baseline_offset
.map(|baseline| baseline.into()),
CollapsedBlockMargins::zero(),
)
.with_baselines(layout.layout.baselines)
}
}