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-01 17:04:27 +00:00
parent e9f34d6624
commit 65b6b0c69f
40 changed files with 203 additions and 120 deletions

View File

@@ -851,7 +851,8 @@ nscoord nsFieldSetFrame::SynthesizeFallbackBaseline(
}
Maybe<nscoord> nsFieldSetFrame::GetNaturalBaselineBOffset(
WritingMode aWM, BaselineSharingGroup aBaselineGroup) const {
WritingMode aWM, BaselineSharingGroup aBaselineGroup,
BaselineExportContext aExportContext) const {
if (StyleDisplay()->IsContainLayout()) {
// If we are layout-contained, our child 'inner' should not
// affect how we calculate our baseline.
@@ -862,7 +863,8 @@ Maybe<nscoord> nsFieldSetFrame::GetNaturalBaselineBOffset(
return Nothing{};
}
MOZ_ASSERT(!inner->GetWritingMode().IsOrthogonalTo(aWM));
const auto result = inner->GetNaturalBaselineBOffset(aWM, aBaselineGroup);
const auto result =
inner->GetNaturalBaselineBOffset(aWM, aBaselineGroup, aExportContext);
if (!result) {
return Nothing{};
}