NEW315487
CSS dotted/dashed text-decoration phase resets at bidi-run and inline-fragment boundaries
https://bugs.webkit.org/show_bug.cgi?id=315487
Summary CSS dotted/dashed text-decoration phase resets at bidi-run and inline-fragmen...
Karl Dubost
Reported 2026-05-24 22:10:29 PDT
Steps: Apply `text-decoration: dotted underline` to a block containing either * mixed-direction text (fooשלוםbaz) * or an inline child (foo<span>bar</span>baz). Expected: A single continuous dotted underline across the whole text run (one decorating box per css-text-decor-4 §line-decoration (https://drafts.csswg.org/css-text-decor-4/#line-decoration)). Actual: Dot phase restarts at each direction-run / inline-fragment boundary, producing visibly discontinuous dot patterns. Same defect for dashed. Tests: imported/w3c/web-platform-tests/css/css-text-decor/text-decoration-dotted-001.html imported/w3c/web-platform-tests/css/css-text-decor/text-decoration-dotted-002.html both currently [ ImageOnlyFailure ] at LayoutTests/TestExpectations:4539-4540. Root cause: TextDecorationPainter.cpp:53 maps Dotted/Dashed to StrokeStyle::Dotted/DashedStroke; the dot-phase origin is the per-segment start point, not the decorating-box start.
Attachments
Diagrams of the issue (8.66 KB, image/svg+xml)
2026-05-25 06:56 PDT, Karl Dubost
no flags
01-inline-fragment-thickness (1.94 KB, text/html)
2026-05-25 07:15 PDT, Karl Dubost
no flags
rendering in patched minibrowser, safari, firefox, chrome (551.41 KB, image/png)
2026-05-25 07:16 PDT, Karl Dubost
no flags
02-bidi-mixed (1.58 KB, text/html)
2026-05-25 07:36 PDT, Karl Dubost
no flags
03-dashed-style (1.66 KB, text/html)
2026-05-25 07:46 PDT, Karl Dubost
no flags
rendering in patched minibrowser, safari, firefox, chrome in 03-dashed-style (493.09 KB, image/png)
2026-05-25 07:48 PDT, Karl Dubost
no flags
04-color-matrix (2.29 KB, text/html)
2026-05-25 08:02 PDT, Karl Dubost
no flags
rendering in patched minibrowser, safari, firefox, chrome in 04-color-matrix (395.94 KB, image/png)
2026-05-25 08:04 PDT, Karl Dubost
no flags
05-multiple-spans (1.49 KB, text/html)
2026-05-25 08:10 PDT, Karl Dubost
no flags
rendering in patched minibrowser, safari, firefox, chrome in 05-multiple-spans (464.25 KB, image/png)
2026-05-25 08:12 PDT, Karl Dubost
no flags
06-line-through (1.73 KB, text/html)
2026-05-25 08:20 PDT, Karl Dubost
no flags
rendering in patched minibrowser, safari, firefox, chrome in 06-line-through (516.68 KB, image/png)
2026-05-25 08:21 PDT, Karl Dubost
no flags
08-side-by-side (2.20 KB, text/html)
2026-05-25 08:25 PDT, Karl Dubost
no flags
rendering in patched minibrowser, safari, firefox, chrome in 08-side-by-side (414.55 KB, image/png)
2026-05-25 08:27 PDT, Karl Dubost
no flags
Karl Dubost
Comment 1 2026-05-25 06:56:41 PDT
Created attachment 479796 [details] Diagrams of the issue pre and post diagrams illustrating the issue Each grey rectangle is one text-box (foo, bar, baz) painted on a single line; orange dashed lines mark text-box boundaries. The horizontal hatched strip below each row of boxes is the underline area; coloured rectangles inside it are the dot rects the helper appends. Red rects are the pre-fix output, green rects are the post-fix output. Numbers under each strip are the gaps between consecutive painted dots in pixels (red = pattern broken, green = boundary stitched cleanly). The blue vertical line and label in the post-fix row mark the phaseOrigin; the j=0..6 tick row beneath it is the world-aligned phase grid phaseOrigin + j × 30.
Karl Dubost
Comment 2 2026-05-25 07:15:30 PDT
Created attachment 479797 [details] 01-inline-fragment-thickness Testing different thickness
Karl Dubost
Comment 3 2026-05-25 07:16:27 PDT
Created attachment 479798 [details] rendering in patched minibrowser, safari, firefox, chrome
Radar WebKit Bug Importer
Comment 4 2026-05-25 07:16:53 PDT
Karl Dubost
Comment 5 2026-05-25 07:36:04 PDT
Created attachment 479799 [details] 02-bidi-mixed The current patch fails with the case fooשלוםbaz. But maybe we can fix that too.
Karl Dubost
Comment 6 2026-05-25 07:46:13 PDT
Created attachment 479800 [details] 03-dashed-style 03-dashed-style is being fixed by the current patch.
Karl Dubost
Comment 7 2026-05-25 07:48:06 PDT
Created attachment 479801 [details] rendering in patched minibrowser, safari, firefox, chrome in 03-dashed-style fixed for 03-dashed-style
Karl Dubost
Comment 8 2026-05-25 08:02:54 PDT
Created attachment 479804 [details] 04-color-matrix Double check if it is working with different colors.
Karl Dubost
Comment 9 2026-05-25 08:04:56 PDT
Created attachment 479805 [details] rendering in patched minibrowser, safari, firefox, chrome in 04-color-matrix Fixed with colors for 04-color-matrix
Karl Dubost
Comment 10 2026-05-25 08:10:52 PDT
Created attachment 479806 [details] 05-multiple-spans 05 — three-fragment chains Multiple inner inline boxes mean more boundaries. With period 40px and arbitrary text-box widths, every boundary has a high probability of phase mismatch pre-fix.
Karl Dubost
Comment 11 2026-05-25 08:12:28 PDT
Created attachment 479807 [details] rendering in patched minibrowser, safari, firefox, chrome in 05-multiple-spans fixed for 05-multiple-spans
Karl Dubost
Comment 12 2026-05-25 08:20:15 PDT
Created attachment 479808 [details] 06-line-through 06 — line-through continuity Line-through goes through paintForegroundDecorations rather than paintBackgroundDecorations. The fix wires phaseOriginX into ForegroundDecorationGeometry too, so the line-through pattern is also continuous.
Karl Dubost
Comment 13 2026-05-25 08:21:47 PDT
Created attachment 479809 [details] rendering in patched minibrowser, safari, firefox, chrome in 06-line-through Not fixed by the current patch.
Karl Dubost
Comment 14 2026-05-25 08:25:40 PDT
Created attachment 479810 [details] 08-side-by-side Left column: the failing pattern (with inner <span> or bidi). Right column: hand-shaped reference text without internal boundaries — the patched left column should visually match the right.
Karl Dubost
Comment 15 2026-05-25 08:27:49 PDT
Created attachment 479811 [details] rendering in patched minibrowser, safari, firefox, chrome in 08-side-by-side This is not fixed by the current patched for 08-side-by-side
Karl Dubost
Comment 16 2026-05-25 09:18:47 PDT
Note You need to log in before you can comment on or make changes to this bug.