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

Changeset 285931 in webkit


Ignore:
Timestamp:
Nov 17, 2021, 8:30:20 AM (5 years ago)
Author:
Alan Bujtas
Message:

[LFC][IFC] Fix imported/w3c/web-platform-tests/css/css-text/white-space/white-space-intrinsic-size-013.html
https://bugs.webkit.org/show_bug.cgi?id=233237

Reviewed by Antti Koivisto.

Do not take hanging glyphs into account when measuring content for preferred width.
(Note that this patch is in preparation for enabling IFC preferred width computation)

  • layout/formattingContexts/inline/InlineLine.cpp:

(WebCore::Layout::Line::removeHangingGlyphs):

  • layout/formattingContexts/inline/InlineLine.h:
  • layout/formattingContexts/inline/InlineLineBuilder.cpp:

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

Location:
trunk/Source/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r285930 r285931  
     12021-11-17  Alan Bujtas  <zalan@apple.com>
     2
     3        [LFC][IFC] Fix imported/w3c/web-platform-tests/css/css-text/white-space/white-space-intrinsic-size-013.html
     4        https://bugs.webkit.org/show_bug.cgi?id=233237
     5
     6        Reviewed by Antti Koivisto.
     7
     8        Do not take hanging glyphs into account when measuring content for preferred width.
     9        (Note that this patch is in preparation for enabling IFC preferred width computation)
     10
     11        * layout/formattingContexts/inline/InlineLine.cpp:
     12        (WebCore::Layout::Line::removeHangingGlyphs):
     13        * layout/formattingContexts/inline/InlineLine.h:
     14        * layout/formattingContexts/inline/InlineLineBuilder.cpp:
     15        (WebCore::Layout::LineBuilder::close):
     16
    1172021-11-17  Alan Bujtas  <zalan@apple.com>
    218
  • trunk/Source/WebCore/layout/formattingContexts/inline/InlineLine.cpp

    r285926 r285931  
    195195
    196196    m_contentLogicalWidth -= m_trimmableTrailingContent.remove();
     197}
     198
     199void Line::removeHangingGlyphs()
     200{
     201    ASSERT(m_trimmableTrailingContent.isEmpty());
     202    m_contentLogicalWidth -= m_hangingTrailingContent.width();
     203    m_hangingTrailingContent.reset();
    197204}
    198205
  • trunk/Source/WebCore/layout/formattingContexts/inline/InlineLine.h

    r285926 r285931  
    6565
    6666    void removeTrailingTrimmableContent();
     67    void removeHangingGlyphs();
    6768    void visuallyCollapseHangingOverflowingGlyphs(InlineLayoutUnit horizontalAvailableSpace);
    6869    void applyRunExpansion(InlineLayoutUnit horizontalAvailableSpace);
  • trunk/Source/WebCore/layout/formattingContexts/inline/InlineLineBuilder.cpp

    r285930 r285931  
    459459    auto horizontalAvailableSpace = m_lineLogicalRect.width();
    460460    m_line.removeTrailingTrimmableContent();
    461     m_line.visuallyCollapseHangingOverflowingGlyphs(horizontalAvailableSpace);
     461    if (isInIntrinsicWidthMode()) {
     462        // 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.
     463        // https://drafts.csswg.org/css-text/#hanging
     464        // FIXME: Add support for conditionally hanging glyphs.
     465        m_line.removeHangingGlyphs();
     466    } else
     467        m_line.visuallyCollapseHangingOverflowingGlyphs(horizontalAvailableSpace);
     468
    462469    auto horizontalAlignment = root().style().textAlign();
    463470    auto runsExpandHorizontally = horizontalAlignment == TextAlignMode::Justify && !isLastLineWithInlineContent(lineRange, needsLayoutRange.end, committedContent.partialTrailingContentLength);
Note: See TracChangeset for help on using the changeset viewer.