From fc61f42e3871ef01b8fb0553ad09ba841b4bff34 Mon Sep 17 00:00:00 2001 From: jp2masa Date: Fri, 14 Aug 2026 15:20:00 +0000 Subject: [PATCH 01/48] Improve StorageBookmarkHelper.TryDecodeBookmark. (#21977) --- .../Storage/FileIO/StorageBookmarkHelper.cs | 21 +++++++++---------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/src/Avalonia.Base/Platform/Storage/FileIO/StorageBookmarkHelper.cs b/src/Avalonia.Base/Platform/Storage/FileIO/StorageBookmarkHelper.cs index 4c43331803..cafbfdfa25 100644 --- a/src/Avalonia.Base/Platform/Storage/FileIO/StorageBookmarkHelper.cs +++ b/src/Avalonia.Base/Platform/Storage/FileIO/StorageBookmarkHelper.cs @@ -86,20 +86,19 @@ internal static class StorageBookmarkHelper Span decodedBookmark; - // Each base64 character represents 6 bits, but to be safe, - var arrayPool = ArrayPool.Shared.Rent(HeaderLength + base64bookmark.Length * 6); - if (Convert.TryFromBase64Chars(base64bookmark, arrayPool, out int bytesWritten)) - { - decodedBookmark = arrayPool.AsSpan().Slice(0, bytesWritten); - } - else - { - nativeBookmark = null; - return DecodeResult.InvalidFormat; - } + var arrayPool = ArrayPool.Shared.Rent(HeaderLength + base64bookmark.Length / 4 * 3); try { + // Each base64 character represents 6 bits, but to be safe, + if (!Convert.TryFromBase64Chars(base64bookmark, arrayPool, out int bytesWritten)) + { + nativeBookmark = null; + return DecodeResult.InvalidFormat; + } + + decodedBookmark = arrayPool.AsSpan(..bytesWritten); + if (decodedBookmark.Length < HeaderLength // Check if decoded string starts with the correct prefix, checking v1 at the same time. && !AvaHeaderPrefix.SequenceEqual(decodedBookmark.Slice(0, AvaHeaderPrefix.Length))) From 13f272d92816783a8c71df1bdb47889da756e05f Mon Sep 17 00:00:00 2001 From: Julien Lebosquain Date: Mon, 17 Aug 2026 07:30:35 +0000 Subject: [PATCH 02/48] Implement WindowDrawnDecorations.TitleBarDecorations (#21969) * Implement WindowDrawnDecorations.TitleBarDecorations * Add TitleBarDecorations sample to ControlCatalog --- samples/ControlCatalog/MainWindow.xaml | 1 + .../Pages/WindowCustomizationsPage.xaml | 59 +++++++++--- samples/ControlCatalog/ScrollPage.xaml | 2 +- .../ViewModels/MainWindowViewModel.cs | 52 +++++++++++ .../Chrome/TitleBarDecorations.cs | 45 +++++++++ .../Chrome/WindowDrawnDecorations.cs | 59 ++++++++++-- .../Controls/WindowDrawnDecorations.xaml | 18 +++- .../Controls/WindowDrawnDecorations.xaml | 18 +++- .../WindowTests.cs | 92 +++++++++++++++++++ 9 files changed, 320 insertions(+), 26 deletions(-) create mode 100644 src/Avalonia.Controls/Chrome/TitleBarDecorations.cs diff --git a/samples/ControlCatalog/MainWindow.xaml b/samples/ControlCatalog/MainWindow.xaml index d839689db7..308b29c572 100644 --- a/samples/ControlCatalog/MainWindow.xaml +++ b/samples/ControlCatalog/MainWindow.xaml @@ -12,6 +12,7 @@ CanResize="{Binding CanResize}" CanMinimize="{Binding CanMinimize}" CanMaximize="{Binding CanMaximize}" + WindowDrawnDecorations.TitleBarDecorations="{Binding TitleBarDecorations}" Win32Properties.WindowCornerPreference="{Binding Win32WindowCornerPreference}" x:Class="ControlCatalog.MainWindow" WindowState="{Binding WindowState, Mode=TwoWay}" x:DataType="vm:MainWindowViewModel"> diff --git a/samples/ControlCatalog/Pages/WindowCustomizationsPage.xaml b/samples/ControlCatalog/Pages/WindowCustomizationsPage.xaml index 5114dd16e9..f304f78898 100644 --- a/samples/ControlCatalog/Pages/WindowCustomizationsPage.xaml +++ b/samples/ControlCatalog/Pages/WindowCustomizationsPage.xaml @@ -9,28 +9,58 @@ x:DataType="viewModels:MainWindowViewModel" x:CompileBindings="True" DataContext="{Binding $parent[Window].DataContext}"> - + - - + - + - + + + + + + + + + + + + + + + + + + + @@ -45,7 +75,7 @@