Bug 1843086: Line participants use block start ascent, instead of not-yet stored baseline. r=emilio

Differential Revision: https://phabricator.services.mozilla.com/D183432
This commit is contained in:
David Shin 2023-07-13 13:40:25 +00:00
Родитель 0b1afe7e6d
Коммит e86d57ef18
3 изменённых файлов: 36 добавлений и 4 удалений

Просмотреть файл

@ -1349,16 +1349,19 @@ void nsLineLayout::PlaceFrame(PerFrameData* pfd, ReflowOutput& aMetrics) {
? lineWM.IsLineInverted() ? 0 : aMetrics.BSize(lineWM)
: aMetrics.BSize(lineWM) / 2;
} else {
if (pfd->mFrame->StyleDisplay()->mBaselineSource ==
StyleBaselineSource::Auto) {
// For inline reflow participants, baseline may get assigned as the frame is
// vertically aligned, which happens after this.
const auto baselineSource = pfd->mFrame->StyleDisplay()->mBaselineSource;
if (baselineSource == StyleBaselineSource::Auto ||
pfd->mFrame->IsFrameOfType(nsIFrame::eLineParticipant)) {
if (aMetrics.BlockStartAscent() == ReflowOutput::ASK_FOR_BASELINE) {
pfd->mAscent = pfd->mFrame->GetLogicalBaseline(lineWM);
} else {
pfd->mAscent = aMetrics.BlockStartAscent();
}
} else {
const auto sourceGroup = [pfd]() {
switch (pfd->mFrame->StyleDisplay()->mBaselineSource) {
const auto sourceGroup = [baselineSource]() {
switch (baselineSource) {
case StyleBaselineSource::First:
return BaselineSharingGroup::First;
case StyleBaselineSource::Last:

Просмотреть файл

@ -0,0 +1,11 @@
<!DOCTYPE html>
<link rel="stylesheet" href="/fonts/ahem.css">
<style>
div {
border: 1px solid;
}
</style>
<div>
<span>a</span>
</div>

Просмотреть файл

@ -0,0 +1,18 @@
<!DOCTYPE html>
<link rel="author" title="David Shin" href="mailto:dshin@mozilla.com">
<meta name="assert" content="Ensure that specifying baseline-source on inline boxes have no effect.">
<link rel="help" href="https://drafts.csswg.org/css-inline-3/#baseline-source">
<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1792501">
<link rel="stylesheet" href="/fonts/ahem.css">
<link rel="match" href="baseline-source-inline-box-ref.html">
<style>
div {
border: 1px solid;
}
span {
baseline-source: first;
}
</style>
<div>
<span>a</span>
</div>