Skip to content

Commit

Permalink
perf(WindowManager): Add CssSupports binding
Browse files Browse the repository at this point in the history
  • Loading branch information
ebariche committed Mar 24, 2023
1 parent 9a46fda commit bf0276d
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/Uno.UI/UI/Xaml/WindowManagerInterop.wasm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -371,9 +371,13 @@ private struct WindowManagerSetStylesParams

internal static bool IsCssFeatureSupported(string supportCondition)
{
#if NET7_0_OR_GREATER
return NativeMethods.CssSupports(supportCondition);
#else
var command = $"Uno.UI.WindowManager.current.isCssConditionSupported(\"{WebAssemblyRuntime.EscapeJs(supportCondition)}\")";
var result = WebAssemblyRuntime.InvokeJS(command);
return bool.Parse(result);
#endif
}

#endregion
Expand Down Expand Up @@ -1194,6 +1198,9 @@ internal static partial void ArrangeElement(
[JSImport("globalThis.Uno.UI.WindowManager.current.createContentNativeFast")]
internal static partial void CreateContent(IntPtr htmlId, string tagName, int uiElementRegistrationId, bool isFocusable, bool isSvg);

[JSImport("globalThis.CSS.supports")]
internal static partial bool CssSupports(string condition);

[JSImport("globalThis.Uno.UI.WindowManager.current.destroyViewNativeFast")]
internal static partial void DestroyView(IntPtr htmlId);

Expand Down

0 comments on commit bf0276d

Please sign in to comment.