Merge branch 'master' into add-xamarin-ios

This commit is contained in:
Rui Marinho
2016-12-16 14:18:24 +00:00
6 changed files with 17 additions and 20 deletions

View File

@@ -53,7 +53,7 @@
- (NSUInteger)yg_numberOfChildren - (NSUInteger)yg_numberOfChildren
{ {
return YGNodeChildCount([self ygNode]); return YGNodeGetChildCount([self ygNode]);
} }
#pragma mark - Setters #pragma mark - Setters
@@ -295,7 +295,7 @@ static void YGAttachNodesFromViewHierachy(UIView *view) {
} }
BOOL shouldReconstructChildList = NO; BOOL shouldReconstructChildList = NO;
if (YGNodeChildCount(node) != subviewsToInclude.count) { if (YGNodeGetChildCount(node) != subviewsToInclude.count) {
shouldReconstructChildList = YES; shouldReconstructChildList = YES;
} else { } else {
for (int i = 0; i < subviewsToInclude.count; i++) { for (int i = 0; i < subviewsToInclude.count; i++) {
@@ -324,8 +324,8 @@ static void YGRemoveAllChildren(const YGNodeRef node)
return; return;
} }
while (YGNodeChildCount(node) > 0) { while (YGNodeGetChildCount(node) > 0) {
YGNodeRemoveChild(node, YGNodeGetChild(node, YGNodeChildCount(node) - 1)); YGNodeRemoveChild(node, YGNodeGetChild(node, YGNodeGetChildCount(node) - 1));
} }
} }

View File

@@ -14,22 +14,19 @@ namespace Facebook.Yoga
{ {
internal static class Native internal static class Native
{ {
#if UNITY_IOS && !UNITY_EDITOR || __IOS__ #if (UNITY_IOS && !UNITY_EDITOR) || __IOS__
private const string DllName = "__Internal"; private const string DllName = "__Internal";
#else #else
private const string DllName = "yoga"; private const string DllName = "yoga";
#endif #endif
#if !__IOS__
[DllImport(DllName)] [DllImport(DllName)]
public static extern void YGInteropSetLogger( public static extern void YGInteropSetLogger(
[MarshalAs(UnmanagedType.FunctionPtr)] YogaLogger.Func func); [MarshalAs(UnmanagedType.FunctionPtr)] YogaLogger.Func func);
#endif
[DllImport(DllName)] [DllImport(DllName)]
public static extern IntPtr YGNodeNew(); public static extern IntPtr YGNodeNew();
#if !__IOS__
[DllImport(DllName)]
public static extern void YGNodeInit(IntPtr node);
#endif
[DllImport(DllName)] [DllImport(DllName)]
public static extern void YGNodeFree(IntPtr node); public static extern void YGNodeFree(IntPtr node);
@@ -58,7 +55,7 @@ namespace Facebook.Yoga
public static extern IntPtr YGNodeGetChild(IntPtr node, uint index); public static extern IntPtr YGNodeGetChild(IntPtr node, uint index);
[DllImport(DllName)] [DllImport(DllName)]
public static extern uint YGNodeChildCount(IntPtr node); public static extern uint YGNodeGetChildCount(IntPtr node);
[DllImport(DllName)] [DllImport(DllName)]
public static extern void YGNodeCalculateLayout(IntPtr node, public static extern void YGNodeCalculateLayout(IntPtr node,

View File

@@ -36,7 +36,7 @@ static void YGTransferLayoutOutputsRecursive(YGNodeRef root) {
obj->setFieldValue(topField, YGNodeLayoutGetTop(root)); obj->setFieldValue(topField, YGNodeLayoutGetTop(root));
YGTransferLayoutDirection(root, obj); YGTransferLayoutDirection(root, obj);
for (uint32_t i = 0; i < YGNodeChildCount(root); i++) { for (uint32_t i = 0; i < YGNodeGetChildCount(root); i++) {
YGTransferLayoutOutputsRecursive(YGNodeGetChild(root, i)); YGTransferLayoutOutputsRecursive(YGNodeGetChild(root, i));
} }
} else { } else {

View File

@@ -13,7 +13,7 @@
TEST(YogaTest, assert_default_values) { TEST(YogaTest, assert_default_values) {
const YGNodeRef root = YGNodeNew(); const YGNodeRef root = YGNodeNew();
ASSERT_EQ(0, YGNodeChildCount(root)); ASSERT_EQ(0, YGNodeGetChildCount(root));
ASSERT_EQ(NULL, YGNodeGetChild(root, 1)); ASSERT_EQ(NULL, YGNodeGetChild(root, 1));
ASSERT_EQ(YGDirectionInherit, YGNodeStyleGetDirection(root)); ASSERT_EQ(YGDirectionInherit, YGNodeStyleGetDirection(root));

View File

@@ -256,7 +256,7 @@ void YGNodeFree(const YGNodeRef node) {
node->parent = NULL; node->parent = NULL;
} }
const uint32_t childCount = YGNodeChildCount(node); const uint32_t childCount = YGNodeGetChildCount(node);
for (uint32_t i = 0; i < childCount; i++) { for (uint32_t i = 0; i < childCount; i++) {
const YGNodeRef child = YGNodeGetChild(node, i); const YGNodeRef child = YGNodeGetChild(node, i);
child->parent = NULL; child->parent = NULL;
@@ -268,7 +268,7 @@ void YGNodeFree(const YGNodeRef node) {
} }
void YGNodeFreeRecursive(const YGNodeRef root) { void YGNodeFreeRecursive(const YGNodeRef root) {
while (YGNodeChildCount(root) > 0) { while (YGNodeGetChildCount(root) > 0) {
const YGNodeRef child = YGNodeGetChild(root, 0); const YGNodeRef child = YGNodeGetChild(root, 0);
YGNodeRemoveChild(root, child); YGNodeRemoveChild(root, child);
YGNodeFreeRecursive(child); YGNodeFreeRecursive(child);
@@ -277,7 +277,7 @@ void YGNodeFreeRecursive(const YGNodeRef root) {
} }
void YGNodeReset(const YGNodeRef node) { void YGNodeReset(const YGNodeRef node) {
YG_ASSERT(YGNodeChildCount(node) == 0, "Cannot reset a node which still has children attached"); YG_ASSERT(YGNodeGetChildCount(node) == 0, "Cannot reset a node which still has children attached");
YG_ASSERT(node->parent == NULL, "Cannot reset a node still attached to a parent"); YG_ASSERT(node->parent == NULL, "Cannot reset a node still attached to a parent");
YGNodeListFree(node->children); YGNodeListFree(node->children);
@@ -303,7 +303,7 @@ void YGNodeSetMeasureFunc(const YGNodeRef node, YGMeasureFunc measureFunc) {
if (measureFunc == NULL) { if (measureFunc == NULL) {
node->measure = NULL; node->measure = NULL;
} else { } else {
YG_ASSERT(YGNodeChildCount(node) == 0, YG_ASSERT(YGNodeGetChildCount(node) == 0,
"Cannot set measure function: Nodes with measure functions cannot have children."); "Cannot set measure function: Nodes with measure functions cannot have children.");
node->measure = measureFunc; node->measure = measureFunc;
} }
@@ -337,7 +337,7 @@ YGNodeRef YGNodeGetParent(const YGNodeRef node) {
return node->parent; return node->parent;
} }
inline uint32_t YGNodeChildCount(const YGNodeRef node) { inline uint32_t YGNodeGetChildCount(const YGNodeRef node) {
return YGNodeListCount(node->children); return YGNodeListCount(node->children);
} }

View File

@@ -65,7 +65,7 @@ WIN_EXPORT void YGNodeInsertChild(const YGNodeRef node,
WIN_EXPORT void YGNodeRemoveChild(const YGNodeRef node, const YGNodeRef child); WIN_EXPORT void YGNodeRemoveChild(const YGNodeRef node, const YGNodeRef child);
WIN_EXPORT YGNodeRef YGNodeGetChild(const YGNodeRef node, const uint32_t index); WIN_EXPORT YGNodeRef YGNodeGetChild(const YGNodeRef node, const uint32_t index);
WIN_EXPORT YGNodeRef YGNodeGetParent(const YGNodeRef node); WIN_EXPORT YGNodeRef YGNodeGetParent(const YGNodeRef node);
WIN_EXPORT uint32_t YGNodeChildCount(const YGNodeRef node); WIN_EXPORT uint32_t YGNodeGetChildCount(const YGNodeRef node);
WIN_EXPORT void YGNodeCalculateLayout(const YGNodeRef node, WIN_EXPORT void YGNodeCalculateLayout(const YGNodeRef node,
const float availableWidth, const float availableWidth,