[webkit-changes] [WebKit/WebKit] c1353d: text-wrap balance should consider line-clamp when ...

Vitor Roriz noreply at github.com
Tue Jan 30 17:28:40 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: c1353df4a27c21ed9d969ee0f20a367a68ffbd29
      https://github.com/WebKit/WebKit/commit/c1353df4a27c21ed9d969ee0f20a367a68ffbd29
  Author: Vitor Roriz <vitor.roriz at apple.com>
  Date:   2024-01-30 (Tue, 30 Jan 2024)

  Changed paths:
    M LayoutTests/TestExpectations
    M Source/WebCore/layout/formattingContexts/block/BlockLayoutState.h
    M Source/WebCore/layout/formattingContexts/inline/InlineContentBalancer.cpp
    M Source/WebCore/layout/formattingContexts/inline/InlineContentBalancer.h
    M Source/WebCore/layout/formattingContexts/inline/InlineFormattingContext.cpp

  Log Message:
  -----------
  text-wrap balance should consider line-clamp when balancing
https://bugs.webkit.org/show_bug.cgi?id=268302
rdar://121858978

Reviewed by Alan Baradlay.

According to spec resolution [1], if line-clamp
is defined, text-wrap: balance should balance
only within the clamped lines.

Up to this patch, we would balance taking into
consideration all the lines and we would clamp
it after balance.

This patches makes InlineContentBalancer::initialize()
take the maximum number of visible lines into account,
based into the line-clamp property.

Also, this allows for a small optimization:
If line-clamp clamps to 1 line, we can skip balacing.

[1] https://github.com/w3c/csswg-drafts/issues/9310

* LayoutTests/TestExpectations:
* Source/WebCore/layout/formattingContexts/block/BlockLayoutState.h:
(WebCore::Layout::BlockLayoutState::LineClamp::allowedLineCount const):
* Source/WebCore/layout/formattingContexts/inline/InlineContentBalancer.cpp:
(WebCore::Layout::InlineContentBalancer::initialize):
(WebCore::Layout::InlineContentBalancer::computeBalanceConstraints):
* Source/WebCore/layout/formattingContexts/inline/InlineContentBalancer.h:
* Source/WebCore/layout/formattingContexts/inline/InlineFormattingContext.cpp:
(WebCore::Layout::InlineFormattingContext::createDisplayContentForInlineContent):

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




More information about the webkit-changes mailing list