[webkit-changes] [WebKit/WebKit] b2ec60: [IFC][Intrinsic width] Incorrect shrink-to-fit box...

Alan Baradlay noreply at github.com
Sat Mar 16 16:48:43 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: b2ec60c7d5b8ab1ded9edfae217285f4059aa28d
      https://github.com/WebKit/WebKit/commit/b2ec60c7d5b8ab1ded9edfae217285f4059aa28d
  Author: Alan Baradlay <zalan at apple.com>
  Date:   2024-03-16 (Sat, 16 Mar 2024)

  Changed paths:
    A LayoutTests/fast/text/min-max-content-negative-text-indent-expected.html
    A LayoutTests/fast/text/min-max-content-negative-text-indent.html
    M Source/WebCore/layout/formattingContexts/inline/InlineFormattingContext.cpp

  Log Message:
  -----------
  [IFC][Intrinsic width] Incorrect shrink-to-fit box logical width when negative text-indent is present
https://bugs.webkit.org/show_bug.cgi?id=271113
<rdar://problem/124784190>

Reviewed by Antti Koivisto.

Negative text-indent value could confuse the min/max inline size computation as running layout with 0 constraint
may produce wider content than running layout with infinite constraint.

Consider the following case:

<div style="text-indent: -100px;">some content</div>

With infinite constraint this content produce only one line with the line box width of 0 (assume the measured content width of "some content" is < 100px)
It simply means that [some content] visually overflows on the left due to this implicit negative content margin.
              _
some content |_|

However when computing the minimum content size we have to take into account all the possible soft wrap opportunities with the constraint value of 0.
Now we end up constructing 2 lines where the second line has 0px used text-indent.
              _
some         |_|
              ________
             |content |
              --------
which clearly computes a content value > 0px.

Let's fix this by making sure minimum width is never larger than maximum width. This behavior also seems to match with other rendering engines.

* LayoutTests/fast/text/min-max-content-negative-text-indent-expected.html: Added.
* LayoutTests/fast/text/min-max-content-negative-text-indent.html: Added.
* Source/WebCore/layout/formattingContexts/inline/InlineFormattingContext.cpp:
(WebCore::Layout::InlineFormattingContext::minimumMaximumContentSize):
(WebCore::Layout::InlineFormattingContext::minimumContentSize):

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