Bug 1809568 - Part 2: Provide GetNaturalBaselineBOffset with baseline export context. r=emilio

Some baseline exports are context-sensitive. One example: In line-layout scenario,
the last baseline of a scroll container is always the margin-end. In other (e.g.
flex, grid) scenarios, it's the border-box clamped offset to the last line in the
container.
This enables the required 3 different behaviours for `inline-block` scroll containers
for 3 different `baseline-source` values:
- `auto`: Last baseline, margin-end
- `first`: Border-box clamped offset to the first line
- `last`: Border-box clamped offset to the last line

Differential Revision: https://phabricator.services.mozilla.com/D173886
This commit is contained in:
David Shin
2023-05-15 14:34:26 +00:00
parent d82335fc8b
commit 6f868ef403
40 changed files with 204 additions and 120 deletions

View File

@@ -1298,10 +1298,12 @@ void nsColumnSetFrame::AppendDirectlyOwnedAnonBoxes(
}
Maybe<nscoord> nsColumnSetFrame::GetNaturalBaselineBOffset(
WritingMode aWM, BaselineSharingGroup aBaselineGroup) const {
WritingMode aWM, BaselineSharingGroup aBaselineGroup,
BaselineExportContext aExportContext) const {
Maybe<nscoord> result;
for (const auto* kid : mFrames) {
auto kidBaseline = kid->GetNaturalBaselineBOffset(aWM, aBaselineGroup);
auto kidBaseline =
kid->GetNaturalBaselineBOffset(aWM, aBaselineGroup, aExportContext);
if (!kidBaseline) {
continue;
}