|
Lines 179-186
InlineLevelBox::AscentAndDescent LineBoxBuilder::enclosingAscentDescentWithFallb
a/Source/WebCore/layout/formattingContexts/inline/InlineLineBoxBuilder.cpp_sec1
|
| 179 |
maxAscent = std::max(maxAscent, ascentAndDescent.ascent); |
179 |
maxAscent = std::max(maxAscent, ascentAndDescent.ascent); |
| 180 |
maxDescent = std::max(maxDescent, ascentAndDescent.descent); |
180 |
maxDescent = std::max(maxDescent, ascentAndDescent.descent); |
| 181 |
} |
181 |
} |
| 182 |
// We need floor/ceil to match legacy layout integral positioning. |
182 |
return { maxAscent, maxDescent }; |
| 183 |
return { floorf(maxAscent), ceilf(maxDescent) }; |
|
|
| 184 |
} |
183 |
} |
| 185 |
|
184 |
|
| 186 |
void LineBoxBuilder::setLayoutBoundsForInlineBox(InlineLevelBox& inlineBox, FontBaseline fontBaseline) const |
185 |
void LineBoxBuilder::setLayoutBoundsForInlineBox(InlineLevelBox& inlineBox, FontBaseline fontBaseline) const |
|
Lines 223-236
void LineBoxBuilder::setLayoutBoundsForInlineBox(InlineLevelBox& inlineBox, Font
a/Source/WebCore/layout/formattingContexts/inline/InlineLineBoxBuilder.cpp_sec2
|
| 223 |
ascent += inlineBoxGeometry.marginBorderAndPaddingBefore(); |
222 |
ascent += inlineBoxGeometry.marginBorderAndPaddingBefore(); |
| 224 |
descent += inlineBoxGeometry.marginBorderAndPaddingAfter(); |
223 |
descent += inlineBoxGeometry.marginBorderAndPaddingAfter(); |
| 225 |
} |
224 |
} |
| 226 |
inlineBox.setLayoutBounds({ floorf(ascent), ceilf(descent) }); |
225 |
inlineBox.setLayoutBounds({ ascent, descent }); |
| 227 |
} |
226 |
} |
| 228 |
|
227 |
|
| 229 |
void LineBoxBuilder::setVerticalPropertiesForInlineLevelBox(const LineBox& lineBox, InlineLevelBox& inlineLevelBox) const |
228 |
void LineBoxBuilder::setVerticalPropertiesForInlineLevelBox(const LineBox& lineBox, InlineLevelBox& inlineLevelBox) const |
| 230 |
{ |
229 |
{ |
| 231 |
auto setVerticalProperties = [&] (InlineLevelBox::AscentAndDescent ascentAndDescent, bool applyLegacyRounding = true) { |
230 |
auto setVerticalProperties = [&] (InlineLevelBox::AscentAndDescent ascentAndDescent) { |
| 232 |
if (applyLegacyRounding) |
|
|
| 233 |
ascentAndDescent.round(); |
| 234 |
inlineLevelBox.setAscentAndDescent(ascentAndDescent); |
231 |
inlineLevelBox.setAscentAndDescent(ascentAndDescent); |
| 235 |
inlineLevelBox.setLayoutBounds(ascentAndDescent); |
232 |
inlineLevelBox.setLayoutBounds(ascentAndDescent); |
| 236 |
inlineLevelBox.setLogicalHeight(ascentAndDescent.height()); |
233 |
inlineLevelBox.setLogicalHeight(ascentAndDescent.height()); |
|
Lines 314-320
void LineBoxBuilder::setVerticalPropertiesForInlineLevelBox(const LineBox& lineB
a/Source/WebCore/layout/formattingContexts/inline/InlineLineBoxBuilder.cpp_sec3
|
| 314 |
} |
311 |
} |
| 315 |
return marginBoxHeight; |
312 |
return marginBoxHeight; |
| 316 |
}(); |
313 |
}(); |
| 317 |
setVerticalProperties({ ascent, marginBoxHeight - ascent }, false); |
314 |
setVerticalProperties({ ascent, marginBoxHeight - ascent }); |
| 318 |
return; |
315 |
return; |
| 319 |
} |
316 |
} |
| 320 |
ASSERT_NOT_REACHED(); |
317 |
ASSERT_NOT_REACHED(); |
|
Lines 538-544
void LineBoxBuilder::adjustInlineBoxHeightsForLineBoxContainIfApplicable(LineBox
a/Source/WebCore/layout/formattingContexts/inline/InlineLineBoxBuilder.cpp_sec4
|
| 538 |
auto mayShrinkLineBox = inlineBox->isRootInlineBox() ? !lineBoxContain.contains(LineBoxContain::Block) : true; |
535 |
auto mayShrinkLineBox = inlineBox->isRootInlineBox() ? !lineBoxContain.contains(LineBoxContain::Block) : true; |
| 539 |
auto ascent = mayShrinkLineBox ? enclosingAscentDescentForInlineBox.ascent : std::max(enclosingAscentDescentForInlineBox.ascent, inlineBoxLayoutBounds.ascent); |
536 |
auto ascent = mayShrinkLineBox ? enclosingAscentDescentForInlineBox.ascent : std::max(enclosingAscentDescentForInlineBox.ascent, inlineBoxLayoutBounds.ascent); |
| 540 |
auto descent = mayShrinkLineBox ? enclosingAscentDescentForInlineBox.descent : std::max(enclosingAscentDescentForInlineBox.descent, inlineBoxLayoutBounds.descent); |
537 |
auto descent = mayShrinkLineBox ? enclosingAscentDescentForInlineBox.descent : std::max(enclosingAscentDescentForInlineBox.descent, inlineBoxLayoutBounds.descent); |
| 541 |
inlineBox->setLayoutBounds({ ceilf(ascent), ceilf(descent) }); |
538 |
inlineBox->setLayoutBounds({ ascent, descent }); |
| 542 |
} |
539 |
} |
| 543 |
} |
540 |
} |
| 544 |
|
541 |
|
|
Lines 583-589
void LineBoxBuilder::adjustIdeographicBaselineIfApplicable(LineBox& lineBox)
a/Source/WebCore/layout/formattingContexts/inline/InlineLineBoxBuilder.cpp_sec5
|
| 583 |
setVerticalPropertiesForInlineLevelBox(lineBox, inlineLevelBox); |
580 |
setVerticalPropertiesForInlineLevelBox(lineBox, inlineLevelBox); |
| 584 |
else if (inlineLevelBox.isAtomicInlineLevelBox()) { |
581 |
else if (inlineLevelBox.isAtomicInlineLevelBox()) { |
| 585 |
auto inlineLevelBoxHeight = inlineLevelBox.logicalHeight(); |
582 |
auto inlineLevelBoxHeight = inlineLevelBox.logicalHeight(); |
| 586 |
InlineLayoutUnit ideographicBaseline = roundToInt(inlineLevelBoxHeight / 2); |
583 |
InlineLayoutUnit ideographicBaseline = inlineLevelBoxHeight / 2; |
| 587 |
// Move the baseline position but keep the same logical height. |
584 |
// Move the baseline position but keep the same logical height. |
| 588 |
inlineLevelBox.setAscentAndDescent({ ideographicBaseline, inlineLevelBoxHeight - ideographicBaseline }); |
585 |
inlineLevelBox.setAscentAndDescent({ ideographicBaseline, inlineLevelBoxHeight - ideographicBaseline }); |
| 589 |
inlineLevelBox.setLayoutBounds({ ideographicBaseline, inlineLevelBoxHeight - ideographicBaseline }); |
586 |
inlineLevelBox.setLayoutBounds({ ideographicBaseline, inlineLevelBoxHeight - ideographicBaseline }); |