Skip to content

Commit 406c5e2

Browse files
committed
perf(WindowManager): Add CreateContentNativeFast binding
1 parent e0fe6df commit 406c5e2

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

src/Uno.UI/UI/Xaml/WindowManagerInterop.wasm.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,9 @@ internal static void CreateContent(IntPtr htmlId, string htmlTag, IntPtr handle,
8181
}
8282
else
8383
{
84+
#if NET7_0_OR_GREATER
85+
NativeMethods.CreateContent(htmlId, htmlTag, uiElementRegistrationId, isFocusable, htmlTagIsSvg);
86+
#else
8487
var parms = new WindowManagerCreateContentParams
8588
{
8689
HtmlId = htmlId,
@@ -92,6 +95,7 @@ internal static void CreateContent(IntPtr htmlId, string htmlTag, IntPtr handle,
9295
};
9396

9497
TSInteropMarshaller.InvokeJS("Uno:createContentNative", parms);
98+
#endif
9599
}
96100
}
97101

@@ -1563,6 +1567,9 @@ internal static partial void ArrangeElement(
15631567
double clipBottom,
15641568
double clipRight);
15651569

1570+
[JSImport("globalThis.Uno.UI.WindowManager.current.createContentNativeFast")]
1571+
internal static partial void CreateContent(IntPtr htmlId, string tagName, int uiElementRegistrationId, bool isFocusable, bool isSvg);
1572+
15661573
[JSImport("globalThis.Uno.UI.WindowManager.current.measureViewNativeFast")]
15671574
internal static partial void MeasureView(IntPtr htmlId, double availableWidth, double availableHeight, bool measureContent, IntPtr pReturn);
15681575

src/Uno.UI/ts/WindowManager.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,23 @@ namespace Uno.UI {
252252
return true;
253253
}
254254

255+
public createContentNativeFast(
256+
htmlId: number,
257+
tagName: string,
258+
uiElementRegistrationId: number,
259+
isFocusable: boolean,
260+
isSvg: boolean) {
261+
262+
this.createContentInternal({
263+
id: this.handleToString(htmlId),
264+
handle: htmlId, /* handle is htmlId */
265+
tagName: tagName,
266+
uiElementRegistrationId: uiElementRegistrationId,
267+
isFocusable: isFocusable,
268+
isSvg: isSvg
269+
});
270+
}
271+
255272
private createContentInternal(contentDefinition: IContentDefinition): void {
256273
// Create the HTML element
257274
const element =

0 commit comments

Comments
 (0)