Repository navigation
chore(winui-sync): Onboard Icons at WinUI 2.7.0 - #26678
MartinZikmund wants to merge 4 commits into
Conversation
Co-Authored-By: Claude Fable 5.2 <[email protected]> Claude-Session: https://claude.ai/code/session_01TXMNu19XJALYCKbepQUqsS
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01TXMNu2UutP6MJa47mVagdR
Co-Authored-By: Claude Fable 5.2 <[email protected]> Claude-Session: https://claude.ai/code/session_01TXMNu19XJALYCKbepQUqsS
|
Claude finished @MartinZikmund's task in 15s —— View job Review summaryVerdict: fix-first (one blocking issue)
This was a targeted review of the diff, not a full line-by-line comparison against upstream. I read the core icon files (
|
|
Tick the box to add this pull request to the merge queue (same as
|
| // As in the native picker, a name that already ends with one of the choices' extensions is kept as is. | ||
| var fileName = hasChoiceExtension ? SuggestedFileName : SuggestedFileName + extension; | ||
| // The mime type is chosen by the extension, and we cannot reliably send multiple mime type in the browser | ||
| var fileName = SuggestedFileName + extension; |
There was a problem hiding this comment.
This change is unrelated to the icons onboarding, and it looks like a revert. It drops the hasChoiceExtension check that #25672 (merged just before this branch) introduced. With the check gone, a suggested name that already ends in a choice extension (for example report.txt with a .txt choice) is saved as report.txt.txt on WASM.
It was probably brought in by a bad conflict resolution or a stale merge. Please restore it, or move the change to its own PR with a test and an explanation. The PR description says nothing about it.
Co-Authored-By: Claude Fable 5.2 <[email protected]> Claude-Session: https://claude.ai/code/session_01TXMNu19XJALYCKbepQUqsS
a76083e to
26e278d
Compare
|
Claude finished @MartinZikmund's task in 12s —— View job Review updateVerdict: no blocking issues found in this pass. I did not do a new line-by-line review of the icon port. Retracting the earlier
That inline comment can be resolved. It should not block merge. Not verified: I did not build or run tests. The test results are taken from the PR description. |
|
|
||
| var scaleTransform = fontIcon.RenderTransform as ScaleTransform; | ||
| Assert.IsNotNull(scaleTransform); | ||
| Assert.AreEqual(-1.0, scaleTransform.ScaleX); |
| if (GetChildElementNoRef() is Image image) | ||
| { | ||
| if (ShowAsMonochrome) | ||
| { | ||
| // If a valid brush has been set, then we'll use its RGB values, otherwise | ||
| // we'll use white. | ||
| image.MonochromeColor = pBrush?.Color ?? Colors.White; | ||
| } | ||
| #if HAS_UNO | ||
| else | ||
| { | ||
| // TODO Uno specific: WinUI keeps the previous tint until the image reloads. | ||
| image.MonochromeColor = null; | ||
| } | ||
| #endif | ||
| } |
| { | ||
| partial class MockIAnimatedIconSource2 : IAnimatedVisualSource2 | ||
| { | ||
| Dictionary<string, double> markers = new Dictionary<string, double>(); |
| { | ||
| Dictionary<string, double> markers = new Dictionary<string, double>(); | ||
|
|
||
| IAnimatedVisualSource2 visual = new Controls_02_Hamburger(); |
|
🤖 Your WebAssembly Sample App stage site is ready! Visit it here: |
|
The build 248689 found UI Test snapshots differences: Details
|
GitHub Issue: closes #26521, closes https://github.com/unoplatform/uno-private/issues/2619, closes https://github.com/unoplatform/uno-private/issues/2631
Related: #26677 (members left unported), #25595 (open PR touching
MakeIconElementFrom).PR Type:
What changed? 🚀
Onboards the icon controls to the
WinUI Port Syncas one area,icons, recorded at WinUI 2.7.0 (1b5b1a0ccc):IconElement,FontIcon,BitmapIcon,PathIcon,SymbolIcon,IconSourceElement, theIconSourcefamily,ImageIconandAnimatedIconwith its animated visuals. Before adding the area, the port was caught up to the latest stable release, reviewed line by line against it, and its Uno workarounds were audited.They are one area because they share upstream files: all the core icons live in
icon.cpp/icon.h, andAnimatedIconandImageIconbuild on them.Mapping
controls/dev/AnimatedIcon(folder, withAnimatedVisuals)Controls/AnimatedIconcontrols/dev/IconSource(folder)Controls/IconSource(AnimatedIconSource.cs,ImageIconSource.cs)controls/dev/ImageIcon(folder)Controls/ImageIconcontrols/dev/Generated/{AnimatedIcon,AnimatedIconSource,AnimatedIconTestHooks,ImageIcon,ImageIconSource}.properties.**.Properties.cs/ property blocksdxaml/xcp/core/core/elements/icon.cpp,dxaml/xcp/core/inc/icon.hControls/Icons/*.mux.cs,*.h.mux.csdxaml/xcp/dxaml/lib/{IconSource,BitmapIconSource,FontIconSource,PathIconSource,SymbolIconSource,SymbolIcon}_Partial.*Controls/IconSource/*.cs,Icons/SymbolIcon.partial.mux.csdxaml/xcp/dxaml/lib/winrtgeneratedclasses/<type>.g.cpp/.g.hfor the 11 core types,dxaml/xcp/core/controls/generated/C*IconSource.g.hIcons/*.Properties.cs, the property blocks inIconSource/*.csAnimatedIcon/APITests,IconSource/APITests,ImageIcon/APITestsUno.UI.RuntimeTests/Microsoft/UI/Xaml/Controls/{AnimatedIcon,IconSource,ImageIcon}AnimatedIcon/TestUI,ImageIcon/TestUISamplesApp.Samples/.../AnimatedIconTests,.../ImageIconTestsImageIcon/InteractionTestsis not mapped and was not ported (interaction tests are out of scope for now).ImageIcon.xaml, an emptyStyle, with an emptyImageIcon_themeresources.xaml. Uno has no copy. Both files sit in the mappedcontrols/dev/ImageIconfolder, so a future change shows up in the sync diff.Stringsfor these controls.Starting point
The headers on
masterwere mixed: the animated visuals at5f9e85113(March 2026), theIconSourcefamily andImageIconat 1.4.2, a fewAnimatedIconfiles at older commits from before thecontrols/devlayout, and the six core icon files with no header at all (they were Uno-written, not ports). 1.4.2 is the oldest tag the headers name, so the upstream changes below are listed from there. The core icons were re-ported fromicon.cpp/icon.h, and the whole port was then reviewed against 2.7.0.Upstream changes 1.4.2 → 2.7.0
icon.cpp:CSymbolIcon::ConvertSymbolValueToGlyph(legacyE0xx-E5xxsymbol values mapped to current glyphs)SymbolIcon.mux.cs)icon.cpp,ImageIcon.cpp: opt-inIconNoGridOptimization(noGridaround theTextBlock/Image)ImageIcon.OnApplyTemplatehandles both tree shapes, as upstream. See #26677icon.h: SAL annotations,m_fontSize{}IconSource_Partial.cpp:CreateIconElementsetsForegroundonly when the source has oneIconSource/APITests: +136 lines of new testsImageIcon/APITests: checks theImageis loaded#if HAS_UNObranch for theGrid(see above)AnimatedIcon/TestUI: classes madepartial(6 files)AnimatedVisuals:BUILD_WINDOWSinclude block removed5f9e85113SymbolIcon_Partial.cpp,ImageIcon.vcxitems: annotation and project changesImageIcon/InteractionTestsBetween 2.6.5 and 2.7.0 nothing changed in any mapped file.
Line-by-line review against 2.7.0
icon.cpp/icon.hIcons/{IconElement,FontIcon,BitmapIcon,PathIcon,SymbolIcon,IconSourceElement}.mux.cs,.h.mux.csApplyTemplate, inside the transparent rootGrid(AddChildElement/RemoveChildElement/GetChildElementNoRef/UpdateLinkedChildProperty).FontIconmirrors itself forMirroredWhenRightToLefton enter and onFlowDirectionchanges.IconSourceElementbinds the created icon to its source and bindsForegroundonly when the source sets one. Marked: text formatting inheritance (Uno pushesForegroundand the font properties to the child),BitmapIcontinting (Image.MonochromeColorinstead of a tintedWriteableBitmap), Uno's symbols font. Not ported, marked: theCreatetype converters and the no-Gridoptimization (#26677)SymbolIcon_Partial.cppSymbolIcon.partial.mux.cs*.g.cpp/.g.hfor the 11 core types*.Properties.cs,IconSource/*.csIconSource_Partial.cppand the four derived*_Partial.cppIconSource/{IconSource,FontIconSource,BitmapIconSource,PathIconSource,SymbolIconSource}.csCreateIconElementappliesForegroundonly when set and tracks created elements weakly;OnPropertyChanged2forwards to the live elements (routed from each property's changed callback, marked)AnimatedIconSource.cpp,ImageIconSource.cpp.csImageIcon.cppImageIcon.cs,ImageIcon.Uno.csImageIconfromBitmapIconnatively, so Uno creates theImageitselfAnimatedIcon.cpp/.h, test hooksAnimatedIcon.cs,.Header.cs,AnimatedIconTestHooks.csAnimatedVisuals/*AnimatedVisuals/*Given_AnimatedBackVisualSource,Given_AnimatedIconand the ported page*.mux.csAnimatedIconTests10,IconSourceApiTests6 (plus 4 kept from an older upstream version),ImageIconTests1. None is disabledAnimatedIcon/TestUI,ImageIcon/TestUIAll Uno files in the area carry a
MUX Referenceheader naming their upstream file, with no version:areas/icons.jsonholds it.Workaround audit
Foregroundguard, noIsComposed())SymbolIconTargetglyph worked around a missing WinUI glyph0xF5F0Given_SymbolIconAnimatedVisuals/*.AnimatedVisual.mux.cs(8 files)TransformMatrixwith identity, because the generated matrix (zero onM33) collapsed the layerGiven_AnimatedBackVisualSource(22) andGiven_AnimatedIcon(18) pass; the icons render in the ported pageAnimatedAcceptVisualSourceAnimatedIcon.OnLoadedVisualAnimatedIcon.MeasureOverride/ArrangeOverrideGridAnimatedIconForegroundbrush callbacks registered weakly, re-subscribed on loadIconElement.ForegroundSamples ported from TestUI
AnimatedIconPage(replaces a 23-line placeholder) withAnimatedIconHost,ToggleAnimatedIconHost, the two converters and the LottieGenBrightnessSunvisual.ImageIconPage, re-synced with upstream.Marked differences from upstream:
#if HAS_UNO, as in the other ported pages.BrightnessSunneeds Win2D, which the WinAppSDK head does not reference, so the class and the block using it are Uno-only.Sliderbinds with{Binding}: the Uno XAML generator rejects a TwoWayx:Bindto an attached property.ToggleAnimatedIconHostregistersIconSourcewith its own type as owner: upstream registers it underAnimatedIconHost, which Uno rejects as a duplicate.LastAnimationSegmentChangedevent while unloaded, since SamplesApp keeps running after the sample closes.Tests
Given_SymbolIcon.Validate_Size, ignored for [Epic] Flaky tests roundup #9080, and oneGiven_CommandBarFlyoutcase).AnimatedIconTests10,IconSourceApiTests10,ImageIconTests1,Given_AnimatedIcon18,Given_AnimatedBackVisualSource22,Given_BitmapIcon9,Given_FontIcon8,Given_PathIcon4,Given_SymbolIcon8,Given_IconSourceElement1.Given_AppBarButton,Given_CommandBar,Given_CommandBarFlyout,Given_AutoSuggestBox,Given_InfoBadge,InfoBadgeTests.BrightnessSunslider drives its icon; the image icons load PNG and SVG sources.SamplesAppdesktop (withUno.UIand the runtime tests) builds in Release with analyzers on (noUnoFastDevBuild), at net10.0. The WinAppSDK head was not built locally.detect.ps1 -AreaFilter iconsreports up to date, and the 138 Pester tests pass. The samples pass the XamlStyler check.No project or MSBuild files changed.
PR Checklist ✅
Screenshots Compare Test Runresults.🤖 Generated with Claude Code
https://claude.ai/code/session_01TXMNu19XJALYCKbepQUqsS