SVG text positioning lists break decomposed accents

#41007184 Area: Blink>SVG / text layout CL 8644950 In Review

What happens

SvgTextLayoutAttributesBuilder walked the text per UTF-16 code point and gave each one its own value from the x/y/dx/dy/rotate lists. A combining mark therefore took a list value of its own, was shaped as a separate segment and drawn away from the letter it belongs to: with x="10 60" on a + U+0301, the accent lands at x=60.

Per the SVG text layout algorithm the lists are indexed by addressable characters, but repositioning applies to typographic characters. A code point that extends the previous typographic character is its "middle": it still consumes a list value, but x/y are dropped and dx/dy are accumulated into the next typographic character. The fix implements that, behind the default-on SvgTextPositioningGraphemeClusters kill switch.

x lists over "a" + U+0301 (+ "b"), markers at the list values

Your browser: unpatched Chrome draws the accent on its own at the second marker.
Before: accent detached
Without the patch: the accent sits at x=60, and in the second case it also pushes "b" onto the third value by accident of counting.
After: accent on the letter
With the patch: accented a at x=10 and b at x=110 -- the mark's list value is dropped, not shifted onto the next character.

The subtle part

The first version of this fix simply let a combining mark consume nothing from the lists. That renders case 1 correctly, but it shifts every later value by one: in case 2 "b" would land on the mark's value (x=60) instead of its own (x=110). The spec is explicit that the arrays stay indexed by addressable characters and only the application is per typographic character, so the landed version consumes the value and throws the x/y part away, while dx/dy accumulate.

A second WPT reftest, text-positioning-list-combining-marks-indexing.html, pins exactly that: it is red on upstream and red on the first version of the fix.

Verification

Links

Issue 41007184 CL 8644950 standalone sampler.html capture_screenshots.py