Repository navigation
refactor(build): Drop .Skia naming from the UI layer - #24001
Conversation
|
Claude finished @MartinZikmund's task in 9m 20s —— View job Review complete
SummaryThis is a well-executed mechanical refactoring. The three layers of change (project renames, nuspec path updates, and 2 findings — both pre-existing bugs surfaced by the merge:
Both were already wrong in the
Verdict: fix-first on the two inline items, then this is ready. |
|
Tick the box to add this pull request to the merge queue (same as
|
| { | ||
| int save = canvas.Save(); | ||
| // Note that this is applied before the SourceOffset translates the canvas' matrix, so | ||
| canvas.ClipRect(new SKRect(0, 0, (this as ISkiaSurface).Size.X, (this as ISkiaSurface).Size.X), antialias: true); |
There was a problem hiding this comment.
Pre-existing bug (now surfaced by merge): The ClipRect call uses .Size.X for both the right and bottom parameters, making the clip rectangle always a square equal to the surface width — non-square source visuals are clipped incorrectly on the bottom edge.
| canvas.ClipRect(new SKRect(0, 0, (this as ISkiaSurface).Size.X, (this as ISkiaSurface).Size.X), antialias: true); | |
| canvas.ClipRect(new SKRect(0, 0, (this as ISkiaSurface).Size.X, (this as ISkiaSurface).Size.Y), antialias: true); |
This was already wrong in CompositionVisualSurface.skia.cs before the merge; the PR is faithfully reproducing it, but the merge is a good opportunity to fix it. Fix this →
| private (Size availableSize, Size outSize, TextAlignment? alignment) _lastParsedTextCreationValues = (Size.Empty, Size.Empty, TextAlignment.Left); | ||
| internal IParsedText ParsedText { get; private set; } = Microsoft.UI.Xaml.Documents.ParsedText.Empty; | ||
|
|
||
| internal event Action? DrawingFinished; |
There was a problem hiding this comment.
event Action violation (AGENTS.md rule): Raw Action delegates as event fields bypass the standard add/remove contract. Per AGENTS.md: "NEVER declare event Action or event Action<T>". This was pre-existing in TextBlock.skia.cs; the merge into the base file is a good opportunity to correct it.
| internal event Action? DrawingFinished; | |
| internal event EventHandler? DrawingFinished; |
The subscriber in TextSelectionGripperPresenter.cs (_host.GripperTextSurface.DrawingFinished += () => …) would become += (_, _) => …. Fix this →
a00c201 to
10f9326
Compare
547d491 to
91c39d8
Compare
91c39d8 to
22e3f6e
Compare
Folding the Reference flavor into Skia left nine UI-layer projects with a single remaining flavor, making the .Skia file-name suffix inert. All nine already declare an explicit <AssemblyName> without .Skia, so the project file names had simply drifted from the assemblies they produce. Rename them to match, and follow through everywhere the project file name leaks into a path: BaseOutputPath is bin\$(MSBuildProjectName), so the build output folder moves with the rename. That covers 38 hardcoded nuspec <file src> paths across five packages, and the source-generator test helper that probes bin\<name>\<config>\<tfm> for reference assemblies. Uno.UI.Toolkit and Uno.UI.MSAL keep their .Skia name: they still have .Windows (and .netcoremobile) siblings, so there the suffix still distinguishes a real flavor. No shipped assembly name or package id changes. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_0116jGPPHhD4sJL6PfzN1XVp
Uno.UI, Uno.UI.Composition and Uno.UI.XamlHost each build from a single csproj with UnoRuntimeIdentifier=Skia across every TFM, so the .skia.cs suffix no longer selects anything: CrossTargetting only strips those files when the runtime identifier is not Skia. Fold each partial into its base file so one type lives in one file again. Mechanical merge, but not a rename — several things had to travel with the members rather than just the braces: - Base lists. Explicit interface implementations live on the skia half (CompositionVisualSurface : ISkiaSurface, TextBlock : IBlock, the Shapes hierarchy), so interfaces are merged into the base declaration. - Nullable context. Several skia partials enable #nullable only for scoped regions, so the moved members keep their original context via an explicit directive pair rather than inheriting the base file's. - Name resolution. Merging using directives can create ambiguity that neither file had alone: PointerPoint and GestureRecognizer in TextBlock, GeometryHelper in Polygon/Polyline. Those call sites are now qualified. - AnimatorFactory kept its `internal static` modifiers, which lived on the skia declaration only. Uno.UI.Composition linked Uno.UI's NonUniformCornerRadius halves as two explicit Compile items; the second is now redundant and removed. The remaining six files are left as-is for a follow-up: their braces, #region or #if spans cross the class boundary, or the two halves declare genuinely different types. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_0116jGPPHhD4sJL6PfzN1XVp
Finishes the suffix drop for the three Skia-only assemblies: - FrameworkElement, AcrylicBrush and UIElement merge now that the body is taken up to the closing brace character. Their classes end with an #endregion/#endif that sits in the brace's leading trivia, so stopping short of it orphaned the matching opener. - ViewExtensions.skia.cs declares Uno.UI.ViewExtensions, not the Uno.UI.Extensions.ViewExtensions of its same-named neighbour. Its real counterpart is ViewExtensions.crossruntime.cs, so it merges there. - DamageRegionExtensions, Visual.Damage and RetainedLayer have no base file at all and are plain renames. Image and DispatcherAnimator keep their suffix: their base files sit entirely inside #if branches that are false for the only project that compiles them, so merging would move live code into a branch that never builds. Collapsing those needs the dead branch removed first. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_0116jGPPHhD4sJL6PfzN1XVp
Both base files sit entirely inside a preprocessor branch that is false for Uno.UI: Image.cs is guarded by !IS_UNIT_TESTS && !UNO_REFERENCE_API and DispatcherAnimator.cs by !__SKIA__, while Uno.UI.csproj defines UNO_REFERENCE_API and __SKIA__ and never defines IS_UNIT_TESTS (Uno.UI.UnitTests consumes Uno.UI through a ProjectReference, so its constant does not reach these sources). Neither file contributed a line to any build. Drop the dead bases and promote the Skia implementations in their place, which is what those types actually compile to today. Isolated in its own commit: unlike the rest of the branch this deletes source rather than moving it, so it can be reverted on its own. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_0116jGPPHhD4sJL6PfzN1XVp
22e3f6e to
20153d2
Compare
|
Claude finished @MartinZikmund's task in 3m 24s —— View job Review complete
SummaryThe latest commit ( Findings by severity:
Verdict: fix-first — the three inline items (two carry-over, one new) should be resolved before merge. |
| using System.Linq; | ||
| using System.Security.Authentication.ExtendedProtection; |
There was a problem hiding this comment.
Spurious using (introduced by this commit): System.Security.Authentication.ExtendedProtection is HTTP channel-binding infrastructure — it has nothing to do with animation. It was promoted from DispatcherAnimator.skia.cs where it appears to have been accidentally added (likely an AI artifact).
The following four using directives on lines 2–6 are also all unused after the merge (the DispatcherTimer-based approach they served was dropped):
| using System.Security.Authentication.ExtendedProtection; | |
| using System; | |
| using Microsoft.UI.Dispatching; | |
| using Windows.UI.Core; |
Wait — actually those two are also unused. Here is the minimal correct set:
| using System.Security.Authentication.ExtendedProtection; | |
| using System; |
System.Diagnostics, System.Linq, System.Security.Authentication.ExtendedProtection, Microsoft.UI.Dispatching, and Windows.UI.Core are all unreferenced in the surviving 24-line body and will produce unused-import warnings on CI. Fix this →
WinAppSDK sync generator drift detected on
|
refactor(build): Drop .Skia naming from the UI layer
The drawing-backend merges re-split Ellipse/Line/Path/Polygon/Polyline/ Rectangle/Shape into base .cs + .skia.cs pairs that unoplatform#24001 (skianaming) had already folded into single files on master. Fold them back into one .cs per type, laid out like master, keeping the branch's neutral IGeometry/GeometryFactory/CompositionPath implementation in place of the old SkiaGeometrySource2D/SKPathBuilder bodies. Also removes the #if __NETSTD_REFERENCE__ MeasureOverride/ArrangeOverride stubs that unoplatform#23999 (referencedrop) and unoplatform#24020 (deadflavorguards) dropped and the merges brought back. Co-Authored-By: Claude Sonnet 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01XsQppKuZgijApgJxaTZt81
EllipseGeometry/Geometry/GeometryGroup/PathGeometry/RectangleGeometry were re-split into base .cs + .skia.cs pairs; unoplatform#24001 (skianaming) had already folded these on master. Fold back into one .cs per type, keeping the branch's neutral IGeometry/GeometryFactory implementation in place of the old SKPath/SKPathBuilder bodies. Also removes the #if __NETSTD_REFERENCE__ guard-drop reverts from unoplatform#23999 (referencedrop) that the merges brought back. NonUniformCornerRadius.GetRadii(SKPoint*) from unoplatform#23999/unoplatform#24020 is not restored: BorderVisual.skia.cs already builds rounded-rect geometry straight from the Vector2 corner fields (AddRoundedRectangle), so the unsafe pointer adapter has no remaining caller under the branch design. LineGeometry.cs was left untouched: its only difference from master is the intentional GetGeometry()/IGeometry neutral-seam rewrite. Co-Authored-By: Claude Sonnet 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01XsQppKuZgijApgJxaTZt81
The merges re-split Inline.skia.cs/Run.skia.cs out of the base files and brought back the __NETSTD_REFERENCE__ block unoplatform#23999/unoplatform#24020 removed. Folded back into master's layout, keeping the neutral IFont members. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01XsQppKuZgijApgJxaTZt81
…tform#23619/unoplatform#23671/unoplatform#24020/unoplatform#23999 Fold Application.skia.cs and Application.reference.cs back into Application.cs (unoplatform#24001 skianaming), fix the Lauched->Launched typo (unoplatform#23619), keep the branch's __SKIA__-only ALC window teardown (unoplatform#23671 was WASM+Skia but native heads are gone), and drop the dead UNO_HAS_ENHANCED_LIFECYCLE/__NETSTD_REFERENCE__ guards (unoplatform#24020/unoplatform#23999). Application.reference.cs is dead code in the Skia-only build and is removed, matching master. Co-Authored-By: Claude Sonnet 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01XsQppKuZgijApgJxaTZt81
…m#23999/unoplatform#23671 Image.cs still carried the pre-unoplatform#24001 #if-split legacy download/URI pipeline (dead since the Subscribe/ImageData reactive pipeline replaced it) while the neutral rendering lived in the resurrected Image.skia.cs. Fold that neutral rendering into Image.cs, matching master's structure, and drop the legacy members master already removed (OnImageFailed/OnImageOpened/TraceProvider/ToString/etc. - their behavior now lives in BitmapImage/SvgImageSource raising the events directly). Co-Authored-By: Claude Sonnet 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01XsQppKuZgijApgJxaTZt81
…platform#23999 Fold the resurrected AcrylicBrush.skia.cs (the branch's neutral material-brush + composition-effect rendering) back into AcrylicBrush.cs, matching master's single-file layout without reintroducing the SkiaSharp/SkiaAcrylicBrush types the branch already replaced with AcrylicMaterialBrush/ITexture. Co-Authored-By: Claude Sonnet 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01XsQppKuZgijApgJxaTZt81
…orm#23978/unoplatform#23660 Fold BitmapImage, BitmapSource, RenderTargetBitmap, SvgImageSource, WriteableBitmap and LoadedImageSurface's resurrected .skia.cs partials back into their base .cs files, matching master's single-file layout while keeping the branch's neutral CompositionImageSurface/ITexture types. Also restore the IsMsAppx/NormalizeMsResourceFilesUri call in LoadedImageSurface.StartLoadFromUri that unoplatform#23978 added and the merge dropped (BitmapImage/BitmapSource already had it). RenderTargetBitmap keeps the branch's CPU-raster RenderOffscreen/SnapshotAsync path rather than porting master's GRContext-based async picture-replay, since that mechanism is Skia/GRContext-specific and can't exist in SkiaSharp-free Uno.UI; see report for follow-up. Co-Authored-By: Claude Sonnet 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01XsQppKuZgijApgJxaTZt81
…orm#24001 Master folded this file to its cross-platform name; the merge brought the .skia.cs name back. Pure rename, the content is the branch's. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01XsQppKuZgijApgJxaTZt81
The unoplatform#24001 fold-back carried tab-indented blank lines over from the re-split partial; master's file has none. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01XsQppKuZgijApgJxaTZt81
GitHub Issue: part of #8339
PR Type:
🔄 Refactoring (no functional changes, no api changes)
What changed? 🚀
Follow-up to #23999. Folding the Reference flavor into Skia left the UI layer carrying
.Skianaming that no longer distinguishes anything, so this drops it in both places it appears.1. Project files
Nine projects now have a single flavor, which makes the
.Skiafile-name suffix inert:Uno.UI·Uno.UI.Composition·Uno.UI.FluentTheme{,.v1,.v2}·Uno.UI.XamlHost·Uno.UI.RemoteControl·Uno.UI.Lottie·Uno.UI.SvgAll nine already declared an explicit
<AssemblyName>without.Skia, so the file names had simply drifted from the assemblies they produce. No shipped assembly name or package id changes.The rename is not self-contained, because
BaseOutputPathisbin\$(MSBuildProjectName)— the build output directory moves with the project file. Following that through:<file src>paths across five nuspecs (Uno.WinUI,.DevServer,.Lottie,.Svg,.XamlHost). Missing these would have silently produced packages with missing assemblies.UnoAssemblyHelperin the source-generator tests, which probesbin\<name>\<config>\<tfm>for reference assemblies.Uno.UI.ToolkitandUno.UI.MSALkeep.Skia: they still have real.Windows(and.netcoremobile) siblings, so there the suffix still selects something.2.
.skia.cspartialsAll 99
.skia.csfiles in the three Skia-only assemblies are gone — 96 merged into their base file, 3 plain renames. Those assemblies each build from one csproj withUnoRuntimeIdentifier=Skiaacross every TFM, andUno.CrossTargetting.targetsonly strips**\*.skia.cswhen the runtime identifier is not Skia, so the suffix selected nothing.This was mechanical but not a rename — several things had to travel with the members:
CompositionVisualSurface : ISkiaSurface,TextBlock : IBlock, ITextSelectionGripperHost, theShapeshierarchy), so interfaces are merged into the surviving declaration.#nullableonly for scoped regions. Moved members keep their original context via an explicit directive pair instead of silently inheriting the base file's.PointerPointandGestureRecognizerinTextBlock,GeometryHelperinPolygon/Polyline. Those call sites are now qualified to the type the skia half resolved to.AnimatorFactorykept itsinternal static, which lived only on the skia declaration.AcrylicBrush,UIElementandFrameworkElementend with an#endregion/#endifthat closes a directive opened inside the class body, so the merge had to carry it.ViewExtensions.skia.csdeclaresUno.UI.ViewExtensions, not theUno.UI.Extensions.ViewExtensionsof its same-named neighbour; its real counterpart isViewExtensions.crossruntime.cs.Uno.UI.Compositionlinked both halves ofUno.UI'sNonUniformCornerRadiusas explicitCompileitems; the second is now redundant.Deliberately not merged: the 51
.skia.csunderUno.UWP(46),Uno.UI.RuntimeTests(2),Uno.Foundation(1),Uno.UI.Dispatching(1) andSamplesApp(1). Those folders are compiled by two to four flavors each (Reference/Wasm/netcoremobile/Windows), so the suffix still drives compilation there — merging would compile Skia-only code into the Windows and WebAssembly builds.3. One commit that deletes rather than moves
The last commit replaces
Image.csandDispatcherAnimator.cs, whose entire contents sit inside#ifbranches that are false forUno.UI(!IS_UNIT_TESTS && !UNO_REFERENCE_APIand!__SKIA__respectively;Uno.UI.UnitTestsconsumes Uno.UI through aProjectReference, so its constant never reaches these sources). Neither file contributed a line to any build. It is isolated so it can be reverted on its own if you would rather it went with the dead-#ifsweep.PR Checklist ✅
Screenshots Compare Test Runresults.Validation
Uno.UI,Uno.UI.Composition,Uno.UI.XamlHostand each of the nine renamed projects plusUno.UI.Toolkit.SkiaandUno.UI.UnitTests— 0 warnings, 0 errors.UnoAssemblyHelperpath not been updated, every test would have failed to locate the reference assemblies.Uno.UI-Skia-only.slnfcould not be built locally —Uno.UI.RemoteControl.TestProcessorrequires a .NET 11 SDK. Confirmed the identical failure on the parent branch, so it is pre-existing and unrelated; CI covers it.🤖 Generated with Claude Code