Merge remote-tracking branch 'refs/remotes/facebook/master' into percentage-feature
# Conflicts: # csharp/Facebook.Yoga/YogaNode.Create.cs
This commit is contained in:
8
BUCK
8
BUCK
@@ -7,14 +7,6 @@
|
|||||||
|
|
||||||
include_defs('//YOGA_DEFS')
|
include_defs('//YOGA_DEFS')
|
||||||
|
|
||||||
BASE_COMPILER_FLAGS = [
|
|
||||||
'-fno-omit-frame-pointer',
|
|
||||||
'-fexceptions',
|
|
||||||
'-Wall',
|
|
||||||
'-Werror',
|
|
||||||
'-O3',
|
|
||||||
]
|
|
||||||
|
|
||||||
GMOCK_OVERRIDE_FLAGS = [
|
GMOCK_OVERRIDE_FLAGS = [
|
||||||
# gmock does not mark mocked methods as override, ignore the warnings in tests
|
# gmock does not mark mocked methods as override, ignore the warnings in tests
|
||||||
'-Wno-inconsistent-missing-override',
|
'-Wno-inconsistent-missing-override',
|
||||||
|
@@ -17,6 +17,14 @@ CXX_LIBRARY_WHITELIST = [
|
|||||||
'//java:jni',
|
'//java:jni',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
BASE_COMPILER_FLAGS = [
|
||||||
|
'-fno-omit-frame-pointer',
|
||||||
|
'-fexceptions',
|
||||||
|
'-Wall',
|
||||||
|
'-Werror',
|
||||||
|
'-O3',
|
||||||
|
]
|
||||||
|
|
||||||
def yoga_dep(dep):
|
def yoga_dep(dep):
|
||||||
return '//' + dep
|
return '//' + dep
|
||||||
|
|
||||||
|
@@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
#import <XCTest/XCTest.h>
|
#import <XCTest/XCTest.h>
|
||||||
|
|
||||||
#import "UIView+Yoga.h"
|
#import <YogaKit/UIView+Yoga.h>
|
||||||
|
|
||||||
@interface YogaKitTests : XCTestCase
|
@interface YogaKitTests : XCTestCase
|
||||||
@end
|
@end
|
||||||
|
@@ -55,7 +55,7 @@
|
|||||||
- (YGDirection)yg_resolvedDirection;
|
- (YGDirection)yg_resolvedDirection;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Perform a layout calculation and update the frames of the views in the hierarchy with th results
|
Perform a layout calculation and update the frames of the views in the hierarchy with the results
|
||||||
*/
|
*/
|
||||||
- (void)yg_applyLayout;
|
- (void)yg_applyLayout;
|
||||||
|
|
||||||
|
@@ -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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
43
csharp/BUCK
43
csharp/BUCK
@@ -5,6 +5,10 @@
|
|||||||
# LICENSE file in the root directory of this source tree. An additional grant
|
# LICENSE file in the root directory of this source tree. An additional grant
|
||||||
# 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.
|
||||||
|
|
||||||
|
include_defs('//YOGA_DEFS')
|
||||||
|
|
||||||
|
COMPILER_FLAGS = BASE_COMPILER_FLAGS + ['-std=c++11']
|
||||||
|
|
||||||
csharp_library(
|
csharp_library(
|
||||||
name = 'yogalibnet46',
|
name = 'yogalibnet46',
|
||||||
dll_name = 'Facebook.Yoga.dll',
|
dll_name = 'Facebook.Yoga.dll',
|
||||||
@@ -18,3 +22,42 @@ csharp_library(
|
|||||||
framework_ver = 'net45',
|
framework_ver = 'net45',
|
||||||
srcs = glob(['**/*.cs']),
|
srcs = glob(['**/*.cs']),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
cxx_library(
|
||||||
|
name = 'yoganet',
|
||||||
|
soname = 'libyoga.$(ext)',
|
||||||
|
srcs = glob(['Yoga/YGInterop.cpp']),
|
||||||
|
compiler_flags = COMPILER_FLAGS,
|
||||||
|
link_style = 'static',
|
||||||
|
link_whole = True,
|
||||||
|
deps = [yoga_dep(':yoga')],
|
||||||
|
visibility = ['PUBLIC'],
|
||||||
|
)
|
||||||
|
|
||||||
|
with allow_unsafe_import():
|
||||||
|
import os
|
||||||
|
|
||||||
|
if os.path.isdir('/Applications/Xcode.app'):
|
||||||
|
yoganet_ios_srcs = []
|
||||||
|
for arch in ['iphonesimulator-x86_64', 'iphoneos-arm64', 'iphoneos-armv7']:
|
||||||
|
name = 'yoganet-' + arch
|
||||||
|
yoganet_ios_srcs.append(':' + name)
|
||||||
|
genrule(
|
||||||
|
name = name,
|
||||||
|
srcs = [
|
||||||
|
yoga_dep(':yoga#%s,static' % arch),
|
||||||
|
yoga_dep('YogaKit:YogaKit#%s,static' % arch),
|
||||||
|
yoga_dep('csharp:yoganet#%s,static' % arch),
|
||||||
|
],
|
||||||
|
out = 'libyoga-%s.a' % arch,
|
||||||
|
cmd = 'libtool -static -o $OUT $SRCS',
|
||||||
|
visibility = [yoga_dep('csharp:yoganet-ios')],
|
||||||
|
)
|
||||||
|
|
||||||
|
genrule(
|
||||||
|
name = 'yoganet-ios',
|
||||||
|
srcs = yoganet_ios_srcs,
|
||||||
|
out = 'libyoga.a',
|
||||||
|
cmd = 'lipo $SRCS -create -output $OUT',
|
||||||
|
visibility = ['PUBLIC'],
|
||||||
|
)
|
||||||
|
@@ -14,7 +14,7 @@ namespace Facebook.Yoga
|
|||||||
{
|
{
|
||||||
internal static class Native
|
internal static class Native
|
||||||
{
|
{
|
||||||
#if UNITY_IOS && !UNITY_EDITOR
|
#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";
|
||||||
@@ -27,9 +27,6 @@ namespace Facebook.Yoga
|
|||||||
[DllImport(DllName)]
|
[DllImport(DllName)]
|
||||||
public static extern IntPtr YGNodeNew();
|
public static extern IntPtr YGNodeNew();
|
||||||
|
|
||||||
[DllImport(DllName)]
|
|
||||||
public static extern void YGNodeInit(IntPtr node);
|
|
||||||
|
|
||||||
[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,
|
||||||
|
243
csharp/Facebook.Yoga/YogaNode.Create.cs.orig
Normal file
243
csharp/Facebook.Yoga/YogaNode.Create.cs.orig
Normal file
@@ -0,0 +1,243 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (c) 2014-present, Facebook, Inc.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* This source code is licensed under the BSD-style license found in the
|
||||||
|
* LICENSE file in the root directory of this source tree. An additional grant
|
||||||
|
* of patent rights can be found in the PATENTS file in the same directory.
|
||||||
|
*/
|
||||||
|
|
||||||
|
using System;
|
||||||
|
|
||||||
|
namespace Facebook.Yoga
|
||||||
|
{
|
||||||
|
public partial class YogaNode
|
||||||
|
{
|
||||||
|
public static YogaNode Create(
|
||||||
|
YogaDirection? styleDirection = null,
|
||||||
|
YogaFlexDirection? flexDirection = null,
|
||||||
|
YogaJustify? justifyContent = null,
|
||||||
|
YogaAlign? alignContent = null,
|
||||||
|
YogaAlign? alignItems = null,
|
||||||
|
YogaAlign? alignSelf = null,
|
||||||
|
YogaPositionType? positionType = null,
|
||||||
|
YogaWrap? wrap = null,
|
||||||
|
YogaOverflow? overflow = null,
|
||||||
|
float? flex = null,
|
||||||
|
float? flexGrow = null,
|
||||||
|
float? flexShrink = null,
|
||||||
|
YogaValue? flexBasis = null,
|
||||||
|
Spacing position = null,
|
||||||
|
Spacing margin = null,
|
||||||
|
Spacing padding = null,
|
||||||
|
<<<<<<< HEAD
|
||||||
|
Border border = null,
|
||||||
|
YogaValue? Width = null,
|
||||||
|
YogaValue? Height = null,
|
||||||
|
YogaValue? MaxWidth = null,
|
||||||
|
YogaValue? MaxHeight = null,
|
||||||
|
YogaValue? MinWidth = null,
|
||||||
|
YogaValue? MinHeight = null)
|
||||||
|
=======
|
||||||
|
Spacing border = null,
|
||||||
|
float? width = null,
|
||||||
|
float? height = null,
|
||||||
|
float? maxWidth = null,
|
||||||
|
float? maxHeight = null,
|
||||||
|
float? minWidth = null,
|
||||||
|
float? minHeight = null)
|
||||||
|
>>>>>>> refs/remotes/facebook/master
|
||||||
|
{
|
||||||
|
YogaNode node = new YogaNode();
|
||||||
|
|
||||||
|
if (styleDirection.HasValue)
|
||||||
|
{
|
||||||
|
node.StyleDirection = styleDirection.Value;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (flexDirection.HasValue)
|
||||||
|
{
|
||||||
|
node.FlexDirection = flexDirection.Value;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (justifyContent.HasValue)
|
||||||
|
{
|
||||||
|
node.JustifyContent = justifyContent.Value;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (alignContent.HasValue)
|
||||||
|
{
|
||||||
|
node.AlignContent = alignContent.Value;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (alignItems.HasValue)
|
||||||
|
{
|
||||||
|
node.AlignItems = alignItems.Value;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (alignSelf.HasValue)
|
||||||
|
{
|
||||||
|
node.AlignSelf = alignSelf.Value;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (positionType.HasValue)
|
||||||
|
{
|
||||||
|
node.PositionType = positionType.Value;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (wrap.HasValue)
|
||||||
|
{
|
||||||
|
node.Wrap = wrap.Value;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (overflow.HasValue)
|
||||||
|
{
|
||||||
|
node.Overflow = overflow.Value;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (flex.HasValue)
|
||||||
|
{
|
||||||
|
node.Flex = flex.Value;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (flexGrow.HasValue)
|
||||||
|
{
|
||||||
|
node.FlexGrow = flexGrow.Value;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (flexShrink.HasValue)
|
||||||
|
{
|
||||||
|
node.FlexShrink = flexShrink.Value;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (flexBasis.HasValue)
|
||||||
|
{
|
||||||
|
node.FlexBasis = flexBasis.Value;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (position != null)
|
||||||
|
{
|
||||||
|
if (position.Top.HasValue)
|
||||||
|
{
|
||||||
|
node.SetPosition(YogaEdge.Top, position.Top.Value);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (position.Bottom.HasValue)
|
||||||
|
{
|
||||||
|
node.SetPosition(YogaEdge.Bottom, position.Bottom.Value);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (position.Left.HasValue)
|
||||||
|
{
|
||||||
|
node.SetPosition(YogaEdge.Left, position.Left.Value);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (position.Right.HasValue)
|
||||||
|
{
|
||||||
|
node.SetPosition(YogaEdge.Right, position.Right.Value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (margin != null)
|
||||||
|
{
|
||||||
|
if (margin.Top.HasValue)
|
||||||
|
{
|
||||||
|
node.SetMargin(YogaEdge.Top, margin.Top.Value);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (margin.Bottom.HasValue)
|
||||||
|
{
|
||||||
|
node.SetMargin(YogaEdge.Bottom, margin.Bottom.Value);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (margin.Left.HasValue)
|
||||||
|
{
|
||||||
|
node.SetMargin(YogaEdge.Left, margin.Left.Value);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (margin.Right.HasValue)
|
||||||
|
{
|
||||||
|
node.SetMargin(YogaEdge.Right, margin.Right.Value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (padding != null)
|
||||||
|
{
|
||||||
|
if (padding.Top.HasValue)
|
||||||
|
{
|
||||||
|
node.SetPadding(YogaEdge.Top, padding.Top.Value);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (padding.Bottom.HasValue)
|
||||||
|
{
|
||||||
|
node.SetPadding(YogaEdge.Bottom, padding.Bottom.Value);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (padding.Left.HasValue)
|
||||||
|
{
|
||||||
|
node.SetPadding(YogaEdge.Left, padding.Left.Value);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (padding.Right.HasValue)
|
||||||
|
{
|
||||||
|
node.SetPadding(YogaEdge.Right, padding.Right.Value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (border != null)
|
||||||
|
{
|
||||||
|
if (border.Top.HasValue)
|
||||||
|
{
|
||||||
|
node.SetBorder(YogaEdge.Top, border.Top.Value);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (border.Bottom.HasValue)
|
||||||
|
{
|
||||||
|
node.SetBorder(YogaEdge.Bottom, border.Bottom.Value);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (border.Left.HasValue)
|
||||||
|
{
|
||||||
|
node.SetBorder(YogaEdge.Left, border.Left.Value);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (border.Right.HasValue)
|
||||||
|
{
|
||||||
|
node.SetBorder(YogaEdge.Right, border.Right.Value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (width.HasValue)
|
||||||
|
{
|
||||||
|
node.Width = width.Value;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (height.HasValue)
|
||||||
|
{
|
||||||
|
node.Height = height.Value;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (minWidth.HasValue)
|
||||||
|
{
|
||||||
|
node.MinWidth = minWidth.Value;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (minHeight.HasValue)
|
||||||
|
{
|
||||||
|
node.MinHeight = minHeight.Value;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (maxWidth.HasValue)
|
||||||
|
{
|
||||||
|
node.MaxWidth = maxWidth.Value;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (maxHeight.HasValue)
|
||||||
|
{
|
||||||
|
node.MaxHeight = maxHeight.Value;
|
||||||
|
}
|
||||||
|
|
||||||
|
return node;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -21,6 +21,7 @@
|
|||||||
<PropertyGroup Label="Globals">
|
<PropertyGroup Label="Globals">
|
||||||
<ProjectGuid>{0446C86B-F47B-4C46-B673-C7AE0CFF35D5}</ProjectGuid>
|
<ProjectGuid>{0446C86B-F47B-4C46-B673-C7AE0CFF35D5}</ProjectGuid>
|
||||||
<Keyword>Win32Proj</Keyword>
|
<Keyword>Win32Proj</Keyword>
|
||||||
|
<ProjectName>yoga</ProjectName>
|
||||||
<RootNamespace>Yoga</RootNamespace>
|
<RootNamespace>Yoga</RootNamespace>
|
||||||
<WindowsTargetPlatformVersion>10.0.14393.0</WindowsTargetPlatformVersion>
|
<WindowsTargetPlatformVersion>10.0.14393.0</WindowsTargetPlatformVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
@@ -87,12 +87,12 @@ namespace Facebook.Yoga
|
|||||||
padding: new Spacing(top: 13, bottom: 14, left: 15, right: 16),
|
padding: new Spacing(top: 13, bottom: 14, left: 15, right: 16),
|
||||||
border: new Border(top: 17, bottom: 18, left: 19, right: 20),
|
border: new Border(top: 17, bottom: 18, left: 19, right: 20),
|
||||||
|
|
||||||
Width: 21,
|
width: 21,
|
||||||
Height: 22,
|
height: 22,
|
||||||
MinWidth: 23,
|
minWidth: 23,
|
||||||
MinHeight: 24,
|
minHeight: 24,
|
||||||
MaxWidth: 25,
|
maxWidth: 25,
|
||||||
MaxHeight: 26);
|
maxHeight: 26);
|
||||||
|
|
||||||
Assert.AreEqual(YogaDirection.RTL, node.StyleDirection);
|
Assert.AreEqual(YogaDirection.RTL, node.StyleDirection);
|
||||||
Assert.AreEqual(YogaFlexDirection.RowReverse, node.FlexDirection);
|
Assert.AreEqual(YogaFlexDirection.RowReverse, node.FlexDirection);
|
||||||
|
@@ -1,16 +1,6 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
if clang --version >/dev/null 2>&1; then true; else
|
if mcs --version >/dev/null 2>&1 && mono --version >/dev/null 2>&1; then true; else
|
||||||
echo "ERROR: Can't execute clang. You need to install Xcode and command line tools."
|
echo "ERROR: Need to install Mono (brew install mono, or http://www.mono-project.com/download/)"
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if mcs --version >/dev/null 2>&1; then true; else
|
|
||||||
echo "ERROR: Can't execute mcs. You need to install Mono from http://www.mono-project.com/download/ and re-login to apply PATH environment."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if mono --version >/dev/null 2>&1; then true; else
|
|
||||||
echo "ERROR: Can't execute mono64. You need to install Mono from http://www.mono-project.com/download/ and re-login to apply PATH environment."
|
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -28,6 +18,11 @@ if [ -d $NUNIT \
|
|||||||
rm NUnit-2.6.4.zip
|
rm NUnit-2.6.4.zip
|
||||||
fi
|
fi
|
||||||
|
|
||||||
clang -g -Wall -Wextra -dynamiclib -o libyoga.dylib -I../../.. ../../../yoga/*.c ../../Yoga/YGInterop.cpp
|
TARGET=//csharp:yoganet#default,shared
|
||||||
|
buck build $TARGET
|
||||||
|
ROOT=`buck root|tail -1`
|
||||||
|
DYLIB=`buck targets --show-output $TARGET|tail -1|awk '{print $2}'`
|
||||||
|
cp $ROOT/$DYLIB .
|
||||||
|
|
||||||
mcs -debug -t:library -r:$NUNIT/nunit.framework.dll -out:YogaTest.dll *.cs ../../../csharp/Facebook.Yoga/*cs
|
mcs -debug -t:library -r:$NUNIT/nunit.framework.dll -out:YogaTest.dll *.cs ../../../csharp/Facebook.Yoga/*cs
|
||||||
MONO_PATH=$NUNIT mono --arch=64 --debug $NUNIT/nunit-console.exe YogaTest.dll
|
MONO_PATH=$NUNIT mono --arch=64 --debug $NUNIT/nunit-console.exe YogaTest.dll
|
||||||
|
@@ -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 {
|
||||||
|
@@ -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));
|
14
yoga/Yoga.c
14
yoga/Yoga.c
@@ -293,7 +293,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;
|
||||||
@@ -305,7 +305,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);
|
||||||
@@ -314,7 +314,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);
|
||||||
@@ -340,7 +340,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;
|
||||||
}
|
}
|
||||||
@@ -370,7 +370,11 @@ YGNodeRef YGNodeGetChild(const YGNodeRef node, const uint32_t index) {
|
|||||||
return YGNodeListGet(node->children, index);
|
return YGNodeListGet(node->children, index);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline uint32_t YGNodeChildCount(const YGNodeRef node) {
|
YGNodeRef YGNodeGetParent(const YGNodeRef node) {
|
||||||
|
return node->parent;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline uint32_t YGNodeGetChildCount(const YGNodeRef node) {
|
||||||
return YGNodeListCount(node->children);
|
return YGNodeListCount(node->children);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -73,7 +73,8 @@ WIN_EXPORT void YGNodeInsertChild(const YGNodeRef node,
|
|||||||
const uint32_t index);
|
const uint32_t index);
|
||||||
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 uint32_t YGNodeChildCount(const YGNodeRef node);
|
WIN_EXPORT YGNodeRef YGNodeGetParent(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,
|
||||||
|
Reference in New Issue
Block a user