mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-14 10:59:24 +02:00
When trimming trailing whitespace from line boxes, we were only subtracting the glyph width of each trimmed character. However, during text shaping, letter-spacing is added to each glyph's advance width. We must subtract the full advance (glyph width + letter-spacing) to get an accurate line width after trimming. This also fixes a pre-existing precision bug where the glyph width (a float) was truncated to int, leaving fractional phantom width in the line box. Together, these issues caused text with letter-spacing and trailing HTML whitespace to have an underestimated intrinsic width, leading to unexpected text wrapping in flex layouts.
6.1 KiB
6.1 KiB