Skip to content

fix(skia): Scope the native-element clip cache to its composition target - #24123

Merged
MartinZikmund merged 3 commits into
masterfrom
dev/mazi/clip-path-per-target
Nov 10, 2026
Merged

MartinZikmund merged 3 commits into
masterfrom
dev/mazi/clip-path-per-target

Conversation

@MartinZikmund

Copy link
Copy Markdown
Member

GitHub Issue: closes #24122

PR Type:

🐞 Bugfix

What changed? 🚀

_lastNativeClipPath and _lastScaledNativeClipPath in CompositionTarget.Rendering.skia.cs are static, but everything about them is per-composition-target — i.e. per window:

  • they are invalidated by a per-target event: a canvas recreation nulls the scaled path (:304);
  • they are keyed on this target's frame: _lastNativeClipPath != lastRenderedFrame.nativeElementClipPath (:348);
  • their immediate neighbours under the same comment, _lastCanvasSize and _lastRasterizationScale, are already instance fields.

So with more than one window open the two targets discard and overwrite each other's cache every frame, and the scaled path handed to the native clipping layer at :359 can belong to the wrong window. On the hosts that render each window on its own thread (Win32, X11, and macOS once #23594 lands) it is additionally a plain data race on the SKPath: one thread can be at _lastScaledNativeClipPath = new() (:350) while another transforms into it (:354) or returns it (:359).

This change makes both fields instance fields. Three lines, plus a comment recording why they must not be static.

PR Checklist ✅

  • 🧪 Added Runtime tests, UI tests, or a manual test sample (for bug fixes / features, if applicable) — no, see Testing below.
  • 📚 Docs have been added/updated following the documentation template (for bug fixes / features) — n/a, private field scope, no API or documented behaviour change.
  • 🖼️ Validated PR Screenshots Compare Test Run results. — pending CI.
  • ❗ Contains NO breaking changes
  • 👀 Reviewed 2 other open pull requests (optional but appreciated!)

Testing

Why there is no automated test. The defect is only observable with two windows each hosting native elements with different clip geometry, and the corrupted value is a private SKPath consumed by platform-native clipping (uno_window_clip_svg on macOS). There is no managed surface to assert against, and the race is timing-dependent. A test here would be an expensive approximation that does not actually pin the invariant; the field scope itself is the invariant.

What was verified. Local A/B on the same machine, same 480-test slice (UITEST_RUNTIME_TEST_GROUP=0, COUNT=20), macOS Skia:

build wall clock passed / failed
master (static) 72.6 s 479 / 1
this PR (instance) 74.4 s 479 / 1

Identical outcomes; the difference is run-to-run noise. That is the expected result and is itself the safety argument: with a single window there is one composition target, so instance and static are behaviourally identical. The change can only differ where the bug is — two or more windows.

The single failure (Given_ResourceLoader.When_MissingLocalizedResource_FallbackOnDefault) is pre-existing and present on both sides.

Compiles clean for Skia desktop (SamplesApp.Skia.Generic, net10.0).

🤖 Generated with Claude Code

https://claude.ai/code/session_01K297hJpRGEufnFFqS7pZh9

Copilot AI lite review requested due to automatic review settings August 19, 2026 08:46
@github-actions github-actions Bot added the area/skia ✏️ Categorizes an issue or PR as relevant to Skia label Aug 19, 2026
@github-actions

github-actions Bot commented Aug 19, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @MartinZikmund's task in 1m 49s —— View job


Review: fix(skia): Scope the native-element clip cache to its composition target

  • Gather context and read the changed file
  • Review diff for correctness, style, and coverage
  • Post inline findings
  • Update summary

Verdict: ✅ Ship (1 nit)

The fix is correct and minimal. _lastNativeClipPath and _lastScaledNativeClipPath were incorrectly declared static in a class that has one instance per composition target (per window). Making them instance fields is exactly the right root-cause fix — it eliminates both the cross-window cache corruption and the data race on SKPath in multi-threaded hosts.

Checklist pass:

  • Root-cause fix, not a symptom guard ✓
  • Correctly scoped to .skia.cs ✓
  • No API or public surface change ✓
  • Conventional Commits title (fix(skia): …) ✓
  • No new warnings, no #pragma suppression ✓
  • No event Action or event Action<T> introduced ✓
  • Test omission is justified: the defect only manifests with two windows hosting native elements with different clip geometry, and the corrupted value is a private SKPath consumed by platform-native clipping — there is no managed assertion surface ✓

Findings: 1 nit (inline) — the new comment has a missing word ("All four cache" → "All four fields cache") and conflates all four fields with the two that were actually static. Suggestion posted inline.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a Skia multi-window correctness/concurrency issue by scoping the native-element clip path cache to each CompositionTarget (i.e. per window) instead of sharing it process-wide via static fields.

Changes:

  • Convert _lastNativeClipPath and _lastScaledNativeClipPath from static to instance fields.
  • Expand the in-code comment to document why the cache must be per-target (cross-window corruption + potential data race on multi-threaded hosts).

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

@nventive-devops

Copy link
Copy Markdown
Contributor

The build 228599 found UI Test snapshots differences: skia-linux-screenshots: 57, skia-windows-screenshots: 2348, wasm: 11

Details
  • skia-linux-screenshots: 57 changed over 2348

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • Examples.png-dark
    • Examples.png
    • ExpanderColorValidationPage.png-dark
    • ExpanderColorValidationPage.png
    • ButtonClippingTestsControl.png-dark
    • ButtonClippingTestsControl.png
    • Buttons.png-dark
    • Buttons.png
    • DropDownButtonPage.png-dark
    • DropDownButtonPage.png
    • ClipboardTests.png-dark
    • CalendarView_Theming.png-dark
    • CalendarView_Theming.png
    • ElementLevelTheme.png-dark
    • ElementLevelTheme.png
    • Focus_FocusVisual_Properties.png-dark
    • Gamepad_CurrentReading.png-dark
    • Gamepad_CurrentReading.png
    • Gamepad_Enumeration.png-dark
    • Gamepad_Enumeration.png
  • skia-windows-screenshots: 2348 changed over 2396

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • AndroidWindowInsets.png-dark
    • AppBarButtonTest.png
    • AppBar_KeyBoard.png-dark
    • AnimatedIconPage.png-dark
    • AppXamlDefinedResources.png
    • AppWindowFeatures.png-dark
    • AppWindowClosing.png-dark
    • ApplicationViewSizing.png-dark
    • AutoBorderStretchwithleftmargin.png
    • ArcSegment.png
    • AppWindowPresenters.png-dark
    • Arrange_Performance01.png-dark
    • AutoSizedTopLeft.png-dark
    • AutomationPropertiesExtensions_Role.png
    • Attributed_text_Simple.png-dark
    • AutoBorderStretchwithtopmargin.png-dark
    • AutoSuggestBox_Reason.png-dark
    • BadgeNotificationTests.png-dark
    • AutoBorderStretchwithtopmargin.png
    • AutoSizedTopLeft.png
  • wasm: 11 changed over 1076

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • UITests.Microsoft_UI_Xaml_Controls.WebView2Tests.WebView2_NavigationProperties
    • UITests.Windows_UI_Xaml_Media_Animation.ColorAnimation_Background
    • SamplesApp.Windows_UI_Xaml_Controls.ListView.ListViewSelectedItems
    • UITests.Windows_UI_Xaml_Controls.CalendarView.CalendarView_Theming
    • UITests.Uno_Web.Http.CookieManagerTests
    • UITests.Shared.Windows_UI_Xaml_Controls.MediaPlayerElement.MediaPlayerElement_Minimal
    • UITests.Shared.Windows_UI_Xaml_Controls.MediaPlayerElement.MediaPlayerElement_Ogg_Extension
    • Uno.UI.Samples.Content.UITests.WebView.WebView_AnchorNavigation
    • SamplesApp.Wasm.Windows_UI_Xaml_Controls.ListView.ListView_IsSelected
    • SamplesApp.Microsoft_UI_Xaml_Controls.WebView2Tests.WebView2_EnableDevTools
    • UITests.Shared.Microsoft_UI_Xaml_Controls.ExpanderTests.WinUIExpanderPage

Copilot AI review requested due to automatic review settings August 20, 2026 12:56
@MartinZikmund
MartinZikmund force-pushed the dev/mazi/clip-path-per-target branch from 62f15a3 to ac5d6ae Compare August 20, 2026 12:56
@github-actions

github-actions Bot commented Aug 20, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @MartinZikmund's task in 2m 7s —— View job


Review: fix(skia): Scope the native-element clip cache to its composition target

  • Gather context
  • Read changed file and diff
  • Review for correctness, style, and coverage
  • Post inline findings
  • Update summary

Verdict: ✅ Ship (1 nit)

The fix is correct and minimal. _lastNativeClipPath and _lastScaledNativeClipPath were incorrectly static in a class with one instance per composition target (per window). Making them instance fields is the right root-cause fix — it eliminates both the cross-window cache corruption and the data race on SKPath in multi-threaded hosts.

Checklist pass:

  • Root-cause fix, not a symptom guard ✓
  • Correctly scoped to .skia.cs ✓
  • No API or public surface change ✓
  • Conventional Commits title (fix(skia): …) ✓
  • No new warnings introduced ✓
  • No event Action / event Action<T> introduced ✓
  • _emptyPath remains correctly static readonly — it's a shared sentinel, not per-target state ✓
  • Test omission is justified: the defect only manifests with two windows hosting native elements with different clip geometry, and the corrupted value is a private SKPath consumed by platform-native clipping — there is no managed assertion surface ✓

Findings: 1 nit (inline) — the comment still says "All four cache … must not be static" but only the two SKPath fields were incorrectly static; _lastCanvasSize and _lastRasterizationScale were already instance fields. "All four" also reads as a missing noun. Suggestion posted inline.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

@unodevops

Copy link
Copy Markdown
Contributor

@nventive-devops

Copy link
Copy Markdown
Contributor

The build 228903 found UI Test snapshots differences: skia-linux-screenshots: 57, skia-windows-screenshots: 2348, wasm: 11

Details
  • skia-linux-screenshots: 57 changed over 2348

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • ButtonClippingTestsControl.png-dark
    • ButtonClippingTestsControl.png
    • Buttons.png-dark
    • Buttons.png
    • DropDownButtonPage.png-dark
    • DropDownButtonPage.png
    • Focus_FocusVisual_Properties.png-dark
    • CalendarView_Theming.png-dark
    • CalendarView_Theming.png
    • ContextRequested.png-dark
    • ContextRequested.png
    • ImageIconPage.png-dark
    • ClipboardTests.png-dark
    • Examples.png-dark
    • Examples.png
    • ExpanderColorValidationPage.png-dark
    • ExpanderColorValidationPage.png
    • Gamepad_CurrentReading.png-dark
    • Gamepad_CurrentReading.png
    • Gamepad_Enumeration.png-dark
  • skia-windows-screenshots: 2348 changed over 2396

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • AppBar_KeyBoard.png
    • ApplicationViewMode.png
    • Accessibility_ScreenReader.png
    • AnimatedIconPage.png-dark
    • AppBarButtonTest.png-dark
    • AppBarButtonWithIconTest.png-dark
    • AppBarToggleButtonTest.png
    • AppWindowFeatures.png
    • AppWindowPositionAndSize.png-dark
    • Attributed_text_Supserscript.png
    • ApplicationViewSizing.png
    • ApplicationViewSpanningRectsPage.png-dark
    • Arrange_Performance01.png-dark
    • AppWindowFeatures.png-dark
    • Attributed_text_FontSize_Changing.png
    • AppWindowTitleBar Properties.png
    • AutoSuggestBox_Icons.png
    • AppWindowPositionAndSize.png
    • Arrange_Performance01.png
    • AutoBorderStretchwithbottommargin.png
  • wasm: 11 changed over 1076

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • UITests.Windows_UI_Xaml_Media_Animation.ColorAnimation_Background
    • UITests.Microsoft_UI_Xaml_Controls.WebView2Tests.WebView2_NavigationProperties
    • UITests.Windows_UI_Xaml_Controls.CalendarView.CalendarView_Theming
    • UITests.Shared.Windows_UI_Xaml_Controls.MediaPlayerElement.MediaPlayerElement_Minimal
    • UITests.Shared.Microsoft_UI_Xaml_Controls.ExpanderTests.WinUIExpanderPage
    • SamplesApp.Wasm.Windows_UI_Xaml_Controls.ListView.ListView_IsSelected
    • Uno.UI.Samples.Content.UITests.WebView.WebView_AnchorNavigation
    • SamplesApp.Microsoft_UI_Xaml_Controls.WebView2Tests.WebView2_EnableDevTools
    • SamplesApp.Windows_UI_Xaml_Controls.ListView.ListViewSelectedItems
    • UITests.Uno_Web.Http.CookieManagerTests
    • UITests.Shared.Windows_UI_Xaml_Controls.MediaPlayerElement.MediaPlayerElement_Ogg_Extension

@github-actions

github-actions Bot commented Aug 20, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @MartinZikmund's task in 1m 22s —— View job


Review: fix(skia): Scope the native-element clip cache to its composition target

  • Gather context
  • Read changed file and diff
  • Review for correctness, style, and coverage
  • Post inline findings
  • Update summary

Verdict: ✅ Ship (1 persistent nit)

The fix is correct and minimal. _lastNativeClipPath and _lastScaledNativeClipPath were incorrectly static in a class with one instance per composition target (per window). Making them instance fields is the right root-cause fix — it eliminates both the cross-window cache corruption and the data race on SKPath in multi-threaded hosts (Win32, X11, macOS with per-window threads).

Checklist pass:

  • Root-cause fix, not a symptom guard ✓
  • Correctly scoped to .skia.cs ✓
  • No API or public surface change ✓
  • Conventional Commits title (fix(skia): …) ✓
  • No new warnings introduced ✓
  • No event Action / event Action<T> introduced ✓
  • _emptyPath correctly remains static readonly — it's a shared sentinel, not per-target state ✓
  • _lastCanvasSize and _lastRasterizationScale correctly remain instance fields (unchanged) ✓
  • Test omission is justified: defect only manifests with two windows hosting native elements with different clip geometry; the corrupted value is a private SKPath consumed by platform-native clipping — no managed assertion surface ✓

Findings: 1 nit (inline, flagged a third time) — the comment still says "All four cache … must not be static", but only the two SKPath fields were incorrectly static; _lastCanvasSize and _lastRasterizationScale were already instance fields. "All four" also reads as a missing noun. Suggestion posted inline.

@unodevops

Copy link
Copy Markdown
Contributor

@nventive-devops

Copy link
Copy Markdown
Contributor

The build 229011 found UI Test snapshots differences: skia-linux-screenshots: 57, skia-windows-screenshots: 2348, wasm: 11

Details
  • skia-linux-screenshots: 57 changed over 2348

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • ButtonClippingTestsControl.png-dark
    • ButtonClippingTestsControl.png
    • ClipboardTests.png-dark
    • Examples.png-dark
    • Examples.png
    • ExpanderColorValidationPage.png-dark
    • ExpanderColorValidationPage.png
    • Focus_FocusVisual_Properties.png-dark
    • ImageIconPage.png-dark
    • DropDownButtonPage.png-dark
    • DropDownButtonPage.png
    • Gamepad_CurrentReading.png-dark
    • Gamepad_CurrentReading.png
    • Gamepad_Enumeration.png-dark
    • Gamepad_Enumeration.png
    • Buttons.png-dark
    • Buttons.png
    • ContextRequested.png-dark
    • ContextRequested.png
    • CalendarView_Theming.png-dark
  • skia-windows-screenshots: 2348 changed over 2396

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • AppBarToggleButtonTest.png-dark
    • ApplicationViewMode.png-dark
    • AppBarButtonWithIconTest.png-dark
    • AppWindowPresenters.png-dark
    • AppWindowTitleBar Properties.png
    • AppWindowFeatures.png
    • Attributed_text_FontSize_Changing.png
    • AutoBorderStretchwithleftmargin.png-dark
    • Attributed_text_Simple.png-dark
    • AutoSuggestBox_Reason.png-dark
    • AutoSizedTopLeft.png-dark
    • AutoBorderStretchwithleftmargin.png
    • BasicAutoSuggestBox.png-dark
    • AutoSuggestBox_SoftKeboard.png
    • AutoSizedTopLeft.png
    • Battery.png-dark
    • BasicThemeResources.png
    • BadgeNotificationTests.png
    • BenchmarkDotNet.png-dark
    • BitmapImage_vs_SvgImageSource.png-dark
  • wasm: 11 changed over 1076

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • UITests.Shared.Windows_UI_Xaml_Controls.MediaPlayerElement.MediaPlayerElement_Ogg_Extension
    • UITests.Windows_UI_Xaml_Controls.CalendarView.CalendarView_Theming
    • UITests.Windows_UI_Xaml_Media_Animation.ColorAnimation_Background
    • UITests.Shared.Windows_UI_Xaml_Controls.MediaPlayerElement.MediaPlayerElement_Minimal
    • UITests.Microsoft_UI_Xaml_Controls.WebView2Tests.WebView2_NavigationProperties
    • UITests.Uno_Web.Http.CookieManagerTests
    • UITests.Shared.Microsoft_UI_Xaml_Controls.ExpanderTests.WinUIExpanderPage
    • SamplesApp.Wasm.Windows_UI_Xaml_Controls.ListView.ListView_IsSelected
    • SamplesApp.Windows_UI_Xaml_Controls.ListView.ListViewSelectedItems
    • SamplesApp.Microsoft_UI_Xaml_Controls.WebView2Tests.WebView2_EnableDevTools
    • Uno.UI.Samples.Content.UITests.WebView.WebView_AnchorNavigation

Copilot AI review requested due to automatic review settings August 22, 2026 09:47
@MartinZikmund
MartinZikmund force-pushed the dev/mazi/clip-path-per-target branch from df2ea40 to 5279ba3 Compare August 22, 2026 09:47
@github-actions

github-actions Bot commented Aug 22, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @MartinZikmund's task in 1m 6s —— View job


Review: fix(skia): Scope the native-element clip cache to its composition target

  • Gather context and read the changed file
  • Review diff for correctness, style, and coverage
  • Post inline findings
  • Update summary

Verdict: ✅ Ship (1 persistent nit)

The fix is correct and minimal. The chore: Retrigger CI commit did not change the code — the substantive fix (making _lastNativeClipPath and _lastScaledNativeClipPath instance fields) is sound. Both the cross-window cache corruption and the data race on SKPath in multi-threaded hosts (Win32, X11, macOS with per-window threads) are properly addressed.

Checklist pass:

  • Root-cause fix, not a symptom guard ✓
  • Correctly scoped to .skia.cs ✓
  • No API or public surface change ✓
  • Conventional Commits title (fix(skia): …) ✓
  • No new warnings introduced ✓
  • No event Action / event Action<T> introduced ✓
  • _emptyPath correctly remains static readonly — shared sentinel, not per-target state ✓
  • _lastCanvasSize and _lastRasterizationScale correctly remain instance fields (unchanged) ✓
  • Test omission justified: defect requires two windows with different native-element clip geometry; the corrupted value is a private SKPath consumed by platform-native clipping — no managed assertion surface ✓

Findings: 1 nit (inline, flagged for the fourth time) — the comment "All four cache…" has a missing noun and is factually wrong: _lastCanvasSize and _lastRasterizationScale were already instance fields before this PR; only the two SKPath fields were incorrectly static. Suggestion posted inline.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

@unodevops

Copy link
Copy Markdown
Contributor

@MartinZikmund
MartinZikmund changed the base branch from master to feature/breakingchanges August 22, 2026 14:39
@MartinZikmund
MartinZikmund force-pushed the dev/mazi/clip-path-per-target branch from 5279ba3 to 7431e66 Compare August 22, 2026 14:39
@github-actions

github-actions Bot commented Aug 22, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @MartinZikmund's task in 3m 0s —— View job


Review: fix(skia): Scope the native-element clip cache to its composition target

  • Gather context
  • Read changed file and diff
  • Review for correctness, style, and coverage
  • Post inline findings (if any)
  • Update summary

Verdict: ✅ Ship (1 persistent nit)

The fix is correct and minimal. _lastNativeClipPath and _lastScaledNativeClipPath were incorrectly static in a class with one instance per composition target (per window). Making them instance fields is the right root-cause fix — it eliminates both the cross-window cache corruption and the data race on SKPath in multi-threaded hosts (Win32, X11, macOS with per-window threads).

Checklist pass:

  • Root-cause fix, not a symptom guard ✓
  • No API or public surface change ✓
  • Conventional Commits title (fix(skia): …) ✓
  • No new warnings introduced ✓
  • No event Action / event Action<T> introduced ✓
  • _emptyPath correctly remains static readonly — shared sentinel, not per-target state ✓
  • _lastCanvasSize and _lastRasterizationScale correctly remain instance fields (unchanged) ✓
  • Test omission justified: defect requires two windows with different native-element clip geometry; the corrupted value is a private SKPath consumed by platform-native clipping — no managed assertion surface ✓

Findings: 1 nit (inline, flagged for the fifth time) — the comment "All four cache…" has a missing noun and is factually wrong: _lastCanvasSize and _lastRasterizationScale were already instance fields before this PR; only the two SKPath fields were incorrectly static. Suggestion posted inline.

@unodevops

Copy link
Copy Markdown
Contributor

@unodevops

Copy link
Copy Markdown
Contributor

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

@nventive-devops

Copy link
Copy Markdown
Contributor

The build 229480 found UI Test snapshots differences: skia-linux-screenshots: 73, skia-windows-screenshots: 178

Details
  • skia-linux-screenshots: 73 changed over 2366

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • Buttons.png
    • Gamepad_CurrentReading.png-dark
    • Gamepad_CurrentReading.png
    • Gamepad_Enumeration.png-dark
    • ClipboardTests.png-dark
    • ClipboardTests.png
    • ContentControl_Inheritance.png
    • CalendarView_Theming.png-dark
    • Examples.png
    • Image_Margin_Large.png
    • ExpanderColorValidationPage.png-dark
    • ExpanderColorValidationPage.png
    • ImageBrushInList.png-dark
    • ImageBrushInList.png
    • DisplayInformation.png-dark
    • DisplayInformation.png
    • ImageBrush_Stretch.png
    • ButtonClippingTestsControl.png-dark
    • ButtonClippingTestsControl.png
    • ContextRequested.png-dark
  • skia-windows-screenshots: 178 changed over 2368

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • Basics Pivot Test.png-dark
    • DoubleAnimation_VisualStates.png-dark
    • DoubleAnimation_VisualStates.png
    • ChatBox.png-dark
    • ChatBox.png
    • ColorPickerSample.png
    • ContentPresenter_Template.png-dark
    • ContentPresenter_Template.png
    • EllipsemaskingEllipseGrid.png-dark
    • CalendarView_Theming.png-dark
    • CalendarView_Theming.png
    • Attributed_text_FontSize_Changing.png-dark
    • Gamepad_CurrentReading.png-dark
    • Gamepad_Enumeration.png-dark
    • ImageBrushInList.png-dark
    • ImageBrushInList.png
    • DataTemplate_Update_Sample.png-dark
    • DataTemplate_Update_Sample.png
    • ExpanderColorValidationPage.png-dark
    • Focus_FocusState.png-dark

@MartinZikmund
MartinZikmund force-pushed the dev/mazi/clip-path-per-target branch from 7431e66 to de46291 Compare August 29, 2026 10:11
@github-actions

github-actions Bot commented Aug 29, 2026 •

Copy link
Copy Markdown
Contributor

Claude encountered an error after 0s —— View job


I'll analyze this and get back to you.

@unodevops

Copy link
Copy Markdown
Contributor

@nventive-devops

Copy link
Copy Markdown
Contributor

The build 231000 found UI Test snapshots differences: skia-linux-screenshots: 73, skia-windows-screenshots: 231

Details
  • skia-linux-screenshots: 73 changed over 2366

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • Buttons.png
    • ContentControl_Inheritance.png
    • ButtonClippingTestsControl.png-dark
    • DynamicFont.png
    • Examples.png
    • ImageIconPage.png-dark
    • ImageIconPage.png
    • Attributed_text_FontSize_Changing.png
    • ButtonClippingTestsControl.png
    • CalendarView_Theming.png-dark
    • ContextRequested.png-dark
    • DisplayInformation.png-dark
    • DisplayInformation.png
    • Gamepad_CurrentReading.png-dark
    • Gamepad_CurrentReading.png
    • Gamepad_Enumeration.png-dark
    • Focus_FocusVisual_Properties.png-dark
    • DropDownButtonPage.png-dark
    • ExpanderColorValidationPage.png-dark
    • ExpanderColorValidationPage.png
  • skia-windows-screenshots: 231 changed over 2368

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • BitmapImage_vs_SvgImageSource.png
    • CalendarView_Theming.png-dark
    • CalendarView_Theming.png
    • DoubleImageBrushInList.png-dark
    • DoubleImageBrushInList.png
    • Focus_FocusVisual_Properties.png-dark
    • Focus_FocusVisual_Properties.png
    • Hyperlink_Button.png-dark
    • Hyperlink_Button.png
    • Hyperlink_CanExecute_False.png-dark
    • Hyperlink_CanExecute_False.png
    • ImageAlignment2541.png-dark
    • ImageAlignment2541.png
    • DropDownButtonPage.png-dark
    • DropDownButtonPage.png
    • GetFocus.png-dark
    • GetFocus.png
    • Grid_ScrollViewer.png-dark
    • Grid_ScrollViewer.png
    • ImageIconPage.png-dark

@MartinZikmund
MartinZikmund changed the base branch from feature/breakingchanges to master September 2, 2026 20:02
@unodevops

Copy link
Copy Markdown
Contributor

@nventive-devops

Copy link
Copy Markdown
Contributor

The build 231684 found UI Test snapshots differences: skia-linux-screenshots: 57, skia-windows-screenshots: 2310, wasm: 11

Details
  • skia-linux-screenshots: 57 changed over 2348

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • DisplayInformation.png-dark
    • ClipboardTests.png-dark
    • ButtonClippingTestsControl.png-dark
    • ButtonClippingTestsControl.png
    • CalendarView_Theming.png-dark
    • CalendarView_Theming.png
    • Examples.png-dark
    • Examples.png
    • ExpanderColorValidationPage.png-dark
    • ExpanderColorValidationPage.png
    • Focus_FocusVisual_Properties.png-dark
    • ContextRequested.png-dark
    • ContextRequested.png
    • Gamepad_CurrentReading.png-dark
    • Gamepad_CurrentReading.png
    • Gamepad_Enumeration.png-dark
    • Gamepad_Enumeration.png
    • DropDownButtonPage.png-dark
    • DropDownButtonPage.png
    • ElementLevelTheme.png-dark
  • skia-windows-screenshots: 2310 changed over 2402

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • AppBarToggleButtonTest.png-dark
    • AppWindowPositionAndSize.png-dark
    • AppWindowTitleBar Properties.png
    • AuthenticationBroker_Demo.png
    • AutomationProperties_Name.png
    • AutoSuggestBox_Reason.png
    • BasicAutoSuggestBox.png
    • Basics Pivot Test.png-dark
    • Battery.png
    • BeginTime_MultipleAnimations.png-dark
    • BorderBottomwithmargins.png-dark
    • BorderBottomwithmargins.png
    • Border_BorderThickness.png-dark
    • Border_BorderThickness.png
    • Border_Corner_Overlap.png-dark
    • Border_Corner_Overlap.png
    • Border_With_TranslateTransform.png
    • BreadcrumbBarPage.png-dark
    • Button_Enabled_Control_Disabled.png-dark
    • Button_Enabled_Control_Disabled.png
  • wasm: 11 changed over 1076

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • SamplesApp.Windows_UI_Xaml_Controls.ListView.ListViewSelectedItems
    • UITests.Windows_UI_Xaml_Media_Animation.ColorAnimation_Background
    • SamplesApp.Wasm.Windows_UI_Xaml_Controls.ListView.ListView_IsSelected
    • UITests.Shared.Microsoft_UI_Xaml_Controls.ExpanderTests.WinUIExpanderPage
    • UITests.Microsoft_UI_Xaml_Controls.WebView2Tests.WebView2_NavigationProperties
    • UITests.Shared.Windows_UI_Xaml_Controls.MediaPlayerElement.MediaPlayerElement_Ogg_Extension
    • UITests.Shared.Windows_UI_Xaml_Controls.MediaPlayerElement.MediaPlayerElement_Minimal
    • SamplesApp.Microsoft_UI_Xaml_Controls.WebView2Tests.WebView2_EnableDevTools
    • UITests.Windows_UI_Xaml_Controls.CalendarView.CalendarView_Theming
    • UITests.Uno_Web.Http.CookieManagerTests
    • Uno.UI.Samples.Content.UITests.WebView.WebView_AnchorNavigation

@morning4coffe-dev morning4coffe-dev left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code review assessment: both path caches are keyed/invalidated by per-composition-target size, scale, and frame state, so instance ownership is the correct fix for cross-window interference and concurrent access. The two existing size/scale fields were already instance fields. No blocking issue found; repeated comment-wording nits do not invalidate the ownership correction. This is an Uno/Skia cache implementation detail, not a literal WinUI SKPath port.

_lastNativeClipPath and _lastScaledNativeClipPath are static, but everything
about them is per-composition-target — i.e. per window:

  - they are invalidated by a per-target event (a canvas recreation at
    CompositionTarget.Rendering.skia.cs:304 nulls the scaled path),
  - they are keyed on this target's own frame
    (_lastNativeClipPath != lastRenderedFrame.nativeElementClipPath at :348),
  - and their immediate neighbours, _lastCanvasSize and _lastRasterizationScale,
    are already instance fields under the same comment.

So with more than one window open the two targets discard and overwrite each
other's cache every frame, and the scaled path handed to the native layer can
belong to the wrong window. On the hosts that render each window on its own
thread it is also a plain data race on the SKPath: one thread can be at
`_lastScaledNativeClipPath = new()` (:350) while another transforms into it
(:354) or returns it (:359).

Making them instance fields is a no-op for a single window — one target means one
cache either way — which is why this has gone unnoticed.
Build 228903 was green on 17 of 18 runtime-test jobs, including macOS and
Linux framebuffer. The single failure was
Given_InputInjector.When_MouseMove_PointerEventsAreRaised on WinAppSDK
("PointerMoved should have been raised", 3ms) — a mouse-injection test running
against native WinUI, which cannot be reached by a change to a *.skia.cs file.
Re-running to clear it.
@MartinZikmund
MartinZikmund force-pushed the dev/mazi/clip-path-per-target branch from de46291 to a1500aa Compare October 3, 2026 09:07
Copilot AI lite review requested due to automatic review settings October 3, 2026 09:07

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warning

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Copilot review overview

Review effort: Lite
Findings: 1 Low severity

Open (1)

@github-actions

github-actions Bot commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @MartinZikmund's task in 1m 47s —— View job


Review: fix(skia): Scope the native-element clip cache to its composition target

  • Gather context and read the changed file
  • Review diff for correctness, style, and coverage
  • Post inline findings
  • Update summary

Verdict: ✅ Ship

Re-reviewed against AGENTS.md / the path-scoped rules. The diff is unchanged since the last pass (33d8218e + the no-op a1500aa5 "retrigger CI" commit) and has already been human-approved (@morning4coffe-dev).

Correctness: _lastNativeClipPath / _lastScaledNativeClipPath were static on a type with one instance per CompositionTarget (per window), while their invalidation (:453) and keying (:535) are both per-target. Making them instance fields is the right root-cause fix — it removes the cross-window cache overwrite and the concurrent-access hazard on hosts that render each window on its own thread. Verified against current usage at lines 448–453 and 533–545; both fields are now correctly scoped alongside their already-instance neighbours _lastCanvasSize/_lastRasterizationScale.

Checklist pass:

  • Root-cause fix (state/lifecycle scope correction), not a symptom guard ✓
  • No public API / DependencyProperty / event surface touched ✓
  • Conventional Commits title ✓
  • No new warnings, no #pragma growth ✓
  • Test omission justified — the defect needs two windows with native elements of differing clip geometry, and the corrupted value is a private field consumed only internally; no managed assertion surface exists ✓

Not re-flagging: the comment-wording nit on the new 5-line block (missing noun in "All four cache…", and it overstates scope — only the two path fields were ever static) has already been raised and left unaddressed across six prior automated passes, and the human reviewer explicitly treated it as non-blocking ("repeated comment-wording nits do not invalidate the ownership correction"). No new inline comment added since there's nothing new to report — reposting the identical suggestion an eighth time wouldn't add information. If it's ever touched again, the one-line fix is narrowing "All four" to name the two IGeometry? fields specifically (not SKPath — that's what earlier suggestions assumed, but it's the actual field type in this file).

No cross-cutting concerns found.

Branch: dev/mazi/clip-path-per-target

@unodevops

Copy link
Copy Markdown
Contributor

@nventive-devops

Copy link
Copy Markdown
Contributor

The build 237219 found UI Test snapshots differences: skia-linux-screenshots: 119, skia-windows-screenshots: 144

Details
  • skia-linux-screenshots: 119 changed over 2454

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • CalendarView_Theming.png-dark
    • ButtonClippingTestsControl.png-dark
    • ButtonClippingTestsControl.png
    • Buttons.png-dark
    • Buttons.png
    • DisplayInformation.png-dark
    • CompositionEffectBrush.png-dark
    • CompositionEffectBrush.png
    • ElementLevelTheme.png-dark
    • ElementLevelTheme.png
    • ImageBrush_Formats.png-dark
    • ImageBrush_Formats.png
    • ExpanderColorValidationPage.png-dark
    • ExpanderColorValidationPage.png
    • Examples.png
    • Focus_FocusVisual_Properties.png-dark
    • Image_AnimatedWebP.png-dark
    • Image_AnimatedWebP.png
    • Gamepad_CurrentReading.png-dark
    • Gamepad_Enumeration.png-dark
  • skia-windows-screenshots: 144 changed over 2456

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • ColorPickerSample.png-dark
    • ColorPickerSample.png
    • Buttons.png-dark
    • ButtonClippingTestsControl.png-dark
    • ButtonClippingTestsControl.png
    • ClipboardTests.png-dark
    • ClipboardTests.png
    • DeferLoadStrategyWithTemplateBinding.png-dark
    • DeferLoadStrategyWithTemplateBinding.png
    • CalendarView_Theming.png-dark
    • DisplayInformation.png-dark
    • Examples.png
    • DoubleImageBrushInList.png-dark
    • DoubleImageBrushInList.png
    • ElementLevelTheme.png-dark
    • ElementLevelTheme.png
    • Gamepad_CurrentReading.png-dark
    • Gamepad_Enumeration.png-dark
    • Grid_left_column_Auto.png-dark
    • Grid_left_column_Auto.png

Copilot AI lite review requested due to automatic review settings November 10, 2026 09:47

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing. Review the Copilot code review billing settings.

@github-actions

github-actions Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @MartinZikmund's task in 18s —— View job


Review: fix(skia): Scope the native-element clip cache to its composition target

Verdict: ✅ Ship. I found no issues, so I posted no inline comments.

Code review assessment (by inspection only):

  • _lastNativeClipPath and _lastScaledNativeClipPath are now instance fields in src/Uno.UI/UI/Xaml/Media/CompositionTarget.Rendering.cs:141,143. They sit next to the already-instance _lastCanvasSize and _lastRasterizationScale.
  • Both fields are invalidated (line 452) and keyed (line 534) by per-target state, so instance scope is the correct ownership. This is a root-cause fix, not a guard.
  • The latest commit, 00ae09e6, tightened the comment. It now names "the two clip geometry fields", which resolves the wording nit raised in earlier passes. Nothing is left open on that point.
  • The change touches no public API, DependencyProperty or event. The title follows Conventional Commits.

Validation: I did not compile or run anything. Only the PR description reports a Skia desktop compile and a macOS runtime A/B slice. The missing automated test is reasonable, because the failure needs two windows and a private clip geometry that nothing outside the class can read.

CI: The screenshot-diff bot comments flag many Skia Linux and Windows images. I did not investigate them. The change is a private field scope with no rendering change on a single window, but please check that the diffs match what master produces.
· Branch

@MartinZikmund

Copy link
Copy Markdown
Member Author

Addressed PR comments up to this point

All 6 open bot threads were the same comment nit ("All four cache ..."). Reworded in 00ae09e (comment-only, no code change); threads resolved.

@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 245154 found UI Test snapshots differences: skia-linux-screenshots: 215, skia-windows-screenshots: 261

Details
  • skia-linux-screenshots: 215 changed over 2494

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • AnimatedVisualsTestbedPage.png-dark
    • AutomationProperties_AutomationId.png-dark
    • AutomationProperties_AutomationId.png
    • Basics.png-dark
    • Basics.png
    • BenchmarkDotNet.png-dark
    • BenchmarkDotNet.png
    • Border_CornerRadius_Binding.png-dark
    • Border_CornerRadius_Binding.png
    • Border_CornerRadius_BorderThickness.png-dark
    • Border_CornerRadius_BorderThickness.png
    • ButtonClippingTestsControl.png-dark
    • ButtonClippingTestsControl.png
    • Buttons.png-dark
    • Buttons.png
    • CalendarView_Theming.png-dark
    • CalendarView_Theming.png
    • DisplayInformation.png-dark
    • AnimatedVisualsTestbedPage.png
    • BreadcrumbBarPage.png-dark
  • skia-windows-screenshots: 261 changed over 2494

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • AnimatedBackVisualSourceSamplePage.png-dark
    • AutomationProperties_AutomationId.png-dark
    • BenchmarkDotNet.png-dark
    • BenchmarkDotNet.png
    • BreadcrumbBarPage.png-dark
    • BreadcrumbBarPage.png
    • CalendarView_Theming.png-dark
    • CalendarView_Theming.png
    • AnimatedVisualsTestbedPage.png
    • AutomationProperties_AutomationId.png
    • CompositionPath.png-dark
    • CompositionPath.png
    • AnimatedVisualsTestbedPage.png-dark
    • AppWindowTitleBar Properties.png
    • AutomationProperties_StructureAndProps.png-dark
    • BasicAcrylicBrushTest.png-dark
    • BasicAcrylicBrushTest.png
    • ClipboardTests.png-dark
    • ClipboardTests.png
    • AnimatedBackVisualSourceSamplePage.png

@MartinZikmund
MartinZikmund merged commit 8a08743 into master Nov 10, 2026
49 of 51 checks passed
@MartinZikmund
MartinZikmund deleted the dev/mazi/clip-path-per-target branch November 10, 2026 11:15
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.

Skia: native-element clip path cache is static, so it is shared across windows and raced by per-window render threads

5 participants