Repository navigation
Theming (animations) - #23491
Theming (animations)#23491MartinZikmund wants to merge 24 commits into
Conversation
|
Claude finished @MartinZikmund's task in 6m 47s —— View job PR Review: Theming (animations)
Overall VerdictThis is a substantial, high-quality WinUI port. The code is well-structured, follows the MUX reference discipline ( Issues: 2 medium, 4 lowMedium — performance/GC pressure:
Low — correctness/style:
Cross-cutting notes
|
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-23491/wasm-skia-net9/index.html |
1eb43a0 to
bcc8191
Compare
|
Claude finished @MartinZikmund's task in 7m 0s —— View job PR Review: Theming (animations) — Incremental Update
Scope of this review7 new commits since the previous review:
Overall verdictThese incremental fixes are high quality. The three layered approaches — (1) correct Issues: 1 low
Cross-cutting notes
|
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-23491/wasm-skia-net9/index.html |
|
|
|
Claude finished @MartinZikmund's task in 5m 45s —— View job PR Review: Theming (animations) — Incremental Update
Scope of this review3 new commits since the previous review:
Overall verdictAll three commits are clean. No new bugs found.
Cross-cutting notes
|
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-23491/wasm-skia-net9/index.html |
|
|
58ed42c to
6dd7404
Compare
|
Claude finished @MartinZikmund's task in 6m 24s —— View job PR Review: Theming (animations) — Incremental Update
Scope of this reviewNo new commits since the previous round — this is a full re-review pass of all 20 changed files to ensure nothing was missed. Overall verdictThe PR remains high quality. The New issue: 1 lowLow — policy:
Remaining open from prior reviews
|
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-23491/wasm-skia-net9/index.html |
|
|
|
Claude finished @MartinZikmund's task in 4m 56s —— View job PR Review: Theming (animations) — Incremental Update
Scope of this review3 new commits since the previous round (full re-review on 2026-07-13):
Overall verdictAll three commits are clean. No new issues found. All findings from prior review rounds have been addressed:
Cross-cutting notes on
|
|
@comment.md |
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-23491/wasm-skia-net9/index.html |
|
|
A VisualState Setter's {ThemeResource} was resolved against, and registered
on, the setter's TARGET. When the same visual state also applied a
RequestedTheme boundary to that target — as ComboBoxTextBoxStyle and the
NumberBox template both do, setting ContentElement.RequestedTheme=Light
alongside ContentElement.Foreground — the value re-resolved under that
boundary and produced a near-black foreground in dark theme.
WinUI keeps the setter's live theme binding on the CSetter itself
(ThemeResource.cpp:194-203), resolves it under the setter's own theme
(SetThemeResourceBinding, Theming.cpp:415-424), and hands the target an
already-resolved value (VisualStateSetterHelper.cpp:186), so the target's
RequestedTheme never participates.
Uno keeps the reference registered on the target so the existing
re-application path can reach it, and pins the setter-side resolution owner
(the element owning the VisualStateGroups) on the reference instead. Both
re-resolution sites honour the pin. Mid-walk the pinned owner's persisted
theme is the pre-switch one — WinUI persists m_theme only once the subtree
completes (Theming.cpp:153-156) — so the in-flight walk theme is used there,
which keeps an owner-driven theme change re-applying its active setters.
Verified against a native WinUI oracle (WinAppSDK 2.1.3): focused editable
ComboBox in a dark subtree now reports ContentElement.ActualTheme=Light with
Foreground=#FFFFFFFF, matching WinUI exactly.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_0151QVKJaCdWSQp6U5sv2Gu9
Every MUX citation on this branch is pinned to microsoft-ui-xaml2 commit
fc2f82117, as the file headers declare. The local checkout sits on a later
commit (bac7a9c33) where the tree dropped the src/ prefix and framework.cpp,
Theming.cpp, depends.cpp, corep.h and xcpcore.cpp all shifted, so citations
derived from the working tree rather than the pin drifted.
Corrected against `git show fc2f82117:src/dxaml/...`:
xcpcore.cpp 7905 -> 8132 (SetSubTreeTheme; 7905 is inside
CCoreServices::SetFocusVisualKindIsReveal)
corep.h 2144 -> 2205-2206 (m_spTheming; 2144 is InitWaitForIdleEvents)
framework.cpp 3399-3418 -> 3284-3304 (GetRequestedThemeOverride)
depends.cpp 1023-1048 -> 1044-1069 (the theme block of EnterImpl, which
itself starts at 971)
Theming.cpp 415-424 -> 367-379 (the SetThemeResourceBinding slot push;
the file is 403 lines at the pin)
ThemeResource.cpp 194-203 -> 189-198 (the Style-setter vs VSM-setter branch)
The last two are from the preceding setter-side commit, which cited the
working tree rather than the pin.
Comments only; no behaviour change.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_0151QVKJaCdWSQp6U5sv2Gu9
WinUI's CFrameworkElement::NotifyThemeChangedForInheritedProperties bails BEFORE the freeze/unfreeze split: the goto Cleanup at framework.cpp:3423-3429 (@ fc2f82117) jumps over both SetFreezeForeground(true) at :3460 and SetFreezeForeground(false) at :3476, so on bail the function writes nothing at all. Uno instead computed a skipSetValue flag inside the freeze branch and fell through: it still wrote _themeForeground and _isForegroundFrozen and skipped only the DP write. A themed boundary that already carried its own Foreground therefore published the Light DefaultTextForegroundThemeBrush to its whole subtree. That is the NumberBox and editable ComboBox Focused state, which sets ContentElement.Foreground and ContentElement.RequestedTheme=Light on the same ScrollViewer: the inner TextBox's display block inherits Foreground and so rendered near-black in dark theme (#24021). The predicate maps exactly. HasLocalOrModifierValue is !(IsPropertyDefault || IsPropertySetByStyle) (PropertySystem.cpp:319-324) and BaseValueSourceStyle calls SetPropertyIsLocal before SetIsSetByStyle (:2951-2956), so the whole expression collapses to !IsPropertyDefault. An inherited value leaves IsPropertyDefault true, which is why Uno maps both DefaultValue and Inheritance to "default". No compensating write is added on the bail. WinUI needs none because its freeze brush and the element's own Foreground share one storage slot (TextFormatting::m_pForeground); in Uno the equivalent fallback for children is plain DP inheritance of the element's own Foreground. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_0151QVKJaCdWSQp6U5sv2Gu9
Uno materializes a VisualState's Storyboard/Setters lazily, outside the Enter walk, then establishes the chain's per-object theme itself. That read used ResolveOwnerTheme, which returns the owner's PERSISTED theme — and during a theme walk that is still the pre-switch one, because the new theme is persisted only after NotifyThemeChangedCore returns for the whole subtree (Theming.cpp:153-156). A state materialized from inside a walk therefore stamped its keyframes with the old theme. Switches to ResolvePinnedOwnerTheme, which substitutes the owner's in-flight walk theme while it is mid-walk — the same pinning the VSM setter path already uses. Also adds a groups-owner fallback for VisualStateGroups declared outside a ControlTemplate, where there is no templated parent at all (MUX: the collection hangs off the element carrying the attached property, CVisualStateManager2.cpp:345-354, :464). Templated parent stays primary so the keyframes resolve under the same owner the state's Setters do: VisualStateManager passes the Control into VisualStateGroup.GoToState, which is what Setter.ApplyValue then receives. Making the groups owner primary would split that agreement for any template whose root part carries its own RequestedTheme. Validation: the 219-test theming/VisualState/ToggleSwitch suite stays green apart from two pre-existing failures. No discriminating regression test — the observable trigger (materializing a state from inside a theme walk) could not be reproduced in the runtime-test harness; the added test is a coverage guard that passes both with and without the change, as its comment states. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_0151QVKJaCdWSQp6U5sv2Gu9
WinUI keeps a re-applied theme value from defeating a held animation with a PER-PROPERTY gate, not a global suppression. SetThemeResourceBinding arms pModifiedValue->SetModifierValueBeingSet(true) when the property HasModifiers, released by a scope_exit (Theming.cpp:355-362 @ fc2f82117), and SetValue reads !IsModifierValueBeingSet() and SKIPS the hardcoded SetBaseValue(.., BaseValueSourceLocal) entirely (PropertySystem.cpp:1649-1652) — the call that would otherwise OR in fvsLocalValueNewerThanAnimatedValue (ModifiedValue.cpp:206-209) and let the base win at GetEffectiveValue. Uno approximated this with a process-wide static counter wrapped around UpdateResourceBindings, which missed the Enter walk entirely (Enter reaches UpdateAllThemeReferences without going through UpdateResourceBindings) and, while armed, changed the precedence outcome of every SetValue on every object in the process — including user code running inside theme-walk callbacks. Ports the gate: HasModifiers and IsModifierValueBeingSet on ModifiedValue, armed by a scope struct around the value application in UpdateThemeReference and in the Phase-2 resource-binding fallback. Uno still refreshes _baseValue under the gate, because WinUI can skip the write only thanks to m_baseValue holding the live CThemeResource, re-resolved on read; Uno stores the resolved snapshot, which would otherwise freeze at the pre-change theme once the animation is cleared. The pass-level counter is dropped from UpdateResourceBindings, now subsumed. Its two remaining call sites (the global theme-switch wrappers in CoreServices and Application) encode a separate concern and are left for a follow-up. Validation: proven load-bearing — neutering the gate with the counter already removed makes When_ThemeResource_Reresolution_Does_Not_Defeat_Active_Animation fail with the resolved base (#FF00AA44) instead of the held accent (#FF0062A9); restoring it passes. Uno.UI.UnitTests 4055/4090 (the 12 failures are timezone-dependent Gregorian calendar tests, unrelated), incl. all 33 Given_ThemeResource tests. Runtime: 472/478 across theming, VisualState, animation and control suites; all 6 failures pre-existing or order-dependent flakes that pass in isolation. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_0151QVKJaCdWSQp6U5sv2Gu9
7.0 dissolved DependencyObjectStore into DependencyObject and removed IDependencyObjectStoreProvider, so the call sites this branch introduces (ThemeResolution.ResolvePinnedOwnerTheme, VisualState.EnsureMaterialized and the Given_Theme_Materialization resource-binding helpers) no longer compile as written. Call the members straight on the DependencyObject instead - same behaviour, no behavioural change to the retargeted work. Uno.UI (net10.0) and Uno.UI.RuntimeTests.Skia (net10.0) both build clean.
src/Uno.UI is Skia-only on 7.0 (plain net10.0;net11.0, UnoRuntimeIdentifier=Skia), so UNO_HAS_ENHANCED_LIFECYCLE is always defined there. Inline the two #if UNO_HAS_ENHANCED_LIFECYCLE arms this branch introduces - the mid-walk theme pin in ThemeResolution.ResolvePinnedOwnerTheme and the lazy VisualState theme establishment in VisualState.EnsureMaterialized (whose #else UpdateResourceBindings fallback is dead) - and drop the directives. Scoped strictly to the arms this branch adds; the pre-existing guards in ResourceDictionary/FrameworkElement are left to the repo-wide sweep.
The T6e cached-page test was re-enabled on NativeWinUI in 19ebcd0 on the strength of a hand validation against a real WinUI 3 app. The behavior claim holds, but the test still cannot run in the WinAppSDK harness: its probe pages are code-only Page subclasses, so the app's XamlTypeInfo has no entry for them. WinUI then resolves the type through ImportUnknownClassInfo, which builds a CCustomClassInfo with a null backing IXamlType, and ActivationAPI::ActivateInstance calls GetXamlTypeNoRef()->ActivateInstance() through it unguarded — a null vtable dereference that faults the process with 0xC0000005. The run produces no results file, so the whole WinAppSDK job fails rather than a single test. Restore the exclusion to match its two siblings, and record the actual mechanism in all three comments so the reasoning is not re-litigated. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01AzsBupsJWXqZrc35HZUfce
A theme change re-applied the final keyframe to every non-Stopped color animation, so a paused one jumped to its endpoint. WinUI keeps the paused clock and recomputes at the retained progress; limit the re-apply to Active and Filling. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
With no established owner theme, the pinned VisualState setter fell back to the requested-theme-for-subtree slot, which mid-boundary carries the very theme the pin escapes. Restores the never-switched-theme case master covered (When_Editable_ComboBox_Focused_In_Dark_Theme_Without_Theme_Walk). Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
22d2bd1 to
89668bf
Compare
There was a problem hiding this comment.
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: 2
Open (3)
The PR description currently sayscloses #without an issue number and doesn’t indicate a PR Type… · NewsetterOwneris declared as non-nullable but defaults tonull. If nullable reference types are… · New The PR description still contains the template placeholder**GitHub Issue:** closes #with no…
Resolved since last review (5)
[global::System.Flags]is not a valid attribute type (should beFlagsAttribute). This will not…setterOwnerdefaults tonullbut is declared non-nullable (DependencyObject). Under nullable… This comment block says Uno has no modifier-being-set gate and relies on a counter-based suppress,…[global::System.Flags]is not a valid attribute type (the attribute isFlagsAttribute). This… This comment block says Uno "has no" modifier-being-set gate and that UpdateResourceBindings…
| @@ -0,0 +1,129 @@ | |||
| # Theming WinUI Alignment — Audit Findings & Remaining Work | |||
| // Pin the setter-side resolution owner so a later re-resolution keeps resolving | ||
| // under it rather than under the target's own RequestedTheme. | ||
| ResolutionOwner = setterOwner, | ||
| }; | ||
| provider.SetThemeResource(property, themeRef); |
|
Claude finished @MartinZikmund's task in 1m 23s —— View job PR Review: Theming (animations) — Incremental Update
Scope of this reviewHEAD is Status of previously-flagged findings
Overall verdictOne medium-ish/low finding remains outstanding (the |
| // back to the requested-theme-for-subtree slot, which mid-boundary carries the very theme the pin escapes. | ||
| if (owner is null || owner.GetTheme() == Theme.None) | ||
| { | ||
| return Uno.UI.Xaml.Core.CoreServices.Instance.Theming.GetBaseTheme() | GetApplicationHighContrastTheme(); |
There was a problem hiding this comment.
Still open from the two prior review rounds (2026-09-24, 2026-09-25): this fallback calls CoreServices.Instance directly, which eagerly constructs the CoreServices singleton if one doesn't already exist. Every other ambient-theme read in this subsystem guards the same read with CoreServices.HasInstance first — e.g. ResourceDictionary.GetActiveTheme() (ResourceDictionary.cs:1411-1425, whose own doc comment calls out "early/unit-test contexts that have no CoreServices instance") and the two other HasInstance call sites in that file (ResourceDictionary.cs:579, :1375).
ResolvePinnedOwnerTheme is reachable from unit tests exercising VSM setter {ThemeResource} resolution without a full app/window lifecycle. Hitting the owner is null || owner.GetTheme() == Theme.None branch there will construct CoreServices (and its EventManager) as a side effect of a resource lookup — exactly what HasInstance exists to avoid elsewhere in this file.
if (owner is null || owner.GetTheme() == Theme.None)
{
return Uno.UI.Xaml.Core.CoreServices.HasInstance
? Uno.UI.Xaml.Core.CoreServices.Instance.Theming.GetBaseTheme() | GetApplicationHighContrastTheme()
: ResourceDictionary.GetActiveBaseTheme() | GetApplicationHighContrastTheme();
}There was a problem hiding this comment.
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
Open (7)
[global::System.Flags]is not a valid attribute type in .NET/C# (the attribute is… · New The optional parametersetterOwnerdefaults tonullbut is declared as non-nullable… · NewsetterOwneris declared as non-nullable but defaults tonull. If nullable reference types are… The PR description currently sayscloses #without an issue number and doesn’t indicate a PR Type… Typo in comment:modifer...should bemodifier...(e.g.,modifierValueBeingSet,… · New The PR description still contains placeholder/template text (e.g.,closes #, PR type not… · New The PR description still contains the template placeholder**GitHub Issue:** closes #with no…
| private bool _isProcessingThemeWalk; | ||
| // Per-store transient lifecycle/theme flags, packed into one field instead of one bool field per | ||
| // flag — WinUI packs the equivalent state into CDependencyObject's m_bitFields (corep.h:224-348). | ||
| [global::System.Flags] |
| /// property is not a <see cref="DependencyProperty"/>. | ||
| /// </returns> | ||
| internal static bool ApplyVisualStateSetter(SpecializedResourceDictionary.ResourceKey resourceKey, object context, BindingPath bindingPath, DependencyPropertyValuePrecedences precedence, ResourceUpdateReason updateReason) | ||
| internal static bool ApplyVisualStateSetter(SpecializedResourceDictionary.ResourceKey resourceKey, object context, BindingPath bindingPath, DependencyPropertyValuePrecedences precedence, ResourceUpdateReason updateReason, DependencyObject setterOwner = null) |
| // bool modiferValueBeingSet = (pModifiedValue && pModifiedValue->HasModifiers()); | ||
| // if (modiferValueBeingSet) pModifiedValue->SetModifierValueBeingSet(true); | ||
| // auto modiferGuard = wil::scope_exit([&] { if (modiferValueBeingSet) pModifiedValue->SetModifierValueBeingSet(false); }); |
| // Establish the per-object theme on the lazily-built VisualState chain (storyboard, | ||
| // animations, keyframes, setters); without it a keyframe keeps _theme=None and later | ||
| // re-resolves its {ThemeResource} against the unscoped app base theme. |
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-23491/wasm-skia-net9/index.html |
|
🤖 Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-23491/docs/index.html |
|
The build 237176 found UI Test snapshots differences: Details
|
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_011VUyB4pHCfJMGmHzN8TWfF
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_011VUyB4pHCfJMGmHzN8TWfF
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_011VUyB4pHCfJMGmHzN8TWfF
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_011VUyB4pHCfJMGmHzN8TWfF
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_011VUyB4pHCfJMGmHzN8TWfF
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_011VUyB4pHCfJMGmHzN8TWfF
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_011VUyB4pHCfJMGmHzN8TWfF



GitHub Issue: closes #
PR Type:
What changed? 🚀
PR Checklist ✅
Screenshots Compare Test Runresults.