From c590b6df128b1da2c57f8dcf5a2b13866ed0599d Mon Sep 17 00:00:00 2001 From: Denys Volodarskyi Date: Wed, 10 Jul 2024 22:08:37 +0300 Subject: [PATCH 1/5] Update packages. Update version to net 8. --- Source/Avalonia.HtmlRenderer/Avalonia.HtmlRenderer.csproj | 6 +++--- .../HtmlRenderer.Demo.Avalonia.Android.csproj | 4 ++-- .../HtmlRenderer.Demo.Avalonia.Browser.csproj | 4 ++-- .../HtmlRenderer.Demo.Avalonia.Desktop.csproj | 6 +++--- .../HtmlRenderer.Demo.Avalonia.iOS.csproj | 4 ++-- .../HtmlRenderer.Demo.Avalonia.csproj | 6 +++--- Source/Demo/Common/HtmlRenderer.Demo.Common.csproj | 4 ++-- 7 files changed, 17 insertions(+), 17 deletions(-) diff --git a/Source/Avalonia.HtmlRenderer/Avalonia.HtmlRenderer.csproj b/Source/Avalonia.HtmlRenderer/Avalonia.HtmlRenderer.csproj index 80b2065..2c925ac 100644 --- a/Source/Avalonia.HtmlRenderer/Avalonia.HtmlRenderer.csproj +++ b/Source/Avalonia.HtmlRenderer/Avalonia.HtmlRenderer.csproj @@ -6,7 +6,7 @@ 11.0.0 Avalonia Team - Copyright 2013-$([System.DateTime]::Now.ToString(`yyyy`)) © The AvaloniaUI Project + Copyright 2013-$([System.DateTime]::Now.ToString(`yyyy`)) © The AvaloniaUI Project https://avaloniaui.net https://github.com/AvaloniaUI/Avalonia.HtmlRenderer/ MIT @@ -29,7 +29,7 @@ - - + + diff --git a/Source/Demo/Avalonia/HtmlRenderer.Demo.Avalonia.Android/HtmlRenderer.Demo.Avalonia.Android.csproj b/Source/Demo/Avalonia/HtmlRenderer.Demo.Avalonia.Android/HtmlRenderer.Demo.Avalonia.Android.csproj index 4833420..ff9e32b 100644 --- a/Source/Demo/Avalonia/HtmlRenderer.Demo.Avalonia.Android/HtmlRenderer.Demo.Avalonia.Android.csproj +++ b/Source/Demo/Avalonia/HtmlRenderer.Demo.Avalonia.Android/HtmlRenderer.Demo.Avalonia.Android.csproj @@ -1,7 +1,7 @@ Exe - net7.0-android + net8.0-android 21 enable com.CompanyName.HtmlRenderer.Demo.Avalonia @@ -18,7 +18,7 @@ - + diff --git a/Source/Demo/Avalonia/HtmlRenderer.Demo.Avalonia.Browser/HtmlRenderer.Demo.Avalonia.Browser.csproj b/Source/Demo/Avalonia/HtmlRenderer.Demo.Avalonia.Browser/HtmlRenderer.Demo.Avalonia.Browser.csproj index 928e23a..7cfd371 100644 --- a/Source/Demo/Avalonia/HtmlRenderer.Demo.Avalonia.Browser/HtmlRenderer.Demo.Avalonia.Browser.csproj +++ b/Source/Demo/Avalonia/HtmlRenderer.Demo.Avalonia.Browser/HtmlRenderer.Demo.Avalonia.Browser.csproj @@ -1,6 +1,6 @@  - net7.0 + net8.0 browser-wasm AppBundle\main.js Exe @@ -12,7 +12,7 @@ - + diff --git a/Source/Demo/Avalonia/HtmlRenderer.Demo.Avalonia.Desktop/HtmlRenderer.Demo.Avalonia.Desktop.csproj b/Source/Demo/Avalonia/HtmlRenderer.Demo.Avalonia.Desktop/HtmlRenderer.Demo.Avalonia.Desktop.csproj index 703d03d..1d355d7 100644 --- a/Source/Demo/Avalonia/HtmlRenderer.Demo.Avalonia.Desktop/HtmlRenderer.Demo.Avalonia.Desktop.csproj +++ b/Source/Demo/Avalonia/HtmlRenderer.Demo.Avalonia.Desktop/HtmlRenderer.Demo.Avalonia.Desktop.csproj @@ -1,7 +1,7 @@  WinExe - net7.0 + net8.0 enable true @@ -11,9 +11,9 @@ - + - + diff --git a/Source/Demo/Avalonia/HtmlRenderer.Demo.Avalonia.iOS/HtmlRenderer.Demo.Avalonia.iOS.csproj b/Source/Demo/Avalonia/HtmlRenderer.Demo.Avalonia.iOS/HtmlRenderer.Demo.Avalonia.iOS.csproj index 1ecfd00..0a825e0 100644 --- a/Source/Demo/Avalonia/HtmlRenderer.Demo.Avalonia.iOS/HtmlRenderer.Demo.Avalonia.iOS.csproj +++ b/Source/Demo/Avalonia/HtmlRenderer.Demo.Avalonia.iOS/HtmlRenderer.Demo.Avalonia.iOS.csproj @@ -1,7 +1,7 @@  Exe - net7.0-ios + net8.0-ios 10.0 manual enable @@ -13,7 +13,7 @@ - + diff --git a/Source/Demo/Avalonia/HtmlRenderer.Demo.Avalonia/HtmlRenderer.Demo.Avalonia.csproj b/Source/Demo/Avalonia/HtmlRenderer.Demo.Avalonia/HtmlRenderer.Demo.Avalonia.csproj index 16c6ebc..f759cf9 100644 --- a/Source/Demo/Avalonia/HtmlRenderer.Demo.Avalonia/HtmlRenderer.Demo.Avalonia.csproj +++ b/Source/Demo/Avalonia/HtmlRenderer.Demo.Avalonia/HtmlRenderer.Demo.Avalonia.csproj @@ -1,6 +1,6 @@  - net7.0 + net8.0 @@ -10,7 +10,7 @@ - - + + \ No newline at end of file diff --git a/Source/Demo/Common/HtmlRenderer.Demo.Common.csproj b/Source/Demo/Common/HtmlRenderer.Demo.Common.csproj index b8bad4e..16e5233 100644 --- a/Source/Demo/Common/HtmlRenderer.Demo.Common.csproj +++ b/Source/Demo/Common/HtmlRenderer.Demo.Common.csproj @@ -130,7 +130,7 @@ - - + + \ No newline at end of file From 7bc0482426878fb72dc32fe1df6e22ce346fff8e Mon Sep 17 00:00:00 2001 From: Denys Volodarskyi Date: Wed, 10 Jul 2024 22:30:13 +0300 Subject: [PATCH 2/5] HtmlRenderer project updated from net6 to net8 --- Source/Avalonia.HtmlRenderer/Avalonia.HtmlRenderer.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Avalonia.HtmlRenderer/Avalonia.HtmlRenderer.csproj b/Source/Avalonia.HtmlRenderer/Avalonia.HtmlRenderer.csproj index 2c925ac..c1f1f88 100644 --- a/Source/Avalonia.HtmlRenderer/Avalonia.HtmlRenderer.csproj +++ b/Source/Avalonia.HtmlRenderer/Avalonia.HtmlRenderer.csproj @@ -1,6 +1,6 @@  - netstandard2.0;net6.0 + netstandard2.0;net8.0 CS0436 From 12f7ac3dedac1a1452ce0fa88c3630fb319f6457 Mon Sep 17 00:00:00 2001 From: Denys Volodarskyi Date: Wed, 10 Jul 2024 22:31:01 +0300 Subject: [PATCH 3/5] Set language version to Latest for HtmlRenderer --- Source/Avalonia.HtmlRenderer/Avalonia.HtmlRenderer.csproj | 1 + 1 file changed, 1 insertion(+) diff --git a/Source/Avalonia.HtmlRenderer/Avalonia.HtmlRenderer.csproj b/Source/Avalonia.HtmlRenderer/Avalonia.HtmlRenderer.csproj index c1f1f88..4b3a2cf 100644 --- a/Source/Avalonia.HtmlRenderer/Avalonia.HtmlRenderer.csproj +++ b/Source/Avalonia.HtmlRenderer/Avalonia.HtmlRenderer.csproj @@ -2,6 +2,7 @@ netstandard2.0;net8.0 CS0436 + Latest 11.0.0 From 6ba5f04f22365ecf3cfe8ee5578307cbfa6bbe1b Mon Sep 17 00:00:00 2001 From: Denys Volodarskyi Date: Wed, 10 Jul 2024 22:33:12 +0300 Subject: [PATCH 4/5] Added missing usages --- Source/HtmlRenderer/Core/Dom/HoverBoxBlock.cs | 5 +++++ Source/HtmlRenderer/Core/HtmlContainerInt.cs | 2 ++ Source/HtmlRenderer/Core/Parse/DomParser.cs | 1 + 3 files changed, 8 insertions(+) diff --git a/Source/HtmlRenderer/Core/Dom/HoverBoxBlock.cs b/Source/HtmlRenderer/Core/Dom/HoverBoxBlock.cs index 967dcd9..934eb5c 100644 --- a/Source/HtmlRenderer/Core/Dom/HoverBoxBlock.cs +++ b/Source/HtmlRenderer/Core/Dom/HoverBoxBlock.cs @@ -10,7 +10,12 @@ // - Sun Tsu, // "The Art of War" +using System.Collections.Generic; +using System.Linq; + using TheArtOfDev.HtmlRenderer.Core.Entities; +using TheArtOfDev.HtmlRenderer.Core.Parse; +using TheArtOfDev.HtmlRenderer.Core.Utils; namespace TheArtOfDev.HtmlRenderer.Core.Dom { diff --git a/Source/HtmlRenderer/Core/HtmlContainerInt.cs b/Source/HtmlRenderer/Core/HtmlContainerInt.cs index f344854..11c98d0 100644 --- a/Source/HtmlRenderer/Core/HtmlContainerInt.cs +++ b/Source/HtmlRenderer/Core/HtmlContainerInt.cs @@ -13,6 +13,8 @@ using System; using System.Collections.Generic; using System.Diagnostics; +using System.Linq; + using TheArtOfDev.HtmlRenderer.Adapters; using TheArtOfDev.HtmlRenderer.Adapters.Entities; using TheArtOfDev.HtmlRenderer.Core.Dom; diff --git a/Source/HtmlRenderer/Core/Parse/DomParser.cs b/Source/HtmlRenderer/Core/Parse/DomParser.cs index db28645..1d97ff4 100644 --- a/Source/HtmlRenderer/Core/Parse/DomParser.cs +++ b/Source/HtmlRenderer/Core/Parse/DomParser.cs @@ -11,6 +11,7 @@ // "The Art of War" using System; +using System.Collections.Generic; using System.Globalization; using TheArtOfDev.HtmlRenderer.Adapters.Entities; using TheArtOfDev.HtmlRenderer.Core.Dom; From 4287b95ba88a6db9e549f54b859903c340415277 Mon Sep 17 00:00:00 2001 From: Denys Volodarskyi Date: Wed, 10 Jul 2024 22:37:57 +0300 Subject: [PATCH 5/5] Added missing AssignCssProps (similar to AssignCssBlock) --- Source/HtmlRenderer/Core/Parse/DomParser.cs | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/Source/HtmlRenderer/Core/Parse/DomParser.cs b/Source/HtmlRenderer/Core/Parse/DomParser.cs index 1d97ff4..2a449ed 100644 --- a/Source/HtmlRenderer/Core/Parse/DomParser.cs +++ b/Source/HtmlRenderer/Core/Parse/DomParser.cs @@ -333,14 +333,9 @@ namespace TheArtOfDev.HtmlRenderer.Core.Parse return true; } - /// - /// Assigns the given css style block properties to the given css box. - /// - /// the css box to assign css to - /// the css block to assign - private static void AssignCssBlock(CssBox box, CssBlock block) + internal static void AssignCssProps(CssBox box, IDictionary properties) { - foreach (var prop in block.Properties) + foreach (var prop in properties) { var value = prop.Value; if (prop.Value == CssConstants.Inherit && box.ParentBox != null) @@ -354,6 +349,16 @@ namespace TheArtOfDev.HtmlRenderer.Core.Parse } } + /// + /// Assigns the given css style block properties to the given css box. + /// + /// the css box to assign css to + /// the css block to assign + private static void AssignCssBlock(CssBox box, CssBlock block) + { + AssignCssProps(box, block.Properties); + } + /// /// Check if the given style is allowed to be set on the given css box.
/// Used to prevent invalid CssBoxes creation like table with inline display style.