[webkit-changes] [WebKit/WebKit] 8ea290: webkit-line-clamp in nested context does not rende...

Alan Baradlay noreply at github.com
Fri Dec 6 05:10:55 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 8ea2903a98c446cbbef057f1d9d5344b093f8096
      https://github.com/WebKit/WebKit/commit/8ea2903a98c446cbbef057f1d9d5344b093f8096
  Author: Alan Baradlay <zalan at apple.com>
  Date:   2024-12-06 (Fri, 06 Dec 2024)

  Changed paths:
    M LayoutTests/fast/block/line-clamp-collapse-nested-blocks-expected.html
    M LayoutTests/fast/inline/dynamic-line-clamp-change-on-nested-content-expected.html
    A LayoutTests/fast/overflow/line-clamp-on-last-formatted-line-expected.html
    A LayoutTests/fast/overflow/line-clamp-on-last-formatted-line.html
    M Source/WebCore/layout/formattingContexts/inline/InlineFormattingContext.cpp
    M Source/WebCore/layout/formattingContexts/inline/RangeBasedLineBuilder.cpp
    M Source/WebCore/layout/formattingContexts/inline/display/InlineDisplayLineBuilder.cpp
    M Source/WebCore/layout/formattingContexts/inline/display/InlineDisplayLineBuilder.h
    M Source/WebCore/layout/integration/inline/LayoutIntegrationLineLayout.cpp
    M Source/WebCore/layout/integration/inline/LayoutIntegrationLineLayout.h
    M Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp

  Log Message:
  -----------
  webkit-line-clamp in nested context does not render ellipsis when inline content fits.
https://bugs.webkit.org/show_bug.cgi?id=281136
<rdar://problem/137585973>

Reviewed by Antti Koivisto.

We fail to put ellipsis on the clamped line when it is the last formatted line followed by
a sibling IFC with more inline content.
e.g.
<div clamp=1>
 <div>Last formatted line in this IFC but not in the parent BFC. Needs ellipsis.</div>
 <div>this line is clamped</div>
</div>

^ in this case ellipsis should go to the end of "last formatted line", even though it does
not overflow the container in block direction, but it is considered "overflowing" the parent BFC.

In this change, we start putting ellipsis on such last formatted lines and if they turn out to be truly the last line in the clamp context (where we should NOT put ellipsis) we simply remove the ellipsis by running a no-clamp layout.
<div clamp=1>
 <div>Last formatted line in this IFC and in the parent BFC as well. No ellipsis here.</div>
</div>

* LayoutTests/fast/block/line-clamp-collapse-nested-blocks-expected.html:
* LayoutTests/fast/inline/dynamic-line-clamp-change-on-nested-content-expected.html:
* LayoutTests/fast/overflow/line-clamp-on-last-formatted-line-expected.html: Added.
* LayoutTests/fast/overflow/line-clamp-on-last-formatted-line.html: Added.
* Source/WebCore/layout/formattingContexts/inline/InlineFormattingContext.cpp:
(WebCore::Layout::InlineFormattingContext::createDisplayContentForInlineContent):
* Source/WebCore/layout/formattingContexts/inline/RangeBasedLineBuilder.cpp:
(WebCore::Layout::RangeBasedLineBuilder::isEligibleForRangeInlineLayout):
* Source/WebCore/layout/formattingContexts/inline/display/InlineDisplayLineBuilder.cpp:
(WebCore::Layout::trailingEllipsisVisualRectAfterTruncation):
(WebCore::Layout::InlineDisplayLineBuilder::addLegacyLineClampTrailingLinkBoxIfApplicable):
(WebCore::Layout::InlineDisplayLineBuilder::applyEllipsisIfNeeded):
* Source/WebCore/layout/formattingContexts/inline/display/InlineDisplayLineBuilder.h:
* Source/WebCore/layout/integration/inline/LayoutIntegrationLineLayout.cpp:
(WebCore::LayoutIntegration::LineLayout::hasEllipsisInBlockDirectionOnLastFormattedLine const):
* Source/WebCore/layout/integration/inline/LayoutIntegrationLineLayout.h:
* Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp:
(WebCore::blockContainerForLastFormattedLine):
(WebCore::RenderDeprecatedFlexibleBox::applyLineClamp):

Canonical link: https://commits.webkit.org/287441@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