Add C# bindings for Errata API (#1259)

Summary:
Pull Request resolved: https://github.com/facebook/yoga/pull/1259

Wires C ABI to C# bindings using `System.Runtime.InteropServices`. Note that we don't have a working C# build right now, but there is [effort to address that](https://github.com/facebook/yoga/pull/1207) which may get some more effort before the Yoga release, so this keeps the bindings up to date.

Reviewed By: yungsters

Differential Revision: D45297676

fbshipit-source-id: 408f84d74ebbc7698407e951e831627117cbc2ed
This commit is contained in:
Nick Gerleman
2023-04-27 13:53:45 -07:00
committed by Facebook GitHub Bot
parent c1a5219b03
commit 215f0a9d6d
2 changed files with 25 additions and 2 deletions

View File

@@ -73,6 +73,12 @@ namespace Facebook.Yoga
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
public static extern bool YGConfigGetUseLegacyStretchBehaviour(YGConfigHandle config);
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
public static extern void YGConfigSetErrata(YGConfigHandle config, YogaErrata errata);
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
public static extern YogaErrata YGConfigGetErrata(YGConfigHandle config);
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
public static extern void YGConfigSetPointScaleFactor(
YGConfigHandle config,

View File

@@ -117,8 +117,12 @@ namespace Facebook.Yoga
}
}
public bool UseLegacyStretchBehaviour
{
[ObsoleteAttribute("\"UseLegacyStretchBehaviour\" will be removed in the next release. " +
"Usage should be replaced with \"Errata\" set to \"YogaErrata.All\" to opt out of all " +
"future breaking conformance fixes, or \"YogaErrata.StretchFlexBasis\" toopt out of " +
"the specific conformance fix previously disabled by \"UseLegacyStretchBehaviour\".",
true /*error*/)]
public bool UseLegacyStretchBehaviour {
get
{
return Native.YGConfigGetUseLegacyStretchBehaviour(_ygConfig);
@@ -130,6 +134,19 @@ namespace Facebook.Yoga
}
}
public YogaErrata Errata
{
get
{
return Native.YGConfigGetErrata(_ygConfig);
}
set
{
Native.YGConfigSetErrata(_ygConfig, value);
}
}
public float PointScaleFactor
{
set