Repository navigation
RichTextBlock - #23731
RichTextBlock#23731
RichTextBlock#23731Conversation
|
Claude finished @MartinZikmund's task in 5m 21s —— View job PR Review: WIP
|
| # | Severity | File | Summary |
|---|---|---|---|
| 1 | 🔴 Bug | TextSelectionManager.skia.cs:869 |
GetSelectionBoundingRect computes Max(Width) instead of Max(Right)−MinX; underreports bounding rect for multi-line selections |
| 2 | 🟠 Resource leak | RichTextBlock.skia.cs:173 |
Old PageNode replaced every Measure without calling Dispose(), so InlineUIContainer children accumulate as orphaned visual-tree elements |
| 3 | 🟡 Performance | RichTextBlock.skia.cs:307 |
GetParagraphHighlighters builds a Enumerable.Empty().Append() chain on every render frame — O(n) heap allocations in the paint path |
| 4 | 🟡 Policy | ParagraphNode.skia.cs:6, PageNode.skia.cs:6, BlockLayoutHelpers.skia.cs:6 |
File-wide #pragma warning disable CS8600,CS8602,CS8604,CS8618 suppress all nullable analysis with a WIP note; must be narrowed or resolved before merge |
| 5 | 🟡 Repo hygiene | doc/dev/richtextblock-*.md (6 files) |
Internal porting stage plans and work-logs committed to doc/dev/; should stay in PR body / issue, not repo tree |
| 6 | ℹ️ Note | Various | Multiple // TODO Uno (Stage X) stubs (caret browsing, high-contrast system colours, gripper host, ClearEmbeddedElements) — expected for WIP, but worth tracking as follow-up issues before marking the PR non-WIP |
Cross-cutting observations (no inline comment needed):
- DependencyProperty registrations look correct: right owner types,
nameof, correctFrameworkPropertyMetadataOptions(includingAffectsMeasure/Inheritswhere appropriate). - No
async void,.Result/.GetAwaiter().GetResult()blocking calls, orevent Actionin the new files. - Platform file suffixes are correct (
.skia.csfor all Skia-only code; thecrossruntime.csstubs are one-liner delegates — fine). OnUnloadedproperly destroys theTextSelectionManagerto avoid event/reference leaks.- Test coverage is solid: unit tests for
InlineCollection_RunModelandTextHighlightMerge, plus runtime tests for text pointer, formatter, overflow, and InlineUIContainer scenarios.
Verdict: fix-first — address items 1–4 before removing the WIP tag. Item 5 (doc files) can be done as a clean-up commit. Item 6 is expected for a staged port.
XAML Styler drift detected on
|
|
Claude finished @MartinZikmund's task in 4m 56s —— View job PR Review: WIP
|
| # | Severity | Location | Description |
|---|---|---|---|
| 1 | 🔴 Bug | TextRangeAdapter.skia.cs:792 |
ScrollIntoView rect height is computed as Y0 + Y1 + H1 (sum of Y coords) instead of Y1 + H1 - Y0 (span) |
| 2 | 🟠 Perf | RichTextBlock.skia.cs:307 |
GetParagraphHighlighters builds IEnumerable via .Append() chains in the paint path — heap allocation per paragraph per frame |
| 3 | 🟠 Quality | TextRangeAdapter.skia.cs:509 |
Bare catch { } swallows all exceptions in GetBoundingRectangles with no logging |
| 4 | 🟡 Quality | TextBlockView.skia.cs:163 |
GetAdjustedPosition/GetCharacterIndex throw NotSupportedException for in-range positions — UIA automation path on TextBlock crashes for any non-trivial document |
| 5 | 🟡 Maintainability | RichTextBlock.skia.cs:249 |
Magic 2 for inter-paragraph separator should reference (or at minimum name) the InterParagraphSeparatorLength constant already in RichTextBlockView |
| 6 | 🟡 Tests | Given_RichTextBlock_Input.skia.cs:245,265,276,305 |
Assert.Inconclusive for platform skips should use [PlatformCondition] per Uno runtime-test conventions |
| 7 | 🟡 Hygiene | doc/dev/richtextblock-*.md |
Six internal planning/port documents committed to the tree; these are ephemeral working notes that shouldn't land in main |
| 8 | 🟡 Hygiene | RichTextBlockTests/ |
Multiple sample files are byte-for-byte identical to their RichTextBlockControl/ counterparts (same SHA) — consolidate or differentiate |
Cross-cutting observations
- DependencyProperties — all well-formed:
FrameworkPropertyMetadata, correct option flags, change-handler wiring.RichTextBlockOverflow.MaxLines/Paddingcorrectly rely onAffectsMeasurewithout an explicit callback, which is sufficient for those properties. - Async / cancellation —
GetDefaultFontDetailsContinueWithcorrectly marshals back to the main thread viaNativeDispatcher.Main.Enqueue. No.Result/.GetAwaiter().GetResult()found. - Platform correctness —
ILinkedTextContaineroverflow chain,LinkedRichTextBlockView, and the master/overflow selection manager wiring are correctly Skia-only via file suffixes; the cross-runtime partial (RichTextBlock.crossruntime.cs) is appropriately minimal. - WIP TODOs — many
// TODO Uno (Stage N)comments are expected in a WIP branch. The TextBlock automation crash (Navigation view control doesn't work #4 above) is the one that should be audited for call-site guards before landing. - XAML Styler — CI already flagged formatting drift; the
/apply-xaml-stylebot comment can handle that automatically.
XAML Styler drift detected on
|
|
Claude finished @MartinZikmund's task in 6m 59s —— View job PR Review: WIP
|
XAML Styler drift detected on
|
WinAppSDK sync generator drift detected on
|
WinAppSDK sync generator drift detected on
|
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Hyperlink keyboard state and automation geometry have unresolved correctness and accessibility defects.
Get a fresh assessment by requesting another Copilot review.
Review effort: Balanced
Findings: 1
Open (1)
|
🤖 Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-23731/docs/index.html |
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-23731/wasm-skia-net9/index.html |
The peer returned an empty rect, so automation clients saw a focusable link with zero bounds. Union the link range's text bounds and transform them to screen space, as CCoreServices::GetTextElementBoundingRect does, and round the clickable point's Y up like WinUI. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01KgHGJja8qcSFT2iHrm9teq
Fails with the previous empty rect. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01KgHGJja8qcSFT2iHrm9teq
InputManager type-tested Hyperlink, which put control-specific handling in a general location. WinUI has CHyperlink register its own KeyDown/KeyUp listeners; Uno raises routed events on UIElements only, so the focused TextElement now takes the key through a virtual it overrides. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01KgHGJja8qcSFT2iHrm9teq
Measure runs repeatedly while the shared font task is pending, and each pass attached another continuation that strongly captured the control, so an unloaded RichTextBlock stayed alive until the font resolved and OnFontLoaded could fire several times. Register one continuation per task and hold the control weakly. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01KgHGJja8qcSFT2iHrm9teq
Uno.UI builds once for Skia, so #if __SKIA__ is always true and #if !__WASM__ never selects the other branch. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01KgHGJja8qcSFT2iHrm9teq
GeneralTransform.Inverse never returns null, so the fallback was unreachable while a singular transform silently produced NaN coordinates. Check the result instead. Also state the PlainTextPosition identity invariant, which follows CPlainTextPosition::Equals comparing the offset alone. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01KgHGJja8qcSFT2iHrm9teq
|
Claude finished @MartinZikmund's task in 9m 2s —— View job PR Review: WIP
|
| # | Severity | File | Summary |
|---|---|---|---|
| 1 | 🟡 Nullable | RichTextBlockOverflow.Properties.cs:159 |
ContentSource still declared non-nullable RichTextBlock while GetMaster() returns RichTextBlock? — flagged in several earlier review passes, touched again by this #if __SKIA__ cleanup but still not fixed |
Confirmed correct (verified by inspection, not just trusting commit messages)
GetSelectedTextrewrite (RichTextBlock.mux.cs) — replaces plainGetPlainText()[start..end]slicing with a flat-position-aware walk that treatsLineBreakas 1 flat char / 2 text chars (\r\n) and inserts a 2-char paragraph separator. Traced the arithmetic againstTextBlockViewHelpers.AdjustPositionByCharacterCount(the established flat-space reference):InlineUIContainerandSpanopen/close markers correctly contribute zero flat characters, matching that helper's documented convention ("InlineUIContainer does not have any characters..."). The trailing per-paragraph separator is naturally excluded whenendlands exactly at the paragraph boundary (to = 0), which the existingWhen_SelectAll_Multiple_Paragraphstest already confirms ("First\r\nSecond", no trailing CRLF). No bug found here despite the complexity.- Font-load continuation fix (
RichTextBlock.mux.cs) — root-causes the previously-flagged resource-lifetime issue: dedupes registration per-task via_pendingFontLoad, and holds the control through aWeakReference<RichTextBlock>so an unloaded control isn't kept alive by a slow font load. Correct. - Trimmer-safety fix (
DependencyProperty.cs,DependencyObject.Store.cs,FrameworkElement.Theming.cs) — replaces== RichTextBlock.ForegroundProperty(reading the static field rootsRichTextBlock's cctor and the whole type for apps that never touch it) with an owner-type+name comparison (IsRichTextBlockProperty) /DependencyProperty.GetProperty(typeof(...), name)lookup that avoids the static reference. Verified bothForegroundPropertyandSelectionFlyoutPropertyare real (non-inherited) registrations onRichTextBlock, so the identity check is sound. ReverseTransformFromRootNaN fix (TextAdapter.cs) — the prior code's.Inverse is { } inversenull check was dead: tracedGeneralTransform.InverseCore→Transform.InverseCore→Matrix3x2.Invert, and a non-invertible matrix produces NaN components, nevernull. The newdouble.IsNaN(...)check is the real fallback condition; this is a genuine correctness fix, not cosmetic.Hyperlinkbounding-rectangle fix (HyperlinkAutomationPeer.cs) — unions per-line text bounds viaRect.Union(confirmed it mutatesthisin place, so theunion.Union(bounds[i])loop is correct) and transforms to screen space; backed by a new runtime test that loads a link after leading text and asserts non-zero, in-bounds geometry.- Overflow link-capture muting fix (
RichTextBlockOverflow.Input.cs) — now tracks_linkPressPointerIdand only silencesPointerCaptureLostfor the release matching the pointer that actually took a link-press capture, leaving a selection-drag's own capture release unmuted. A new complementary test (When_Selection_Drag_In_Overflow_Is_Released_CaptureLost_Is_Raised) confirms the drag case still raises the event, so the fix isn't overcorrected. EnterImpl/LeaveImplmigration — movesTextSelectionManagerteardown fromOnUnloadedtoLeaveImpl(checkedIsLive), matchingCRichTextBlock::EnterImpl/LeaveImplinvalidating inherited content on live tree attach/detach. ConfirmedEnterImpl(EnterParams, int)/LeaveImpl(LeaveParams)are the real virtual signatures onUIElement.- Test quality —
Assert.Inconclusivefor the macOS Ctrl-key skips (a repeatedly-flagged issue) is now replaced with[PlatformCondition(ConditionMode.Exclude, RuntimeTestPlatforms.SkiaMacOS)]. The rewrittenWhen_ShiftClick_Extends_Selectionuses deterministic click points derived fromTextPointer.GetCharacterRectinstead of pixel-guessing, and injected-timestamp mouse steps instead of a wall-clockTask.Delay. A native-WinUI-only test gap (When_Reloaded_SelectAll_Selects_Content) is correctly documented with a TODO and excluded only for the native comparison target, not silently skipped.
Cross-cutting notes
- No
event Action,.Result/.GetAwaiter().GetResult(), or newasync voidin this batch. - Commit messages in this range are properly Conventional-Commits formatted.
- Dead
#if __SKIA__/#if !__WASM__removal acrossRichTextBlock.cs,InlineCollection.cs,Paragraph.cs,Span.cs, and the automation peers is consistent withUno.UInow being Skia-only — no behavior change, just removing now-unreachable branches.
Verdict: fix-first — item 1 is a one-line nullable-annotation fix (RichTextBlock?) that's been carried across several review rounds; nothing else in this batch needs changes before landing this increment.
There was a problem hiding this comment.
Copilot review overview
🔵 Needs a closer look
The large cross-cutting port changes layout, input, accessibility, rendering, and public API behavior across many interdependent components.
Review effort: Balanced
Findings: None
Resolved since last review (1)
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-23731/wasm-skia-net9/index.html |
|
🤖 Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-23731/docs/index.html |
|
The build 234688 found UI Test snapshots differences: Details
|
The engine awaits a test body unbounded unless the method declares [Timeout], so an injected pointer or key that never arrives on a CI emulator hangs the whole job: Android groups burned the 45-minute cap three times on this branch (a healthy group runs ~11 min) with no test named anywhere. 120s per test keeps a hang a named failure. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01KgHGJja8qcSFT2iHrm9teq
|
Claude finished @MartinZikmund's task in 7m 32s —— View job PR Review:
|
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-23731/wasm-skia-net9/index.html |
|
🤖 Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-23731/docs/index.html |
|
The build 234690 found UI Test snapshots differences: Details
|

GitHub Issue: closes #81
PR Type:
✨ Feature
What changed? 🚀
Before: Uno's
RichTextBlockwas a flat, Uno-original managed implementation. It measured and drew paragraphs directly, and much of the WinUI surface was stubbed as[NotImplemented]:RichTextBlockOverflowchaining,TextPointer,TextHighlighters,TextTrimming,InlineUIContainerand the UIA Text pattern.After:
RichTextBlockandRichTextBlockOverflowrun on a port of WinUI's core text stack (dxaml/xcp/core/text). Uno's Skia text engine replaces WinUI's Line Services formatter underneath it:BlockLayoutEnginewith thePageNode/ContainerNode/ParagraphNodetree, breaks, and drawing contexts. The formatter contract (TextFormatter/TextLine/TextSource) is bridged ontoParsedTextbySkiaTextFormatter/SkiaTextLine. That bridge is the only Uno-specific layer.RichTextBlockView,LinkedRichTextBlockViewandRichTextBlockBreak. Content flows from the master into linkedRichTextBlockOverflowcolumns, which also handle input, links, selection and highlighter painting.TextSelectionManager: pointer and keyboard selection,SelectAll, copy, and double-tap word selection.ITextContainer, the run model,TextPointer,TextElement.ContentStart/ContentEnd/ElementStart/ElementEnd,RichTextBlock.Select/GetPositionFromPoint, andTextHighlightersthrough the ported highlight merge.MaxLines,LineHeight/LineStackingStrategy,TextLineBounds,BaselineOffset, andInlineUIContainerhosting.TextAdapter/TextRangeAdapter) forRichTextBlockandRichTextBlockOverflow,Hyperlinkautomation peers, and keyboard activation of a focusedHyperlink.Design notes, the port plan and a member-by-member validation against WinUI are in
specs/richtextblock-winui-port/.Remaining gaps are tracked as follow-ups: #24336, #24337, #24338, #24339, #24340, #24341, #24342, #24343, #24344, #24345 and #24347.
PR Checklist ✅
Given_RichTextBlock*,Given_RichTextBlockOverflow,Given_BlockLayoutEngine,Given_RichTextBlockView,Given_SkiaTextFormatter,Given_TextElement_MutationGiven_InlineCollection_RunModel,Given_TextContainer_Invalidation,Given_TextHighlightMergeSamplesApp/.../RichTextBlockTests/*Screenshots Compare Test Runresults.🤖 Generated with Claude Code
https://claude.ai/code/session_01EJ2tM5KVZK7Qv7oHKNnfwu