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

Changeset 285999 in webkit


Ignore:
Timestamp:
Nov 18, 2021, 6:20:45 AM (5 years ago)
Author:
Alan Bujtas
Message:

[LFC][IFC] Glyphs that conditionally hang are taken into account for max-content only
https://bugs.webkit.org/show_bug.cgi?id=233287

Reviewed by Antti Koivisto.

Remove hanging glyphs for min-content only. It simply means that content followed by (pre-wrap) whitespace may make shrink wrapped lines wider.

  • layout/formattingContexts/inline/InlineLineBuilder.cpp:

(WebCore::Layout::LineBuilder::close):

  • rendering/RenderBlockFlow.cpp:
Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r285998 r285999  
     12021-11-18  Alan Bujtas  <zalan@apple.com>
     2
     3        [LFC][IFC] Glyphs that conditionally hang are taken into account for max-content only
     4        https://bugs.webkit.org/show_bug.cgi?id=233287
     5
     6        Reviewed by Antti Koivisto.
     7
     8        Remove hanging glyphs for min-content only. It simply means that content followed by (pre-wrap) whitespace may make shrink wrapped lines wider.
     9
     10        * layout/formattingContexts/inline/InlineLineBuilder.cpp:
     11        (WebCore::Layout::LineBuilder::close):
     12        * rendering/RenderBlockFlow.cpp:
     13
    1142021-11-18  Ziran Sun  <zsun@igalia.com>
    215
  • trunk/Source/WebCore/layout/formattingContexts/inline/InlineLineBuilder.cpp

    r285956 r285999  
    460460        return lineRange;
    461461    }
     462    auto isLastLine = isLastLineWithInlineContent(lineRange, needsLayoutRange.end, committedContent.partialTrailingContentLength);
    462463    auto horizontalAvailableSpace = m_lineLogicalRect.width();
    463464    auto isInIntrinsicWidthMode = this->isInIntrinsicWidthMode();
     
    473474        // When a glyph at the start or end edge of a line hangs, it is not considered when measuring the line’s contents for fit.
    474475        // https://drafts.csswg.org/css-text/#hanging
    475         // FIXME: Add support for conditionally hanging glyphs.
    476         m_line.removeHangingGlyphs();
     476        if (*intrinsicWidthMode() == IntrinsicWidthMode::Minimum)
     477            m_line.removeHangingGlyphs();
     478        else {
     479            // Glyphs that conditionally hang are not taken into account when computing min-content sizes and any sizes derived thereof, but they are taken into account for max-content sizes and any sizes derived thereof.
     480            auto isConditionalHanging = isLastLine || (!m_line.runs().isEmpty() && m_line.runs().last().isLineBreak());
     481            if (!isConditionalHanging)
     482                m_line.removeHangingGlyphs();
     483        }
    477484    } else
    478485        m_line.visuallyCollapseHangingOverflowingGlyphs(horizontalAvailableSpace);
    479486
    480487    auto horizontalAlignment = root().style().textAlign();
    481     auto runsExpandHorizontally = horizontalAlignment == TextAlignMode::Justify && !isLastLineWithInlineContent(lineRange, needsLayoutRange.end, committedContent.partialTrailingContentLength);
     488    auto runsExpandHorizontally = horizontalAlignment == TextAlignMode::Justify && !isLastLine;
    482489    if (runsExpandHorizontally)
    483490        m_line.applyRunExpansion(horizontalAvailableSpace);
Note: See TracChangeset for help on using the changeset viewer.