Skip to content

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

Merged
ramezgerges merged 2 commits into
unoplatform:servicing/6.8from
ramezgerges:dev/rara/spellcheck-squiggle-6.8
Oct 29, 2026
Merged

ramezgerges merged 2 commits into
unoplatform:servicing/6.8from
ramezgerges:dev/rara/spellcheck-squiggle-6.8

Conversation

@ramezgerges

Copy link
Copy Markdown
Contributor

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

PR Type:

🐞 Bugfix

What changed? 🚀

This backports #25392 to servicing/6.8. It doesn't cherry-pick: 6.8 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:

  • The layer is added directly as the top child of the host's visual. 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):

Test 6.8 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.8's native heads.

PR Checklist ✅

🤖 Generated with Claude Code

@github-actions github-actions Bot added the area/skia ✏️ Categorizes an issue or PR as relevant to Skia label Oct 21, 2026
@unodevops

Copy link
Copy Markdown
Contributor

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

@nventive-devops

Copy link
Copy Markdown
Contributor

The build 240637 did not find any UI Test snapshots differences.

@unodevops

Copy link
Copy Markdown
Contributor

⚠️⚠️ The build 240637 has failed on Uno.UI - CI.

@ramezgerges
ramezgerges enabled auto-merge October 26, 2026 17:59
@ramezgerges

Copy link
Copy Markdown
Contributor Author

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@unodevops

Copy link
Copy Markdown
Contributor

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

@unodevops

Copy link
Copy Markdown
Contributor

⚠️⚠️ The build 241482 has failed on Uno.UI - CI.

@ramezgerges ramezgerges mentioned this pull request Oct 27, 2026
2 of 5 tasks
ramezgerges and others added 2 commits October 27, 2026 20:15
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]>
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]>
@ramezgerges
ramezgerges force-pushed the dev/rara/spellcheck-squiggle-6.8 branch from ac021dc to 0b341f8 Compare October 28, 2026 00:16
@ajpinedam

Copy link
Copy Markdown
Contributor

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@unodevops

Copy link
Copy Markdown
Contributor

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

@nventive-devops

Copy link
Copy Markdown
Contributor

The build 242068 did not find any UI Test snapshots differences.

@ramezgerges
ramezgerges merged commit 9db5af1 into unoplatform:servicing/6.8 Oct 29, 2026
43 checks passed
@ramezgerges
ramezgerges deleted the dev/rara/spellcheck-squiggle-6.8 branch November 2, 2026 16:53
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