[webkit-changes] [WebKit/WebKit] da4254: CSS line clamp together with float not working cor...

Alan Baradlay noreply at github.com
Tue Dec 19 10:27:37 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: da42549d3773aa043610e1db4e578ef79dc716d5
      https://github.com/WebKit/WebKit/commit/da42549d3773aa043610e1db4e578ef79dc716d5
  Author: Alan Baradlay <zalan at apple.com>
  Date:   2023-12-19 (Tue, 19 Dec 2023)

  Changed paths:
    A LayoutTests/fast/flexbox/line-clamp-with-float-expected.html
    A LayoutTests/fast/flexbox/line-clamp-with-float.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/InlineLineTypes.h
    M Source/WebCore/layout/formattingContexts/inline/display/InlineDisplayLineBuilder.cpp
    M Source/WebCore/rendering/RenderBlockFlow.cpp
    M Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp

  Log Message:
  -----------
  CSS line clamp together with float not working correctly
https://bugs.webkit.org/show_bug.cgi?id=266018
<rdar://problem/119355692>

Reviewed by Antti Koivisto.

1. Line clamping should ignore lines with no inline content. It usually happens when floats don't let us put content on the candidate line (see numberOfLinesWithInlineContent)
2. Move lineEndingEllipsisPolicy to InlineFormattingUtils and use numberOfLinesWithInlineContent as input to decide of the ellipsis policy
3. LineEndingEllipsisPolicy::No -> LineEndingEllipsisPolicy::NoEllipsis
4. While line-clamp state is valid across block container boundaries, we should not apply it on floats/out-of-flow content (i.e. do not count lines inside floats)
5. RenderDeprecatedFlexibleBox::applyModernLineClamp should only return null_opt when we couldn't manage to run line clamping at all.

* LayoutTests/fast/flexbox/line-clamp-with-float-expected.html: Added.
* LayoutTests/fast/flexbox/line-clamp-with-float.html: Added.
* Source/WebCore/layout/formattingContexts/inline/InlineFormattingContext.cpp:
(WebCore::Layout::InlineFormattingContext::lineLayout):
(WebCore::Layout::InlineFormattingContext::createDisplayContentForInlineContent):
(WebCore::Layout::lineEndingEllipsisPolicy): Deleted.
* Source/WebCore/layout/formattingContexts/inline/InlineFormattingContext.h:
* Source/WebCore/layout/formattingContexts/inline/InlineFormattingUtils.cpp:
(WebCore::Layout::InlineFormattingUtils::lineEndingEllipsisPolicy):
* Source/WebCore/layout/formattingContexts/inline/InlineFormattingUtils.h:
* Source/WebCore/layout/formattingContexts/inline/InlineLineTypes.h:
* Source/WebCore/layout/formattingContexts/inline/display/InlineDisplayLineBuilder.cpp:
(WebCore::Layout::InlineDisplayLineBuilder::trailingEllipsisVisualRectAfterTruncation):
* Source/WebCore/rendering/RenderBlockFlow.cpp:
(WebCore::RenderBlockFlow::layoutModernLines):
* Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp:
(WebCore::RenderDeprecatedFlexibleBox::layoutVerticalBox):
(WebCore::getHeightForLineCount):
(WebCore::RenderDeprecatedFlexibleBox::applyModernLineClamp):

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




More information about the webkit-changes mailing list