⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 272118 in webkit


Ignore:
Timestamp:
Jan 30, 2021, 11:34:48 AM (6 years ago)
Author:
Alan Bujtas
Message:

[LFC][IFC] Line gap metric should apply to all inline boxes
​https://bugs.webkit.org/show_bug.cgi?id=221179

Reviewed by Antti Koivisto.

According to the CSS spec (​https://www.w3.org/TR/css-inline-3/#inline-height)
when the line-height computes to normal (RenderStyle::lineHeight().isNegative()) and
either text-edge is leading (property is not supported yet, initial value is leading) or
this is the root inline box, the font’s line gap should be taken into account when computing
layout bounds.

  • layout/inlineformatting/InlineFormattingContextGeometry.cpp:

(WebCore::Layout::LineBoxBuilder::setVerticalGeometryForInlineBox const):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r272117 r272118  
     12021-01-30  Zalan Bujtas  <zalan@apple.com>
     2
     3        [LFC][IFC] Line gap metric should apply to all inline boxes
     4        https://bugs.webkit.org/show_bug.cgi?id=221179
     5
     6        Reviewed by Antti Koivisto.
     7
     8        According to the CSS spec (https://www.w3.org/TR/css-inline-3/#inline-height)
     9        when the line-height computes to normal (RenderStyle::lineHeight().isNegative()) and
     10        either text-edge is leading (property is not supported yet, initial value is leading) or
     11        this is the root inline box, the font’s line gap should be taken into account when computing
     12        layout bounds.
     13
     14        * layout/inlineformatting/InlineFormattingContextGeometry.cpp:
     15        (WebCore::Layout::LineBoxBuilder::setVerticalGeometryForInlineBox const):
     16
    1172021-01-30  Wenson Hsieh  <wenson_hsieh@apple.com>
    218
  • trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContextGeometry.cpp

    r272115 r272118  
    186186        // If line-height computes to normal and either text-edge is leading or this is the root inline box,
    187187        // the font’s line gap metric may also be incorporated into A and D by adding half to each side as half-leading.
    188         auto shouldLineGapStretchInlineLevelBox = inlineLevelBox.isRootInlineBox() || inlineLevelBox.isLineBreakBox();
    189         if (shouldLineGapStretchInlineLevelBox) {
    190             auto halfLineGap = (fontMetrics.lineSpacing() - logicalHeight) / 2;
    191             ascent += halfLineGap;
    192             descent += halfLineGap;
    193         }
     188        // https://www.w3.org/TR/css-inline-3/#inline-height
     189        // Since text-edge is not supported yet and the initial value is leading, we should just apply it to
     190        // all inline boxes.
     191        auto halfLineGap = (fontMetrics.lineSpacing() - logicalHeight) / 2;
     192        ascent += halfLineGap;
     193        descent += halfLineGap;
    194194    } else {
    195195        InlineLayoutUnit lineHeight = style.computedLineHeight();
Note: See TracChangeset for help on using the changeset viewer.