Update CSSNodeFree for C#, Java and Objective-C

Summary:
- Update CSSNodeFree to unlink parent and children for C#, Java and Objective-C bindings finalizer.
- [C#] Fix build (Fix #232)
- [C#] Add Clear API for convenience as CSSNodeFreeRecursive.
- [C#] Revise and add unit tests

Reviewed By: emilsjolander

Differential Revision: D4069655

fbshipit-source-id: 1fd764059784d7968af38b6aaf7fb6f70fdee8ee
This commit is contained in:
Kazuki Sakamoto
2016-10-25 07:38:06 -07:00
committed by Facebook Github Bot
parent 4d0e657653
commit 2168d68007
3 changed files with 67 additions and 94 deletions

View File

@@ -15,7 +15,7 @@ using System.Text;
namespace Facebook.CSSLayout
{
public class CSSNode : IDisposable, IEnumerable<CSSNode>
public class CSSNode : IEnumerable<CSSNode>
{
private IntPtr _cssNode;
@@ -35,7 +35,6 @@ namespace Facebook.CSSLayout
{
throw new InvalidOperationException("Failed to allocate native memory");
}
}
~CSSNode()
@@ -483,6 +482,14 @@ namespace Facebook.CSSLayout
Native.CSSNodeRemoveChild(_cssNode, child._cssNode);
}
public void Clear()
{
while (_children.Count > 0)
{
RemoveAt(0);
}
}
public int IndexOf(CSSNode node)
{
return _children.IndexOf(node);