Skip to content

fix(textbox): Draw spell-check squiggles below the descenders (6.7, backport of #25392) - #25935

Merged
agneszitte merged 2 commits into
unoplatform:release/stable/6.7from
ramezgerges:dev/rara/spellcheck-squiggle-6.7
Nov 2, 2026
Merged

agneszitte merged 2 commits into
unoplatform:release/stable/6.7from
ramezgerges:dev/rara/spellcheck-squiggle-6.7

Conversation

@ramezgerges

Copy link
Copy Markdown
Contributor

GitHub Issue: related to unoplatform/kahua-private#556 (backport of #25392 via #25620)

PR Type:

🐞 Bugfix

What changed? 🚀

This backports #25392 to release/stable/6.7, by cherry-picking the two commits of its 6.8 backport #25620, which apply cleanly. 6.7 shares 6.8's text stack, so the 6.8 adaptation applies unchanged. As for 6.8, the fix doesn't cherry-pick from master directly: 6.7 has the SkiaSharp text stack (UnicodeText.skia.cs, SKCanvas painting) and no managed RichEditBox, so only the TextBox half applies. It's adapted as follows.

In a TextBox, the spell-check squiggle overlapped the descenders of g, y and p. The text is clipped to its lines by the ScrollContentPresenter, and the line box ends less than a pixel below the descenders. The wave was therefore clamped into the line and overlapped them.

  • The wave's top edge now sits on the font's descent (SKFontMetrics.Descent), below the line box.
  • UnicodeText.Draw no longer draws the squiggles. IParsedText.DrawSpellCheckSquiggles(SKCanvas, opacity) draws them on request, in the text's own coordinates.
  • TextBoxView draws them in a layer on the TextBox's content element (TextBoxView.SpellCheck.skia.cs):
    • The layer sits above the text and is clipped to the padding box, so the text's own clipping is unchanged.
    • It draws through the transform from the text to its host, so it follows scrolling and flow direction.
    • It repaints when the text is parsed again or the view scrolls.
    • TextBox.skia.cs attaches it where it sets up the TextBoxView.

Differences from master (same as in #25620):

  • The layer is added directly as the top child of the host's visual. 6.7/6.8's ElementCompositionPreview.SetElementChildVisual wraps the visual in a new container on each call and can't take null to remove it.
  • The squiggle now honours the layer's opacity, as on master. Before, it was always opaque red.

Validation (Skia desktop on Windows, SamplesApp.Skia.Generic net10.0, built from this branch):

Test 6.7 without the fix With the fix
When_SpellCheck_Squiggle_Is_Below_Descenders(14) fails: squiggle top row 20, descenders end at row 22 passes
When_SpellCheck_Squiggle_Is_Below_Descenders(20) fails: squiggle top row 26, descenders end at row 30 passes
When_SpellCheck_Squiggle_Scrolled_Out_Of_View passes passes

The tests are restricted to Skia (PlatformCondition Include Skia), since this file also runs on 6.7's native heads.

PR Checklist ✅

🤖 Generated with Claude Code

ramezgerges and others added 2 commits November 2, 2026 11:54
The squiggle crossed the descenders of g, y and p. A text box's text is
clipped to its lines by the scroll presenter, and the line box ends
less than a pixel below the descenders, so the wave was clamped into
the line and overlapped them.

The wave's top edge now sits on the font's descent, below the line
box. The parsed text no longer draws the squiggles with the text:
IParsedText.DrawSpellCheckSquiggles draws them on request, and
TextBoxView draws them in a layer on its content element, clipped to
the padding box, so the text's own clipping is unchanged. The layer
follows scrolling and repaints when the text is parsed again.

Backport of unoplatform#25392, adapted to 6.8's SkiaSharp text stack.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
(cherry picked from commit f03ee12)
Checks the squiggle is drawn below the text's descenders, and that it
scrolls out of view with its word.

Backport of unoplatform#25392.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
(cherry picked from commit 0b341f8)
@ramezgerges
ramezgerges enabled auto-merge November 2, 2026 17:02
@github-actions github-actions Bot added the area/skia ✏️ Categorizes an issue or PR as relevant to Skia label Nov 2, 2026
@unodevops

Copy link
Copy Markdown
Contributor

🤖 Your WebAssembly Sample App stage site is ready! Visit it here:

@agneszitte
agneszitte disabled auto-merge November 2, 2026 20:41
@agneszitte
agneszitte merged commit 0a76d89 into unoplatform:release/stable/6.7 Nov 2, 2026
42 of 47 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/skia ✏️ Categorizes an issue or PR as relevant to Skia

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants