Fixing TextFlow selection fill (JDK-8149134)

William Barton wjbarton at protonmail.com
Thu Jun 15 09:53:41 UTC 2023


I've recently run into JDK-8149134: when a Text node has been added to a TextFlow, the Text node's selectionStart and selectionEnd properties are interpreted relative to the whole TextFlow rather than the individual span, which means that a selectionFill color may be applied in the wrong place. This prevents rich-text controls implementing the same text-selection appearance as regular TextAreas.

The bug was originally reported against JavaFX 8 but the relevant code appears to behave identically in the current git master.

I'd like to get this fixed -- it looks like a fairly simple task, as the JBS report already identifies a solution (and I suspect the implementation can be simplified, since the Text.spanOffset function added in the JBS draft patch appears to be recalculating information already available from TextRun.getStart).

Is anyone already working on this? If not, would it be appropriate at this point for me to update the patch, add tests, and open a PR, or is further discussion required first?

Thanks,

-- Will
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/openjfx-dev/attachments/20230615/69c991ed/attachment.htm>


More information about the openjfx-dev mailing list