Skip to content

Commit

Permalink
fix(wasm): fix non-uno.ui type HtmlElementAttribute inheritance
Browse files Browse the repository at this point in the history
  • Loading branch information
Daoting authored and jeromelaban committed Feb 4, 2021
1 parent e6db5a3 commit 2518b14
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 1 deletion.
7 changes: 7 additions & 0 deletions src/SamplesApp/UITests.Shared/UITests.Shared.projitems
Original file line number Diff line number Diff line change
Expand Up @@ -3793,6 +3793,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="$(MSBuildThisFileDirectory)Windows_UI_Xaml_Shapes\Path_Custom.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="$(MSBuildThisFileDirectory)Windows_UI_Xaml_Shapes\Path_Geometries.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
Expand Down Expand Up @@ -6094,6 +6098,9 @@
<Compile Include="$(MSBuildThisFileDirectory)Windows_UI_Xaml_Shapes\Path_ClearData.xaml.cs">
<DependentUpon>Path_ClearData.xaml</DependentUpon>
</Compile>
<Compile Include="$(MSBuildThisFileDirectory)Windows_UI_Xaml_Shapes\Path_Custom.xaml.cs">
<DependentUpon>Path_Custom.xaml</DependentUpon>
</Compile>
<Compile Include="$(MSBuildThisFileDirectory)Windows_UI_Xaml_Shapes\Path_Geometries.xaml.cs">
<DependentUpon>Path_Geometries.xaml</DependentUpon>
</Compile>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<Page
x:Class="UITests.Windows_UI_Xaml_Shapes.Path_Custom"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:UITests.Windows_UI_Xaml_Shapes"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">

<Grid>
<local:MyPath Stroke="Black" StrokeThickness="1" >
<Path.Data>
<PathGeometry>
<PathGeometry.Figures>
<PathFigure StartPoint="10,50">
<PathFigure.Segments>
<BezierSegment
Point1="100,0"
Point2="200,200"
Point3="300,100"/>
<LineSegment Point="400,100" />
<ArcSegment
Size="50,50" RotationAngle="45"
IsLargeArc="True" SweepDirection="Clockwise"
Point="200,100"/>
</PathFigure.Segments>
</PathFigure>
</PathGeometry.Figures>
</PathGeometry>
</Path.Data>
</local:MyPath>
</Grid>
</Page>
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using Uno.UI.Samples.Controls;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Shapes;

namespace UITests.Windows_UI_Xaml_Shapes
{
[Sample("Shapes")]
public sealed partial class Path_Custom : Page
{
public Path_Custom()
{
this.InitializeComponent();
}
}

//#if __WASM__
// [Uno.UI.Runtime.WebAssembly.HtmlElement("svg")]
//#endif
public partial class MyPath : Path
{

}
}
3 changes: 2 additions & 1 deletion src/Uno.UI/UI/Xaml/UIElement.wasm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,8 @@ private string GetHtmlTag(string htmlTag)

if (!_htmlTagCache.TryGetValue(currentType, out var htmlTagOverride))
{
htmlTagOverride = DefaultHtmlTag;
// Set the tag of the parent class to default.
htmlTagOverride = htmlTag;

if (currentType.GetCustomAttribute(_htmlElementAttribute) is Attribute attr)
{
Expand Down

0 comments on commit 2518b14

Please sign in to comment.