Skip to content

[css-inline] A question for the procedure to compute the resolved value of "line-height" #3749

@joonghunpark

Description

@joonghunpark

I have a question about the procedure to compute the used value of "line-height".
I'm currently making a change on blink in
https://chromium-review.googlesource.com/c/chromium/src/+/1522053/3.
This change is for "line-height" to return used value instead of "normal keyword"
as resolved value.

In case of WebKit, fontMetrics().lineSpacing() value is used instead of 'normal' as below.

int RenderStyle::computedLineHeight() const
{
    const Length& lh = lineHeight();
    // Negative value means the line height is not set. Use the font's built-in spacing.
    if (lh.isNegative())
        return fontMetrics().lineSpacing();
    if (lh.isPercentOrCalculated())
        return minimumValueForLength(lh, computedFontPixelSize());
    return clampTo<int>(lh.value());
}

And Firefox returns used value "px" instead of "normal" also.

But I'm not sure what is the exact procedure to compute the used value for "line-height",
because I coundn't find that in spec.

Is it ok to use font metircs linespacing value like WebKit, or is there a exact procedure to compute the used value?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions