Workaround for P/Invoke AccessViolationException
Summary: The issue is on ARM builds for Windows UWP. For the C# P/Invoke API wrapper, any native method that returns the YogaValue struct throws the AccessViolationException. The issue is not with structs in general, as returning the YogaSize / YGSize struct works fine. The issue seems to be limited to structs that have an enum member. I tried a number of things to resolve the issue without changing the underlying native API for Windows. I read the ARM documentation and saw reference to variable enum sizes based on the number of enum members, so I tried to use a number of different UnmanagedType values in a [MarsalAs()] attribute on the enum member of the C# struct declaration. What ultimately worked was to return a pointer to the location of the struct, and use the System.Runtime.InteropServices.PtrToStructure API to read the struct data from that pointer. I added a few new macros that will return the struct address on Windows only, other builds are not affected. Note, I have not tested the impact of this ch Closes https://github.com/facebook/yoga/pull/459 Reviewed By: emilsjolander Differential Revision: D4652278 Pulled By: splhack fbshipit-source-id: bf7ada4da1781e3f813b3ba331974b7bded476d9
This commit is contained in:
committed by
Facebook Github Bot
parent
62f47190fb
commit
5bc0197c78
@@ -12,6 +12,12 @@ using System.Runtime.InteropServices;
|
|||||||
|
|
||||||
namespace Facebook.Yoga
|
namespace Facebook.Yoga
|
||||||
{
|
{
|
||||||
|
#if WINDOWS_UWP_ARM
|
||||||
|
using YogaValueType = IntPtr;
|
||||||
|
#else
|
||||||
|
using YogaValueType = YogaValue;
|
||||||
|
#endif
|
||||||
|
|
||||||
internal static class Native
|
internal static class Native
|
||||||
{
|
{
|
||||||
#if (UNITY_IOS && !UNITY_EDITOR) || __IOS__
|
#if (UNITY_IOS && !UNITY_EDITOR) || __IOS__
|
||||||
@@ -282,7 +288,7 @@ namespace Facebook.Yoga
|
|||||||
public static extern void YGNodeStyleSetFlexBasisAuto(YGNodeHandle node);
|
public static extern void YGNodeStyleSetFlexBasisAuto(YGNodeHandle node);
|
||||||
|
|
||||||
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern YogaValue YGNodeStyleGetFlexBasis(YGNodeHandle node);
|
public static extern YogaValueType YGNodeStyleGetFlexBasis(YGNodeHandle node);
|
||||||
|
|
||||||
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern void YGNodeStyleSetWidth(YGNodeHandle node, float width);
|
public static extern void YGNodeStyleSetWidth(YGNodeHandle node, float width);
|
||||||
@@ -294,7 +300,7 @@ namespace Facebook.Yoga
|
|||||||
public static extern void YGNodeStyleSetWidthAuto(YGNodeHandle node);
|
public static extern void YGNodeStyleSetWidthAuto(YGNodeHandle node);
|
||||||
|
|
||||||
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern YogaValue YGNodeStyleGetWidth(YGNodeHandle node);
|
public static extern YogaValueType YGNodeStyleGetWidth(YGNodeHandle node);
|
||||||
|
|
||||||
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern void YGNodeStyleSetHeight(YGNodeHandle node, float height);
|
public static extern void YGNodeStyleSetHeight(YGNodeHandle node, float height);
|
||||||
@@ -306,7 +312,7 @@ namespace Facebook.Yoga
|
|||||||
public static extern void YGNodeStyleSetHeightAuto(YGNodeHandle node);
|
public static extern void YGNodeStyleSetHeightAuto(YGNodeHandle node);
|
||||||
|
|
||||||
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern YogaValue YGNodeStyleGetHeight(YGNodeHandle node);
|
public static extern YogaValueType YGNodeStyleGetHeight(YGNodeHandle node);
|
||||||
|
|
||||||
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern void YGNodeStyleSetMinWidth(YGNodeHandle node, float minWidth);
|
public static extern void YGNodeStyleSetMinWidth(YGNodeHandle node, float minWidth);
|
||||||
@@ -315,7 +321,7 @@ namespace Facebook.Yoga
|
|||||||
public static extern void YGNodeStyleSetMinWidthPercent(YGNodeHandle node, float minWidth);
|
public static extern void YGNodeStyleSetMinWidthPercent(YGNodeHandle node, float minWidth);
|
||||||
|
|
||||||
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern YogaValue YGNodeStyleGetMinWidth(YGNodeHandle node);
|
public static extern YogaValueType YGNodeStyleGetMinWidth(YGNodeHandle node);
|
||||||
|
|
||||||
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern void YGNodeStyleSetMinHeight(YGNodeHandle node, float minHeight);
|
public static extern void YGNodeStyleSetMinHeight(YGNodeHandle node, float minHeight);
|
||||||
@@ -324,7 +330,7 @@ namespace Facebook.Yoga
|
|||||||
public static extern void YGNodeStyleSetMinHeightPercent(YGNodeHandle node, float minHeight);
|
public static extern void YGNodeStyleSetMinHeightPercent(YGNodeHandle node, float minHeight);
|
||||||
|
|
||||||
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern YogaValue YGNodeStyleGetMinHeight(YGNodeHandle node);
|
public static extern YogaValueType YGNodeStyleGetMinHeight(YGNodeHandle node);
|
||||||
|
|
||||||
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern void YGNodeStyleSetMaxWidth(YGNodeHandle node, float maxWidth);
|
public static extern void YGNodeStyleSetMaxWidth(YGNodeHandle node, float maxWidth);
|
||||||
@@ -333,7 +339,7 @@ namespace Facebook.Yoga
|
|||||||
public static extern void YGNodeStyleSetMaxWidthPercent(YGNodeHandle node, float maxWidth);
|
public static extern void YGNodeStyleSetMaxWidthPercent(YGNodeHandle node, float maxWidth);
|
||||||
|
|
||||||
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern YogaValue YGNodeStyleGetMaxWidth(YGNodeHandle node);
|
public static extern YogaValueType YGNodeStyleGetMaxWidth(YGNodeHandle node);
|
||||||
|
|
||||||
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern void YGNodeStyleSetMaxHeight(YGNodeHandle node, float maxHeight);
|
public static extern void YGNodeStyleSetMaxHeight(YGNodeHandle node, float maxHeight);
|
||||||
@@ -342,7 +348,7 @@ namespace Facebook.Yoga
|
|||||||
public static extern void YGNodeStyleSetMaxHeightPercent(YGNodeHandle node, float maxHeight);
|
public static extern void YGNodeStyleSetMaxHeightPercent(YGNodeHandle node, float maxHeight);
|
||||||
|
|
||||||
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern YogaValue YGNodeStyleGetMaxHeight(YGNodeHandle node);
|
public static extern YogaValueType YGNodeStyleGetMaxHeight(YGNodeHandle node);
|
||||||
|
|
||||||
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern void YGNodeStyleSetAspectRatio(YGNodeHandle node, float aspectRatio);
|
public static extern void YGNodeStyleSetAspectRatio(YGNodeHandle node, float aspectRatio);
|
||||||
@@ -361,7 +367,7 @@ namespace Facebook.Yoga
|
|||||||
public static extern void YGNodeStyleSetPositionPercent(YGNodeHandle node, YogaEdge edge, float position);
|
public static extern void YGNodeStyleSetPositionPercent(YGNodeHandle node, YogaEdge edge, float position);
|
||||||
|
|
||||||
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern YogaValue YGNodeStyleGetPosition(YGNodeHandle node, YogaEdge edge);
|
public static extern YogaValueType YGNodeStyleGetPosition(YGNodeHandle node, YogaEdge edge);
|
||||||
|
|
||||||
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern void YGNodeStyleSetMargin(YGNodeHandle node, YogaEdge edge, float margin);
|
public static extern void YGNodeStyleSetMargin(YGNodeHandle node, YogaEdge edge, float margin);
|
||||||
@@ -373,7 +379,7 @@ namespace Facebook.Yoga
|
|||||||
public static extern void YGNodeStyleSetMarginAuto(YGNodeHandle node, YogaEdge edge);
|
public static extern void YGNodeStyleSetMarginAuto(YGNodeHandle node, YogaEdge edge);
|
||||||
|
|
||||||
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern YogaValue YGNodeStyleGetMargin(YGNodeHandle node, YogaEdge edge);
|
public static extern YogaValueType YGNodeStyleGetMargin(YGNodeHandle node, YogaEdge edge);
|
||||||
|
|
||||||
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern void YGNodeStyleSetPadding(YGNodeHandle node, YogaEdge edge, float padding);
|
public static extern void YGNodeStyleSetPadding(YGNodeHandle node, YogaEdge edge, float padding);
|
||||||
@@ -382,7 +388,7 @@ namespace Facebook.Yoga
|
|||||||
public static extern void YGNodeStyleSetPaddingPercent(YGNodeHandle node, YogaEdge edge, float padding);
|
public static extern void YGNodeStyleSetPaddingPercent(YGNodeHandle node, YogaEdge edge, float padding);
|
||||||
|
|
||||||
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern YogaValue YGNodeStyleGetPadding(YGNodeHandle node, YogaEdge edge);
|
public static extern YogaValueType YGNodeStyleGetPadding(YGNodeHandle node, YogaEdge edge);
|
||||||
|
|
||||||
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern void YGNodeStyleSetBorder(YGNodeHandle node, YogaEdge edge, float border);
|
public static extern void YGNodeStyleSetBorder(YGNodeHandle node, YogaEdge edge, float border);
|
||||||
|
@@ -7,8 +7,6 @@
|
|||||||
* of patent rights can be found in the PATENTS file in the same directory.
|
* of patent rights can be found in the PATENTS file in the same directory.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
using System;
|
|
||||||
|
|
||||||
namespace Facebook.Yoga
|
namespace Facebook.Yoga
|
||||||
{
|
{
|
||||||
public partial class YogaNode
|
public partial class YogaNode
|
||||||
@@ -17,7 +15,7 @@ namespace Facebook.Yoga
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return Native.YGNodeStyleGetPosition(_ygNode, YogaEdge.Left);
|
return YogaValue.MarshalValue(Native.YGNodeStyleGetPosition(_ygNode, YogaEdge.Left));
|
||||||
}
|
}
|
||||||
|
|
||||||
set
|
set
|
||||||
@@ -30,7 +28,7 @@ namespace Facebook.Yoga
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return Native.YGNodeStyleGetPosition(_ygNode, YogaEdge.Top);
|
return YogaValue.MarshalValue(Native.YGNodeStyleGetPosition(_ygNode, YogaEdge.Top));
|
||||||
}
|
}
|
||||||
|
|
||||||
set
|
set
|
||||||
@@ -43,7 +41,7 @@ namespace Facebook.Yoga
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return Native.YGNodeStyleGetPosition(_ygNode, YogaEdge.Right);
|
return YogaValue.MarshalValue(Native.YGNodeStyleGetPosition(_ygNode, YogaEdge.Right));
|
||||||
}
|
}
|
||||||
|
|
||||||
set
|
set
|
||||||
@@ -56,7 +54,7 @@ namespace Facebook.Yoga
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return Native.YGNodeStyleGetPosition(_ygNode, YogaEdge.Bottom);
|
return YogaValue.MarshalValue(Native.YGNodeStyleGetPosition(_ygNode, YogaEdge.Bottom));
|
||||||
}
|
}
|
||||||
|
|
||||||
set
|
set
|
||||||
@@ -69,7 +67,7 @@ namespace Facebook.Yoga
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return Native.YGNodeStyleGetPosition(_ygNode, YogaEdge.Start);
|
return YogaValue.MarshalValue(Native.YGNodeStyleGetPosition(_ygNode, YogaEdge.Start));
|
||||||
}
|
}
|
||||||
|
|
||||||
set
|
set
|
||||||
@@ -82,7 +80,7 @@ namespace Facebook.Yoga
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return Native.YGNodeStyleGetPosition(_ygNode, YogaEdge.End);
|
return YogaValue.MarshalValue(Native.YGNodeStyleGetPosition(_ygNode, YogaEdge.End));
|
||||||
}
|
}
|
||||||
|
|
||||||
set
|
set
|
||||||
@@ -107,7 +105,7 @@ namespace Facebook.Yoga
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return Native.YGNodeStyleGetMargin(_ygNode, YogaEdge.Left);
|
return YogaValue.MarshalValue(Native.YGNodeStyleGetMargin(_ygNode, YogaEdge.Left));
|
||||||
}
|
}
|
||||||
|
|
||||||
set
|
set
|
||||||
@@ -120,7 +118,7 @@ namespace Facebook.Yoga
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return Native.YGNodeStyleGetMargin(_ygNode, YogaEdge.Top);
|
return YogaValue.MarshalValue(Native.YGNodeStyleGetMargin(_ygNode, YogaEdge.Top));
|
||||||
}
|
}
|
||||||
|
|
||||||
set
|
set
|
||||||
@@ -133,7 +131,7 @@ namespace Facebook.Yoga
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return Native.YGNodeStyleGetMargin(_ygNode, YogaEdge.Right);
|
return YogaValue.MarshalValue(Native.YGNodeStyleGetMargin(_ygNode, YogaEdge.Right));
|
||||||
}
|
}
|
||||||
|
|
||||||
set
|
set
|
||||||
@@ -146,7 +144,7 @@ namespace Facebook.Yoga
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return Native.YGNodeStyleGetMargin(_ygNode, YogaEdge.Bottom);
|
return YogaValue.MarshalValue(Native.YGNodeStyleGetMargin(_ygNode, YogaEdge.Bottom));
|
||||||
}
|
}
|
||||||
|
|
||||||
set
|
set
|
||||||
@@ -159,7 +157,7 @@ namespace Facebook.Yoga
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return Native.YGNodeStyleGetMargin(_ygNode, YogaEdge.Start);
|
return YogaValue.MarshalValue(Native.YGNodeStyleGetMargin(_ygNode, YogaEdge.Start));
|
||||||
}
|
}
|
||||||
|
|
||||||
set
|
set
|
||||||
@@ -172,7 +170,7 @@ namespace Facebook.Yoga
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return Native.YGNodeStyleGetMargin(_ygNode, YogaEdge.End);
|
return YogaValue.MarshalValue(Native.YGNodeStyleGetMargin(_ygNode, YogaEdge.End));
|
||||||
}
|
}
|
||||||
|
|
||||||
set
|
set
|
||||||
@@ -185,7 +183,7 @@ namespace Facebook.Yoga
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return Native.YGNodeStyleGetMargin(_ygNode, YogaEdge.Horizontal);
|
return YogaValue.MarshalValue(Native.YGNodeStyleGetMargin(_ygNode, YogaEdge.Horizontal));
|
||||||
}
|
}
|
||||||
|
|
||||||
set
|
set
|
||||||
@@ -198,7 +196,7 @@ namespace Facebook.Yoga
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return Native.YGNodeStyleGetMargin(_ygNode, YogaEdge.Vertical);
|
return YogaValue.MarshalValue(Native.YGNodeStyleGetMargin(_ygNode, YogaEdge.Vertical));
|
||||||
}
|
}
|
||||||
|
|
||||||
set
|
set
|
||||||
@@ -211,7 +209,7 @@ namespace Facebook.Yoga
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return Native.YGNodeStyleGetMargin(_ygNode, YogaEdge.All);
|
return YogaValue.MarshalValue(Native.YGNodeStyleGetMargin(_ygNode, YogaEdge.All));
|
||||||
}
|
}
|
||||||
|
|
||||||
set
|
set
|
||||||
@@ -240,7 +238,7 @@ namespace Facebook.Yoga
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return Native.YGNodeStyleGetPadding(_ygNode, YogaEdge.Left);
|
return YogaValue.MarshalValue(Native.YGNodeStyleGetPadding(_ygNode, YogaEdge.Left));
|
||||||
}
|
}
|
||||||
|
|
||||||
set
|
set
|
||||||
@@ -253,7 +251,7 @@ namespace Facebook.Yoga
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return Native.YGNodeStyleGetPadding(_ygNode, YogaEdge.Top);
|
return YogaValue.MarshalValue(Native.YGNodeStyleGetPadding(_ygNode, YogaEdge.Top));
|
||||||
}
|
}
|
||||||
|
|
||||||
set
|
set
|
||||||
@@ -266,7 +264,7 @@ namespace Facebook.Yoga
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return Native.YGNodeStyleGetPadding(_ygNode, YogaEdge.Right);
|
return YogaValue.MarshalValue(Native.YGNodeStyleGetPadding(_ygNode, YogaEdge.Right));
|
||||||
}
|
}
|
||||||
|
|
||||||
set
|
set
|
||||||
@@ -279,7 +277,7 @@ namespace Facebook.Yoga
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return Native.YGNodeStyleGetPadding(_ygNode, YogaEdge.Bottom);
|
return YogaValue.MarshalValue(Native.YGNodeStyleGetPadding(_ygNode, YogaEdge.Bottom));
|
||||||
}
|
}
|
||||||
|
|
||||||
set
|
set
|
||||||
@@ -292,7 +290,7 @@ namespace Facebook.Yoga
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return Native.YGNodeStyleGetPadding(_ygNode, YogaEdge.Start);
|
return YogaValue.MarshalValue(Native.YGNodeStyleGetPadding(_ygNode, YogaEdge.Start));
|
||||||
}
|
}
|
||||||
|
|
||||||
set
|
set
|
||||||
@@ -305,7 +303,7 @@ namespace Facebook.Yoga
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return Native.YGNodeStyleGetPadding(_ygNode, YogaEdge.End);
|
return YogaValue.MarshalValue(Native.YGNodeStyleGetPadding(_ygNode, YogaEdge.End));
|
||||||
}
|
}
|
||||||
|
|
||||||
set
|
set
|
||||||
@@ -318,7 +316,7 @@ namespace Facebook.Yoga
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return Native.YGNodeStyleGetPadding(_ygNode, YogaEdge.Horizontal);
|
return YogaValue.MarshalValue(Native.YGNodeStyleGetPadding(_ygNode, YogaEdge.Horizontal));
|
||||||
}
|
}
|
||||||
|
|
||||||
set
|
set
|
||||||
@@ -331,7 +329,7 @@ namespace Facebook.Yoga
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return Native.YGNodeStyleGetPadding(_ygNode, YogaEdge.Vertical);
|
return YogaValue.MarshalValue(Native.YGNodeStyleGetPadding(_ygNode, YogaEdge.Vertical));
|
||||||
}
|
}
|
||||||
|
|
||||||
set
|
set
|
||||||
@@ -344,7 +342,7 @@ namespace Facebook.Yoga
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return Native.YGNodeStyleGetPadding(_ygNode, YogaEdge.All);
|
return YogaValue.MarshalValue(Native.YGNodeStyleGetPadding(_ygNode, YogaEdge.All));
|
||||||
}
|
}
|
||||||
|
|
||||||
set
|
set
|
||||||
|
@@ -318,7 +318,7 @@ namespace Facebook.Yoga
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return Native.YGNodeStyleGetFlexBasis(_ygNode);
|
return YogaValue.MarshalValue(Native.YGNodeStyleGetFlexBasis(_ygNode));
|
||||||
}
|
}
|
||||||
|
|
||||||
set
|
set
|
||||||
@@ -342,7 +342,7 @@ namespace Facebook.Yoga
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return Native.YGNodeStyleGetWidth(_ygNode);
|
return YogaValue.MarshalValue(Native.YGNodeStyleGetWidth(_ygNode));
|
||||||
}
|
}
|
||||||
|
|
||||||
set
|
set
|
||||||
@@ -366,7 +366,7 @@ namespace Facebook.Yoga
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return Native.YGNodeStyleGetHeight(_ygNode);
|
return YogaValue.MarshalValue(Native.YGNodeStyleGetHeight(_ygNode));
|
||||||
}
|
}
|
||||||
|
|
||||||
set
|
set
|
||||||
@@ -390,7 +390,7 @@ namespace Facebook.Yoga
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return Native.YGNodeStyleGetMaxWidth(_ygNode);
|
return YogaValue.MarshalValue(Native.YGNodeStyleGetMaxWidth(_ygNode));
|
||||||
}
|
}
|
||||||
|
|
||||||
set
|
set
|
||||||
@@ -410,7 +410,7 @@ namespace Facebook.Yoga
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return Native.YGNodeStyleGetMaxHeight(_ygNode);
|
return YogaValue.MarshalValue(Native.YGNodeStyleGetMaxHeight(_ygNode));
|
||||||
}
|
}
|
||||||
|
|
||||||
set
|
set
|
||||||
@@ -430,7 +430,7 @@ namespace Facebook.Yoga
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return Native.YGNodeStyleGetMinWidth(_ygNode);
|
return YogaValue.MarshalValue(Native.YGNodeStyleGetMinWidth(_ygNode));
|
||||||
}
|
}
|
||||||
|
|
||||||
set
|
set
|
||||||
@@ -450,7 +450,7 @@ namespace Facebook.Yoga
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return Native.YGNodeStyleGetMinHeight(_ygNode);
|
return YogaValue.MarshalValue(Native.YGNodeStyleGetMinHeight(_ygNode));
|
||||||
}
|
}
|
||||||
|
|
||||||
set
|
set
|
||||||
|
@@ -7,6 +7,7 @@
|
|||||||
* of patent rights can be found in the PATENTS file in the same directory.
|
* of patent rights can be found in the PATENTS file in the same directory.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
using System;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
namespace Facebook.Yoga
|
namespace Facebook.Yoga
|
||||||
@@ -92,5 +93,17 @@ namespace Facebook.Yoga
|
|||||||
{
|
{
|
||||||
return Point(pointValue);
|
return Point(pointValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if WINDOWS_UWP_ARM
|
||||||
|
internal static YogaValue MarshalValue(IntPtr ptr)
|
||||||
|
{
|
||||||
|
return Marshal.PtrToStructure<YogaValue>(ptr);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
internal static YogaValue MarshalValue(YogaValue value)
|
||||||
|
{
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -7,7 +7,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{5289E508
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Native", "Native", "{51A8E803-C084-431F-9130-F277481C2BB2}"
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Native", "Native", "{51A8E803-C084-431F-9130-F277481C2BB2}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "NETStandard", "NETStandard", "{DCF7899B-A487-49C0-BCDE-DC088B6750C2}"
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Universal", "Universal", "{1048DB7D-9B95-48CA-B43E-D9C35AB1DCD4}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "yoga.uwp", "..\Yoga\Yoga.Universal.vcxproj", "{2EACF721-73B5-46AE-9775-4A8674D05A9C}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "yoga.uwp", "..\Yoga\Yoga.Universal.vcxproj", "{2EACF721-73B5-46AE-9775-4A8674D05A9C}"
|
||||||
EndProject
|
EndProject
|
||||||
@@ -15,7 +15,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Shared", "Shared", "{39A2FF
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "Facebook.Yoga.Shared", "..\Facebook.Yoga\Facebook.Yoga.Shared.shproj", "{91C42D32-291D-4B72-90B4-551663D60B8B}"
|
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "Facebook.Yoga.Shared", "..\Facebook.Yoga\Facebook.Yoga.Shared.shproj", "{91C42D32-291D-4B72-90B4-551663D60B8B}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Facebook.Yoga", "Facebook.Yoga\Facebook.Yoga.csproj", "{3AACE384-FDEC-4D91-A3B2-EEB21B46C9AD}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Facebook.Yoga.Universal", "Facebook.Yoga.Universal\Facebook.Yoga.Universal.csproj", "{D6477AD6-9EDD-4EBA-8C60-CD31F77C52C6}"
|
||||||
ProjectSection(ProjectDependencies) = postProject
|
ProjectSection(ProjectDependencies) = postProject
|
||||||
{2EACF721-73B5-46AE-9775-4A8674D05A9C} = {2EACF721-73B5-46AE-9775-4A8674D05A9C}
|
{2EACF721-73B5-46AE-9775-4A8674D05A9C} = {2EACF721-73B5-46AE-9775-4A8674D05A9C}
|
||||||
EndProjectSection
|
EndProjectSection
|
||||||
@@ -26,7 +26,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Facebook.Yoga.Universal.Tes
|
|||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SharedMSBuildProjectFiles) = preSolution
|
GlobalSection(SharedMSBuildProjectFiles) = preSolution
|
||||||
..\Facebook.Yoga\Facebook.Yoga.Shared.projitems*{3aace384-fdec-4d91-a3b2-eeb21b46c9ad}*SharedItemsImports = 4
|
..\Facebook.Yoga\Facebook.Yoga.Shared.projitems*{d6477ad6-9edd-4eba-8c60-cd31f77c52c6}*SharedItemsImports = 4
|
||||||
..\tests\Facebook.Yoga\Facebook.Yoga.Shared.Tests.projitems*{4edc82d9-a201-4831-8fe0-98f468f8e4ae}*SharedItemsImports = 13
|
..\tests\Facebook.Yoga\Facebook.Yoga.Shared.Tests.projitems*{4edc82d9-a201-4831-8fe0-98f468f8e4ae}*SharedItemsImports = 13
|
||||||
..\Facebook.Yoga\Facebook.Yoga.Shared.projitems*{91c42d32-291d-4b72-90b4-551663d60b8b}*SharedItemsImports = 13
|
..\Facebook.Yoga\Facebook.Yoga.Shared.projitems*{91c42d32-291d-4b72-90b4-551663d60b8b}*SharedItemsImports = 13
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
@@ -55,22 +55,21 @@ Global
|
|||||||
{2EACF721-73B5-46AE-9775-4A8674D05A9C}.Release|x64.Build.0 = Release|x64
|
{2EACF721-73B5-46AE-9775-4A8674D05A9C}.Release|x64.Build.0 = Release|x64
|
||||||
{2EACF721-73B5-46AE-9775-4A8674D05A9C}.Release|x86.ActiveCfg = Release|Win32
|
{2EACF721-73B5-46AE-9775-4A8674D05A9C}.Release|x86.ActiveCfg = Release|Win32
|
||||||
{2EACF721-73B5-46AE-9775-4A8674D05A9C}.Release|x86.Build.0 = Release|Win32
|
{2EACF721-73B5-46AE-9775-4A8674D05A9C}.Release|x86.Build.0 = Release|Win32
|
||||||
{3AACE384-FDEC-4D91-A3B2-EEB21B46C9AD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{D6477AD6-9EDD-4EBA-8C60-CD31F77C52C6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{3AACE384-FDEC-4D91-A3B2-EEB21B46C9AD}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{D6477AD6-9EDD-4EBA-8C60-CD31F77C52C6}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{3AACE384-FDEC-4D91-A3B2-EEB21B46C9AD}.Debug|ARM.ActiveCfg = Debug|ARM
|
{D6477AD6-9EDD-4EBA-8C60-CD31F77C52C6}.Debug|ARM.ActiveCfg = Debug|ARM
|
||||||
{3AACE384-FDEC-4D91-A3B2-EEB21B46C9AD}.Debug|ARM.Build.0 = Debug|ARM
|
{D6477AD6-9EDD-4EBA-8C60-CD31F77C52C6}.Debug|ARM.Build.0 = Debug|ARM
|
||||||
{3AACE384-FDEC-4D91-A3B2-EEB21B46C9AD}.Debug|x64.ActiveCfg = Debug|x64
|
{D6477AD6-9EDD-4EBA-8C60-CD31F77C52C6}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
{3AACE384-FDEC-4D91-A3B2-EEB21B46C9AD}.Debug|x64.Build.0 = Debug|x64
|
{D6477AD6-9EDD-4EBA-8C60-CD31F77C52C6}.Debug|x64.Build.0 = Debug|x64
|
||||||
{3AACE384-FDEC-4D91-A3B2-EEB21B46C9AD}.Debug|x86.ActiveCfg = Debug|x86
|
{D6477AD6-9EDD-4EBA-8C60-CD31F77C52C6}.Debug|x86.ActiveCfg = Debug|x86
|
||||||
{3AACE384-FDEC-4D91-A3B2-EEB21B46C9AD}.Debug|x86.Build.0 = Debug|x86
|
{D6477AD6-9EDD-4EBA-8C60-CD31F77C52C6}.Debug|x86.Build.0 = Debug|x86
|
||||||
{3AACE384-FDEC-4D91-A3B2-EEB21B46C9AD}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{D6477AD6-9EDD-4EBA-8C60-CD31F77C52C6}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{3AACE384-FDEC-4D91-A3B2-EEB21B46C9AD}.Release|Any CPU.Build.0 = Release|Any CPU
|
{D6477AD6-9EDD-4EBA-8C60-CD31F77C52C6}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
{3AACE384-FDEC-4D91-A3B2-EEB21B46C9AD}.Release|ARM.ActiveCfg = Release|ARM
|
{D6477AD6-9EDD-4EBA-8C60-CD31F77C52C6}.Release|ARM.ActiveCfg = Release|ARM
|
||||||
{3AACE384-FDEC-4D91-A3B2-EEB21B46C9AD}.Release|ARM.Build.0 = Release|ARM
|
{D6477AD6-9EDD-4EBA-8C60-CD31F77C52C6}.Release|ARM.Build.0 = Release|ARM
|
||||||
{3AACE384-FDEC-4D91-A3B2-EEB21B46C9AD}.Release|x64.ActiveCfg = Release|x64
|
{D6477AD6-9EDD-4EBA-8C60-CD31F77C52C6}.Release|x64.ActiveCfg = Release|x64
|
||||||
{3AACE384-FDEC-4D91-A3B2-EEB21B46C9AD}.Release|x64.Build.0 = Release|x64
|
{D6477AD6-9EDD-4EBA-8C60-CD31F77C52C6}.Release|x64.Build.0 = Release|x64
|
||||||
{3AACE384-FDEC-4D91-A3B2-EEB21B46C9AD}.Release|x86.ActiveCfg = Release|x86
|
{D6477AD6-9EDD-4EBA-8C60-CD31F77C52C6}.Release|x86.ActiveCfg = Release|x86
|
||||||
{3AACE384-FDEC-4D91-A3B2-EEB21B46C9AD}.Release|x86.Build.0 = Release|x86
|
|
||||||
{0C76D2FE-6767-44FE-B03D-21B2076BAA73}.Debug|Any CPU.ActiveCfg = Debug|x86
|
{0C76D2FE-6767-44FE-B03D-21B2076BAA73}.Debug|Any CPU.ActiveCfg = Debug|x86
|
||||||
{0C76D2FE-6767-44FE-B03D-21B2076BAA73}.Debug|ARM.ActiveCfg = Debug|ARM
|
{0C76D2FE-6767-44FE-B03D-21B2076BAA73}.Debug|ARM.ActiveCfg = Debug|ARM
|
||||||
{0C76D2FE-6767-44FE-B03D-21B2076BAA73}.Debug|ARM.Build.0 = Debug|ARM
|
{0C76D2FE-6767-44FE-B03D-21B2076BAA73}.Debug|ARM.Build.0 = Debug|ARM
|
||||||
@@ -98,7 +97,7 @@ Global
|
|||||||
GlobalSection(NestedProjects) = preSolution
|
GlobalSection(NestedProjects) = preSolution
|
||||||
{2EACF721-73B5-46AE-9775-4A8674D05A9C} = {51A8E803-C084-431F-9130-F277481C2BB2}
|
{2EACF721-73B5-46AE-9775-4A8674D05A9C} = {51A8E803-C084-431F-9130-F277481C2BB2}
|
||||||
{91C42D32-291D-4B72-90B4-551663D60B8B} = {39A2FFDA-C093-4FA6-8143-45B5019E7DAC}
|
{91C42D32-291D-4B72-90B4-551663D60B8B} = {39A2FFDA-C093-4FA6-8143-45B5019E7DAC}
|
||||||
{3AACE384-FDEC-4D91-A3B2-EEB21B46C9AD} = {DCF7899B-A487-49C0-BCDE-DC088B6750C2}
|
{D6477AD6-9EDD-4EBA-8C60-CD31F77C52C6} = {1048DB7D-9B95-48CA-B43E-D9C35AB1DCD4}
|
||||||
{4EDC82D9-A201-4831-8FE0-98F468F8E4AE} = {39A2FFDA-C093-4FA6-8143-45B5019E7DAC}
|
{4EDC82D9-A201-4831-8FE0-98F468F8E4AE} = {39A2FFDA-C093-4FA6-8143-45B5019E7DAC}
|
||||||
{0C76D2FE-6767-44FE-B03D-21B2076BAA73} = {5289E508-8386-45A1-A12B-258A5899CD45}
|
{0C76D2FE-6767-44FE-B03D-21B2076BAA73} = {5289E508-8386-45A1-A12B-258A5899CD45}
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
|
@@ -159,7 +159,7 @@
|
|||||||
</PrecompiledHeader>
|
</PrecompiledHeader>
|
||||||
<WarningLevel>Level3</WarningLevel>
|
<WarningLevel>Level3</WarningLevel>
|
||||||
<Optimization>Disabled</Optimization>
|
<Optimization>Disabled</Optimization>
|
||||||
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;YOGA_EXPORTS;FB_ASSERTIONS_ENABLED=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>WINARMDLL;WIN32;_DEBUG;_WINDOWS;_USRDLL;YOGA_EXPORTS;FB_ASSERTIONS_ENABLED=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<SDLCheck>true</SDLCheck>
|
<SDLCheck>true</SDLCheck>
|
||||||
<AdditionalIncludeDirectories>$(ProjectDir)..\..\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>$(ProjectDir)..\..\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
<CompileAsWinRT>false</CompileAsWinRT>
|
<CompileAsWinRT>false</CompileAsWinRT>
|
||||||
@@ -210,7 +210,7 @@
|
|||||||
<Optimization>MaxSpeed</Optimization>
|
<Optimization>MaxSpeed</Optimization>
|
||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;YOGA_EXPORTS;FB_ASSERTIONS_ENABLED=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>WINARMDLL;WIN32;NDEBUG;_WINDOWS;_USRDLL;YOGA_EXPORTS;FB_ASSERTIONS_ENABLED=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<SDLCheck>true</SDLCheck>
|
<SDLCheck>true</SDLCheck>
|
||||||
<AdditionalIncludeDirectories>$(ProjectDir)..\..\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>$(ProjectDir)..\..\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
<CompileAsWinRT>false</CompileAsWinRT>
|
<CompileAsWinRT>false</CompileAsWinRT>
|
||||||
|
@@ -23,6 +23,14 @@
|
|||||||
#define WIN_EXPORT
|
#define WIN_EXPORT
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef WINARMDLL
|
||||||
|
#define WIN_STRUCT(type) type*
|
||||||
|
#define WIN_STRUCT_REF(value) &value
|
||||||
|
#else
|
||||||
|
#define WIN_STRUCT(type) type
|
||||||
|
#define WIN_STRUCT_REF(value) value
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef FB_ASSERTIONS_ENABLED
|
#ifndef FB_ASSERTIONS_ENABLED
|
||||||
#define FB_ASSERTIONS_ENABLED 1
|
#define FB_ASSERTIONS_ENABLED 1
|
||||||
#endif
|
#endif
|
||||||
|
@@ -613,8 +613,8 @@ static inline const YGValue *YGNodeResolveFlexBasisPtr(const YGNodeRef node) {
|
|||||||
} \
|
} \
|
||||||
} \
|
} \
|
||||||
\
|
\
|
||||||
type YGNodeStyleGet##name(const YGNodeRef node, const YGEdge edge) { \
|
WIN_STRUCT(type) YGNodeStyleGet##name(const YGNodeRef node, const YGEdge edge) { \
|
||||||
return node->style.instanceName[edge]; \
|
return WIN_STRUCT_REF(node->style.instanceName[edge]); \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define YG_NODE_STYLE_EDGE_PROPERTY_IMPL(type, name, paramName, instanceName) \
|
#define YG_NODE_STYLE_EDGE_PROPERTY_IMPL(type, name, paramName, instanceName) \
|
||||||
|
@@ -141,7 +141,7 @@ WIN_EXPORT void YGNodeCopyStyle(const YGNodeRef dstNode, const YGNodeRef srcNode
|
|||||||
WIN_EXPORT void YGNodeStyleSet##name##Percent(const YGNodeRef node, \
|
WIN_EXPORT void YGNodeStyleSet##name##Percent(const YGNodeRef node, \
|
||||||
const YGEdge edge, \
|
const YGEdge edge, \
|
||||||
const float paramName); \
|
const float paramName); \
|
||||||
WIN_EXPORT type YGNodeStyleGet##name(const YGNodeRef node, const YGEdge edge);
|
WIN_EXPORT WIN_STRUCT(type) YGNodeStyleGet##name(const YGNodeRef node, const YGEdge edge);
|
||||||
|
|
||||||
#define YG_NODE_STYLE_EDGE_PROPERTY_UNIT_AUTO(type, name) \
|
#define YG_NODE_STYLE_EDGE_PROPERTY_UNIT_AUTO(type, name) \
|
||||||
WIN_EXPORT void YGNodeStyleSet##name##Auto(const YGNodeRef node, const YGEdge edge);
|
WIN_EXPORT void YGNodeStyleSet##name##Auto(const YGNodeRef node, const YGEdge edge);
|
||||||
|
Reference in New Issue
Block a user