Skip to content

fix: Avoid InvalidateRender in UIElement#21235

Closed
MartinZikmund wants to merge 1 commit intomasterfrom
dev/mazi/invalidaterender-textbox
Closed

fix: Avoid InvalidateRender in UIElement#21235
MartinZikmund wants to merge 1 commit intomasterfrom
dev/mazi/invalidaterender-textbox

Conversation

@MartinZikmund
Copy link
Member

Depends on #21189

PR Type: 🐞 Bugfix

What is the current behavior? 🤔

What is the new behavior? 🚀

PR Checklist ✅

Please check if your PR fulfills the following requirements:

Other information ℹ️

Copilot AI review requested due to automatic review settings August 10, 2025 17:41
@github-actions github-actions bot added platform/wasm 🌐 Categorizes an issue or PR as relevant to the WebAssembly platform platform/android 🤖 Categorizes an issue or PR as relevant to the Android platform platform/macos 🍏 Categorizes an issue or PR as relevant to the macOS platform platform/ios 🍎 Categorizes an issue or PR as relevant to the iOS platform area/skia ✏️ Categorizes an issue or PR as relevant to Skia platform/wpf 🪟 Categorizes an issue or PR as relevant to WPF platform/x11 🐧 Categorizes an issue or PR as relevant to X11 labels Aug 10, 2025
@MartinZikmund MartinZikmund marked this pull request as draft August 10, 2025 17:41
Copy link
Contributor

Copilot AI left a comment

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 refactors the rendering invalidation mechanism in Uno's Skia-based platforms by avoiding direct InvalidateRender calls within UIElement and introducing a more centralized approach to picture recording and rendering.

  • Removes the workaround InvalidateRender call from the layout update cycle in UIElement
  • Introduces SetEntireSubtreeDirty method and centralizes picture recording logic in SkiaRenderHelper
  • Consolidates rendering logic across all Skia platforms to use shared helper methods

Reviewed Changes

Copilot reviewed 23 out of 23 changed files in this pull request and generated 2 comments.

File Description
UIElement.cs Removes workaround InvalidateRender call and adds SetEntireSubtreeDirty method
XamlIslandRootScale.mux.cs Enables the previously commented SetEntireSubtreeDirty call
SkiaRenderHelper.skia.cs Refactors and consolidates picture recording and rendering logic
Various platform-specific files Updates all Skia platforms to use centralized rendering approach

using Windows.Win32.Graphics.Gdi;
using Windows.Win32.UI.HiDpi;
using Windows.Win32.UI.WindowsAndMessaging;
using System.Runtime.InteropServices.JavaScript;
Copy link

Copilot AI Aug 10, 2025

Choose a reason for hiding this comment

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

The System.Runtime.InteropServices.JavaScript import appears to be incorrect for a Win32 platform. This namespace is typically used for WebAssembly interop.

Suggested change
using System.Runtime.InteropServices.JavaScript;

Copilot uses AI. Check for mistakes.
using Microsoft.UI.Xaml.Controls;
using SkiaSharp;
using Uno.UI.Xaml.Core;
using static Uno.UI.Helpers.SkiaRenderHelper;
Copy link

Copilot AI Aug 10, 2025

Choose a reason for hiding this comment

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

Using a static import for the same class being defined creates a circular reference and is unnecessary. This line should be removed.

Suggested change
using static Uno.UI.Helpers.SkiaRenderHelper;

Copilot uses AI. Check for mistakes.
@unodevops
Copy link
Contributor

🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-21235/wasm-skia-net9/index.html

@unodevops
Copy link
Contributor

🤖 Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-21235/docs/index.html

@unodevops
Copy link
Contributor

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

@MartinZikmund MartinZikmund force-pushed the dev/mazi/invalidaterender-textbox branch from 22ddf92 to a366937 Compare August 11, 2025 06:41
@github-actions github-actions bot removed platform/wasm 🌐 Categorizes an issue or PR as relevant to the WebAssembly platform platform/android 🤖 Categorizes an issue or PR as relevant to the Android platform platform/macos 🍏 Categorizes an issue or PR as relevant to the macOS platform platform/ios 🍎 Categorizes an issue or PR as relevant to the iOS platform area/skia ✏️ Categorizes an issue or PR as relevant to Skia platform/wpf 🪟 Categorizes an issue or PR as relevant to WPF platform/x11 🐧 Categorizes an issue or PR as relevant to X11 labels Aug 11, 2025
@unodevops
Copy link
Contributor

🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-21235/wasm-skia-net9/index.html

@unodevops
Copy link
Contributor

🤖 Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-21235/docs/index.html

@unodevops
Copy link
Contributor

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

@MartinZikmund MartinZikmund force-pushed the dev/mazi/invalidaterender-textbox branch from a366937 to 97f62e4 Compare August 12, 2025 12:14
@unodevops
Copy link
Contributor

🤖 Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-21235/docs/index.html

@unodevops
Copy link
Contributor

🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-21235/wasm-skia-net9/index.html

@unodevops
Copy link
Contributor

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

@ramezgerges
Copy link
Contributor

This change is included in #21299

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants