[webkit-changes] [WebKit/WebKit] 1be1a3: text-wrap: balance, prefering longer lines at the ...

Vitor Roriz noreply at github.com
Mon Feb 5 19:12:42 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 1be1a3ffb5a581913100e29d6296db6c8a7d8899
      https://github.com/WebKit/WebKit/commit/1be1a3ffb5a581913100e29d6296db6c8a7d8899
  Author: Vitor Roriz <vitor.roriz at apple.com>
  Date:   2024-02-05 (Mon, 05 Feb 2024)

  Changed paths:
    A LayoutTests/fast/text/whitespace/text-wrap-balance-shape-expected.html
    A LayoutTests/fast/text/whitespace/text-wrap-balance-shape.html
    M Source/WebCore/layout/formattingContexts/inline/InlineContentBalancer.cpp

  Log Message:
  -----------
  text-wrap: balance, prefering longer lines at the beginning of block
https://bugs.webkit.org/show_bug.cgi?id=268780
rdar://122338948

Reviewed by Alan Baradlay.

When balancing, there are different results that produce the same score,
i.e.: the overall deviation to the ideal line is the same for different
layout configurations. The current implementation prefers to keep longer
lines at the end of the block, rather than at the beginning. Although
this is not a bug, since specification doesn't dictates the shape of
balancing, this might look a bit weird for some authors, as we are used
to the Greedy behavior of "wrap", which will have a shorter line at the
end.

Also, other UAs prefers to have longer lines at the beginning, so, although
it is not a bug, it would make the feature less confusing for authors if we
would match the same behavior.

We are introducing a new test to track the behavior of WebKit shape, but since
this is not dictate by specification, this should not be WPT test.

* LayoutTests/fast/text/whitespace/text-wrap-balance-shape-expected.html: Added.
* LayoutTests/fast/text/whitespace/text-wrap-balance-shape.html: Added.
* Source/WebCore/layout/formattingContexts/inline/InlineContentBalancer.cpp:
(WebCore::Layout::InlineContentBalancer::balanceRangeWithLineRequirement):

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




More information about the webkit-changes mailing list