[webkit-changes] [WebKit/WebKit] 33bd86: [line-clamp] Number of contentful lines does not a...

Alan Baradlay noreply at github.com
Thu Dec 5 16:05:45 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 33bd862c809224610cc5fbea4f1c52394896d85a
      https://github.com/WebKit/WebKit/commit/33bd862c809224610cc5fbea4f1c52394896d85a
  Author: Alan Baradlay <zalan at apple.com>
  Date:   2024-12-05 (Thu, 05 Dec 2024)

  Changed paths:
    M LayoutTests/fast/inline/pagination-and-css-line-clamp-crash-expected.txt
    A LayoutTests/fast/overflow/line-clamp-with-trailing-non-contentful-boxes-expected.html
    A LayoutTests/fast/overflow/line-clamp-with-trailing-non-contentful-boxes.html
    M Source/WebCore/layout/formattingContexts/inline/InlineFormattingContext.cpp
    M Source/WebCore/layout/formattingContexts/inline/InlineFormattingContext.h
    M Source/WebCore/layout/formattingContexts/inline/InlineFormattingUtils.cpp
    M Source/WebCore/layout/formattingContexts/inline/InlineFormattingUtils.h
    M Source/WebCore/layout/formattingContexts/inline/display/InlineDisplayLineBuilder.cpp
    M Source/WebCore/layout/integration/inline/LayoutIntegrationInlineContentBuilder.cpp
    M Source/WebCore/layout/integration/inline/LayoutIntegrationLineLayout.cpp

  Log Message:
  -----------
  [line-clamp] Number of contentful lines does not always match the number of lines with inline content
https://bugs.webkit.org/show_bug.cgi?id=284104

Reviewed by Antti Koivisto.

Let's track the number of _contentful_ lines for line clamping.

In some cases (trailing out-of-flow boxes or non-contentful inline content after the final <br>) we end up creating
a display line with no display box other than the root inline display box. Such "empty" lines should not be
taken into account when counting the lines for line-clamp.

examples:
<div>this line is contentful<br><div style="position: absolute"></div> <- out of flow box after last contentful line
<div>this line is contenful<br><span></span></div> <- non-contentful trailing inline content

* Source/WebCore/layout/formattingContexts/inline/InlineFormattingContext.cpp:
(WebCore::Layout::InlineFormattingContext::lineLayout):
(WebCore::Layout::InlineFormattingContext::createDisplayContentForInlineContent):
(WebCore::Layout::InlineFormattingContext::createDisplayContentForLineFromCachedContent):
(WebCore::Layout::InlineFormattingContext::createDisplayContentForEmptyInlineContent):
* Source/WebCore/layout/formattingContexts/inline/InlineFormattingContext.h:
* Source/WebCore/layout/formattingContexts/inline/InlineFormattingUtils.cpp:
(WebCore::Layout::InlineFormattingUtils::lineEndingTruncationPolicy):
* Source/WebCore/layout/formattingContexts/inline/InlineFormattingUtils.h:
* Source/WebCore/layout/formattingContexts/inline/display/InlineDisplayLineBuilder.cpp:
(WebCore::Layout::moveDisplayBoxToClampedLine):
* Source/WebCore/layout/integration/inline/LayoutIntegrationInlineContentBuilder.cpp:
(WebCore::LayoutIntegration::InlineContentBuilder::adjustDisplayLines const):

Canonical link: https://commits.webkit.org/287416@main



To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications


More information about the webkit-changes mailing list