diff --git a/csharp/CSSLayout/CSSInterop.h b/csharp/CSSLayout/CSSInterop.h old mode 100755 new mode 100644 diff --git a/csharp/Facebook.CSSLayout/CSSNode.cs b/csharp/Facebook.CSSLayout/CSSNode.cs index dff4e5fb..1648617f 100644 --- a/csharp/Facebook.CSSLayout/CSSNode.cs +++ b/csharp/Facebook.CSSLayout/CSSNode.cs @@ -22,7 +22,6 @@ namespace Facebook.CSSLayout private List _children; private MeasureFunction _measureFunction; private CSSMeasureFunc _cssMeasureFunc; - private MeasureOutput _measureOutput; private object _data; public CSSNode() @@ -509,16 +508,7 @@ namespace Facebook.CSSLayout public void SetMeasureFunction(MeasureFunction measureFunction) { _measureFunction = measureFunction; - if (measureFunction != null) - { - _cssMeasureFunc = MeasureInternal; - _measureOutput = new MeasureOutput(); - } - else - { - _cssMeasureFunc = null; - _measureOutput = null; - } + _cssMeasureFunc = measureFunction != null ? MeasureInternal : (CSSMeasureFunc)null; Native.CSSNodeSetMeasureFunc(_cssNode, _cssMeasureFunc); } diff --git a/csharp/Facebook.CSSLayout/MeasureOutput.cs b/csharp/Facebook.CSSLayout/MeasureOutput.cs index ef3ce1d7..5fabf348 100644 --- a/csharp/Facebook.CSSLayout/MeasureOutput.cs +++ b/csharp/Facebook.CSSLayout/MeasureOutput.cs @@ -13,7 +13,7 @@ namespace Facebook.CSSLayout { public static long Make(int width, int height) { - return ((long) width) << 32 | ((long) height); + return (long)(((ulong) width) << 32 | ((ulong) height)); } public static int GetWidth(long measureOutput) diff --git a/csharp/tests/Facebook.CSSLayout/CSSNodeTest.cs b/csharp/tests/Facebook.CSSLayout/CSSNodeTest.cs index 7ebd3f96..f46ef24d 100644 --- a/csharp/tests/Facebook.CSSLayout/CSSNodeTest.cs +++ b/csharp/tests/Facebook.CSSLayout/CSSNodeTest.cs @@ -44,6 +44,7 @@ namespace Facebook.CSSLayout { CSSNode parent = new CSSNode(); foreach (CSSNode node in parent) { + Assert.Fail(node.ToString()); } CSSNode child0 = new CSSNode(); @@ -302,9 +303,8 @@ namespace Facebook.CSSLayout { CSSNode child = new CSSNode(); parent.Insert(0, child); - child.SetMeasureFunction((_, width, widthMode, height, heightMode, measureResult) => { - measureResult.Width = 120; - measureResult.Height = 130; + child.SetMeasureFunction((_, width, widthMode, height, heightMode) => { + return MeasureOutput.Make(120, 130); }); } #endif