Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[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
- Loading branch information