Skip to content

Commit f29356d

Browse files
committed
Remove WIN_STRUCT macro
If ARM compatibility still requires the WIN_STRUCT macro, we have a lot of additional changes to make. Removing for now, as this is clearly broken for some Yoga values (e.g., margin, padding, etc.). Will follow up with another PR after validating that we still need to pass structs by ref in RS1 or later.
1 parent ad86cf8 commit f29356d

8 files changed

Lines changed: 52 additions & 78 deletions

File tree

csharp/Facebook.Yoga/Native.cs

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,6 @@
1010

1111
namespace Facebook.Yoga
1212
{
13-
#if WINDOWS_UWP_ARM
14-
using YogaValueType = IntPtr;
15-
#else
16-
using YogaValueType = YogaValue;
17-
#endif
18-
1913
internal static class Native
2014
{
2115
#if (UNITY_IOS && !UNITY_EDITOR) || __IOS__
@@ -234,7 +228,7 @@ public static extern void YGNodeSetHasNewLayout(
234228
public static extern void YGNodeStyleSetFlexBasisAuto(YGNodeHandle node);
235229

236230
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
237-
public static extern YogaValueType YGNodeStyleGetFlexBasis(YGNodeHandle node);
231+
public static extern YogaValue YGNodeStyleGetFlexBasis(YGNodeHandle node);
238232

239233
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
240234
public static extern void YGNodeStyleSetWidth(YGNodeHandle node, float width);
@@ -246,7 +240,7 @@ public static extern void YGNodeSetHasNewLayout(
246240
public static extern void YGNodeStyleSetWidthAuto(YGNodeHandle node);
247241

248242
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
249-
public static extern YogaValueType YGNodeStyleGetWidth(YGNodeHandle node);
243+
public static extern YogaValue YGNodeStyleGetWidth(YGNodeHandle node);
250244

251245
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
252246
public static extern void YGNodeStyleSetHeight(YGNodeHandle node, float height);
@@ -258,7 +252,7 @@ public static extern void YGNodeSetHasNewLayout(
258252
public static extern void YGNodeStyleSetHeightAuto(YGNodeHandle node);
259253

260254
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
261-
public static extern YogaValueType YGNodeStyleGetHeight(YGNodeHandle node);
255+
public static extern YogaValue YGNodeStyleGetHeight(YGNodeHandle node);
262256

263257
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
264258
public static extern void YGNodeStyleSetMinWidth(YGNodeHandle node, float minWidth);
@@ -267,7 +261,7 @@ public static extern void YGNodeSetHasNewLayout(
267261
public static extern void YGNodeStyleSetMinWidthPercent(YGNodeHandle node, float minWidth);
268262

269263
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
270-
public static extern YogaValueType YGNodeStyleGetMinWidth(YGNodeHandle node);
264+
public static extern YogaValue YGNodeStyleGetMinWidth(YGNodeHandle node);
271265

272266
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
273267
public static extern void YGNodeStyleSetMinHeight(YGNodeHandle node, float minHeight);
@@ -276,7 +270,7 @@ public static extern void YGNodeSetHasNewLayout(
276270
public static extern void YGNodeStyleSetMinHeightPercent(YGNodeHandle node, float minHeight);
277271

278272
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
279-
public static extern YogaValueType YGNodeStyleGetMinHeight(YGNodeHandle node);
273+
public static extern YogaValue YGNodeStyleGetMinHeight(YGNodeHandle node);
280274

281275
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
282276
public static extern void YGNodeStyleSetMaxWidth(YGNodeHandle node, float maxWidth);
@@ -285,7 +279,7 @@ public static extern void YGNodeSetHasNewLayout(
285279
public static extern void YGNodeStyleSetMaxWidthPercent(YGNodeHandle node, float maxWidth);
286280

287281
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
288-
public static extern YogaValueType YGNodeStyleGetMaxWidth(YGNodeHandle node);
282+
public static extern YogaValue YGNodeStyleGetMaxWidth(YGNodeHandle node);
289283

290284
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
291285
public static extern void YGNodeStyleSetMaxHeight(YGNodeHandle node, float maxHeight);
@@ -294,7 +288,7 @@ public static extern void YGNodeSetHasNewLayout(
294288
public static extern void YGNodeStyleSetMaxHeightPercent(YGNodeHandle node, float maxHeight);
295289

296290
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
297-
public static extern YogaValueType YGNodeStyleGetMaxHeight(YGNodeHandle node);
291+
public static extern YogaValue YGNodeStyleGetMaxHeight(YGNodeHandle node);
298292

299293
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
300294
public static extern void YGNodeStyleSetAspectRatio(YGNodeHandle node, float aspectRatio);
@@ -313,7 +307,7 @@ public static extern void YGNodeSetHasNewLayout(
313307
public static extern void YGNodeStyleSetPositionPercent(YGNodeHandle node, YogaEdge edge, float position);
314308

315309
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
316-
public static extern YogaValueType YGNodeStyleGetPosition(YGNodeHandle node, YogaEdge edge);
310+
public static extern YogaValue YGNodeStyleGetPosition(YGNodeHandle node, YogaEdge edge);
317311

318312
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
319313
public static extern void YGNodeStyleSetMargin(YGNodeHandle node, YogaEdge edge, float margin);
@@ -325,7 +319,7 @@ public static extern void YGNodeSetHasNewLayout(
325319
public static extern void YGNodeStyleSetMarginAuto(YGNodeHandle node, YogaEdge edge);
326320

327321
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
328-
public static extern YogaValueType YGNodeStyleGetMargin(YGNodeHandle node, YogaEdge edge);
322+
public static extern YogaValue YGNodeStyleGetMargin(YGNodeHandle node, YogaEdge edge);
329323

330324
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
331325
public static extern void YGNodeStyleSetPadding(YGNodeHandle node, YogaEdge edge, float padding);
@@ -334,7 +328,7 @@ public static extern void YGNodeSetHasNewLayout(
334328
public static extern void YGNodeStyleSetPaddingPercent(YGNodeHandle node, YogaEdge edge, float padding);
335329

336330
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
337-
public static extern YogaValueType YGNodeStyleGetPadding(YGNodeHandle node, YogaEdge edge);
331+
public static extern YogaValue YGNodeStyleGetPadding(YGNodeHandle node, YogaEdge edge);
338332

339333
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
340334
public static extern void YGNodeStyleSetBorder(YGNodeHandle node, YogaEdge edge, float border);

csharp/Facebook.Yoga/YogaNode.Spacing.cs

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/**
1+
/**
22
* Copyright (c) Facebook, Inc. and its affiliates.
33
*
44
* This source code is licensed under the MIT license found in the
@@ -13,7 +13,7 @@ public YogaValue Left
1313
{
1414
get
1515
{
16-
return YogaValue.MarshalValue(Native.YGNodeStyleGetPosition(_ygNode, YogaEdge.Left));
16+
return Native.YGNodeStyleGetPosition(_ygNode, YogaEdge.Left);
1717
}
1818

1919
set
@@ -26,7 +26,7 @@ public YogaValue Top
2626
{
2727
get
2828
{
29-
return YogaValue.MarshalValue(Native.YGNodeStyleGetPosition(_ygNode, YogaEdge.Top));
29+
return Native.YGNodeStyleGetPosition(_ygNode, YogaEdge.Top);
3030
}
3131

3232
set
@@ -39,7 +39,7 @@ public YogaValue Right
3939
{
4040
get
4141
{
42-
return YogaValue.MarshalValue(Native.YGNodeStyleGetPosition(_ygNode, YogaEdge.Right));
42+
return Native.YGNodeStyleGetPosition(_ygNode, YogaEdge.Right);
4343
}
4444

4545
set
@@ -52,7 +52,7 @@ public YogaValue Bottom
5252
{
5353
get
5454
{
55-
return YogaValue.MarshalValue(Native.YGNodeStyleGetPosition(_ygNode, YogaEdge.Bottom));
55+
return Native.YGNodeStyleGetPosition(_ygNode, YogaEdge.Bottom);
5656
}
5757

5858
set
@@ -65,7 +65,7 @@ public YogaValue Start
6565
{
6666
get
6767
{
68-
return YogaValue.MarshalValue(Native.YGNodeStyleGetPosition(_ygNode, YogaEdge.Start));
68+
return Native.YGNodeStyleGetPosition(_ygNode, YogaEdge.Start);
6969
}
7070

7171
set
@@ -78,7 +78,7 @@ public YogaValue End
7878
{
7979
get
8080
{
81-
return YogaValue.MarshalValue(Native.YGNodeStyleGetPosition(_ygNode, YogaEdge.End));
81+
return Native.YGNodeStyleGetPosition(_ygNode, YogaEdge.End);
8282
}
8383

8484
set
@@ -103,7 +103,7 @@ public YogaValue MarginLeft
103103
{
104104
get
105105
{
106-
return YogaValue.MarshalValue(Native.YGNodeStyleGetMargin(_ygNode, YogaEdge.Left));
106+
return Native.YGNodeStyleGetMargin(_ygNode, YogaEdge.Left);
107107
}
108108

109109
set
@@ -116,7 +116,7 @@ public YogaValue MarginTop
116116
{
117117
get
118118
{
119-
return YogaValue.MarshalValue(Native.YGNodeStyleGetMargin(_ygNode, YogaEdge.Top));
119+
return Native.YGNodeStyleGetMargin(_ygNode, YogaEdge.Top);
120120
}
121121

122122
set
@@ -129,7 +129,7 @@ public YogaValue MarginRight
129129
{
130130
get
131131
{
132-
return YogaValue.MarshalValue(Native.YGNodeStyleGetMargin(_ygNode, YogaEdge.Right));
132+
return Native.YGNodeStyleGetMargin(_ygNode, YogaEdge.Right);
133133
}
134134

135135
set
@@ -142,7 +142,7 @@ public YogaValue MarginBottom
142142
{
143143
get
144144
{
145-
return YogaValue.MarshalValue(Native.YGNodeStyleGetMargin(_ygNode, YogaEdge.Bottom));
145+
return Native.YGNodeStyleGetMargin(_ygNode, YogaEdge.Bottom);
146146
}
147147

148148
set
@@ -155,7 +155,7 @@ public YogaValue MarginStart
155155
{
156156
get
157157
{
158-
return YogaValue.MarshalValue(Native.YGNodeStyleGetMargin(_ygNode, YogaEdge.Start));
158+
return Native.YGNodeStyleGetMargin(_ygNode, YogaEdge.Start);
159159
}
160160

161161
set
@@ -168,7 +168,7 @@ public YogaValue MarginEnd
168168
{
169169
get
170170
{
171-
return YogaValue.MarshalValue(Native.YGNodeStyleGetMargin(_ygNode, YogaEdge.End));
171+
return Native.YGNodeStyleGetMargin(_ygNode, YogaEdge.End);
172172
}
173173

174174
set
@@ -181,7 +181,7 @@ public YogaValue MarginHorizontal
181181
{
182182
get
183183
{
184-
return YogaValue.MarshalValue(Native.YGNodeStyleGetMargin(_ygNode, YogaEdge.Horizontal));
184+
return Native.YGNodeStyleGetMargin(_ygNode, YogaEdge.Horizontal);
185185
}
186186

187187
set
@@ -194,7 +194,7 @@ public YogaValue MarginVertical
194194
{
195195
get
196196
{
197-
return YogaValue.MarshalValue(Native.YGNodeStyleGetMargin(_ygNode, YogaEdge.Vertical));
197+
return Native.YGNodeStyleGetMargin(_ygNode, YogaEdge.Vertical);
198198
}
199199

200200
set
@@ -207,7 +207,7 @@ public YogaValue Margin
207207
{
208208
get
209209
{
210-
return YogaValue.MarshalValue(Native.YGNodeStyleGetMargin(_ygNode, YogaEdge.All));
210+
return Native.YGNodeStyleGetMargin(_ygNode, YogaEdge.All);
211211
}
212212

213213
set
@@ -236,7 +236,7 @@ public YogaValue PaddingLeft
236236
{
237237
get
238238
{
239-
return YogaValue.MarshalValue(Native.YGNodeStyleGetPadding(_ygNode, YogaEdge.Left));
239+
return Native.YGNodeStyleGetPadding(_ygNode, YogaEdge.Left);
240240
}
241241

242242
set
@@ -249,7 +249,7 @@ public YogaValue PaddingTop
249249
{
250250
get
251251
{
252-
return YogaValue.MarshalValue(Native.YGNodeStyleGetPadding(_ygNode, YogaEdge.Top));
252+
return Native.YGNodeStyleGetPadding(_ygNode, YogaEdge.Top);
253253
}
254254

255255
set
@@ -262,7 +262,7 @@ public YogaValue PaddingRight
262262
{
263263
get
264264
{
265-
return YogaValue.MarshalValue(Native.YGNodeStyleGetPadding(_ygNode, YogaEdge.Right));
265+
return Native.YGNodeStyleGetPadding(_ygNode, YogaEdge.Right);
266266
}
267267

268268
set
@@ -275,7 +275,7 @@ public YogaValue PaddingBottom
275275
{
276276
get
277277
{
278-
return YogaValue.MarshalValue(Native.YGNodeStyleGetPadding(_ygNode, YogaEdge.Bottom));
278+
return Native.YGNodeStyleGetPadding(_ygNode, YogaEdge.Bottom);
279279
}
280280

281281
set
@@ -288,7 +288,7 @@ public YogaValue PaddingStart
288288
{
289289
get
290290
{
291-
return YogaValue.MarshalValue(Native.YGNodeStyleGetPadding(_ygNode, YogaEdge.Start));
291+
return Native.YGNodeStyleGetPadding(_ygNode, YogaEdge.Start);
292292
}
293293

294294
set
@@ -301,7 +301,7 @@ public YogaValue PaddingEnd
301301
{
302302
get
303303
{
304-
return YogaValue.MarshalValue(Native.YGNodeStyleGetPadding(_ygNode, YogaEdge.End));
304+
return Native.YGNodeStyleGetPadding(_ygNode, YogaEdge.End);
305305
}
306306

307307
set
@@ -314,7 +314,7 @@ public YogaValue PaddingHorizontal
314314
{
315315
get
316316
{
317-
return YogaValue.MarshalValue(Native.YGNodeStyleGetPadding(_ygNode, YogaEdge.Horizontal));
317+
return Native.YGNodeStyleGetPadding(_ygNode, YogaEdge.Horizontal);
318318
}
319319

320320
set
@@ -327,7 +327,7 @@ public YogaValue PaddingVertical
327327
{
328328
get
329329
{
330-
return YogaValue.MarshalValue(Native.YGNodeStyleGetPadding(_ygNode, YogaEdge.Vertical));
330+
return Native.YGNodeStyleGetPadding(_ygNode, YogaEdge.Vertical);
331331
}
332332

333333
set
@@ -340,7 +340,7 @@ public YogaValue Padding
340340
{
341341
get
342342
{
343-
return YogaValue.MarshalValue(Native.YGNodeStyleGetPadding(_ygNode, YogaEdge.All));
343+
return Native.YGNodeStyleGetPadding(_ygNode, YogaEdge.All);
344344
}
345345

346346
set

csharp/Facebook.Yoga/YogaNode.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/**
1+
/**
22
* Copyright (c) Facebook, Inc. and its affiliates.
33
*
44
* This source code is licensed under the MIT license found in the
@@ -271,7 +271,7 @@ public YogaValue FlexBasis
271271
{
272272
get
273273
{
274-
return YogaValue.MarshalValue(Native.YGNodeStyleGetFlexBasis(_ygNode));
274+
return Native.YGNodeStyleGetFlexBasis(_ygNode);
275275
}
276276

277277
set
@@ -295,7 +295,7 @@ public YogaValue Width
295295
{
296296
get
297297
{
298-
return YogaValue.MarshalValue(Native.YGNodeStyleGetWidth(_ygNode));
298+
return Native.YGNodeStyleGetWidth(_ygNode);
299299
}
300300

301301
set
@@ -319,7 +319,7 @@ public YogaValue Height
319319
{
320320
get
321321
{
322-
return YogaValue.MarshalValue(Native.YGNodeStyleGetHeight(_ygNode));
322+
return Native.YGNodeStyleGetHeight(_ygNode);
323323
}
324324

325325
set
@@ -343,7 +343,7 @@ public YogaValue MaxWidth
343343
{
344344
get
345345
{
346-
return YogaValue.MarshalValue(Native.YGNodeStyleGetMaxWidth(_ygNode));
346+
return Native.YGNodeStyleGetMaxWidth(_ygNode);
347347
}
348348

349349
set
@@ -363,7 +363,7 @@ public YogaValue MaxHeight
363363
{
364364
get
365365
{
366-
return YogaValue.MarshalValue(Native.YGNodeStyleGetMaxHeight(_ygNode));
366+
return Native.YGNodeStyleGetMaxHeight(_ygNode);
367367
}
368368

369369
set
@@ -383,7 +383,7 @@ public YogaValue MinWidth
383383
{
384384
get
385385
{
386-
return YogaValue.MarshalValue(Native.YGNodeStyleGetMinWidth(_ygNode));
386+
return Native.YGNodeStyleGetMinWidth(_ygNode);
387387
}
388388

389389
set
@@ -403,7 +403,7 @@ public YogaValue MinHeight
403403
{
404404
get
405405
{
406-
return YogaValue.MarshalValue(Native.YGNodeStyleGetMinHeight(_ygNode));
406+
return Native.YGNodeStyleGetMinHeight(_ygNode);
407407
}
408408

409409
set

0 commit comments

Comments
 (0)