}
}
private static InlineBoxMeasurements calculateInlineMeasurements(LayoutContext c, InlineLayoutBox iB,
VerticalAlignContext vaContext) {
FSFontMetrics fm = iB.getStyle().getFSFontMetrics(c);
CalculatedStyle style = iB.getStyle();
float lineHeight = style.getLineHeight(c);
int halfLeading = Math.round((lineHeight - iB.getStyle().getFont(c).size) / 2);
if (halfLeading > 0) {
halfLeading = Math.round((lineHeight -
(fm.getDescent() + fm.getAscent())) / 2);
}
iB.setBaseline(Math.round(fm.getAscent()));
alignInlineContent(c, iB, fm.getAscent(), fm.getDescent(), vaContext);
List decorations = calculateTextDecorations(iB, iB.getBaseline(), fm);
if (decorations != null) {
iB.setTextDecorations(decorations);
}
InlineBoxMeasurements result = new InlineBoxMeasurements();
result.setBaseline(iB.getY() + iB.getBaseline());
result.setInlineTop(iB.getY() - halfLeading);
result.setInlineBottom(Math.round(result.getInlineTop() + lineHeight));
result.setTextTop(iB.getY());
result.setTextBottom((int) (result.getBaseline() + fm.getDescent()));
RectPropertySet padding = iB.getPadding(c);
BorderPropertySet border = iB.getBorder(c);
result.setPaintingTop((int)Math.floor(iB.getY() - border.top() - padding.top()));
result.setPaintingBottom((int)Math.ceil(iB.getY() +
fm.getAscent() + fm.getDescent() +
border.bottom() + padding.bottom()));
return result;
}