RFR: 8355774: RichTextArea: provide mechanism for CSS styling of highlights [v3]

Kevin Rushforth kcr at openjdk.org
Thu Jul 10 14:02:46 UTC 2025


On Thu, 3 Jul 2025 19:30:13 GMT, Andy Goryachev <angorya at openjdk.org> wrote:

>> Adding missing APIs related to styling the highlights with CSS:
>> 
>> ![Screenshot 2025-05-07 at 15 08 53](https://github.com/user-attachments/assets/e37062b4-9804-40a7-872d-830fe0f584c1)
>> 
>> 
>> 
>> Adds methods to the `RichParagraph.Builder`:
>> 
>> 
>>         /**
>>          * Adds a wavy underline (typically used as a spell checker indicator) with the specified style name(s).
>>          * <p>
>>          * The corresponding styles should define CSS properties applicable to {@link javafx.scene.shape.Path}.
>>          *
>>          * @param start the start offset
>>          * @param length the end offset
>>          * @param css the style name(s)
>>          * @return this {@code Builder} instance
>>          * @since 25
>>          */
>>         public Builder addWavyUnderline(int start, int length, String ... css) {
>> 
>> 
>> 
>>         /**
>>          * Adds a highlight with the specified style name(s).
>>          * Use translucent colors to enable multiple highlights in the same region of text.
>>          * <p>
>>          * The corresponding styles should define CSS properties applicable to {@link javafx.scene.shape.Path}.
>>          *
>>          * @param start the start offset
>>          * @param length the end offset
>>          * @param css the style name(s)
>>          * @return this {@code Builder} instance
>>          * @since 25
>>          */
>>         public Builder addHighlight(int start, int length, String ... css) {
>> 
>> 
>> 
>> Also adding similar methods to the `SimpleViewOnlyStyledModel` class:
>> 
>> 
>>     /**
>>      * Adds a highlight of the given color to the specified range within the last paragraph,
>>      * with the specified style name(s).
>>      *
>>      * @param start the start offset
>>      * @param length the length of the highlight
>>      * @param css the highlight style name(s)
>>      * @return this model instance
>>      * @since 25
>>      */
>>     public SimpleViewOnlyStyledModel highlight(int start, int length, String ... css) {
>> 
>> 
>>     /**
>>      * Adds a wavy underline (typically used as a spell checker indicator)
>>      * to the specified range within the last paragraph, with the specified style name(s).
>>      *
>>      * @param start the start offset
>>      * @param length the length of the highlight
>>      * @param css the highlight style name(s)
>>      * @return this model instance
>>      * @since 25
>>      */
>>     public SimpleViewOnlyStyledModel addWavyUnderline(int start, int length, String ... css) {
>
> Andy Goryachev has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains four additional commits since the last revision:
> 
>  - Merge branch 'master' into 8355774.css
>  - Merge remote-tracking branch 'origin/master' into 8355774.css
>  - tab
>  - css

Looks good. Create the CSR and I'll review it.

-------------

Marked as reviewed by kcr (Lead).

PR Review: https://git.openjdk.org/jfx/pull/1802#pullrequestreview-3005843456


More information about the openjfx-dev mailing list