Compare commits
146 Commits
1.11.0
...
carlhuting
Author | SHA1 | Date | |
---|---|---|---|
|
19035c90e9 | ||
|
19fd066507 | ||
|
204e849218 | ||
|
8ff13c922a | ||
|
af219f8836 | ||
|
e33123f955 | ||
|
755fa07b39 | ||
|
2701d80078 | ||
|
c393ed1381 | ||
|
a4bdd9cd9b | ||
|
4a4325afb6 | ||
|
586eb6102a | ||
|
b1e6793460 | ||
|
8b17459254 | ||
|
195c166efe | ||
|
0908d3a173 | ||
|
f304990656 | ||
|
cea3865c74 | ||
|
b74c0d4766 | ||
|
54e863cef2 | ||
|
1938792517 | ||
|
aa71dbb5bd | ||
|
8dc46c0a87 | ||
|
1180afed9c | ||
|
1562bce9b4 | ||
|
a9514513a7 | ||
|
cf809b8e8b | ||
|
d7ff5c0689 | ||
|
e3156279fc | ||
|
0ce42d83e0 | ||
|
afc1108659 | ||
|
a15bf6e701 | ||
|
74fc37efc8 | ||
|
5824dbda66 | ||
|
e96a09e5ff | ||
|
9e20dfeea1 | ||
|
6e04631862 | ||
|
88b23ebb3d | ||
|
018916403e | ||
|
af38fd31f8 | ||
|
1e0ebdae2f | ||
|
1adbafe950 | ||
|
e51ca95713 | ||
|
a803421739 | ||
|
011c1964a0 | ||
|
05d205cf89 | ||
|
0a4f7bd558 | ||
|
cea862a6bf | ||
|
cc02a20c9e | ||
|
98fda9c587 | ||
|
2eed95f3e4 | ||
|
e5d3baca81 | ||
|
dee93017f7 | ||
|
e167642672 | ||
|
e9bb1efb03 | ||
|
3f7d03b443 | ||
|
ffce716557 | ||
|
fcfb19e9cf | ||
|
c5f105a7b6 | ||
|
b062d23947 | ||
|
7fc6fcb38c | ||
|
bc7e504b29 | ||
|
3d8afa9e90 | ||
|
a1e47e37ae | ||
|
e0bc0ebe29 | ||
|
498c0ff4bf | ||
|
d42d43e90f | ||
|
bfc6319daa | ||
|
74ce5afd9e | ||
|
c11faf2d56 | ||
|
5fad8008ab | ||
|
948ade4b1c | ||
|
b1a7f2b4d9 | ||
|
d44a6d936f | ||
|
1fc8472d35 | ||
|
c235301b52 | ||
|
2fb81500c1 | ||
|
68d9209dd9 | ||
|
e91569cdad | ||
|
f31917aa01 | ||
|
74202aecff | ||
|
9c2108c69e | ||
|
3d2836a947 | ||
|
e4856a2264 | ||
|
a2ee0f65bd | ||
|
85352c4e45 | ||
|
7d7b7b9e18 | ||
|
62d8a911ff | ||
|
ca46c67e9e | ||
|
5bb2265083 | ||
|
ab3bf40c7d | ||
|
f273e80c77 | ||
|
1471be54e3 | ||
|
f039835249 | ||
|
f793ba2d6b | ||
|
9f72ad05ce | ||
|
14f3827491 | ||
|
0d96098fd9 | ||
|
42e3b78f04 | ||
|
3ad49d27d9 | ||
|
3331a9e480 | ||
|
7890672ecc | ||
|
d7bfbf3646 | ||
|
6d271c05f6 | ||
|
a9bddf87ff | ||
|
88994129ae | ||
|
888892885e | ||
|
de79f2a1d4 | ||
|
6368416178 | ||
|
a935a222b5 | ||
|
7c4da0a341 | ||
|
b047af25ca | ||
|
2abd9dd91b | ||
|
afadc5cf6b | ||
|
8823cc357a | ||
|
8b8d9a05b7 | ||
|
15668aceb6 | ||
|
e25fe994b3 | ||
|
47abe1c482 | ||
|
95169c3150 | ||
|
7331de78bd | ||
|
05f36a835a | ||
|
dcd9438488 | ||
|
d38db1292c | ||
|
4463fe0856 | ||
|
2156de5fb5 | ||
|
b1c749075d | ||
|
367a93de88 | ||
|
2643b96589 | ||
|
016a10df26 | ||
|
cbcf07f08a | ||
|
59bcac3289 | ||
|
bd90192df9 | ||
|
e7fcf1ee65 | ||
|
f86c74ce7e | ||
|
d5ad51bccc | ||
|
0bdf36f5d1 | ||
|
1b9053bc5d | ||
|
446101a168 | ||
|
f0324035bf | ||
|
a2f94cbf9a | ||
|
d21fa68033 | ||
|
5a6d84abc9 | ||
|
61ae484316 | ||
|
42657017bd | ||
|
9b9a344934 |
@@ -9,7 +9,7 @@ AlignTrailingComments: false
|
||||
AllowAllParametersOfDeclarationOnNextLine: false
|
||||
AllowShortBlocksOnASingleLine: false
|
||||
AllowShortCaseLabelsOnASingleLine: false
|
||||
AllowShortFunctionsOnASingleLine: Empty
|
||||
AllowShortFunctionsOnASingleLine: Inline
|
||||
AllowShortIfStatementsOnASingleLine: false
|
||||
AllowShortLoopsOnASingleLine: true
|
||||
AlwaysBreakAfterReturnType: None
|
||||
|
@@ -1 +1 @@
|
||||
3.0
|
||||
4.0
|
||||
|
31
BUCK
31
BUCK
@@ -9,21 +9,31 @@ GMOCK_OVERRIDE_FLAGS = [
|
||||
"-Wno-inconsistent-missing-override",
|
||||
]
|
||||
|
||||
COMPILER_FLAGS = LIBRARY_COMPILER_FLAGS + [
|
||||
"-std=c++1y",
|
||||
]
|
||||
|
||||
TEST_COMPILER_FLAGS = BASE_COMPILER_FLAGS + GMOCK_OVERRIDE_FLAGS + [
|
||||
"-std=c++1y",
|
||||
"-DDEBUG",
|
||||
"-DYG_ENABLE_EVENTS",
|
||||
]
|
||||
|
||||
yoga_cxx_library(
|
||||
name = "yoga",
|
||||
srcs = glob(["yoga/*.cpp"]),
|
||||
headers = subdir_glob([("", "yoga/**/*.h")]),
|
||||
srcs = glob(["yoga/**/*.cpp"]),
|
||||
header_namespace = "",
|
||||
exported_headers = subdir_glob([("", "yoga/*.h")]),
|
||||
compiler_flags = COMPILER_FLAGS,
|
||||
exported_headers = subdir_glob([("", "yoga/**/*.h")]),
|
||||
compiler_flags = LIBRARY_COMPILER_FLAGS,
|
||||
soname = "libyogacore.$(ext)",
|
||||
tests = [":YogaTests"],
|
||||
visibility = ["PUBLIC"],
|
||||
deps = [
|
||||
yoga_dep("lib/fb:ndklog"),
|
||||
],
|
||||
)
|
||||
|
||||
yoga_cxx_library(
|
||||
name = "yogaForDebug",
|
||||
srcs = glob(["yoga/**/*.cpp"]),
|
||||
header_namespace = "",
|
||||
exported_headers = subdir_glob([("", "yoga/**/*.h")]),
|
||||
compiler_flags = TEST_COMPILER_FLAGS,
|
||||
soname = "libyogacore.$(ext)",
|
||||
tests = [":YogaTests"],
|
||||
visibility = ["PUBLIC"],
|
||||
@@ -40,7 +50,8 @@ yoga_cxx_test(
|
||||
contacts = ["emilsj@fb.com"],
|
||||
visibility = ["PUBLIC"],
|
||||
deps = [
|
||||
":yoga",
|
||||
":yogaForDebug",
|
||||
yoga_dep("testutil:testutil"),
|
||||
GTEST_TARGET,
|
||||
],
|
||||
)
|
||||
|
@@ -13,3 +13,4 @@ file(GLOB yogacore_SRC yoga/*.cpp)
|
||||
add_library(yogacore STATIC ${yogacore_SRC})
|
||||
|
||||
target_link_libraries(yogacore android log)
|
||||
set_target_properties(yogacore PROPERTIES CXX_STANDARD 11)
|
||||
|
5224
ReactYoga.xcodeproj/project.pbxproj
Normal file
5224
ReactYoga.xcodeproj/project.pbxproj
Normal file
File diff suppressed because it is too large
Load Diff
@@ -6,7 +6,7 @@
|
||||
#
|
||||
Pod::Spec.new do |spec|
|
||||
spec.name = 'Yoga'
|
||||
spec.version = '1.9.0'
|
||||
spec.version = '1.14.0'
|
||||
spec.license = { :type => 'MIT', :file => "LICENSE" }
|
||||
spec.homepage = 'https://yogalayout.com/'
|
||||
spec.documentation_url = 'https://yogalayout.com/docs'
|
||||
@@ -19,7 +19,7 @@ Pod::Spec.new do |spec|
|
||||
:git => 'https://github.com/facebook/yoga.git',
|
||||
:tag => spec.version.to_s,
|
||||
}
|
||||
spec.platforms = { :ios => "4.3", :osx => "10.7", :tvos => "10.0", :watchos => "2.0" }
|
||||
spec.platforms = { :ios => "8.0", :osx => "10.7", :tvos => "10.0", :watchos => "2.0" }
|
||||
spec.module_name = 'yoga'
|
||||
spec.requires_arc = false
|
||||
spec.pod_target_xcconfig = {
|
||||
|
10
YogaDev.xcworkspace/contents.xcworkspacedata
generated
Normal file
10
YogaDev.xcworkspace/contents.xcworkspacedata
generated
Normal file
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Workspace
|
||||
version = "1.0">
|
||||
<FileRef
|
||||
location = "group:YogaDev/YogaDev.xcodeproj">
|
||||
</FileRef>
|
||||
<FileRef
|
||||
location = "group:ReactYoga.xcodeproj">
|
||||
</FileRef>
|
||||
</Workspace>
|
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>IDEDidComputeMac32BitWarning</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>
|
350
YogaDev/YogaDev.xcodeproj/project.pbxproj
Normal file
350
YogaDev/YogaDev.xcodeproj/project.pbxproj
Normal file
@@ -0,0 +1,350 @@
|
||||
// !$*UTF8*$!
|
||||
{
|
||||
archiveVersion = 1;
|
||||
classes = {
|
||||
};
|
||||
objectVersion = 50;
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
6D4C7FA42249476900CBB1EC /* YGMarker.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6D4C7F892249476700CBB1EC /* YGMarker.cpp */; };
|
||||
6D4C7FA52249476900CBB1EC /* YGValue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6D4C7F8B2249476700CBB1EC /* YGValue.cpp */; };
|
||||
6D4C7FA62249476900CBB1EC /* YGLayout.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6D4C7F902249476700CBB1EC /* YGLayout.cpp */; };
|
||||
6D4C7FA72249476900CBB1EC /* YGNodePrint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6D4C7F922249476700CBB1EC /* YGNodePrint.cpp */; };
|
||||
6D4C7FA82249476900CBB1EC /* YGStyle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6D4C7F992249476800CBB1EC /* YGStyle.cpp */; };
|
||||
6D4C7FA92249476900CBB1EC /* log.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6D4C7F9A2249476800CBB1EC /* log.cpp */; };
|
||||
6D4C7FAA2249476900CBB1EC /* YGNode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6D4C7F9B2249476800CBB1EC /* YGNode.cpp */; };
|
||||
6D4C7FAB2249476900CBB1EC /* Yoga.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6D4C7F9C2249476800CBB1EC /* Yoga.cpp */; };
|
||||
6D4C7FAC2249476900CBB1EC /* Utils.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6D4C7F9D2249476800CBB1EC /* Utils.cpp */; };
|
||||
6D4C7FAD2249476900CBB1EC /* YGEnums.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6D4C7F9E2249476800CBB1EC /* YGEnums.cpp */; };
|
||||
6D4C7FAE2249476900CBB1EC /* YGConfig.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6D4C7FA32249476800CBB1EC /* YGConfig.cpp */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXCopyFilesBuildPhase section */
|
||||
6D4C7F76224945B200CBB1EC /* CopyFiles */ = {
|
||||
isa = PBXCopyFilesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
dstPath = "include/$(PRODUCT_NAME)";
|
||||
dstSubfolderSpec = 16;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXCopyFilesBuildPhase section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
6D4C7F78224945B200CBB1EC /* libYogaDev.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libYogaDev.a; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
6D4C7F892249476700CBB1EC /* YGMarker.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = YGMarker.cpp; path = ../yoga/YGMarker.cpp; sourceTree = "<group>"; };
|
||||
6D4C7F8A2249476700CBB1EC /* Utils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Utils.h; path = ../yoga/Utils.h; sourceTree = "<group>"; };
|
||||
6D4C7F8B2249476700CBB1EC /* YGValue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = YGValue.cpp; path = ../yoga/YGValue.cpp; sourceTree = "<group>"; };
|
||||
6D4C7F8C2249476700CBB1EC /* instrumentation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = instrumentation.h; path = ../yoga/instrumentation.h; sourceTree = "<group>"; };
|
||||
6D4C7F8D2249476700CBB1EC /* YGStyle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = YGStyle.h; path = ../yoga/YGStyle.h; sourceTree = "<group>"; };
|
||||
6D4C7F8E2249476700CBB1EC /* YGNodePrint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = YGNodePrint.h; path = ../yoga/YGNodePrint.h; sourceTree = "<group>"; };
|
||||
6D4C7F8F2249476700CBB1EC /* YGMarker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = YGMarker.h; path = ../yoga/YGMarker.h; sourceTree = "<group>"; };
|
||||
6D4C7F902249476700CBB1EC /* YGLayout.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = YGLayout.cpp; path = ../yoga/YGLayout.cpp; sourceTree = "<group>"; };
|
||||
6D4C7F912249476700CBB1EC /* YGEnums.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = YGEnums.h; path = ../yoga/YGEnums.h; sourceTree = "<group>"; };
|
||||
6D4C7F922249476700CBB1EC /* YGNodePrint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = YGNodePrint.cpp; path = ../yoga/YGNodePrint.cpp; sourceTree = "<group>"; };
|
||||
6D4C7F932249476700CBB1EC /* YGMacros.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = YGMacros.h; path = ../yoga/YGMacros.h; sourceTree = "<group>"; };
|
||||
6D4C7F942249476700CBB1EC /* log.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = log.h; path = ../yoga/log.h; sourceTree = "<group>"; };
|
||||
6D4C7F952249476800CBB1EC /* YGFloatOptional.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = YGFloatOptional.h; path = ../yoga/YGFloatOptional.h; sourceTree = "<group>"; };
|
||||
6D4C7F962249476800CBB1EC /* YGNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = YGNode.h; path = ../yoga/YGNode.h; sourceTree = "<group>"; };
|
||||
6D4C7F972249476800CBB1EC /* YGLayout.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = YGLayout.h; path = ../yoga/YGLayout.h; sourceTree = "<group>"; };
|
||||
6D4C7F982249476800CBB1EC /* CompactValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CompactValue.h; path = ../yoga/CompactValue.h; sourceTree = "<group>"; };
|
||||
6D4C7F992249476800CBB1EC /* YGStyle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = YGStyle.cpp; path = ../yoga/YGStyle.cpp; sourceTree = "<group>"; };
|
||||
6D4C7F9A2249476800CBB1EC /* log.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = log.cpp; path = ../yoga/log.cpp; sourceTree = "<group>"; };
|
||||
6D4C7F9B2249476800CBB1EC /* YGNode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = YGNode.cpp; path = ../yoga/YGNode.cpp; sourceTree = "<group>"; };
|
||||
6D4C7F9C2249476800CBB1EC /* Yoga.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Yoga.cpp; path = ../yoga/Yoga.cpp; sourceTree = "<group>"; };
|
||||
6D4C7F9D2249476800CBB1EC /* Utils.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Utils.cpp; path = ../yoga/Utils.cpp; sourceTree = "<group>"; };
|
||||
6D4C7F9E2249476800CBB1EC /* YGEnums.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = YGEnums.cpp; path = ../yoga/YGEnums.cpp; sourceTree = "<group>"; };
|
||||
6D4C7F9F2249476800CBB1EC /* Yoga-internal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "Yoga-internal.h"; path = "../yoga/Yoga-internal.h"; sourceTree = "<group>"; };
|
||||
6D4C7FA02249476800CBB1EC /* YGValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = YGValue.h; path = ../yoga/YGValue.h; sourceTree = "<group>"; };
|
||||
6D4C7FA12249476800CBB1EC /* Yoga.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Yoga.h; path = ../yoga/Yoga.h; sourceTree = "<group>"; };
|
||||
6D4C7FA22249476800CBB1EC /* YGConfig.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = YGConfig.h; path = ../yoga/YGConfig.h; sourceTree = "<group>"; };
|
||||
6D4C7FA32249476800CBB1EC /* YGConfig.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = YGConfig.cpp; path = ../yoga/YGConfig.cpp; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
6D4C7F75224945B200CBB1EC /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
6D4C7F6F224945B200CBB1EC = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
6D4C7F982249476800CBB1EC /* CompactValue.h */,
|
||||
6D4C7F8C2249476700CBB1EC /* instrumentation.h */,
|
||||
6D4C7F9A2249476800CBB1EC /* log.cpp */,
|
||||
6D4C7F942249476700CBB1EC /* log.h */,
|
||||
6D4C7F9D2249476800CBB1EC /* Utils.cpp */,
|
||||
6D4C7F8A2249476700CBB1EC /* Utils.h */,
|
||||
6D4C7FA32249476800CBB1EC /* YGConfig.cpp */,
|
||||
6D4C7FA22249476800CBB1EC /* YGConfig.h */,
|
||||
6D4C7F9E2249476800CBB1EC /* YGEnums.cpp */,
|
||||
6D4C7F912249476700CBB1EC /* YGEnums.h */,
|
||||
6D4C7F952249476800CBB1EC /* YGFloatOptional.h */,
|
||||
6D4C7F902249476700CBB1EC /* YGLayout.cpp */,
|
||||
6D4C7F972249476800CBB1EC /* YGLayout.h */,
|
||||
6D4C7F932249476700CBB1EC /* YGMacros.h */,
|
||||
6D4C7F892249476700CBB1EC /* YGMarker.cpp */,
|
||||
6D4C7F8F2249476700CBB1EC /* YGMarker.h */,
|
||||
6D4C7F9B2249476800CBB1EC /* YGNode.cpp */,
|
||||
6D4C7F962249476800CBB1EC /* YGNode.h */,
|
||||
6D4C7F922249476700CBB1EC /* YGNodePrint.cpp */,
|
||||
6D4C7F8E2249476700CBB1EC /* YGNodePrint.h */,
|
||||
6D4C7F992249476800CBB1EC /* YGStyle.cpp */,
|
||||
6D4C7F8D2249476700CBB1EC /* YGStyle.h */,
|
||||
6D4C7F8B2249476700CBB1EC /* YGValue.cpp */,
|
||||
6D4C7FA02249476800CBB1EC /* YGValue.h */,
|
||||
6D4C7F9F2249476800CBB1EC /* Yoga-internal.h */,
|
||||
6D4C7F9C2249476800CBB1EC /* Yoga.cpp */,
|
||||
6D4C7FA12249476800CBB1EC /* Yoga.h */,
|
||||
6D4C7F79224945B200CBB1EC /* Products */,
|
||||
);
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
6D4C7F79224945B200CBB1EC /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
6D4C7F78224945B200CBB1EC /* libYogaDev.a */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
6D4C7F77224945B200CBB1EC /* YogaDev */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 6D4C7F81224945B200CBB1EC /* Build configuration list for PBXNativeTarget "YogaDev" */;
|
||||
buildPhases = (
|
||||
6D4C7F74224945B200CBB1EC /* Sources */,
|
||||
6D4C7F75224945B200CBB1EC /* Frameworks */,
|
||||
6D4C7F76224945B200CBB1EC /* CopyFiles */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = YogaDev;
|
||||
productName = YogaDev;
|
||||
productReference = 6D4C7F78224945B200CBB1EC /* libYogaDev.a */;
|
||||
productType = "com.apple.product-type.library.static";
|
||||
};
|
||||
/* End PBXNativeTarget section */
|
||||
|
||||
/* Begin PBXProject section */
|
||||
6D4C7F70224945B200CBB1EC /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastUpgradeCheck = 1010;
|
||||
ORGANIZATIONNAME = "Will Wilson";
|
||||
TargetAttributes = {
|
||||
6D4C7F77224945B200CBB1EC = {
|
||||
CreatedOnToolsVersion = 10.1;
|
||||
};
|
||||
};
|
||||
};
|
||||
buildConfigurationList = 6D4C7F73224945B200CBB1EC /* Build configuration list for PBXProject "YogaDev" */;
|
||||
compatibilityVersion = "Xcode 9.3";
|
||||
developmentRegion = en;
|
||||
hasScannedForEncodings = 0;
|
||||
knownRegions = (
|
||||
en,
|
||||
);
|
||||
mainGroup = 6D4C7F6F224945B200CBB1EC;
|
||||
productRefGroup = 6D4C7F79224945B200CBB1EC /* Products */;
|
||||
projectDirPath = "";
|
||||
projectRoot = "";
|
||||
targets = (
|
||||
6D4C7F77224945B200CBB1EC /* YogaDev */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
6D4C7F74224945B200CBB1EC /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
6D4C7FAD2249476900CBB1EC /* YGEnums.cpp in Sources */,
|
||||
6D4C7FAE2249476900CBB1EC /* YGConfig.cpp in Sources */,
|
||||
6D4C7FAA2249476900CBB1EC /* YGNode.cpp in Sources */,
|
||||
6D4C7FAB2249476900CBB1EC /* Yoga.cpp in Sources */,
|
||||
6D4C7FA92249476900CBB1EC /* log.cpp in Sources */,
|
||||
6D4C7FA62249476900CBB1EC /* YGLayout.cpp in Sources */,
|
||||
6D4C7FAC2249476900CBB1EC /* Utils.cpp in Sources */,
|
||||
6D4C7FA82249476900CBB1EC /* YGStyle.cpp in Sources */,
|
||||
6D4C7FA42249476900CBB1EC /* YGMarker.cpp in Sources */,
|
||||
6D4C7FA52249476900CBB1EC /* YGValue.cpp in Sources */,
|
||||
6D4C7FA72249476900CBB1EC /* YGNodePrint.cpp in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXSourcesBuildPhase section */
|
||||
|
||||
/* Begin XCBuildConfiguration section */
|
||||
6D4C7F7F224945B200CBB1EC /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_ANALYZER_NONNULL = YES;
|
||||
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
CODE_SIGN_IDENTITY = "iPhone Developer";
|
||||
COPY_PHASE_STRIP = NO;
|
||||
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
ENABLE_TESTABILITY = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu11;
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
"DEBUG=1",
|
||||
"$(inherited)",
|
||||
);
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 12.1;
|
||||
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
|
||||
MTL_FAST_MATH = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
SDKROOT = iphoneos;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
6D4C7F80224945B200CBB1EC /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_ANALYZER_NONNULL = YES;
|
||||
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
CODE_SIGN_IDENTITY = "iPhone Developer";
|
||||
COPY_PHASE_STRIP = NO;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
ENABLE_NS_ASSERTIONS = NO;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu11;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 12.1;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
MTL_FAST_MATH = YES;
|
||||
SDKROOT = iphoneos;
|
||||
VALIDATE_PRODUCT = YES;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
6D4C7F82224945B200CBB1EC /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
OTHER_LDFLAGS = "-ObjC";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SKIP_INSTALL = YES;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
6D4C7F83224945B200CBB1EC /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
OTHER_LDFLAGS = "-ObjC";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SKIP_INSTALL = YES;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
/* End XCBuildConfiguration section */
|
||||
|
||||
/* Begin XCConfigurationList section */
|
||||
6D4C7F73224945B200CBB1EC /* Build configuration list for PBXProject "YogaDev" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
6D4C7F7F224945B200CBB1EC /* Debug */,
|
||||
6D4C7F80224945B200CBB1EC /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
6D4C7F81224945B200CBB1EC /* Build configuration list for PBXNativeTarget "YogaDev" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
6D4C7F82224945B200CBB1EC /* Debug */,
|
||||
6D4C7F83224945B200CBB1EC /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
};
|
||||
rootObject = 6D4C7F70224945B200CBB1EC /* Project object */;
|
||||
}
|
@@ -6,10 +6,10 @@
|
||||
#
|
||||
podspec = Pod::Spec.new do |spec|
|
||||
spec.name = 'YogaKit'
|
||||
spec.version = '1.10.0'
|
||||
spec.version = '1.14.0'
|
||||
spec.license = { :type => 'MIT', :file => "LICENSE" }
|
||||
spec.homepage = 'https://facebook.github.io/yoga/'
|
||||
spec.documentation_url = 'https://facebook.github.io/yoga/docs/api/yogakit/'
|
||||
spec.documentation_url = 'https://facebook.github.io/yoga/docs/'
|
||||
|
||||
spec.summary = 'Yoga is a cross-platform layout engine which implements Flexbox.'
|
||||
spec.description = 'Yoga is a cross-platform layout engine enabling maximum collaboration within your team by implementing an API many designers are familiar with, and opening it up to developers across different platforms.'
|
||||
@@ -23,12 +23,11 @@ podspec = Pod::Spec.new do |spec|
|
||||
spec.platform = :ios
|
||||
spec.ios.deployment_target = '8.0'
|
||||
spec.ios.frameworks = 'UIKit'
|
||||
|
||||
spec.dependency 'Yoga', '~> 1.9'
|
||||
spec.dependency 'Yoga', '~> 1.14'
|
||||
spec.source_files = 'YogaKit/Source/*.{h,m,swift}'
|
||||
spec.public_header_files = 'YogaKit/Source/{YGLayout,UIView+Yoga}.h'
|
||||
spec.private_header_files = 'YogaKit/Source/YGLayout+Private.h'
|
||||
spec.swift_version = '3.0'
|
||||
spec.swift_version = '4.0'
|
||||
end
|
||||
|
||||
# See https://github.com/facebook/yoga/pull/366
|
||||
|
@@ -1,4 +1,4 @@
|
||||
/**
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the LICENSE
|
||||
|
@@ -1,4 +1,4 @@
|
||||
/**
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the LICENSE
|
||||
|
@@ -1,4 +1,4 @@
|
||||
/**
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the LICENSE
|
||||
|
@@ -180,7 +180,7 @@ static YGConfigRef globalConfig;
|
||||
// the measure function. Since we already know that this is a leaf,
|
||||
// this *should* be fine. Forgive me Hack Gods.
|
||||
const YGNodeRef node = self.node;
|
||||
if (YGNodeGetMeasureFunc(node) == NULL) {
|
||||
if (YGNodeHasMeasureFunc(node)) {
|
||||
YGNodeSetMeasureFunc(node, YGMeasureView);
|
||||
}
|
||||
|
||||
@@ -425,9 +425,7 @@ static void YGRemoveAllChildren(const YGNodeRef node)
|
||||
return;
|
||||
}
|
||||
|
||||
while (YGNodeGetChildCount(node) > 0) {
|
||||
YGNodeRemoveChild(node, YGNodeGetChild(node, YGNodeGetChildCount(node) - 1));
|
||||
}
|
||||
YGNodeRemoveAllChildren(node);
|
||||
}
|
||||
|
||||
static CGFloat YGRoundPixelValue(CGFloat value)
|
||||
|
@@ -1,10 +1,3 @@
|
||||
<!--
|
||||
Copyright (c) Facebook, Inc. and its affiliates.
|
||||
|
||||
This source code is licensed under the MIT license found in the
|
||||
LICENSE file in the root directory of this source tree.
|
||||
-->
|
||||
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Workspace
|
||||
version = "1.0">
|
||||
|
@@ -1,10 +1,3 @@
|
||||
<!--
|
||||
Copyright (c) Facebook, Inc. and its affiliates.
|
||||
|
||||
This source code is licensed under the MIT license found in the
|
||||
LICENSE file in the root directory of this source tree.
|
||||
-->
|
||||
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Workspace
|
||||
version = "1.0">
|
||||
|
@@ -1,5 +1,9 @@
|
||||
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the LICENSE
|
||||
* file in the root directory of this source tree.
|
||||
*/
|
||||
package com.facebook.samples.yoga;
|
||||
|
||||
import android.content.Intent;
|
||||
|
@@ -1,5 +1,9 @@
|
||||
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the LICENSE
|
||||
* file in the root directory of this source tree.
|
||||
*/
|
||||
package com.facebook.samples.yoga;
|
||||
|
||||
import java.io.File;
|
||||
|
@@ -1,5 +1,9 @@
|
||||
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the LICENSE
|
||||
* file in the root directory of this source tree.
|
||||
*/
|
||||
package com.facebook.samples.yoga;
|
||||
|
||||
|
||||
|
@@ -1,5 +1,9 @@
|
||||
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the LICENSE
|
||||
* file in the root directory of this source tree.
|
||||
*/
|
||||
package com.facebook.samples.yoga;
|
||||
|
||||
import android.os.Bundle;
|
||||
|
@@ -1,5 +1,9 @@
|
||||
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the LICENSE
|
||||
* file in the root directory of this source tree.
|
||||
*/
|
||||
package com.facebook.samples.yoga;
|
||||
|
||||
import android.os.Bundle;
|
||||
|
@@ -1,5 +1,9 @@
|
||||
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the LICENSE
|
||||
* file in the root directory of this source tree.
|
||||
*/
|
||||
package com.facebook.samples.yoga;
|
||||
|
||||
import android.os.Bundle;
|
||||
|
@@ -1,11 +1,9 @@
|
||||
/**
|
||||
* Copyright 2014-present, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the license found in the
|
||||
* LICENSE-examples file in the root directory of this source tree.
|
||||
* This source code is licensed under the MIT license found in the LICENSE
|
||||
* file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
package com.facebook.samples.yoga;
|
||||
|
||||
import android.content.Intent;
|
||||
|
@@ -1,10 +1,9 @@
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
* This source code is licensed under the MIT license found in the LICENSE
|
||||
* file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
package com.facebook.yoga.android;
|
||||
|
||||
import java.util.HashMap;
|
||||
@@ -33,7 +32,7 @@ public class VirtualYogaLayout extends ViewGroup {
|
||||
|
||||
final private List<View> mChildren = new LinkedList<>();
|
||||
final private Map<View, YogaNode> mYogaNodes = new HashMap<>();
|
||||
final private YogaNode mYogaNode = new YogaNode();
|
||||
final private YogaNode mYogaNode = YogaNode.create();
|
||||
|
||||
public VirtualYogaLayout(Context context) {
|
||||
super(context);
|
||||
@@ -73,7 +72,7 @@ public class VirtualYogaLayout extends ViewGroup {
|
||||
return;
|
||||
}
|
||||
|
||||
YogaNode node = new YogaNode();
|
||||
YogaNode node = YogaNode.create();
|
||||
YogaLayout.LayoutParams lp = new YogaLayout.LayoutParams(params);
|
||||
YogaLayout.applyLayoutParams(lp, node, child);
|
||||
node.setData(child);
|
||||
|
@@ -1,10 +1,9 @@
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
* This source code is licensed under the MIT license found in the LICENSE
|
||||
* file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
package com.facebook.yoga.android;
|
||||
|
||||
import android.content.Context;
|
||||
@@ -78,7 +77,7 @@ public class YogaLayout extends ViewGroup {
|
||||
public YogaLayout(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
|
||||
mYogaNode = new YogaNode();
|
||||
mYogaNode = YogaNode.create();
|
||||
mYogaNodes = new HashMap<>();
|
||||
|
||||
mYogaNode.setData(this);
|
||||
@@ -155,7 +154,7 @@ public class YogaLayout extends ViewGroup {
|
||||
if(mYogaNodes.containsKey(child)) {
|
||||
childNode = mYogaNodes.get(child);
|
||||
} else {
|
||||
childNode = new YogaNode();
|
||||
childNode = YogaNode.create();
|
||||
}
|
||||
|
||||
childNode.setData(child);
|
||||
|
@@ -1,10 +1,9 @@
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
* This source code is licensed under the MIT license found in the LICENSE
|
||||
* file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
package com.facebook.yoga.android;
|
||||
|
||||
import android.content.Context;
|
||||
|
@@ -1,4 +1,4 @@
|
||||
/**
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the LICENSE
|
||||
|
@@ -9,11 +9,12 @@
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
google()
|
||||
jcenter()
|
||||
maven { url 'https://maven.google.com/' }
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:3.0.0'
|
||||
classpath 'com.android.tools.build:gradle:3.1.0'
|
||||
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3'
|
||||
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.0'
|
||||
|
||||
@@ -24,6 +25,7 @@ buildscript {
|
||||
|
||||
allprojects {
|
||||
repositories {
|
||||
google()
|
||||
jcenter()
|
||||
}
|
||||
}
|
||||
|
@@ -43,9 +43,6 @@ namespace Facebook.Yoga
|
||||
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void YGConfigFree(IntPtr node);
|
||||
|
||||
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int YGNodeGetInstanceCount();
|
||||
|
||||
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int YGConfigGetInstanceCount();
|
||||
|
||||
|
@@ -673,10 +673,5 @@ namespace Facebook.Yoga
|
||||
return _children != null ? ((IEnumerable<YogaNode>)_children).GetEnumerator() :
|
||||
System.Linq.Enumerable.Empty<YogaNode>().GetEnumerator();
|
||||
}
|
||||
|
||||
public static int GetInstanceCount()
|
||||
{
|
||||
return Native.YGNodeGetInstanceCount();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,4 +1,4 @@
|
||||
/**
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the LICENSE
|
||||
|
@@ -1,4 +1,4 @@
|
||||
/**
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the LICENSE
|
||||
|
@@ -1,4 +1,4 @@
|
||||
/**
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the LICENSE
|
||||
|
@@ -1,3 +1,9 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the LICENSE
|
||||
* file in the root directory of this source tree.
|
||||
*/
|
||||
//{{NO_DEPENDENCIES}}
|
||||
// Microsoft Visual C++ generated include file.
|
||||
// Used by Yoga.rc
|
||||
|
@@ -1,4 +1,4 @@
|
||||
/**
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the LICENSE
|
||||
|
@@ -1,4 +1,4 @@
|
||||
/**
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the LICENSE
|
||||
|
@@ -1,4 +1,4 @@
|
||||
/**
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the LICENSE
|
||||
|
@@ -1,10 +1,9 @@
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
* This source code is licensed under the MIT license found in the LICENSE
|
||||
* file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
// @Generated by gentest/gentest.rb from gentest/fixtures/YGAbsolutePositionTest.html
|
||||
|
||||
using System;
|
||||
|
@@ -1,10 +1,9 @@
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
* This source code is licensed under the MIT license found in the LICENSE
|
||||
* file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
// @Generated by gentest/gentest.rb from gentest/fixtures/YGAlignContentTest.html
|
||||
|
||||
using System;
|
||||
@@ -362,39 +361,6 @@ namespace Facebook.Yoga
|
||||
Assert.AreEqual(100f, root.LayoutWidth);
|
||||
Assert.AreEqual(100f, root.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(0f, root_child0.LayoutX);
|
||||
Assert.AreEqual(0f, root_child0.LayoutY);
|
||||
Assert.AreEqual(50f, root_child0.LayoutWidth);
|
||||
Assert.AreEqual(10f, root_child0.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(0f, root_child1.LayoutX);
|
||||
Assert.AreEqual(10f, root_child1.LayoutY);
|
||||
Assert.AreEqual(50f, root_child1.LayoutWidth);
|
||||
Assert.AreEqual(10f, root_child1.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(0f, root_child2.LayoutX);
|
||||
Assert.AreEqual(20f, root_child2.LayoutY);
|
||||
Assert.AreEqual(50f, root_child2.LayoutWidth);
|
||||
Assert.AreEqual(10f, root_child2.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(0f, root_child3.LayoutX);
|
||||
Assert.AreEqual(30f, root_child3.LayoutY);
|
||||
Assert.AreEqual(50f, root_child3.LayoutWidth);
|
||||
Assert.AreEqual(10f, root_child3.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(0f, root_child4.LayoutX);
|
||||
Assert.AreEqual(40f, root_child4.LayoutY);
|
||||
Assert.AreEqual(50f, root_child4.LayoutWidth);
|
||||
Assert.AreEqual(10f, root_child4.LayoutHeight);
|
||||
|
||||
root.StyleDirection = YogaDirection.RTL;
|
||||
root.CalculateLayout();
|
||||
|
||||
Assert.AreEqual(0f, root.LayoutX);
|
||||
Assert.AreEqual(0f, root.LayoutY);
|
||||
Assert.AreEqual(100f, root.LayoutWidth);
|
||||
Assert.AreEqual(100f, root.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(50f, root_child0.LayoutX);
|
||||
Assert.AreEqual(0f, root_child0.LayoutY);
|
||||
Assert.AreEqual(50f, root_child0.LayoutWidth);
|
||||
@@ -419,6 +385,39 @@ namespace Facebook.Yoga
|
||||
Assert.AreEqual(40f, root_child4.LayoutY);
|
||||
Assert.AreEqual(50f, root_child4.LayoutWidth);
|
||||
Assert.AreEqual(10f, root_child4.LayoutHeight);
|
||||
|
||||
root.StyleDirection = YogaDirection.RTL;
|
||||
root.CalculateLayout();
|
||||
|
||||
Assert.AreEqual(0f, root.LayoutX);
|
||||
Assert.AreEqual(0f, root.LayoutY);
|
||||
Assert.AreEqual(100f, root.LayoutWidth);
|
||||
Assert.AreEqual(100f, root.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(0f, root_child0.LayoutX);
|
||||
Assert.AreEqual(0f, root_child0.LayoutY);
|
||||
Assert.AreEqual(50f, root_child0.LayoutWidth);
|
||||
Assert.AreEqual(10f, root_child0.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(0f, root_child1.LayoutX);
|
||||
Assert.AreEqual(10f, root_child1.LayoutY);
|
||||
Assert.AreEqual(50f, root_child1.LayoutWidth);
|
||||
Assert.AreEqual(10f, root_child1.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(0f, root_child2.LayoutX);
|
||||
Assert.AreEqual(20f, root_child2.LayoutY);
|
||||
Assert.AreEqual(50f, root_child2.LayoutWidth);
|
||||
Assert.AreEqual(10f, root_child2.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(0f, root_child3.LayoutX);
|
||||
Assert.AreEqual(30f, root_child3.LayoutY);
|
||||
Assert.AreEqual(50f, root_child3.LayoutWidth);
|
||||
Assert.AreEqual(10f, root_child3.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(0f, root_child4.LayoutX);
|
||||
Assert.AreEqual(40f, root_child4.LayoutY);
|
||||
Assert.AreEqual(50f, root_child4.LayoutWidth);
|
||||
Assert.AreEqual(10f, root_child4.LayoutHeight);
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
@@ -1,10 +1,9 @@
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
* This source code is licensed under the MIT license found in the LICENSE
|
||||
* file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
// @Generated by gentest/gentest.rb from gentest/fixtures/YGAlignItemsTest.html
|
||||
|
||||
using System;
|
||||
|
@@ -1,10 +1,9 @@
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
* This source code is licensed under the MIT license found in the LICENSE
|
||||
* file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
// @Generated by gentest/gentest.rb from gentest/fixtures/YGAlignSelfTest.html
|
||||
|
||||
using System;
|
||||
|
@@ -1,10 +1,9 @@
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
* This source code is licensed under the MIT license found in the LICENSE
|
||||
* file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
// @Generated by gentest/gentest.rb from gentest/fixtures/YGAndroidNewsFeed.html
|
||||
|
||||
using System;
|
||||
|
@@ -1,10 +1,9 @@
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
* This source code is licensed under the MIT license found in the LICENSE
|
||||
* file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
// @Generated by gentest/gentest.rb from gentest/fixtures/YGBorderTest.html
|
||||
|
||||
using System;
|
||||
|
@@ -1,10 +1,9 @@
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
* This source code is licensed under the MIT license found in the LICENSE
|
||||
* file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
// @Generated by gentest/gentest.rb from gentest/fixtures/YGDimensionTest.html
|
||||
|
||||
using System;
|
||||
|
@@ -1,10 +1,9 @@
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
* This source code is licensed under the MIT license found in the LICENSE
|
||||
* file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
// @Generated by gentest/gentest.rb from gentest/fixtures/YGDisplayTest.html
|
||||
|
||||
using System;
|
||||
@@ -214,8 +213,6 @@ namespace Facebook.Yoga
|
||||
root_child1_child0.FlexShrink = 1;
|
||||
root_child1_child0.FlexBasis = 0.Percent();
|
||||
root_child1_child0.Width = 20;
|
||||
root_child1_child0.MinWidth = 0;
|
||||
root_child1_child0.MinHeight = 0;
|
||||
root_child1.Insert(0, root_child1_child0);
|
||||
|
||||
YogaNode root_child2 = new YogaNode(config);
|
||||
|
@@ -1,10 +1,9 @@
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
* This source code is licensed under the MIT license found in the LICENSE
|
||||
* file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
// @Generated by gentest/gentest.rb from gentest/fixtures/YGFlexDirectionTest.html
|
||||
|
||||
using System;
|
||||
|
@@ -1,10 +1,9 @@
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
* This source code is licensed under the MIT license found in the LICENSE
|
||||
* file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
// @Generated by gentest/gentest.rb from gentest/fixtures/YGFlexTest.html
|
||||
|
||||
using System;
|
||||
|
@@ -1,10 +1,9 @@
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
* This source code is licensed under the MIT license found in the LICENSE
|
||||
* file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
// @Generated by gentest/gentest.rb from gentest/fixtures/YGFlexWrapTest.html
|
||||
|
||||
using System;
|
||||
@@ -530,12 +529,12 @@ namespace Facebook.Yoga
|
||||
Assert.AreEqual(0f, root_child0.LayoutX);
|
||||
Assert.AreEqual(0f, root_child0.LayoutY);
|
||||
Assert.AreEqual(50f, root_child0.LayoutWidth);
|
||||
Assert.AreEqual(100f, root_child0.LayoutHeight);
|
||||
Assert.AreEqual(0f, root_child0.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(50f, root_child1.LayoutX);
|
||||
Assert.AreEqual(0f, root_child1.LayoutY);
|
||||
Assert.AreEqual(50f, root_child1.LayoutWidth);
|
||||
Assert.AreEqual(100f, root_child1.LayoutHeight);
|
||||
Assert.AreEqual(0f, root_child1.LayoutHeight);
|
||||
|
||||
root.StyleDirection = YogaDirection.RTL;
|
||||
root.CalculateLayout();
|
||||
@@ -548,12 +547,12 @@ namespace Facebook.Yoga
|
||||
Assert.AreEqual(100f, root_child0.LayoutX);
|
||||
Assert.AreEqual(0f, root_child0.LayoutY);
|
||||
Assert.AreEqual(50f, root_child0.LayoutWidth);
|
||||
Assert.AreEqual(100f, root_child0.LayoutHeight);
|
||||
Assert.AreEqual(0f, root_child0.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(50f, root_child1.LayoutX);
|
||||
Assert.AreEqual(0f, root_child1.LayoutY);
|
||||
Assert.AreEqual(50f, root_child1.LayoutWidth);
|
||||
Assert.AreEqual(100f, root_child1.LayoutHeight);
|
||||
Assert.AreEqual(0f, root_child1.LayoutHeight);
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
@@ -1,10 +1,9 @@
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
* This source code is licensed under the MIT license found in the LICENSE
|
||||
* file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
// @Generated by gentest/gentest.rb from gentest/fixtures/YGJustifyContentTest.html
|
||||
|
||||
using System;
|
||||
|
@@ -1,10 +1,9 @@
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
* This source code is licensed under the MIT license found in the LICENSE
|
||||
* file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
// @Generated by gentest/gentest.rb from gentest/fixtures/YGMarginTest.html
|
||||
|
||||
using System;
|
||||
|
@@ -1,10 +1,9 @@
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
* This source code is licensed under the MIT license found in the LICENSE
|
||||
* file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
// @Generated by gentest/gentest.rb from gentest/fixtures/YGMinMaxDimensionTest.html
|
||||
|
||||
using System;
|
||||
|
@@ -1,10 +1,9 @@
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
* This source code is licensed under the MIT license found in the LICENSE
|
||||
* file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
// @Generated by gentest/gentest.rb from gentest/fixtures/YGPaddingTest.html
|
||||
|
||||
using System;
|
||||
|
@@ -1,10 +1,9 @@
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
* This source code is licensed under the MIT license found in the LICENSE
|
||||
* file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
// @Generated by gentest/gentest.rb from gentest/fixtures/YGPercentageTest.html
|
||||
|
||||
using System;
|
||||
|
@@ -1,10 +1,9 @@
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
* This source code is licensed under the MIT license found in the LICENSE
|
||||
* file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
// @Generated by gentest/gentest.rb from gentest/fixtures/YGRoundingTest.html
|
||||
|
||||
using System;
|
||||
|
@@ -1,10 +1,9 @@
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
* This source code is licensed under the MIT license found in the LICENSE
|
||||
* file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
// @Generated by gentest/gentest.rb from gentest/fixtures/YGSizeOverflowTest.html
|
||||
|
||||
using System;
|
||||
|
286
enums.py
286
enums.py
@@ -3,107 +3,57 @@
|
||||
# This source code is licensed under the MIT license found in the
|
||||
# LICENSE file in the root directory of this source tree.
|
||||
|
||||
from __future__ import absolute_import
|
||||
from __future__ import division
|
||||
from __future__ import print_function
|
||||
from __future__ import unicode_literals
|
||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||
|
||||
import os
|
||||
|
||||
|
||||
ENUMS = {
|
||||
'Direction': [
|
||||
'Inherit',
|
||||
'LTR',
|
||||
'RTL',
|
||||
"Direction": ["Inherit", "LTR", "RTL"],
|
||||
"Unit": ["Undefined", "Point", "Percent", "Auto"],
|
||||
"FlexDirection": ["Column", "ColumnReverse", "Row", "RowReverse"],
|
||||
"Justify": [
|
||||
"FlexStart",
|
||||
"Center",
|
||||
"FlexEnd",
|
||||
"SpaceBetween",
|
||||
"SpaceAround",
|
||||
"SpaceEvenly",
|
||||
],
|
||||
'Unit': [
|
||||
'Undefined',
|
||||
'Point',
|
||||
'Percent',
|
||||
'Auto',
|
||||
"Overflow": ["Visible", "Hidden", "Scroll"],
|
||||
"Align": [
|
||||
"Auto",
|
||||
"FlexStart",
|
||||
"Center",
|
||||
"FlexEnd",
|
||||
"Stretch",
|
||||
"Baseline",
|
||||
"SpaceBetween",
|
||||
"SpaceAround",
|
||||
],
|
||||
'FlexDirection': [
|
||||
'Column',
|
||||
'ColumnReverse',
|
||||
'Row',
|
||||
'RowReverse',
|
||||
"PositionType": ["Relative", "Absolute"],
|
||||
"Display": ["Flex", "None"],
|
||||
"Wrap": ["NoWrap", "Wrap", "WrapReverse"],
|
||||
"MeasureMode": ["Undefined", "Exactly", "AtMost"],
|
||||
"Dimension": ["Width", "Height"],
|
||||
"Edge": [
|
||||
"Left",
|
||||
"Top",
|
||||
"Right",
|
||||
"Bottom",
|
||||
"Start",
|
||||
"End",
|
||||
"Horizontal",
|
||||
"Vertical",
|
||||
"All",
|
||||
],
|
||||
'Justify': [
|
||||
'FlexStart',
|
||||
'Center',
|
||||
'FlexEnd',
|
||||
'SpaceBetween',
|
||||
'SpaceAround',
|
||||
'SpaceEvenly',
|
||||
],
|
||||
'Overflow': [
|
||||
'Visible',
|
||||
'Hidden',
|
||||
'Scroll',
|
||||
],
|
||||
'Align': [
|
||||
'Auto',
|
||||
'FlexStart',
|
||||
'Center',
|
||||
'FlexEnd',
|
||||
'Stretch',
|
||||
'Baseline',
|
||||
'SpaceBetween',
|
||||
'SpaceAround',
|
||||
],
|
||||
'PositionType': [
|
||||
'Relative',
|
||||
'Absolute',
|
||||
],
|
||||
'Display': [
|
||||
'Flex',
|
||||
'None',
|
||||
],
|
||||
'Wrap': [
|
||||
'NoWrap',
|
||||
'Wrap',
|
||||
'WrapReverse',
|
||||
],
|
||||
'MeasureMode': [
|
||||
'Undefined',
|
||||
'Exactly',
|
||||
'AtMost',
|
||||
],
|
||||
'Dimension': [
|
||||
'Width',
|
||||
'Height',
|
||||
],
|
||||
'Edge': [
|
||||
'Left',
|
||||
'Top',
|
||||
'Right',
|
||||
'Bottom',
|
||||
'Start',
|
||||
'End',
|
||||
'Horizontal',
|
||||
'Vertical',
|
||||
'All',
|
||||
],
|
||||
'NodeType': [
|
||||
'Default',
|
||||
'Text',
|
||||
],
|
||||
'LogLevel': [
|
||||
'Error',
|
||||
'Warn',
|
||||
'Info',
|
||||
'Debug',
|
||||
'Verbose',
|
||||
'Fatal',
|
||||
],
|
||||
'ExperimentalFeature': [
|
||||
"NodeType": ["Default", "Text"],
|
||||
"LogLevel": ["Error", "Warn", "Info", "Debug", "Verbose", "Fatal"],
|
||||
"ExperimentalFeature": [
|
||||
# Mimic web flex-basis behavior.
|
||||
'WebFlexBasis',
|
||||
],
|
||||
'PrintOptions': [
|
||||
('Layout', 1),
|
||||
('Style', 2),
|
||||
('Children', 4),
|
||||
"WebFlexBasis"
|
||||
],
|
||||
"PrintOptions": [("Layout", 1), ("Style", 2), ("Children", 4)],
|
||||
}
|
||||
|
||||
LICENSE = """/**
|
||||
@@ -115,23 +65,25 @@ LICENSE = """/**
|
||||
|
||||
"""
|
||||
|
||||
|
||||
def to_java_upper(symbol):
|
||||
symbol = str(symbol)
|
||||
out = ''
|
||||
out = ""
|
||||
for i in range(0, len(symbol)):
|
||||
c = symbol[i]
|
||||
if str.istitle(c) and i is not 0 and not str.istitle(symbol[i - 1]):
|
||||
out += '_'
|
||||
out += "_"
|
||||
out += c.upper()
|
||||
return out
|
||||
|
||||
|
||||
def to_log_lower(symbol):
|
||||
symbol = str(symbol)
|
||||
out = ''
|
||||
out = ""
|
||||
for i in range(0, len(symbol)):
|
||||
c = symbol[i]
|
||||
if str.istitle(c) and i is not 0 and not str.istitle(symbol[i - 1]):
|
||||
out += '-'
|
||||
out += "-"
|
||||
out += c.lower()
|
||||
return out
|
||||
|
||||
@@ -139,114 +91,128 @@ def to_log_lower(symbol):
|
||||
root = os.path.dirname(os.path.abspath(__file__))
|
||||
|
||||
# write out C & Objective-C headers
|
||||
with open(root + '/yoga/YGEnums.h', 'w') as f:
|
||||
with open(root + "/yoga/YGEnums.h", "w") as f:
|
||||
f.write(LICENSE)
|
||||
f.write('#pragma once\n\n')
|
||||
f.write("#pragma once\n\n")
|
||||
f.write('#include "YGMacros.h"\n\n')
|
||||
f.write('YG_EXTERN_C_BEGIN\n\n')
|
||||
f.write("YG_EXTERN_C_BEGIN\n\n")
|
||||
for name, values in sorted(ENUMS.items()):
|
||||
f.write('#define YG%sCount %s\n' % (name, len(values)))
|
||||
f.write('typedef YG_ENUM_BEGIN(YG%s) {\n' % name)
|
||||
f.write("#define YG%sCount %s\n" % (name, len(values)))
|
||||
f.write("typedef YG_ENUM_BEGIN(YG%s) {\n" % name)
|
||||
for value in values:
|
||||
if isinstance(value, tuple):
|
||||
f.write(' YG%s%s = %d,\n' % (name, value[0], value[1]))
|
||||
f.write(" YG%s%s = %d,\n" % (name, value[0], value[1]))
|
||||
else:
|
||||
f.write(' YG%s%s,\n' % (name, value))
|
||||
f.write('} YG_ENUM_END(YG%s);\n' % name)
|
||||
f.write('WIN_EXPORT const char *YG%sToString(const YG%s value);\n' % (name, name))
|
||||
f.write('\n')
|
||||
f.write('YG_EXTERN_C_END\n')
|
||||
f.write(" YG%s%s,\n" % (name, value))
|
||||
f.write("} YG_ENUM_END(YG%s);\n" % name)
|
||||
f.write(
|
||||
"WIN_EXPORT const char *YG%sToString(const YG%s value);\n" % (name, name)
|
||||
)
|
||||
f.write("\n")
|
||||
f.write("YG_EXTERN_C_END\n")
|
||||
|
||||
# write out C body for printing
|
||||
with open(root + '/yoga/YGEnums.cpp', 'w') as f:
|
||||
with open(root + "/yoga/YGEnums.cpp", "w") as f:
|
||||
f.write(LICENSE)
|
||||
f.write('#include "YGEnums.h"\n\n')
|
||||
for name, values in sorted(ENUMS.items()):
|
||||
f.write('const char *YG%sToString(const YG%s value){\n' % (name, name))
|
||||
f.write(' switch(value){\n')
|
||||
f.write("const char *YG%sToString(const YG%s value){\n" % (name, name))
|
||||
f.write(" switch(value){\n")
|
||||
for value in values:
|
||||
if isinstance(value, tuple):
|
||||
f.write(' case YG%s%s:\n' % (name, value[0]))
|
||||
f.write(" case YG%s%s:\n" % (name, value[0]))
|
||||
f.write(' return "%s";\n' % to_log_lower(value[0]))
|
||||
else:
|
||||
f.write(' case YG%s%s:\n' % (name, value))
|
||||
f.write(" case YG%s%s:\n" % (name, value))
|
||||
f.write(' return "%s";\n' % to_log_lower(value))
|
||||
f.write(' }\n')
|
||||
f.write(" }\n")
|
||||
f.write(' return "unknown";\n')
|
||||
f.write('}\n\n')
|
||||
f.write("}\n\n")
|
||||
|
||||
# write out java files
|
||||
for name, values in sorted(ENUMS.items()):
|
||||
with open(root + '/java/com/facebook/yoga/Yoga%s.java' % name, 'w') as f:
|
||||
f.write(LICENSE.replace('/**', '/*', 1))
|
||||
f.write('package com.facebook.yoga;\n\n')
|
||||
f.write('import com.facebook.proguard.annotations.DoNotStrip;\n\n')
|
||||
f.write('@DoNotStrip\n')
|
||||
f.write('public enum Yoga%s {\n' % name)
|
||||
with open(root + "/java/com/facebook/yoga/Yoga%s.java" % name, "w") as f:
|
||||
f.write(LICENSE.replace("/**", "/*", 1))
|
||||
f.write("package com.facebook.yoga;\n\n")
|
||||
f.write("import com.facebook.proguard.annotations.DoNotStrip;\n\n")
|
||||
f.write("@DoNotStrip\n")
|
||||
f.write("public enum Yoga%s {\n" % name)
|
||||
if len(values) > 0:
|
||||
for value in values:
|
||||
if isinstance(value, tuple):
|
||||
f.write(' %s(%d)' % (to_java_upper(value[0]), value[1]))
|
||||
f.write(" %s(%d)" % (to_java_upper(value[0]), value[1]))
|
||||
else:
|
||||
f.write(' %s(%d)' % (to_java_upper(value), values.index(value)))
|
||||
f.write(" %s(%d)" % (to_java_upper(value), values.index(value)))
|
||||
if values.index(value) is len(values) - 1:
|
||||
f.write(';\n')
|
||||
f.write(";\n")
|
||||
else:
|
||||
f.write(',\n')
|
||||
f.write(",\n")
|
||||
else:
|
||||
f.write('__EMPTY(-1);')
|
||||
f.write('\n')
|
||||
f.write(' private int mIntValue;\n')
|
||||
f.write('\n')
|
||||
f.write(' Yoga%s(int intValue) {\n' % name)
|
||||
f.write(' mIntValue = intValue;\n')
|
||||
f.write(' }\n')
|
||||
f.write('\n')
|
||||
f.write(' public int intValue() {\n')
|
||||
f.write(' return mIntValue;\n')
|
||||
f.write(' }\n')
|
||||
f.write('\n')
|
||||
f.write(' public static Yoga%s fromInt(int value) {\n' % name)
|
||||
f.write(' switch (value) {\n')
|
||||
f.write("__EMPTY(-1);")
|
||||
f.write("\n")
|
||||
f.write(" private int mIntValue;\n")
|
||||
f.write("\n")
|
||||
f.write(" Yoga%s(int intValue) {\n" % name)
|
||||
f.write(" mIntValue = intValue;\n")
|
||||
f.write(" }\n")
|
||||
f.write("\n")
|
||||
f.write(" public int intValue() {\n")
|
||||
f.write(" return mIntValue;\n")
|
||||
f.write(" }\n")
|
||||
f.write("\n")
|
||||
f.write(" public static Yoga%s fromInt(int value) {\n" % name)
|
||||
f.write(" switch (value) {\n")
|
||||
for value in values:
|
||||
if isinstance(value, tuple):
|
||||
f.write(' case %d: return %s;\n' % (value[1], to_java_upper(value[0])))
|
||||
f.write(
|
||||
" case %d: return %s;\n" % (value[1], to_java_upper(value[0]))
|
||||
)
|
||||
else:
|
||||
f.write(' case %d: return %s;\n' % (values.index(value), to_java_upper(value)))
|
||||
f.write(' default: throw new IllegalArgumentException("Unknown enum value: " + value);\n')
|
||||
f.write(' }\n')
|
||||
f.write(' }\n')
|
||||
f.write('}\n')
|
||||
f.write(
|
||||
" case %d: return %s;\n"
|
||||
% (values.index(value), to_java_upper(value))
|
||||
)
|
||||
f.write(
|
||||
' default: throw new IllegalArgumentException("Unknown enum value: " + value);\n'
|
||||
)
|
||||
f.write(" }\n")
|
||||
f.write(" }\n")
|
||||
f.write("}\n")
|
||||
|
||||
# write out csharp files
|
||||
for name, values in sorted(ENUMS.items()):
|
||||
with open(root + '/csharp/Facebook.Yoga/Yoga%s.cs' % name, 'w') as f:
|
||||
with open(root + "/csharp/Facebook.Yoga/Yoga%s.cs" % name, "w") as f:
|
||||
f.write(LICENSE)
|
||||
f.write('namespace Facebook.Yoga\n{\n')
|
||||
f.write("namespace Facebook.Yoga\n{\n")
|
||||
if isinstance(next(iter(values or []), None), tuple):
|
||||
f.write(' [System.Flags]\n')
|
||||
f.write(' public enum Yoga%s\n {\n' % name)
|
||||
f.write(" [System.Flags]\n")
|
||||
f.write(" public enum Yoga%s\n {\n" % name)
|
||||
for value in values:
|
||||
if isinstance(value, tuple):
|
||||
f.write(' %s = %d,\n' % (value[0], value[1]))
|
||||
f.write(" %s = %d,\n" % (value[0], value[1]))
|
||||
else:
|
||||
f.write(' %s,\n' % value)
|
||||
f.write(' }\n')
|
||||
f.write('}\n')
|
||||
f.write(" %s,\n" % value)
|
||||
f.write(" }\n")
|
||||
f.write("}\n")
|
||||
|
||||
# write out javascript file
|
||||
with open(root + '/javascript/sources/YGEnums.js', 'w') as f:
|
||||
with open(root + "/javascript/sources/YGEnums.js", "w") as f:
|
||||
f.write(LICENSE)
|
||||
f.write('module.exports = {\n\n')
|
||||
f.write("module.exports = {\n\n")
|
||||
for name, values in sorted(ENUMS.items()):
|
||||
f.write(' %s_COUNT: %s,\n' % (to_java_upper(name), len(values)))
|
||||
f.write(" %s_COUNT: %s,\n" % (to_java_upper(name), len(values)))
|
||||
base = 0
|
||||
for value in values:
|
||||
if isinstance(value, tuple):
|
||||
f.write(' %s_%s: %d,\n' % (to_java_upper(name), to_java_upper(value[0]), value[1]))
|
||||
f.write(
|
||||
" %s_%s: %d,\n"
|
||||
% (to_java_upper(name), to_java_upper(value[0]), value[1])
|
||||
)
|
||||
base = value[1] + 1
|
||||
else:
|
||||
f.write(' %s_%s: %d,\n' % (to_java_upper(name), to_java_upper(value), base))
|
||||
f.write(
|
||||
" %s_%s: %d,\n" % (to_java_upper(name), to_java_upper(value), base)
|
||||
)
|
||||
base += 1
|
||||
f.write('\n')
|
||||
f.write('};\n')
|
||||
f.write("\n")
|
||||
f.write("};\n")
|
||||
|
@@ -44,10 +44,9 @@ function printTest(e, LTRContainer, RTLContainer, genericContainer) {
|
||||
'/**',
|
||||
' * Copyright (c) Facebook, Inc. and its affiliates.',
|
||||
' *',
|
||||
' * This source code is licensed under the MIT license found in the',
|
||||
' * LICENSE file in the root directory of this source tree.',
|
||||
' * This source code is licensed under the MIT license found in the LICENSE',
|
||||
' * file in the root directory of this source tree.',
|
||||
' */',
|
||||
'',
|
||||
'// @Generated by gentest/gentest.rb from gentest/fixtures/' + document.title + '.html',
|
||||
'',
|
||||
]);
|
||||
@@ -138,7 +137,7 @@ function checkDefaultValues() {
|
||||
{style:'bottom', value:'undefined'},
|
||||
{style:'display', value:'flex'},
|
||||
].forEach(function(item) {
|
||||
assert(item.value === getDefaultStyleValue(item.style),
|
||||
assert(isDefaultStyleValue(item.style, item.value),
|
||||
item.style + ' should be ' + item.value);
|
||||
});
|
||||
}
|
||||
@@ -159,7 +158,7 @@ function setupTestTree(e, parent, node, genericNode, nodeName, parentName, index
|
||||
continue;
|
||||
}
|
||||
|
||||
if (node.style[style] !== getDefaultStyleValue(style)) {
|
||||
if (!isDefaultStyleValue(style, node.style[style])) {
|
||||
switch (style) {
|
||||
case 'direction':
|
||||
e.YGNodeStyleSetDirection(nodeName, directionValue(e, node.style[style]));
|
||||
@@ -400,21 +399,38 @@ function displayValue(e, value){
|
||||
}
|
||||
}
|
||||
|
||||
function getDefaultStyleValue(style) {
|
||||
if (style == 'position') {
|
||||
return 'relative';
|
||||
}
|
||||
var DEFAULT_STYLES = new Map();
|
||||
|
||||
function isDefaultStyleValue(style, value) {
|
||||
let defaultStyle = DEFAULT_STYLES.get(style);
|
||||
if (defaultStyle == null) {
|
||||
switch (style) {
|
||||
case 'position':
|
||||
defaultStyle = new Set(['relative']);;
|
||||
break;
|
||||
|
||||
case 'left':
|
||||
case 'top':
|
||||
case 'right':
|
||||
case 'bottom':
|
||||
case 'start':
|
||||
case 'end':
|
||||
return 'undefined';
|
||||
}
|
||||
defaultStyle = new Set(['undefined']);
|
||||
break;
|
||||
|
||||
case 'min-height':
|
||||
case 'min-width':
|
||||
defaultStyle = new Set(['0', '0px', 'auto']);
|
||||
break;
|
||||
|
||||
default:
|
||||
var node = document.getElementById('default');
|
||||
return getComputedStyle(node, null).getPropertyValue(style);
|
||||
defaultStyle = new Set([getComputedStyle(node, null)[style]]);
|
||||
break;
|
||||
}
|
||||
DEFAULT_STYLES.set(style, defaultStyle);
|
||||
}
|
||||
return DEFAULT_STYLES.get(style).has(value);
|
||||
}
|
||||
|
||||
function getRoundedSize(node) {
|
||||
|
@@ -9,7 +9,7 @@
|
||||
|
||||
org.gradle.jvmargs=-Xmx1536M
|
||||
|
||||
VERSION_NAME=1.11.0
|
||||
VERSION_NAME=1.14.0-SNAPSHOT
|
||||
POM_URL=https://github.com/facebook/yoga
|
||||
POM_SCM_URL=https://github.com/facebook/yoga.git
|
||||
POM_SCM_CONNECTION=scm:git:https://github.com/facebook/yoga.git
|
||||
|
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.2-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-bin.zip
|
||||
|
84
gradlew.bat
vendored
Normal file
84
gradlew.bat
vendored
Normal file
@@ -0,0 +1,84 @@
|
||||
@if "%DEBUG%" == "" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@rem
|
||||
@rem ##########################################################################
|
||||
|
||||
@rem Set local scope for the variables with windows NT shell
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%" == "" set DIRNAME=.
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS=
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if "%ERRORLEVEL%" == "0" goto init
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto init
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:init
|
||||
@rem Get command-line arguments, handling Windows variants
|
||||
|
||||
if not "%OS%" == "Windows_NT" goto win9xME_args
|
||||
|
||||
:win9xME_args
|
||||
@rem Slurp the command line arguments.
|
||||
set CMD_LINE_ARGS=
|
||||
set _SKIP=2
|
||||
|
||||
:win9xME_args_slurp
|
||||
if "x%~1" == "x" goto execute
|
||||
|
||||
set CMD_LINE_ARGS=%*
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||
exit /b 1
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
:omega
|
14
java/BUCK
14
java/BUCK
@@ -3,13 +3,18 @@
|
||||
# This source code is licensed under the MIT license found in the
|
||||
# LICENSE file in the root directory of this source tree.
|
||||
|
||||
load("//tools/build_defs/oss:yoga_defs.bzl", "ANDROID", "CXX_LIBRARY_WHITELIST", "FBJNI_JAVA_TARGET", "FBJNI_TARGET", "INFER_ANNOTATIONS_TARGET", "JNI_TARGET", "JSR_305_TARGET", "JUNIT_TARGET", "PROGRUARD_ANNOTATIONS_TARGET", "SOLOADER_TARGET", "yoga_cxx_library", "yoga_dep", "yoga_java_binary", "yoga_java_library", "yoga_java_test")
|
||||
load("//tools/build_defs/oss:yoga_defs.bzl", "ANDROID", "CXX_LIBRARY_WHITELIST", "FBJNI_JAVA_TARGET", "FBJNI_TARGET", "INFER_ANNOTATIONS_TARGET", "JNI_TARGET", "JSR_305_TARGET", "JUNIT_TARGET", "PROGRUARD_ANNOTATIONS_TARGET", "SOLOADER_TARGET", "yoga_cxx_lib", "yoga_cxx_library", "yoga_dep", "yoga_java_binary", "yoga_java_library", "yoga_java_test")
|
||||
|
||||
CXX_LIBRARY_WHITELIST_FOR_TESTS = CXX_LIBRARY_WHITELIST + [
|
||||
yoga_cxx_lib("testutil:jni"),
|
||||
yoga_cxx_lib("testutil:testutil"),
|
||||
]
|
||||
|
||||
yoga_cxx_library(
|
||||
name = "jni",
|
||||
srcs = glob(["jni/*.cpp"]),
|
||||
headers = glob(["jni/*.h"]),
|
||||
header_namespace = "",
|
||||
header_namespace = "yoga/java",
|
||||
exported_headers = glob(["jni/*.h"]),
|
||||
allow_jni_merging = True,
|
||||
compiler_flags = [
|
||||
"-fno-omit-frame-pointer",
|
||||
@@ -55,11 +60,12 @@ yoga_java_library(
|
||||
yoga_java_test(
|
||||
name = "tests",
|
||||
srcs = glob(["tests/**/*.java"]),
|
||||
cxx_library_whitelist = CXX_LIBRARY_WHITELIST,
|
||||
cxx_library_whitelist = CXX_LIBRARY_WHITELIST_FOR_TESTS,
|
||||
use_cxx_libraries = True,
|
||||
visibility = ["PUBLIC"],
|
||||
deps = [
|
||||
":java",
|
||||
yoga_dep("testutil:java"),
|
||||
JUNIT_TARGET,
|
||||
],
|
||||
)
|
||||
|
@@ -29,7 +29,7 @@ add_compile_options(
|
||||
-Wall
|
||||
-std=c++11)
|
||||
|
||||
add_library(yoga SHARED jni/YGJNI.cpp)
|
||||
add_library(yoga SHARED jni/YGJNI.cpp jni/YGJTypes.cpp)
|
||||
|
||||
target_include_directories(yoga PRIVATE
|
||||
${libfb_DIR}/include
|
||||
|
@@ -35,6 +35,7 @@ android {
|
||||
externalNativeBuild {
|
||||
cmake {
|
||||
path 'CMakeLists.txt'
|
||||
version '3.6.0-rc2'
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -1,9 +1,8 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc.
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the LICENSE
|
||||
* file in the root directory of this source tree.
|
||||
*
|
||||
*/
|
||||
package com.facebook.yoga;
|
||||
|
||||
|
@@ -1,9 +1,8 @@
|
||||
/*
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the LICENSE
|
||||
* file in the root directory of this source tree.
|
||||
*
|
||||
*/
|
||||
package com.facebook.yoga;
|
||||
|
||||
|
@@ -1,82 +1,63 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc.
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the LICENSE
|
||||
* file in the root directory of this source tree.
|
||||
*
|
||||
*/
|
||||
package com.facebook.yoga;
|
||||
|
||||
import com.facebook.proguard.annotations.DoNotStrip;
|
||||
import com.facebook.soloader.SoLoader;
|
||||
|
||||
@DoNotStrip
|
||||
public class YogaConfig {
|
||||
|
||||
public static int SPACING_TYPE = 1;
|
||||
|
||||
static {
|
||||
SoLoader.loadLibrary("yoga");
|
||||
}
|
||||
public static boolean useBatchingForLayoutOutputs = false;
|
||||
|
||||
long mNativePointer;
|
||||
private YogaLogger mLogger;
|
||||
private YogaNodeCloneFunction mYogaNodeCloneFunction;
|
||||
|
||||
private native long jni_YGConfigNew();
|
||||
public YogaConfig() {
|
||||
mNativePointer = jni_YGConfigNew();
|
||||
mNativePointer = YogaNative.jni_YGConfigNew();
|
||||
if (mNativePointer == 0) {
|
||||
throw new IllegalStateException("Failed to allocate native memory");
|
||||
}
|
||||
}
|
||||
|
||||
private native void jni_YGConfigFree(long nativePointer);
|
||||
@Override
|
||||
protected void finalize() throws Throwable {
|
||||
try {
|
||||
jni_YGConfigFree(mNativePointer);
|
||||
YogaNative.jni_YGConfigFree(mNativePointer);
|
||||
} finally {
|
||||
super.finalize();
|
||||
}
|
||||
}
|
||||
|
||||
private native void jni_YGConfigSetExperimentalFeatureEnabled(
|
||||
long nativePointer,
|
||||
int feature,
|
||||
boolean enabled);
|
||||
public void setExperimentalFeatureEnabled(YogaExperimentalFeature feature, boolean enabled) {
|
||||
jni_YGConfigSetExperimentalFeatureEnabled(mNativePointer, feature.intValue(), enabled);
|
||||
YogaNative.jni_YGConfigSetExperimentalFeatureEnabled(mNativePointer, feature.intValue(), enabled);
|
||||
}
|
||||
|
||||
private native void jni_YGConfigSetUseWebDefaults(long nativePointer, boolean useWebDefaults);
|
||||
public void setUseWebDefaults(boolean useWebDefaults) {
|
||||
jni_YGConfigSetUseWebDefaults(mNativePointer, useWebDefaults);
|
||||
YogaNative.jni_YGConfigSetUseWebDefaults(mNativePointer, useWebDefaults);
|
||||
}
|
||||
|
||||
private native void jni_YGConfigSetPrintTreeFlag(long nativePointer, boolean enable);
|
||||
public void setPrintTreeFlag(boolean enable) {
|
||||
jni_YGConfigSetPrintTreeFlag(mNativePointer, enable);
|
||||
YogaNative.jni_YGConfigSetPrintTreeFlag(mNativePointer, enable);
|
||||
}
|
||||
|
||||
private native void jni_YGConfigSetPointScaleFactor(long nativePointer, float pixelsInPoint);
|
||||
public void setPointScaleFactor(float pixelsInPoint) {
|
||||
jni_YGConfigSetPointScaleFactor(mNativePointer, pixelsInPoint);
|
||||
YogaNative.jni_YGConfigSetPointScaleFactor(mNativePointer, pixelsInPoint);
|
||||
}
|
||||
|
||||
private native void jni_YGConfigSetUseLegacyStretchBehaviour(long nativePointer, boolean useLegacyStretchBehaviour);
|
||||
|
||||
/**
|
||||
* Yoga previously had an error where containers would take the maximum space possible instead of the minimum
|
||||
* like they are supposed to. In practice this resulted in implicit behaviour similar to align-self: stretch;
|
||||
* Because this was such a long-standing bug we must allow legacy users to switch back to this behaviour.
|
||||
*/
|
||||
public void setUseLegacyStretchBehaviour(boolean useLegacyStretchBehaviour) {
|
||||
jni_YGConfigSetUseLegacyStretchBehaviour(mNativePointer, useLegacyStretchBehaviour);
|
||||
YogaNative.jni_YGConfigSetUseLegacyStretchBehaviour(mNativePointer, useLegacyStretchBehaviour);
|
||||
}
|
||||
|
||||
private native void jni_YGConfigSetShouldDiffLayoutWithoutLegacyStretchBehaviour(
|
||||
long nativePointer, boolean shouldDiffLayoutWithoutLegacyStretchBehaviour);
|
||||
/**
|
||||
* If this flag is set then yoga would diff the layout without legacy flag and would set a bool in
|
||||
* YogaNode(mDoesLegacyStretchFlagAffectsLayout) with true if the layouts were different and false
|
||||
@@ -84,29 +65,16 @@ public class YogaConfig {
|
||||
*/
|
||||
public void setShouldDiffLayoutWithoutLegacyStretchBehaviour(
|
||||
boolean shouldDiffLayoutWithoutLegacyStretchBehaviour) {
|
||||
jni_YGConfigSetShouldDiffLayoutWithoutLegacyStretchBehaviour(
|
||||
YogaNative.jni_YGConfigSetShouldDiffLayoutWithoutLegacyStretchBehaviour(
|
||||
mNativePointer, shouldDiffLayoutWithoutLegacyStretchBehaviour);
|
||||
}
|
||||
|
||||
private native void jni_YGConfigSetLogger(long nativePointer, Object logger);
|
||||
public void setLogger(YogaLogger logger) {
|
||||
mLogger = logger;
|
||||
jni_YGConfigSetLogger(mNativePointer, logger);
|
||||
YogaNative.jni_YGConfigSetLogger(mNativePointer, logger);
|
||||
}
|
||||
|
||||
public YogaLogger getLogger() {
|
||||
return mLogger;
|
||||
}
|
||||
|
||||
private native void jni_YGConfigSetHasCloneNodeFunc(long nativePointer, boolean hasClonedFunc);
|
||||
|
||||
public void setOnCloneNode(YogaNodeCloneFunction cloneYogaNodeFunction) {
|
||||
mYogaNodeCloneFunction = cloneYogaNodeFunction;
|
||||
jni_YGConfigSetHasCloneNodeFunc(mNativePointer, cloneYogaNodeFunction != null);
|
||||
}
|
||||
|
||||
@DoNotStrip
|
||||
private final YogaNode cloneNode(YogaNode oldNode, YogaNode parent, int childIndex) {
|
||||
return mYogaNodeCloneFunction.cloneNode(oldNode, parent, childIndex);
|
||||
}
|
||||
}
|
||||
|
@@ -1,9 +1,8 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc.
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the LICENSE
|
||||
* file in the root directory of this source tree.
|
||||
*
|
||||
*/
|
||||
package com.facebook.yoga;
|
||||
|
||||
|
@@ -1,9 +1,8 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc.
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the LICENSE
|
||||
* file in the root directory of this source tree.
|
||||
*
|
||||
*/
|
||||
package com.facebook.yoga;
|
||||
|
||||
|
@@ -1,9 +1,8 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc.
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the LICENSE
|
||||
* file in the root directory of this source tree.
|
||||
*
|
||||
*/
|
||||
package com.facebook.yoga;
|
||||
|
||||
|
@@ -1,9 +1,8 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc.
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the LICENSE
|
||||
* file in the root directory of this source tree.
|
||||
*
|
||||
*/
|
||||
package com.facebook.yoga;
|
||||
|
||||
|
@@ -1,9 +1,8 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc.
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the LICENSE
|
||||
* file in the root directory of this source tree.
|
||||
*
|
||||
*/
|
||||
package com.facebook.yoga;
|
||||
|
||||
|
@@ -1,9 +1,8 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc.
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the LICENSE
|
||||
* file in the root directory of this source tree.
|
||||
*
|
||||
*/
|
||||
package com.facebook.yoga;
|
||||
|
||||
|
@@ -1,9 +1,8 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc.
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the LICENSE
|
||||
* file in the root directory of this source tree.
|
||||
*
|
||||
*/
|
||||
package com.facebook.yoga;
|
||||
|
||||
|
@@ -1,9 +1,8 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc.
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the LICENSE
|
||||
* file in the root directory of this source tree.
|
||||
*
|
||||
*/
|
||||
package com.facebook.yoga;
|
||||
|
||||
|
@@ -1,9 +1,8 @@
|
||||
/*
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the LICENSE
|
||||
* file in the root directory of this source tree.
|
||||
*
|
||||
*/
|
||||
package com.facebook.yoga;
|
||||
|
||||
|
@@ -1,9 +1,8 @@
|
||||
/*
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the LICENSE
|
||||
* file in the root directory of this source tree.
|
||||
*
|
||||
*/
|
||||
package com.facebook.yoga;
|
||||
|
||||
|
@@ -1,9 +1,8 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc.
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the LICENSE
|
||||
* file in the root directory of this source tree.
|
||||
*
|
||||
*/
|
||||
package com.facebook.yoga;
|
||||
|
||||
|
@@ -1,9 +1,8 @@
|
||||
/*
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the LICENSE
|
||||
* file in the root directory of this source tree.
|
||||
*
|
||||
*/
|
||||
package com.facebook.yoga;
|
||||
|
||||
|
114
java/com/facebook/yoga/YogaNative.java
Normal file
114
java/com/facebook/yoga/YogaNative.java
Normal file
@@ -0,0 +1,114 @@
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the LICENSE
|
||||
* file in the root directory of this source tree.
|
||||
*/
|
||||
package com.facebook.yoga;
|
||||
|
||||
import com.facebook.proguard.annotations.DoNotStrip;
|
||||
import com.facebook.soloader.SoLoader;
|
||||
|
||||
@DoNotStrip
|
||||
public class YogaNative {
|
||||
static {
|
||||
SoLoader.loadLibrary("yoga");
|
||||
}
|
||||
|
||||
// YGConfig related
|
||||
static native long jni_YGConfigNew();
|
||||
static native void jni_YGConfigFree(long nativePointer);
|
||||
static native void jni_YGConfigSetExperimentalFeatureEnabled(long nativePointer, int feature, boolean enabled);
|
||||
static native void jni_YGConfigSetUseWebDefaults(long nativePointer, boolean useWebDefaults);
|
||||
static native void jni_YGConfigSetPrintTreeFlag(long nativePointer, boolean enable);
|
||||
static native void jni_YGConfigSetPointScaleFactor(long nativePointer, float pixelsInPoint);
|
||||
static native void jni_YGConfigSetUseLegacyStretchBehaviour(long nativePointer, boolean useLegacyStretchBehaviour);
|
||||
static native void jni_YGConfigSetShouldDiffLayoutWithoutLegacyStretchBehaviour(long nativePointer, boolean shouldDiffLayoutWithoutLegacyStretchBehaviour);
|
||||
static native void jni_YGConfigSetLogger(long nativePointer, Object logger);
|
||||
|
||||
|
||||
// YGNode related
|
||||
static native long jni_YGNodeNew(boolean useBatchingForLayoutOutputs);
|
||||
static native long jni_YGNodeNewWithConfig(long configPointer, boolean useBatchingForLayoutOutputs);
|
||||
static native void jni_YGNodeFree(long nativePointer);
|
||||
static native void jni_YGNodeReset(long nativePointer);
|
||||
static native void jni_YGNodeInsertChild(long nativePointer, long childPointer, int index);
|
||||
static native void jni_YGNodeSetIsReferenceBaseline(long nativePointer, boolean isReferenceBaseline);
|
||||
static native boolean jni_YGNodeIsReferenceBaseline(long nativePointer);
|
||||
static native void jni_YGNodeClearChildren(long nativePointer);
|
||||
static native void jni_YGNodeRemoveChild(long nativePointer, long childPointer);
|
||||
static native void jni_YGNodeCalculateLayout(long nativePointer, float width, float height, long[] nativePointers, YogaNodeJNIBase[] nodes);
|
||||
static native void jni_YGNodeMarkDirty(long nativePointer);
|
||||
static native void jni_YGNodeMarkDirtyAndPropogateToDescendants(long nativePointer);
|
||||
static native boolean jni_YGNodeIsDirty(long nativePointer);
|
||||
static native void jni_YGNodeCopyStyle(long dstNativePointer, long srcNativePointer);
|
||||
static native int jni_YGNodeStyleGetDirection(long nativePointer);
|
||||
static native void jni_YGNodeStyleSetDirection(long nativePointer, int direction);
|
||||
static native int jni_YGNodeStyleGetFlexDirection(long nativePointer);
|
||||
static native void jni_YGNodeStyleSetFlexDirection(long nativePointer, int flexDirection);
|
||||
static native int jni_YGNodeStyleGetJustifyContent(long nativePointer);
|
||||
static native void jni_YGNodeStyleSetJustifyContent(long nativePointer, int justifyContent);
|
||||
static native int jni_YGNodeStyleGetAlignItems(long nativePointer);
|
||||
static native void jni_YGNodeStyleSetAlignItems(long nativePointer, int alignItems);
|
||||
static native int jni_YGNodeStyleGetAlignSelf(long nativePointer);
|
||||
static native void jni_YGNodeStyleSetAlignSelf(long nativePointer, int alignSelf);
|
||||
static native int jni_YGNodeStyleGetAlignContent(long nativePointer);
|
||||
static native void jni_YGNodeStyleSetAlignContent(long nativePointer, int alignContent);
|
||||
static native int jni_YGNodeStyleGetPositionType(long nativePointer);
|
||||
static native void jni_YGNodeStyleSetPositionType(long nativePointer, int positionType);
|
||||
static native int jni_YGNodeStyleGetFlexWrap(long nativePointer);
|
||||
static native void jni_YGNodeStyleSetFlexWrap(long nativePointer, int wrapType);
|
||||
static native int jni_YGNodeStyleGetOverflow(long nativePointer);
|
||||
static native void jni_YGNodeStyleSetOverflow(long nativePointer, int overflow);
|
||||
static native int jni_YGNodeStyleGetDisplay(long nativePointer);
|
||||
static native void jni_YGNodeStyleSetDisplay(long nativePointer, int display);
|
||||
static native float jni_YGNodeStyleGetFlex(long nativePointer);
|
||||
static native void jni_YGNodeStyleSetFlex(long nativePointer, float flex);
|
||||
static native float jni_YGNodeStyleGetFlexGrow(long nativePointer);
|
||||
static native void jni_YGNodeStyleSetFlexGrow(long nativePointer, float flexGrow);
|
||||
static native float jni_YGNodeStyleGetFlexShrink(long nativePointer);
|
||||
static native void jni_YGNodeStyleSetFlexShrink(long nativePointer, float flexShrink);
|
||||
static native long jni_YGNodeStyleGetFlexBasis(long nativePointer);
|
||||
static native void jni_YGNodeStyleSetFlexBasis(long nativePointer, float flexBasis);
|
||||
static native void jni_YGNodeStyleSetFlexBasisPercent(long nativePointer, float percent);
|
||||
static native void jni_YGNodeStyleSetFlexBasisAuto(long nativePointer);
|
||||
static native long jni_YGNodeStyleGetMargin(long nativePointer, int edge);
|
||||
static native void jni_YGNodeStyleSetMargin(long nativePointer, int edge, float margin);
|
||||
static native void jni_YGNodeStyleSetMarginPercent(long nativePointer, int edge, float percent);
|
||||
static native void jni_YGNodeStyleSetMarginAuto(long nativePointer, int edge);
|
||||
static native long jni_YGNodeStyleGetPadding(long nativePointer, int edge);
|
||||
static native void jni_YGNodeStyleSetPadding(long nativePointer, int edge, float padding);
|
||||
static native void jni_YGNodeStyleSetPaddingPercent(long nativePointer, int edge, float percent);
|
||||
static native float jni_YGNodeStyleGetBorder(long nativePointer, int edge);
|
||||
static native void jni_YGNodeStyleSetBorder(long nativePointer, int edge, float border);
|
||||
static native long jni_YGNodeStyleGetPosition(long nativePointer, int edge);
|
||||
static native void jni_YGNodeStyleSetPosition(long nativePointer, int edge, float position);
|
||||
static native void jni_YGNodeStyleSetPositionPercent(long nativePointer, int edge, float percent);
|
||||
static native long jni_YGNodeStyleGetWidth(long nativePointer);
|
||||
static native void jni_YGNodeStyleSetWidth(long nativePointer, float width);
|
||||
static native void jni_YGNodeStyleSetWidthPercent(long nativePointer, float percent);
|
||||
static native void jni_YGNodeStyleSetWidthAuto(long nativePointer);
|
||||
static native long jni_YGNodeStyleGetHeight(long nativePointer);
|
||||
static native void jni_YGNodeStyleSetHeight(long nativePointer, float height);
|
||||
static native void jni_YGNodeStyleSetHeightPercent(long nativePointer, float percent);
|
||||
static native void jni_YGNodeStyleSetHeightAuto(long nativePointer);
|
||||
static native long jni_YGNodeStyleGetMinWidth(long nativePointer);
|
||||
static native void jni_YGNodeStyleSetMinWidth(long nativePointer, float minWidth);
|
||||
static native void jni_YGNodeStyleSetMinWidthPercent(long nativePointer, float percent);
|
||||
static native long jni_YGNodeStyleGetMinHeight(long nativePointer);
|
||||
static native void jni_YGNodeStyleSetMinHeight(long nativePointer, float minHeight);
|
||||
static native void jni_YGNodeStyleSetMinHeightPercent(long nativePointer, float percent);
|
||||
static native long jni_YGNodeStyleGetMaxWidth(long nativePointer);
|
||||
static native void jni_YGNodeStyleSetMaxWidth(long nativePointer, float maxWidth);
|
||||
static native void jni_YGNodeStyleSetMaxWidthPercent(long nativePointer, float percent);
|
||||
static native long jni_YGNodeStyleGetMaxHeight(long nativePointer);
|
||||
static native void jni_YGNodeStyleSetMaxHeight(long nativePointer, float maxheight);
|
||||
static native void jni_YGNodeStyleSetMaxHeightPercent(long nativePointer, float percent);
|
||||
static native float jni_YGNodeStyleGetAspectRatio(long nativePointer);
|
||||
static native void jni_YGNodeStyleSetAspectRatio(long nativePointer, float aspectRatio);
|
||||
static native void jni_YGNodeSetHasMeasureFunc(long nativePointer, boolean hasMeasureFunc);
|
||||
static native void jni_YGNodeSetHasBaselineFunc(long nativePointer, boolean hasMeasureFunc);
|
||||
static native void jni_YGNodePrint(long nativePointer);
|
||||
static native void jni_YGNodeSetStyleInputs(long nativePointer, float[] styleInputsArray, int size);
|
||||
static native long jni_YGNodeClone(long nativePointer);
|
||||
}
|
@@ -6,250 +6,30 @@
|
||||
*/
|
||||
package com.facebook.yoga;
|
||||
|
||||
import com.facebook.proguard.annotations.DoNotStrip;
|
||||
import com.facebook.soloader.SoLoader;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
@DoNotStrip
|
||||
public class YogaNode implements Cloneable {
|
||||
|
||||
static {
|
||||
SoLoader.loadLibrary("yoga");
|
||||
public abstract class YogaNode {
|
||||
public static YogaNode create() {
|
||||
return YogaConfig.useBatchingForLayoutOutputs ? new YogaNodeJNIBatching() : new YogaNodeJNI();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get native instance count. Useful for testing only.
|
||||
*/
|
||||
static native int jni_YGNodeGetInstanceCount();
|
||||
|
||||
private YogaNode mOwner;
|
||||
@Nullable private List<YogaNode> mChildren;
|
||||
private YogaMeasureFunction mMeasureFunction;
|
||||
private YogaBaselineFunction mBaselineFunction;
|
||||
private long mNativePointer;
|
||||
private Object mData;
|
||||
|
||||
/* Those flags needs be in sync with YGJNI.cpp */
|
||||
private static final int MARGIN = 1;
|
||||
private static final int PADDING = 2;
|
||||
private static final int BORDER = 4;
|
||||
|
||||
@DoNotStrip
|
||||
private int mEdgeSetFlag = 0;
|
||||
|
||||
private boolean mHasSetPosition = false;
|
||||
|
||||
@DoNotStrip
|
||||
private float mWidth = YogaConstants.UNDEFINED;
|
||||
@DoNotStrip
|
||||
private float mHeight = YogaConstants.UNDEFINED;
|
||||
@DoNotStrip
|
||||
private float mTop = YogaConstants.UNDEFINED;
|
||||
@DoNotStrip
|
||||
private float mLeft = YogaConstants.UNDEFINED;
|
||||
@DoNotStrip
|
||||
private float mMarginLeft = 0;
|
||||
@DoNotStrip
|
||||
private float mMarginTop = 0;
|
||||
@DoNotStrip
|
||||
private float mMarginRight = 0;
|
||||
@DoNotStrip
|
||||
private float mMarginBottom = 0;
|
||||
@DoNotStrip
|
||||
private float mPaddingLeft = 0;
|
||||
@DoNotStrip
|
||||
private float mPaddingTop = 0;
|
||||
@DoNotStrip
|
||||
private float mPaddingRight = 0;
|
||||
@DoNotStrip
|
||||
private float mPaddingBottom = 0;
|
||||
@DoNotStrip
|
||||
private float mBorderLeft = 0;
|
||||
@DoNotStrip
|
||||
private float mBorderTop = 0;
|
||||
@DoNotStrip
|
||||
private float mBorderRight = 0;
|
||||
@DoNotStrip
|
||||
private float mBorderBottom = 0;
|
||||
@DoNotStrip
|
||||
private int mLayoutDirection = 0;
|
||||
@DoNotStrip
|
||||
private boolean mHasNewLayout = true;
|
||||
@DoNotStrip private boolean mDoesLegacyStretchFlagAffectsLayout = false;
|
||||
|
||||
private native long jni_YGNodeNew();
|
||||
public YogaNode() {
|
||||
mNativePointer = jni_YGNodeNew();
|
||||
if (mNativePointer == 0) {
|
||||
throw new IllegalStateException("Failed to allocate native memory");
|
||||
}
|
||||
public static YogaNode create(YogaConfig config) {
|
||||
return YogaConfig.useBatchingForLayoutOutputs ? new YogaNodeJNIBatching(config) : new YogaNodeJNI(config);
|
||||
}
|
||||
|
||||
private native long jni_YGNodeNewWithConfig(long configPointer);
|
||||
public YogaNode(YogaConfig config) {
|
||||
mNativePointer = jni_YGNodeNewWithConfig(config.mNativePointer);
|
||||
if (mNativePointer == 0) {
|
||||
throw new IllegalStateException("Failed to allocate native memory");
|
||||
}
|
||||
}
|
||||
public abstract void reset();
|
||||
|
||||
@Override
|
||||
protected void finalize() throws Throwable {
|
||||
try {
|
||||
freeNatives();
|
||||
} finally {
|
||||
super.finalize();
|
||||
}
|
||||
}
|
||||
public abstract int getChildCount();
|
||||
|
||||
private static native void jni_YGNodeFree(long nativePointer);
|
||||
public abstract YogaNode getChildAt(int i);
|
||||
|
||||
/* frees the native underlying YGNode. Useful for testing. */
|
||||
public void freeNatives() {
|
||||
if (mNativePointer > 0) {
|
||||
long nativePointer = mNativePointer;
|
||||
mNativePointer = 0;
|
||||
jni_YGNodeFree(nativePointer);
|
||||
}
|
||||
}
|
||||
public abstract void addChildAt(YogaNode child, int i);
|
||||
|
||||
private static native void jni_YGNodeReset(long nativePointer);
|
||||
public void reset() {
|
||||
mEdgeSetFlag = 0;
|
||||
mHasSetPosition = false;
|
||||
mHasNewLayout = true;
|
||||
public abstract void setIsReferenceBaseline(boolean isReferenceBaseline);
|
||||
|
||||
mWidth = YogaConstants.UNDEFINED;
|
||||
mHeight = YogaConstants.UNDEFINED;
|
||||
mTop = YogaConstants.UNDEFINED;
|
||||
mLeft = YogaConstants.UNDEFINED;
|
||||
mMarginLeft = 0;
|
||||
mMarginTop = 0;
|
||||
mMarginRight = 0;
|
||||
mMarginBottom = 0;
|
||||
mPaddingLeft = 0;
|
||||
mPaddingTop = 0;
|
||||
mPaddingRight = 0;
|
||||
mPaddingBottom = 0;
|
||||
mBorderLeft = 0;
|
||||
mBorderTop = 0;
|
||||
mBorderRight = 0;
|
||||
mBorderBottom = 0;
|
||||
mLayoutDirection = 0;
|
||||
public abstract boolean isReferenceBaseline();
|
||||
|
||||
mMeasureFunction = null;
|
||||
mBaselineFunction = null;
|
||||
mData = null;
|
||||
mDoesLegacyStretchFlagAffectsLayout = false;
|
||||
|
||||
jni_YGNodeReset(mNativePointer);
|
||||
}
|
||||
|
||||
public int getChildCount() {
|
||||
return mChildren == null ? 0 : mChildren.size();
|
||||
}
|
||||
|
||||
public YogaNode getChildAt(int i) {
|
||||
if (mChildren == null) {
|
||||
throw new IllegalStateException("YogaNode does not have children");
|
||||
}
|
||||
return mChildren.get(i);
|
||||
}
|
||||
|
||||
private static native void jni_YGNodeInsertChild(long nativePointer, long childPointer, int index);
|
||||
|
||||
public void addChildAt(YogaNode child, int i) {
|
||||
if (child.mOwner != null) {
|
||||
throw new IllegalStateException("Child already has a parent, it must be removed first.");
|
||||
}
|
||||
|
||||
if (mChildren == null) {
|
||||
mChildren = new ArrayList<>(4);
|
||||
}
|
||||
mChildren.add(i, child);
|
||||
child.mOwner = this;
|
||||
jni_YGNodeInsertChild(mNativePointer, child.mNativePointer, i);
|
||||
}
|
||||
|
||||
private static native void jni_YGNodeSetIsReferenceBaseline(long nativePointer, boolean isReferenceBaseline);
|
||||
|
||||
public void setIsReferenceBaseline(boolean isReferenceBaseline) {
|
||||
jni_YGNodeSetIsReferenceBaseline(mNativePointer, isReferenceBaseline);
|
||||
}
|
||||
|
||||
private static native boolean jni_YGNodeIsReferenceBaseline(long nativePointer);
|
||||
|
||||
public boolean isReferenceBaseline() {
|
||||
return jni_YGNodeIsReferenceBaseline(mNativePointer);
|
||||
}
|
||||
|
||||
private static native void jni_YGNodeSetOwner(long nativePointer, long newOwnerNativePointer);
|
||||
|
||||
private native long jni_YGNodeClone(long nativePointer, Object newNode);
|
||||
|
||||
@Override
|
||||
public YogaNode clone() {
|
||||
try {
|
||||
YogaNode clonedYogaNode = (YogaNode) super.clone();
|
||||
long clonedNativePointer = jni_YGNodeClone(mNativePointer, clonedYogaNode);
|
||||
|
||||
if (mChildren != null) {
|
||||
for (YogaNode child : mChildren) {
|
||||
YogaNode.jni_YGNodeSetOwner(child.mNativePointer, 0);
|
||||
child.mOwner = null;
|
||||
}
|
||||
}
|
||||
|
||||
clonedYogaNode.mNativePointer = clonedNativePointer;
|
||||
clonedYogaNode.mOwner = null;
|
||||
clonedYogaNode.mChildren =
|
||||
mChildren != null ? (List<YogaNode>) ((ArrayList) mChildren).clone() : null;
|
||||
if (clonedYogaNode.mChildren != null) {
|
||||
for (YogaNode child : clonedYogaNode.mChildren) {
|
||||
child.mOwner = null;
|
||||
}
|
||||
}
|
||||
return clonedYogaNode;
|
||||
} catch (CloneNotSupportedException ex) {
|
||||
// This class implements Cloneable, this should not happen
|
||||
throw new RuntimeException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
public YogaNode cloneWithNewChildren() {
|
||||
try {
|
||||
YogaNode clonedYogaNode = (YogaNode) super.clone();
|
||||
long clonedNativePointer = jni_YGNodeClone(mNativePointer, clonedYogaNode);
|
||||
clonedYogaNode.mOwner = null;
|
||||
clonedYogaNode.mNativePointer = clonedNativePointer;
|
||||
clonedYogaNode.clearChildren();
|
||||
return clonedYogaNode;
|
||||
} catch (CloneNotSupportedException ex) {
|
||||
// This class implements Cloneable, this should not happen
|
||||
throw new RuntimeException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
private static native void jni_YGNodeClearChildren(long nativePointer);
|
||||
|
||||
private void clearChildren() {
|
||||
mChildren = null;
|
||||
jni_YGNodeClearChildren(mNativePointer);
|
||||
}
|
||||
|
||||
private static native void jni_YGNodeRemoveChild(long nativePointer, long childPointer);
|
||||
public YogaNode removeChildAt(int i) {
|
||||
if (mChildren == null) {
|
||||
throw new IllegalStateException(
|
||||
"Trying to remove a child of a YogaNode that does not have children");
|
||||
}
|
||||
final YogaNode child = mChildren.remove(i);
|
||||
child.mOwner = null;
|
||||
jni_YGNodeRemoveChild(mNativePointer, child.mNativePointer);
|
||||
return child;
|
||||
}
|
||||
public abstract YogaNode removeChildAt(int i);
|
||||
|
||||
/**
|
||||
* @returns the {@link YogaNode} that owns this {@link YogaNode}.
|
||||
@@ -260,539 +40,187 @@ public class YogaNode implements Cloneable {
|
||||
* {@link YogaNode} is shared between two or more YogaTrees.
|
||||
*/
|
||||
@Nullable
|
||||
public YogaNode getOwner() {
|
||||
return mOwner;
|
||||
}
|
||||
public abstract YogaNode getOwner();
|
||||
|
||||
/** @deprecated Use #getOwner() instead. This will be removed in the next version. */
|
||||
@Deprecated
|
||||
@Nullable
|
||||
public YogaNode getParent() {
|
||||
return getOwner();
|
||||
}
|
||||
|
||||
public int indexOf(YogaNode child) {
|
||||
return mChildren == null ? -1 : mChildren.indexOf(child);
|
||||
}
|
||||
|
||||
private static native void jni_YGNodeCalculateLayout(long nativePointer, float width, float height);
|
||||
public void calculateLayout(float width, float height) {
|
||||
jni_YGNodeCalculateLayout(mNativePointer, width, height);
|
||||
}
|
||||
|
||||
public boolean hasNewLayout() {
|
||||
return mHasNewLayout;
|
||||
}
|
||||
|
||||
private static native void jni_YGNodeMarkDirty(long nativePointer);
|
||||
public void dirty() {
|
||||
jni_YGNodeMarkDirty(mNativePointer);
|
||||
}
|
||||
|
||||
private static native void jni_YGNodeMarkDirtyAndPropogateToDescendants(long nativePointer);
|
||||
|
||||
public void dirtyAllDescendants() {
|
||||
jni_YGNodeMarkDirtyAndPropogateToDescendants(mNativePointer);
|
||||
}
|
||||
|
||||
private static native boolean jni_YGNodeIsDirty(long nativePointer);
|
||||
public boolean isDirty() {
|
||||
return jni_YGNodeIsDirty(mNativePointer);
|
||||
}
|
||||
|
||||
private static native void jni_YGNodeCopyStyle(long dstNativePointer, long srcNativePointer);
|
||||
public void copyStyle(YogaNode srcNode) {
|
||||
jni_YGNodeCopyStyle(mNativePointer, srcNode.mNativePointer);
|
||||
}
|
||||
|
||||
public void markLayoutSeen() {
|
||||
mHasNewLayout = false;
|
||||
}
|
||||
|
||||
private static native int jni_YGNodeStyleGetDirection(long nativePointer);
|
||||
public YogaDirection getStyleDirection() {
|
||||
return YogaDirection.fromInt(jni_YGNodeStyleGetDirection(mNativePointer));
|
||||
}
|
||||
|
||||
private static native void jni_YGNodeStyleSetDirection(long nativePointer, int direction);
|
||||
public void setDirection(YogaDirection direction) {
|
||||
jni_YGNodeStyleSetDirection(mNativePointer, direction.intValue());
|
||||
}
|
||||
|
||||
private static native int jni_YGNodeStyleGetFlexDirection(long nativePointer);
|
||||
public YogaFlexDirection getFlexDirection() {
|
||||
return YogaFlexDirection.fromInt(jni_YGNodeStyleGetFlexDirection(mNativePointer));
|
||||
}
|
||||
|
||||
private static native void jni_YGNodeStyleSetFlexDirection(long nativePointer, int flexDirection);
|
||||
public void setFlexDirection(YogaFlexDirection flexDirection) {
|
||||
jni_YGNodeStyleSetFlexDirection(mNativePointer, flexDirection.intValue());
|
||||
}
|
||||
|
||||
private static native int jni_YGNodeStyleGetJustifyContent(long nativePointer);
|
||||
public YogaJustify getJustifyContent() {
|
||||
return YogaJustify.fromInt(jni_YGNodeStyleGetJustifyContent(mNativePointer));
|
||||
}
|
||||
|
||||
private static native void jni_YGNodeStyleSetJustifyContent(long nativePointer, int justifyContent);
|
||||
public void setJustifyContent(YogaJustify justifyContent) {
|
||||
jni_YGNodeStyleSetJustifyContent(mNativePointer, justifyContent.intValue());
|
||||
}
|
||||
|
||||
private static native int jni_YGNodeStyleGetAlignItems(long nativePointer);
|
||||
public YogaAlign getAlignItems() {
|
||||
return YogaAlign.fromInt(jni_YGNodeStyleGetAlignItems(mNativePointer));
|
||||
}
|
||||
|
||||
private static native void jni_YGNodeStyleSetAlignItems(long nativePointer, int alignItems);
|
||||
public void setAlignItems(YogaAlign alignItems) {
|
||||
jni_YGNodeStyleSetAlignItems(mNativePointer, alignItems.intValue());
|
||||
}
|
||||
|
||||
private static native int jni_YGNodeStyleGetAlignSelf(long nativePointer);
|
||||
public YogaAlign getAlignSelf() {
|
||||
return YogaAlign.fromInt(jni_YGNodeStyleGetAlignSelf(mNativePointer));
|
||||
}
|
||||
|
||||
private static native void jni_YGNodeStyleSetAlignSelf(long nativePointer, int alignSelf);
|
||||
public void setAlignSelf(YogaAlign alignSelf) {
|
||||
jni_YGNodeStyleSetAlignSelf(mNativePointer, alignSelf.intValue());
|
||||
}
|
||||
|
||||
private static native int jni_YGNodeStyleGetAlignContent(long nativePointer);
|
||||
public YogaAlign getAlignContent() {
|
||||
return YogaAlign.fromInt(jni_YGNodeStyleGetAlignContent(mNativePointer));
|
||||
}
|
||||
|
||||
private static native void jni_YGNodeStyleSetAlignContent(long nativePointer, int alignContent);
|
||||
public void setAlignContent(YogaAlign alignContent) {
|
||||
jni_YGNodeStyleSetAlignContent(mNativePointer, alignContent.intValue());
|
||||
}
|
||||
|
||||
private static native int jni_YGNodeStyleGetPositionType(long nativePointer);
|
||||
public YogaPositionType getPositionType() {
|
||||
return YogaPositionType.fromInt(jni_YGNodeStyleGetPositionType(mNativePointer));
|
||||
}
|
||||
|
||||
private static native void jni_YGNodeStyleSetPositionType(long nativePointer, int positionType);
|
||||
public void setPositionType(YogaPositionType positionType) {
|
||||
jni_YGNodeStyleSetPositionType(mNativePointer, positionType.intValue());
|
||||
}
|
||||
|
||||
private static native void jni_YGNodeStyleSetFlexWrap(long nativePointer, int wrapType);
|
||||
public void setWrap(YogaWrap flexWrap) {
|
||||
jni_YGNodeStyleSetFlexWrap(mNativePointer, flexWrap.intValue());
|
||||
}
|
||||
|
||||
private static native int jni_YGNodeStyleGetOverflow(long nativePointer);
|
||||
public YogaOverflow getOverflow() {
|
||||
return YogaOverflow.fromInt(jni_YGNodeStyleGetOverflow(mNativePointer));
|
||||
}
|
||||
|
||||
private static native void jni_YGNodeStyleSetOverflow(long nativePointer, int overflow);
|
||||
public void setOverflow(YogaOverflow overflow) {
|
||||
jni_YGNodeStyleSetOverflow(mNativePointer, overflow.intValue());
|
||||
}
|
||||
|
||||
private static native int jni_YGNodeStyleGetDisplay(long nativePointer);
|
||||
public YogaDisplay getDisplay() {
|
||||
return YogaDisplay.fromInt(jni_YGNodeStyleGetDisplay(mNativePointer));
|
||||
}
|
||||
|
||||
private static native void jni_YGNodeStyleSetDisplay(long nativePointer, int display);
|
||||
public void setDisplay(YogaDisplay display) {
|
||||
jni_YGNodeStyleSetDisplay(mNativePointer, display.intValue());
|
||||
}
|
||||
|
||||
private static native void jni_YGNodeStyleSetFlex(long nativePointer, float flex);
|
||||
public void setFlex(float flex) {
|
||||
jni_YGNodeStyleSetFlex(mNativePointer, flex);
|
||||
}
|
||||
|
||||
private static native float jni_YGNodeStyleGetFlexGrow(long nativePointer);
|
||||
public float getFlexGrow() {
|
||||
return jni_YGNodeStyleGetFlexGrow(mNativePointer);
|
||||
}
|
||||
|
||||
private static native void jni_YGNodeStyleSetFlexGrow(long nativePointer, float flexGrow);
|
||||
public void setFlexGrow(float flexGrow) {
|
||||
jni_YGNodeStyleSetFlexGrow(mNativePointer, flexGrow);
|
||||
}
|
||||
|
||||
private static native float jni_YGNodeStyleGetFlexShrink(long nativePointer);
|
||||
public float getFlexShrink() {
|
||||
return jni_YGNodeStyleGetFlexShrink(mNativePointer);
|
||||
}
|
||||
|
||||
private static native void jni_YGNodeStyleSetFlexShrink(long nativePointer, float flexShrink);
|
||||
public void setFlexShrink(float flexShrink) {
|
||||
jni_YGNodeStyleSetFlexShrink(mNativePointer, flexShrink);
|
||||
}
|
||||
|
||||
private static native Object jni_YGNodeStyleGetFlexBasis(long nativePointer);
|
||||
public YogaValue getFlexBasis() {
|
||||
return (YogaValue) jni_YGNodeStyleGetFlexBasis(mNativePointer);
|
||||
}
|
||||
|
||||
private static native void jni_YGNodeStyleSetFlexBasis(long nativePointer, float flexBasis);
|
||||
public void setFlexBasis(float flexBasis) {
|
||||
jni_YGNodeStyleSetFlexBasis(mNativePointer, flexBasis);
|
||||
}
|
||||
|
||||
private static native void jni_YGNodeStyleSetFlexBasisPercent(long nativePointer, float percent);
|
||||
public void setFlexBasisPercent(float percent) {
|
||||
jni_YGNodeStyleSetFlexBasisPercent(mNativePointer, percent);
|
||||
}
|
||||
|
||||
private static native void jni_YGNodeStyleSetFlexBasisAuto(long nativePointer);
|
||||
public void setFlexBasisAuto() {
|
||||
jni_YGNodeStyleSetFlexBasisAuto(mNativePointer);
|
||||
}
|
||||
|
||||
private static native Object jni_YGNodeStyleGetMargin(long nativePointer, int edge);
|
||||
public YogaValue getMargin(YogaEdge edge) {
|
||||
if (!((mEdgeSetFlag & MARGIN) == MARGIN)) {
|
||||
return YogaValue.UNDEFINED;
|
||||
}
|
||||
return (YogaValue) jni_YGNodeStyleGetMargin(mNativePointer, edge.intValue());
|
||||
}
|
||||
|
||||
private static native void jni_YGNodeStyleSetMargin(long nativePointer, int edge, float margin);
|
||||
public void setMargin(YogaEdge edge, float margin) {
|
||||
mEdgeSetFlag |= MARGIN;
|
||||
jni_YGNodeStyleSetMargin(mNativePointer, edge.intValue(), margin);
|
||||
}
|
||||
|
||||
private static native void jni_YGNodeStyleSetMarginPercent(long nativePointer, int edge, float percent);
|
||||
public void setMarginPercent(YogaEdge edge, float percent) {
|
||||
mEdgeSetFlag |= MARGIN;
|
||||
jni_YGNodeStyleSetMarginPercent(mNativePointer, edge.intValue(), percent);
|
||||
}
|
||||
|
||||
private static native void jni_YGNodeStyleSetMarginAuto(long nativePointer, int edge);
|
||||
public void setMarginAuto(YogaEdge edge) {
|
||||
mEdgeSetFlag |= MARGIN;
|
||||
jni_YGNodeStyleSetMarginAuto(mNativePointer, edge.intValue());
|
||||
}
|
||||
|
||||
private static native Object jni_YGNodeStyleGetPadding(long nativePointer, int edge);
|
||||
public YogaValue getPadding(YogaEdge edge) {
|
||||
if (!((mEdgeSetFlag & PADDING) == PADDING)) {
|
||||
return YogaValue.UNDEFINED;
|
||||
}
|
||||
return (YogaValue) jni_YGNodeStyleGetPadding(mNativePointer, edge.intValue());
|
||||
}
|
||||
|
||||
private static native void jni_YGNodeStyleSetPadding(long nativePointer, int edge, float padding);
|
||||
public void setPadding(YogaEdge edge, float padding) {
|
||||
mEdgeSetFlag |= PADDING;
|
||||
jni_YGNodeStyleSetPadding(mNativePointer, edge.intValue(), padding);
|
||||
}
|
||||
|
||||
private static native void jni_YGNodeStyleSetPaddingPercent(long nativePointer, int edge, float percent);
|
||||
public void setPaddingPercent(YogaEdge edge, float percent) {
|
||||
mEdgeSetFlag |= PADDING;
|
||||
jni_YGNodeStyleSetPaddingPercent(mNativePointer, edge.intValue(), percent);
|
||||
}
|
||||
|
||||
private static native float jni_YGNodeStyleGetBorder(long nativePointer, int edge);
|
||||
public float getBorder(YogaEdge edge) {
|
||||
if (!((mEdgeSetFlag & BORDER) == BORDER)) {
|
||||
return YogaConstants.UNDEFINED;
|
||||
}
|
||||
return jni_YGNodeStyleGetBorder(mNativePointer, edge.intValue());
|
||||
}
|
||||
|
||||
private static native void jni_YGNodeStyleSetBorder(long nativePointer, int edge, float border);
|
||||
public void setBorder(YogaEdge edge, float border) {
|
||||
mEdgeSetFlag |= BORDER;
|
||||
jni_YGNodeStyleSetBorder(mNativePointer, edge.intValue(), border);
|
||||
}
|
||||
|
||||
private static native Object jni_YGNodeStyleGetPosition(long nativePointer, int edge);
|
||||
public YogaValue getPosition(YogaEdge edge) {
|
||||
if (!mHasSetPosition) {
|
||||
return YogaValue.UNDEFINED;
|
||||
}
|
||||
return (YogaValue) jni_YGNodeStyleGetPosition(mNativePointer, edge.intValue());
|
||||
}
|
||||
|
||||
private static native void jni_YGNodeStyleSetPosition(long nativePointer, int edge, float position);
|
||||
public void setPosition(YogaEdge edge, float position) {
|
||||
mHasSetPosition = true;
|
||||
jni_YGNodeStyleSetPosition(mNativePointer, edge.intValue(), position);
|
||||
}
|
||||
|
||||
private static native void jni_YGNodeStyleSetPositionPercent(long nativePointer, int edge, float percent);
|
||||
public void setPositionPercent(YogaEdge edge, float percent) {
|
||||
mHasSetPosition = true;
|
||||
jni_YGNodeStyleSetPositionPercent(mNativePointer, edge.intValue(), percent);
|
||||
}
|
||||
|
||||
private static native Object jni_YGNodeStyleGetWidth(long nativePointer);
|
||||
public YogaValue getWidth() {
|
||||
return (YogaValue) jni_YGNodeStyleGetWidth(mNativePointer);
|
||||
}
|
||||
|
||||
private static native void jni_YGNodeStyleSetWidth(long nativePointer, float width);
|
||||
public void setWidth(float width) {
|
||||
jni_YGNodeStyleSetWidth(mNativePointer, width);
|
||||
}
|
||||
|
||||
private static native void jni_YGNodeStyleSetWidthPercent(long nativePointer, float percent);
|
||||
public void setWidthPercent(float percent) {
|
||||
jni_YGNodeStyleSetWidthPercent(mNativePointer, percent);
|
||||
}
|
||||
|
||||
private static native void jni_YGNodeStyleSetWidthAuto(long nativePointer);
|
||||
public void setWidthAuto() {
|
||||
jni_YGNodeStyleSetWidthAuto(mNativePointer);
|
||||
}
|
||||
|
||||
private static native Object jni_YGNodeStyleGetHeight(long nativePointer);
|
||||
public YogaValue getHeight() {
|
||||
return (YogaValue) jni_YGNodeStyleGetHeight(mNativePointer);
|
||||
}
|
||||
|
||||
private static native void jni_YGNodeStyleSetHeight(long nativePointer, float height);
|
||||
public void setHeight(float height) {
|
||||
jni_YGNodeStyleSetHeight(mNativePointer, height);
|
||||
}
|
||||
|
||||
private static native void jni_YGNodeStyleSetHeightPercent(long nativePointer, float percent);
|
||||
public void setHeightPercent(float percent) {
|
||||
jni_YGNodeStyleSetHeightPercent(mNativePointer, percent);
|
||||
}
|
||||
|
||||
private static native void jni_YGNodeStyleSetHeightAuto(long nativePointer);
|
||||
public void setHeightAuto() {
|
||||
jni_YGNodeStyleSetHeightAuto(mNativePointer);
|
||||
}
|
||||
|
||||
private static native Object jni_YGNodeStyleGetMinWidth(long nativePointer);
|
||||
public YogaValue getMinWidth() {
|
||||
return (YogaValue) jni_YGNodeStyleGetMinWidth(mNativePointer);
|
||||
}
|
||||
|
||||
private static native void jni_YGNodeStyleSetMinWidth(long nativePointer, float minWidth);
|
||||
public void setMinWidth(float minWidth) {
|
||||
jni_YGNodeStyleSetMinWidth(mNativePointer, minWidth);
|
||||
}
|
||||
|
||||
private static native void jni_YGNodeStyleSetMinWidthPercent(long nativePointer, float percent);
|
||||
public void setMinWidthPercent(float percent) {
|
||||
jni_YGNodeStyleSetMinWidthPercent(mNativePointer, percent);
|
||||
}
|
||||
|
||||
private static native Object jni_YGNodeStyleGetMinHeight(long nativePointer);
|
||||
public YogaValue getMinHeight() {
|
||||
return (YogaValue) jni_YGNodeStyleGetMinHeight(mNativePointer);
|
||||
}
|
||||
|
||||
private static native void jni_YGNodeStyleSetMinHeight(long nativePointer, float minHeight);
|
||||
public void setMinHeight(float minHeight) {
|
||||
jni_YGNodeStyleSetMinHeight(mNativePointer, minHeight);
|
||||
}
|
||||
|
||||
private static native void jni_YGNodeStyleSetMinHeightPercent(long nativePointer, float percent);
|
||||
public void setMinHeightPercent(float percent) {
|
||||
jni_YGNodeStyleSetMinHeightPercent(mNativePointer, percent);
|
||||
}
|
||||
|
||||
private static native Object jni_YGNodeStyleGetMaxWidth(long nativePointer);
|
||||
public YogaValue getMaxWidth() {
|
||||
return (YogaValue) jni_YGNodeStyleGetMaxWidth(mNativePointer);
|
||||
}
|
||||
|
||||
private static native void jni_YGNodeStyleSetMaxWidth(long nativePointer, float maxWidth);
|
||||
public void setMaxWidth(float maxWidth) {
|
||||
jni_YGNodeStyleSetMaxWidth(mNativePointer, maxWidth);
|
||||
}
|
||||
|
||||
private static native void jni_YGNodeStyleSetMaxWidthPercent(long nativePointer, float percent);
|
||||
public void setMaxWidthPercent(float percent) {
|
||||
jni_YGNodeStyleSetMaxWidthPercent(mNativePointer, percent);
|
||||
}
|
||||
|
||||
private static native Object jni_YGNodeStyleGetMaxHeight(long nativePointer);
|
||||
public YogaValue getMaxHeight() {
|
||||
return (YogaValue) jni_YGNodeStyleGetMaxHeight(mNativePointer);
|
||||
}
|
||||
|
||||
private static native void jni_YGNodeStyleSetMaxHeight(long nativePointer, float maxheight);
|
||||
public void setMaxHeight(float maxheight) {
|
||||
jni_YGNodeStyleSetMaxHeight(mNativePointer, maxheight);
|
||||
}
|
||||
|
||||
private static native void jni_YGNodeStyleSetMaxHeightPercent(long nativePointer, float percent);
|
||||
public void setMaxHeightPercent(float percent) {
|
||||
jni_YGNodeStyleSetMaxHeightPercent(mNativePointer, percent);
|
||||
}
|
||||
|
||||
private static native float jni_YGNodeStyleGetAspectRatio(long nativePointer);
|
||||
public float getAspectRatio() {
|
||||
return jni_YGNodeStyleGetAspectRatio(mNativePointer);
|
||||
}
|
||||
|
||||
private static native void jni_YGNodeStyleSetAspectRatio(long nativePointer, float aspectRatio);
|
||||
public void setAspectRatio(float aspectRatio) {
|
||||
jni_YGNodeStyleSetAspectRatio(mNativePointer, aspectRatio);
|
||||
}
|
||||
|
||||
public float getLayoutX() {
|
||||
return mLeft;
|
||||
}
|
||||
|
||||
public float getLayoutY() {
|
||||
return mTop;
|
||||
}
|
||||
|
||||
public float getLayoutWidth() {
|
||||
return mWidth;
|
||||
}
|
||||
|
||||
public float getLayoutHeight() {
|
||||
return mHeight;
|
||||
}
|
||||
|
||||
public boolean getDoesLegacyStretchFlagAffectsLayout() {
|
||||
return mDoesLegacyStretchFlagAffectsLayout;
|
||||
}
|
||||
|
||||
public float getLayoutMargin(YogaEdge edge) {
|
||||
switch (edge) {
|
||||
case LEFT:
|
||||
return mMarginLeft;
|
||||
case TOP:
|
||||
return mMarginTop;
|
||||
case RIGHT:
|
||||
return mMarginRight;
|
||||
case BOTTOM:
|
||||
return mMarginBottom;
|
||||
case START:
|
||||
return getLayoutDirection() == YogaDirection.RTL ? mMarginRight : mMarginLeft;
|
||||
case END:
|
||||
return getLayoutDirection() == YogaDirection.RTL ? mMarginLeft : mMarginRight;
|
||||
default:
|
||||
throw new IllegalArgumentException("Cannot get layout margins of multi-edge shorthands");
|
||||
}
|
||||
}
|
||||
|
||||
public float getLayoutPadding(YogaEdge edge) {
|
||||
switch (edge) {
|
||||
case LEFT:
|
||||
return mPaddingLeft;
|
||||
case TOP:
|
||||
return mPaddingTop;
|
||||
case RIGHT:
|
||||
return mPaddingRight;
|
||||
case BOTTOM:
|
||||
return mPaddingBottom;
|
||||
case START:
|
||||
return getLayoutDirection() == YogaDirection.RTL ? mPaddingRight : mPaddingLeft;
|
||||
case END:
|
||||
return getLayoutDirection() == YogaDirection.RTL ? mPaddingLeft : mPaddingRight;
|
||||
default:
|
||||
throw new IllegalArgumentException("Cannot get layout paddings of multi-edge shorthands");
|
||||
}
|
||||
}
|
||||
|
||||
public float getLayoutBorder(YogaEdge edge) {
|
||||
switch (edge) {
|
||||
case LEFT:
|
||||
return mBorderLeft;
|
||||
case TOP:
|
||||
return mBorderTop;
|
||||
case RIGHT:
|
||||
return mBorderRight;
|
||||
case BOTTOM:
|
||||
return mBorderBottom;
|
||||
case START:
|
||||
return getLayoutDirection() == YogaDirection.RTL ? mBorderRight : mBorderLeft;
|
||||
case END:
|
||||
return getLayoutDirection() == YogaDirection.RTL ? mBorderLeft : mBorderRight;
|
||||
default:
|
||||
throw new IllegalArgumentException("Cannot get layout border of multi-edge shorthands");
|
||||
}
|
||||
}
|
||||
|
||||
public YogaDirection getLayoutDirection() {
|
||||
return YogaDirection.fromInt(mLayoutDirection);
|
||||
}
|
||||
|
||||
private static native void jni_YGNodeSetHasMeasureFunc(long nativePointer, boolean hasMeasureFunc);
|
||||
public void setMeasureFunction(YogaMeasureFunction measureFunction) {
|
||||
mMeasureFunction = measureFunction;
|
||||
jni_YGNodeSetHasMeasureFunc(mNativePointer, measureFunction != null);
|
||||
}
|
||||
|
||||
// Implementation Note: Why this method needs to stay final
|
||||
//
|
||||
// We cache the jmethodid for this method in Yoga code. This means that even if a subclass
|
||||
// were to override measure, we'd still call this implementation from layout code since the
|
||||
// overriding method will have a different jmethodid. This is final to prevent that mistake.
|
||||
@DoNotStrip
|
||||
public final long measure(float width, int widthMode, float height, int heightMode) {
|
||||
if (!isMeasureDefined()) {
|
||||
throw new RuntimeException("Measure function isn't defined!");
|
||||
}
|
||||
|
||||
return mMeasureFunction.measure(
|
||||
this,
|
||||
width,
|
||||
YogaMeasureMode.fromInt(widthMode),
|
||||
height,
|
||||
YogaMeasureMode.fromInt(heightMode));
|
||||
}
|
||||
|
||||
private static native void jni_YGNodeSetHasBaselineFunc(long nativePointer, boolean hasMeasureFunc);
|
||||
public void setBaselineFunction(YogaBaselineFunction baselineFunction) {
|
||||
mBaselineFunction = baselineFunction;
|
||||
jni_YGNodeSetHasBaselineFunc(mNativePointer, baselineFunction != null);
|
||||
}
|
||||
|
||||
@DoNotStrip
|
||||
public final float baseline(float width, float height) {
|
||||
return mBaselineFunction.baseline(this, width, height);
|
||||
}
|
||||
|
||||
public boolean isMeasureDefined() {
|
||||
return mMeasureFunction != null;
|
||||
}
|
||||
|
||||
public void setData(Object data) {
|
||||
mData = data;
|
||||
}
|
||||
|
||||
public Object getData() {
|
||||
return mData;
|
||||
}
|
||||
|
||||
private static native void jni_YGNodePrint(long nativePointer);
|
||||
|
||||
/**
|
||||
* Use the set logger (defaults to adb log) to print out the styles, children, and computed
|
||||
* layout of the tree rooted at this node.
|
||||
*/
|
||||
public void print() {
|
||||
jni_YGNodePrint(mNativePointer);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method replaces the child at childIndex position with the newNode received by parameter.
|
||||
* This is different than calling removeChildAt and addChildAt because this method ONLY replaces
|
||||
* the child in the mChildren datastructure. @DoNotStrip: called from JNI
|
||||
*
|
||||
* @return the nativePointer of the newNode {@linl YogaNode}
|
||||
*/
|
||||
@DoNotStrip
|
||||
private final long replaceChild(YogaNode newNode, int childIndex) {
|
||||
if (mChildren == null) {
|
||||
throw new IllegalStateException("Cannot replace child. YogaNode does not have children");
|
||||
}
|
||||
mChildren.remove(childIndex);
|
||||
mChildren.add(childIndex, newNode);
|
||||
newNode.mOwner = this;
|
||||
return newNode.mNativePointer;
|
||||
}
|
||||
public abstract YogaNode getParent();
|
||||
|
||||
public abstract int indexOf(YogaNode child);
|
||||
|
||||
public abstract void calculateLayout(float width, float height);
|
||||
|
||||
public abstract boolean hasNewLayout();
|
||||
|
||||
public abstract void dirty();
|
||||
|
||||
public abstract boolean isDirty();
|
||||
|
||||
public abstract void copyStyle(YogaNode srcNode);
|
||||
|
||||
public abstract void markLayoutSeen();
|
||||
|
||||
public abstract YogaDirection getStyleDirection();
|
||||
|
||||
public abstract void setDirection(YogaDirection direction);
|
||||
|
||||
public abstract YogaFlexDirection getFlexDirection();
|
||||
|
||||
public abstract void setFlexDirection(YogaFlexDirection flexDirection);
|
||||
|
||||
public abstract YogaJustify getJustifyContent();
|
||||
|
||||
public abstract void setJustifyContent(YogaJustify justifyContent);
|
||||
|
||||
public abstract YogaAlign getAlignItems();
|
||||
|
||||
public abstract void setAlignItems(YogaAlign alignItems);
|
||||
|
||||
public abstract YogaAlign getAlignSelf();
|
||||
|
||||
public abstract void setAlignSelf(YogaAlign alignSelf);
|
||||
|
||||
public abstract YogaAlign getAlignContent();
|
||||
|
||||
public abstract void setAlignContent(YogaAlign alignContent);
|
||||
|
||||
public abstract YogaPositionType getPositionType();
|
||||
|
||||
public abstract void setPositionType(YogaPositionType positionType);
|
||||
|
||||
public abstract YogaWrap getWrap();
|
||||
|
||||
public abstract void setWrap(YogaWrap flexWrap);
|
||||
|
||||
public abstract YogaOverflow getOverflow();
|
||||
|
||||
public abstract void setOverflow(YogaOverflow overflow);
|
||||
|
||||
public abstract YogaDisplay getDisplay();
|
||||
|
||||
public abstract void setDisplay(YogaDisplay display);
|
||||
|
||||
public abstract float getFlex();
|
||||
|
||||
public abstract void setFlex(float flex);
|
||||
|
||||
public abstract float getFlexGrow();
|
||||
|
||||
public abstract void setFlexGrow(float flexGrow);
|
||||
|
||||
public abstract float getFlexShrink();
|
||||
|
||||
public abstract void setFlexShrink(float flexShrink);
|
||||
|
||||
public abstract YogaValue getFlexBasis();
|
||||
|
||||
public abstract void setFlexBasis(float flexBasis);
|
||||
|
||||
public abstract void setFlexBasisPercent(float percent);
|
||||
|
||||
public abstract void setFlexBasisAuto();
|
||||
|
||||
public abstract YogaValue getMargin(YogaEdge edge);
|
||||
|
||||
public abstract void setMargin(YogaEdge edge, float margin);
|
||||
|
||||
public abstract void setMarginPercent(YogaEdge edge, float percent);
|
||||
|
||||
public abstract void setMarginAuto(YogaEdge edge);
|
||||
|
||||
public abstract YogaValue getPadding(YogaEdge edge);
|
||||
|
||||
public abstract void setPadding(YogaEdge edge, float padding);
|
||||
|
||||
public abstract void setPaddingPercent(YogaEdge edge, float percent);
|
||||
|
||||
public abstract float getBorder(YogaEdge edge);
|
||||
|
||||
public abstract void setBorder(YogaEdge edge, float border);
|
||||
|
||||
public abstract YogaValue getPosition(YogaEdge edge);
|
||||
|
||||
public abstract void setPosition(YogaEdge edge, float position);
|
||||
|
||||
public abstract void setPositionPercent(YogaEdge edge, float percent);
|
||||
|
||||
public abstract YogaValue getWidth();
|
||||
|
||||
public abstract void setWidth(float width);
|
||||
|
||||
public abstract void setWidthPercent(float percent);
|
||||
|
||||
public abstract void setWidthAuto();
|
||||
|
||||
public abstract YogaValue getHeight();
|
||||
|
||||
public abstract void setHeight(float height);
|
||||
|
||||
public abstract void setHeightPercent(float percent);
|
||||
|
||||
public abstract void setHeightAuto();
|
||||
|
||||
public abstract YogaValue getMinWidth();
|
||||
|
||||
public abstract void setMinWidth(float minWidth);
|
||||
|
||||
public abstract void setMinWidthPercent(float percent);
|
||||
|
||||
public abstract YogaValue getMinHeight();
|
||||
|
||||
public abstract void setMinHeight(float minHeight);
|
||||
|
||||
public abstract void setMinHeightPercent(float percent);
|
||||
|
||||
public abstract YogaValue getMaxWidth();
|
||||
|
||||
public abstract void setMaxWidth(float maxWidth);
|
||||
|
||||
public abstract void setMaxWidthPercent(float percent);
|
||||
|
||||
public abstract YogaValue getMaxHeight();
|
||||
|
||||
public abstract void setMaxHeight(float maxheight);
|
||||
|
||||
public abstract void setMaxHeightPercent(float percent);
|
||||
|
||||
public abstract float getAspectRatio();
|
||||
|
||||
public abstract void setAspectRatio(float aspectRatio);
|
||||
|
||||
public abstract float getLayoutX();
|
||||
|
||||
public abstract float getLayoutY();
|
||||
|
||||
public abstract float getLayoutWidth();
|
||||
|
||||
public abstract float getLayoutHeight();
|
||||
|
||||
public abstract float getLayoutMargin(YogaEdge edge);
|
||||
|
||||
public abstract float getLayoutPadding(YogaEdge edge);
|
||||
|
||||
public abstract float getLayoutBorder(YogaEdge edge);
|
||||
|
||||
public abstract YogaDirection getLayoutDirection();
|
||||
|
||||
public abstract void setMeasureFunction(YogaMeasureFunction measureFunction);
|
||||
|
||||
public abstract void setBaselineFunction(YogaBaselineFunction baselineFunction);
|
||||
|
||||
public abstract boolean isMeasureDefined();
|
||||
|
||||
public abstract boolean isBaselineDefined();
|
||||
|
||||
public abstract void setData(Object data);
|
||||
|
||||
@Nullable
|
||||
public abstract Object getData();
|
||||
|
||||
public abstract void print();
|
||||
|
||||
public abstract void setStyleInputs(float[] styleInputs, int size);
|
||||
|
||||
public abstract YogaNode cloneWithoutChildren();
|
||||
}
|
||||
|
@@ -1,9 +1,8 @@
|
||||
/*
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the LICENSE
|
||||
* file in the root directory of this source tree.
|
||||
*
|
||||
*/
|
||||
package com.facebook.yoga;
|
||||
|
||||
|
186
java/com/facebook/yoga/YogaNodeJNI.java
Normal file
186
java/com/facebook/yoga/YogaNodeJNI.java
Normal file
@@ -0,0 +1,186 @@
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the LICENSE
|
||||
* file in the root directory of this source tree.
|
||||
*/
|
||||
package com.facebook.yoga;
|
||||
|
||||
import com.facebook.proguard.annotations.DoNotStrip;
|
||||
|
||||
@DoNotStrip
|
||||
public class YogaNodeJNI extends YogaNodeJNIBase {
|
||||
|
||||
@DoNotStrip
|
||||
private float mWidth = YogaConstants.UNDEFINED;
|
||||
@DoNotStrip
|
||||
private float mHeight = YogaConstants.UNDEFINED;
|
||||
@DoNotStrip
|
||||
private float mTop = YogaConstants.UNDEFINED;
|
||||
@DoNotStrip
|
||||
private float mLeft = YogaConstants.UNDEFINED;
|
||||
@DoNotStrip
|
||||
private float mMarginLeft = 0;
|
||||
@DoNotStrip
|
||||
private float mMarginTop = 0;
|
||||
@DoNotStrip
|
||||
private float mMarginRight = 0;
|
||||
@DoNotStrip
|
||||
private float mMarginBottom = 0;
|
||||
@DoNotStrip
|
||||
private float mPaddingLeft = 0;
|
||||
@DoNotStrip
|
||||
private float mPaddingTop = 0;
|
||||
@DoNotStrip
|
||||
private float mPaddingRight = 0;
|
||||
@DoNotStrip
|
||||
private float mPaddingBottom = 0;
|
||||
@DoNotStrip
|
||||
private float mBorderLeft = 0;
|
||||
@DoNotStrip
|
||||
private float mBorderTop = 0;
|
||||
@DoNotStrip
|
||||
private float mBorderRight = 0;
|
||||
@DoNotStrip
|
||||
private float mBorderBottom = 0;
|
||||
@DoNotStrip
|
||||
private int mLayoutDirection = 0;
|
||||
@DoNotStrip
|
||||
private boolean mHasNewLayout = true;
|
||||
@DoNotStrip
|
||||
private boolean mDoesLegacyStretchFlagAffectsLayout = false;
|
||||
|
||||
public YogaNodeJNI() {
|
||||
super();
|
||||
}
|
||||
|
||||
public YogaNodeJNI(YogaConfig config) {
|
||||
super(config);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
super.reset();
|
||||
mHasNewLayout = true;
|
||||
|
||||
mWidth = YogaConstants.UNDEFINED;
|
||||
mHeight = YogaConstants.UNDEFINED;
|
||||
mTop = YogaConstants.UNDEFINED;
|
||||
mLeft = YogaConstants.UNDEFINED;
|
||||
mMarginLeft = 0;
|
||||
mMarginTop = 0;
|
||||
mMarginRight = 0;
|
||||
mMarginBottom = 0;
|
||||
mPaddingLeft = 0;
|
||||
mPaddingTop = 0;
|
||||
mPaddingRight = 0;
|
||||
mPaddingBottom = 0;
|
||||
mBorderLeft = 0;
|
||||
mBorderTop = 0;
|
||||
mBorderRight = 0;
|
||||
mBorderBottom = 0;
|
||||
mLayoutDirection = 0;
|
||||
|
||||
mDoesLegacyStretchFlagAffectsLayout = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasNewLayout() {
|
||||
return mHasNewLayout;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void markLayoutSeen() {
|
||||
mHasNewLayout = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getLayoutX() {
|
||||
return mLeft;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getLayoutY() {
|
||||
return mTop;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getLayoutWidth() {
|
||||
return mWidth;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getLayoutHeight() {
|
||||
return mHeight;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getDoesLegacyStretchFlagAffectsLayout() {
|
||||
return mDoesLegacyStretchFlagAffectsLayout;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getLayoutMargin(YogaEdge edge) {
|
||||
switch (edge) {
|
||||
case LEFT:
|
||||
return mMarginLeft;
|
||||
case TOP:
|
||||
return mMarginTop;
|
||||
case RIGHT:
|
||||
return mMarginRight;
|
||||
case BOTTOM:
|
||||
return mMarginBottom;
|
||||
case START:
|
||||
return getLayoutDirection() == YogaDirection.RTL ? mMarginRight : mMarginLeft;
|
||||
case END:
|
||||
return getLayoutDirection() == YogaDirection.RTL ? mMarginLeft : mMarginRight;
|
||||
default:
|
||||
throw new IllegalArgumentException("Cannot get layout margins of multi-edge shorthands");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getLayoutPadding(YogaEdge edge) {
|
||||
switch (edge) {
|
||||
case LEFT:
|
||||
return mPaddingLeft;
|
||||
case TOP:
|
||||
return mPaddingTop;
|
||||
case RIGHT:
|
||||
return mPaddingRight;
|
||||
case BOTTOM:
|
||||
return mPaddingBottom;
|
||||
case START:
|
||||
return getLayoutDirection() == YogaDirection.RTL ? mPaddingRight : mPaddingLeft;
|
||||
case END:
|
||||
return getLayoutDirection() == YogaDirection.RTL ? mPaddingLeft : mPaddingRight;
|
||||
default:
|
||||
throw new IllegalArgumentException("Cannot get layout paddings of multi-edge shorthands");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getLayoutBorder(YogaEdge edge) {
|
||||
switch (edge) {
|
||||
case LEFT:
|
||||
return mBorderLeft;
|
||||
case TOP:
|
||||
return mBorderTop;
|
||||
case RIGHT:
|
||||
return mBorderRight;
|
||||
case BOTTOM:
|
||||
return mBorderBottom;
|
||||
case START:
|
||||
return getLayoutDirection() == YogaDirection.RTL ? mBorderRight : mBorderLeft;
|
||||
case END:
|
||||
return getLayoutDirection() == YogaDirection.RTL ? mBorderLeft : mBorderRight;
|
||||
default:
|
||||
throw new IllegalArgumentException("Cannot get layout border of multi-edge shorthands");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public YogaDirection getLayoutDirection() {
|
||||
return YogaDirection.fromInt(mLayoutDirection);
|
||||
}
|
||||
}
|
533
java/com/facebook/yoga/YogaNodeJNIBase.java
Normal file
533
java/com/facebook/yoga/YogaNodeJNIBase.java
Normal file
@@ -0,0 +1,533 @@
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the LICENSE
|
||||
* file in the root directory of this source tree.
|
||||
*/
|
||||
package com.facebook.yoga;
|
||||
|
||||
import com.facebook.proguard.annotations.DoNotStrip;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
@DoNotStrip
|
||||
public abstract class YogaNodeJNIBase extends YogaNode implements Cloneable {
|
||||
|
||||
@Nullable private YogaNodeJNIBase mOwner;
|
||||
@Nullable private List<YogaNodeJNIBase> mChildren;
|
||||
@Nullable private YogaMeasureFunction mMeasureFunction;
|
||||
@Nullable private YogaBaselineFunction mBaselineFunction;
|
||||
private long mNativePointer;
|
||||
@Nullable private Object mData;
|
||||
|
||||
public YogaNodeJNIBase() {
|
||||
mNativePointer = YogaNative.jni_YGNodeNew(YogaConfig.useBatchingForLayoutOutputs);
|
||||
if (mNativePointer == 0) {
|
||||
throw new IllegalStateException("Failed to allocate native memory");
|
||||
}
|
||||
}
|
||||
|
||||
public YogaNodeJNIBase(YogaConfig config) {
|
||||
mNativePointer = YogaNative.jni_YGNodeNewWithConfig(config.mNativePointer, YogaConfig.useBatchingForLayoutOutputs);
|
||||
if (mNativePointer == 0) {
|
||||
throw new IllegalStateException("Failed to allocate native memory");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void finalize() throws Throwable {
|
||||
try {
|
||||
freeNatives();
|
||||
} finally {
|
||||
super.finalize();
|
||||
}
|
||||
}
|
||||
|
||||
/* frees the native underlying YGNode. Useful for testing. */
|
||||
public void freeNatives() {
|
||||
if (mNativePointer > 0) {
|
||||
long nativePointer = mNativePointer;
|
||||
mNativePointer = 0;
|
||||
YogaNative.jni_YGNodeFree(nativePointer);
|
||||
}
|
||||
}
|
||||
public void reset() {
|
||||
mMeasureFunction = null;
|
||||
mBaselineFunction = null;
|
||||
mData = null;
|
||||
|
||||
YogaNative.jni_YGNodeReset(mNativePointer);
|
||||
}
|
||||
|
||||
public int getChildCount() {
|
||||
return mChildren == null ? 0 : mChildren.size();
|
||||
}
|
||||
|
||||
public YogaNodeJNIBase getChildAt(int i) {
|
||||
if (mChildren == null) {
|
||||
throw new IllegalStateException("YogaNode does not have children");
|
||||
}
|
||||
return mChildren.get(i);
|
||||
}
|
||||
|
||||
public void addChildAt(YogaNode c, int i) {
|
||||
YogaNodeJNIBase child = (YogaNodeJNIBase) c;
|
||||
if (child.mOwner != null) {
|
||||
throw new IllegalStateException("Child already has a parent, it must be removed first.");
|
||||
}
|
||||
|
||||
if (mChildren == null) {
|
||||
mChildren = new ArrayList<>(4);
|
||||
}
|
||||
mChildren.add(i, child);
|
||||
child.mOwner = this;
|
||||
YogaNative.jni_YGNodeInsertChild(mNativePointer, child.mNativePointer, i);
|
||||
}
|
||||
|
||||
public void setIsReferenceBaseline(boolean isReferenceBaseline) {
|
||||
YogaNative.jni_YGNodeSetIsReferenceBaseline(mNativePointer, isReferenceBaseline);
|
||||
}
|
||||
|
||||
public boolean isReferenceBaseline() {
|
||||
return YogaNative.jni_YGNodeIsReferenceBaseline(mNativePointer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public YogaNodeJNIBase cloneWithoutChildren() {
|
||||
try {
|
||||
YogaNodeJNIBase clonedYogaNode = (YogaNodeJNIBase) super.clone();
|
||||
long clonedNativePointer = YogaNative.jni_YGNodeClone(mNativePointer);
|
||||
clonedYogaNode.mOwner = null;
|
||||
clonedYogaNode.mNativePointer = clonedNativePointer;
|
||||
clonedYogaNode.clearChildren();
|
||||
return clonedYogaNode;
|
||||
} catch (CloneNotSupportedException ex) {
|
||||
// This class implements Cloneable, this should not happen
|
||||
throw new RuntimeException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
private void clearChildren() {
|
||||
mChildren = null;
|
||||
YogaNative.jni_YGNodeClearChildren(mNativePointer);
|
||||
}
|
||||
|
||||
public YogaNodeJNIBase removeChildAt(int i) {
|
||||
if (mChildren == null) {
|
||||
throw new IllegalStateException(
|
||||
"Trying to remove a child of a YogaNode that does not have children");
|
||||
}
|
||||
final YogaNodeJNIBase child = mChildren.remove(i);
|
||||
child.mOwner = null;
|
||||
YogaNative.jni_YGNodeRemoveChild(mNativePointer, child.mNativePointer);
|
||||
return child;
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns the {@link YogaNode} that owns this {@link YogaNode}.
|
||||
* The owner is used to identify the YogaTree that a {@link YogaNode} belongs
|
||||
* to.
|
||||
* This method will return the parent of the {@link YogaNode} when the
|
||||
* {@link YogaNode} only belongs to one YogaTree or null when the
|
||||
* {@link YogaNode} is shared between two or more YogaTrees.
|
||||
*/
|
||||
@Nullable
|
||||
public YogaNodeJNIBase getOwner() {
|
||||
return mOwner;
|
||||
}
|
||||
|
||||
/** @deprecated Use #getOwner() instead. This will be removed in the next version. */
|
||||
@Deprecated
|
||||
@Nullable
|
||||
public YogaNodeJNIBase getParent() {
|
||||
return getOwner();
|
||||
}
|
||||
|
||||
public int indexOf(YogaNode child) {
|
||||
return mChildren == null ? -1 : mChildren.indexOf(child);
|
||||
}
|
||||
|
||||
public void calculateLayout(float width, float height) {
|
||||
long[] nativePointers = null;
|
||||
YogaNodeJNIBase[] nodes = null;
|
||||
|
||||
ArrayList<YogaNodeJNIBase> n = new ArrayList<>();
|
||||
n.add(this);
|
||||
for (int i = 0; i < n.size(); ++i) {
|
||||
List<YogaNodeJNIBase> children = n.get(i).mChildren;
|
||||
if (children != null) {
|
||||
n.addAll(children);
|
||||
}
|
||||
}
|
||||
|
||||
nodes = n.toArray(new YogaNodeJNIBase[n.size()]);
|
||||
nativePointers = new long[nodes.length];
|
||||
for (int i = 0; i < nodes.length; ++i) {
|
||||
nativePointers[i] = nodes[i].mNativePointer;
|
||||
}
|
||||
|
||||
YogaNative.jni_YGNodeCalculateLayout(mNativePointer, width, height, nativePointers, nodes);
|
||||
}
|
||||
|
||||
public void dirty() {
|
||||
YogaNative.jni_YGNodeMarkDirty(mNativePointer);
|
||||
}
|
||||
|
||||
public void dirtyAllDescendants() {
|
||||
YogaNative.jni_YGNodeMarkDirtyAndPropogateToDescendants(mNativePointer);
|
||||
}
|
||||
|
||||
public boolean isDirty() {
|
||||
return YogaNative.jni_YGNodeIsDirty(mNativePointer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void copyStyle(YogaNode srcNode) {
|
||||
YogaNative.jni_YGNodeCopyStyle(mNativePointer, ((YogaNodeJNIBase) srcNode).mNativePointer);
|
||||
}
|
||||
|
||||
public YogaDirection getStyleDirection() {
|
||||
return YogaDirection.fromInt(YogaNative.jni_YGNodeStyleGetDirection(mNativePointer));
|
||||
}
|
||||
|
||||
public void setDirection(YogaDirection direction) {
|
||||
YogaNative.jni_YGNodeStyleSetDirection(mNativePointer, direction.intValue());
|
||||
}
|
||||
|
||||
public YogaFlexDirection getFlexDirection() {
|
||||
return YogaFlexDirection.fromInt(YogaNative.jni_YGNodeStyleGetFlexDirection(mNativePointer));
|
||||
}
|
||||
|
||||
public void setFlexDirection(YogaFlexDirection flexDirection) {
|
||||
YogaNative.jni_YGNodeStyleSetFlexDirection(mNativePointer, flexDirection.intValue());
|
||||
}
|
||||
|
||||
public YogaJustify getJustifyContent() {
|
||||
return YogaJustify.fromInt(YogaNative.jni_YGNodeStyleGetJustifyContent(mNativePointer));
|
||||
}
|
||||
|
||||
public void setJustifyContent(YogaJustify justifyContent) {
|
||||
YogaNative.jni_YGNodeStyleSetJustifyContent(mNativePointer, justifyContent.intValue());
|
||||
}
|
||||
|
||||
public YogaAlign getAlignItems() {
|
||||
return YogaAlign.fromInt(YogaNative.jni_YGNodeStyleGetAlignItems(mNativePointer));
|
||||
}
|
||||
|
||||
public void setAlignItems(YogaAlign alignItems) {
|
||||
YogaNative.jni_YGNodeStyleSetAlignItems(mNativePointer, alignItems.intValue());
|
||||
}
|
||||
|
||||
public YogaAlign getAlignSelf() {
|
||||
return YogaAlign.fromInt(YogaNative.jni_YGNodeStyleGetAlignSelf(mNativePointer));
|
||||
}
|
||||
|
||||
public void setAlignSelf(YogaAlign alignSelf) {
|
||||
YogaNative.jni_YGNodeStyleSetAlignSelf(mNativePointer, alignSelf.intValue());
|
||||
}
|
||||
|
||||
public YogaAlign getAlignContent() {
|
||||
return YogaAlign.fromInt(YogaNative.jni_YGNodeStyleGetAlignContent(mNativePointer));
|
||||
}
|
||||
|
||||
public void setAlignContent(YogaAlign alignContent) {
|
||||
YogaNative.jni_YGNodeStyleSetAlignContent(mNativePointer, alignContent.intValue());
|
||||
}
|
||||
|
||||
public YogaPositionType getPositionType() {
|
||||
return YogaPositionType.fromInt(YogaNative.jni_YGNodeStyleGetPositionType(mNativePointer));
|
||||
}
|
||||
|
||||
public void setPositionType(YogaPositionType positionType) {
|
||||
YogaNative.jni_YGNodeStyleSetPositionType(mNativePointer, positionType.intValue());
|
||||
}
|
||||
|
||||
public YogaWrap getWrap() {
|
||||
return YogaWrap.fromInt(YogaNative.jni_YGNodeStyleGetFlexWrap(mNativePointer));
|
||||
}
|
||||
|
||||
public void setWrap(YogaWrap flexWrap) {
|
||||
YogaNative.jni_YGNodeStyleSetFlexWrap(mNativePointer, flexWrap.intValue());
|
||||
}
|
||||
|
||||
public YogaOverflow getOverflow() {
|
||||
return YogaOverflow.fromInt(YogaNative.jni_YGNodeStyleGetOverflow(mNativePointer));
|
||||
}
|
||||
|
||||
public void setOverflow(YogaOverflow overflow) {
|
||||
YogaNative.jni_YGNodeStyleSetOverflow(mNativePointer, overflow.intValue());
|
||||
}
|
||||
|
||||
public YogaDisplay getDisplay() {
|
||||
return YogaDisplay.fromInt(YogaNative.jni_YGNodeStyleGetDisplay(mNativePointer));
|
||||
}
|
||||
|
||||
public void setDisplay(YogaDisplay display) {
|
||||
YogaNative.jni_YGNodeStyleSetDisplay(mNativePointer, display.intValue());
|
||||
}
|
||||
|
||||
public float getFlex() {
|
||||
return YogaNative.jni_YGNodeStyleGetFlex(mNativePointer);
|
||||
}
|
||||
|
||||
public void setFlex(float flex) {
|
||||
YogaNative.jni_YGNodeStyleSetFlex(mNativePointer, flex);
|
||||
}
|
||||
|
||||
public float getFlexGrow() {
|
||||
return YogaNative.jni_YGNodeStyleGetFlexGrow(mNativePointer);
|
||||
}
|
||||
|
||||
public void setFlexGrow(float flexGrow) {
|
||||
YogaNative.jni_YGNodeStyleSetFlexGrow(mNativePointer, flexGrow);
|
||||
}
|
||||
|
||||
public float getFlexShrink() {
|
||||
return YogaNative.jni_YGNodeStyleGetFlexShrink(mNativePointer);
|
||||
}
|
||||
|
||||
public void setFlexShrink(float flexShrink) {
|
||||
YogaNative.jni_YGNodeStyleSetFlexShrink(mNativePointer, flexShrink);
|
||||
}
|
||||
|
||||
public YogaValue getFlexBasis() {
|
||||
return valueFromLong(YogaNative.jni_YGNodeStyleGetFlexBasis(mNativePointer));
|
||||
}
|
||||
|
||||
public void setFlexBasis(float flexBasis) {
|
||||
YogaNative.jni_YGNodeStyleSetFlexBasis(mNativePointer, flexBasis);
|
||||
}
|
||||
|
||||
public void setFlexBasisPercent(float percent) {
|
||||
YogaNative.jni_YGNodeStyleSetFlexBasisPercent(mNativePointer, percent);
|
||||
}
|
||||
|
||||
public void setFlexBasisAuto() {
|
||||
YogaNative.jni_YGNodeStyleSetFlexBasisAuto(mNativePointer);
|
||||
}
|
||||
|
||||
public YogaValue getMargin(YogaEdge edge) {
|
||||
return valueFromLong(YogaNative.jni_YGNodeStyleGetMargin(mNativePointer, edge.intValue()));
|
||||
}
|
||||
|
||||
public void setMargin(YogaEdge edge, float margin) {
|
||||
YogaNative.jni_YGNodeStyleSetMargin(mNativePointer, edge.intValue(), margin);
|
||||
}
|
||||
|
||||
public void setMarginPercent(YogaEdge edge, float percent) {
|
||||
YogaNative.jni_YGNodeStyleSetMarginPercent(mNativePointer, edge.intValue(), percent);
|
||||
}
|
||||
|
||||
public void setMarginAuto(YogaEdge edge) {
|
||||
YogaNative.jni_YGNodeStyleSetMarginAuto(mNativePointer, edge.intValue());
|
||||
}
|
||||
|
||||
public YogaValue getPadding(YogaEdge edge) {
|
||||
return valueFromLong(YogaNative.jni_YGNodeStyleGetPadding(mNativePointer, edge.intValue()));
|
||||
}
|
||||
|
||||
public void setPadding(YogaEdge edge, float padding) {
|
||||
YogaNative.jni_YGNodeStyleSetPadding(mNativePointer, edge.intValue(), padding);
|
||||
}
|
||||
|
||||
public void setPaddingPercent(YogaEdge edge, float percent) {
|
||||
YogaNative.jni_YGNodeStyleSetPaddingPercent(mNativePointer, edge.intValue(), percent);
|
||||
}
|
||||
|
||||
public float getBorder(YogaEdge edge) {
|
||||
return YogaNative.jni_YGNodeStyleGetBorder(mNativePointer, edge.intValue());
|
||||
}
|
||||
|
||||
public void setBorder(YogaEdge edge, float border) {
|
||||
YogaNative.jni_YGNodeStyleSetBorder(mNativePointer, edge.intValue(), border);
|
||||
}
|
||||
|
||||
public YogaValue getPosition(YogaEdge edge) {
|
||||
return valueFromLong(YogaNative.jni_YGNodeStyleGetPosition(mNativePointer, edge.intValue()));
|
||||
}
|
||||
|
||||
public void setPosition(YogaEdge edge, float position) {
|
||||
YogaNative.jni_YGNodeStyleSetPosition(mNativePointer, edge.intValue(), position);
|
||||
}
|
||||
|
||||
public void setPositionPercent(YogaEdge edge, float percent) {
|
||||
YogaNative.jni_YGNodeStyleSetPositionPercent(mNativePointer, edge.intValue(), percent);
|
||||
}
|
||||
|
||||
public YogaValue getWidth() {
|
||||
return valueFromLong(YogaNative.jni_YGNodeStyleGetWidth(mNativePointer));
|
||||
}
|
||||
|
||||
public void setWidth(float width) {
|
||||
YogaNative.jni_YGNodeStyleSetWidth(mNativePointer, width);
|
||||
}
|
||||
|
||||
public void setWidthPercent(float percent) {
|
||||
YogaNative.jni_YGNodeStyleSetWidthPercent(mNativePointer, percent);
|
||||
}
|
||||
|
||||
public void setWidthAuto() {
|
||||
YogaNative.jni_YGNodeStyleSetWidthAuto(mNativePointer);
|
||||
}
|
||||
|
||||
public YogaValue getHeight() {
|
||||
return valueFromLong(YogaNative.jni_YGNodeStyleGetHeight(mNativePointer));
|
||||
}
|
||||
|
||||
public void setHeight(float height) {
|
||||
YogaNative.jni_YGNodeStyleSetHeight(mNativePointer, height);
|
||||
}
|
||||
|
||||
public void setHeightPercent(float percent) {
|
||||
YogaNative.jni_YGNodeStyleSetHeightPercent(mNativePointer, percent);
|
||||
}
|
||||
|
||||
public void setHeightAuto() {
|
||||
YogaNative.jni_YGNodeStyleSetHeightAuto(mNativePointer);
|
||||
}
|
||||
|
||||
public YogaValue getMinWidth() {
|
||||
return valueFromLong(YogaNative.jni_YGNodeStyleGetMinWidth(mNativePointer));
|
||||
}
|
||||
|
||||
public void setMinWidth(float minWidth) {
|
||||
YogaNative.jni_YGNodeStyleSetMinWidth(mNativePointer, minWidth);
|
||||
}
|
||||
|
||||
public void setMinWidthPercent(float percent) {
|
||||
YogaNative.jni_YGNodeStyleSetMinWidthPercent(mNativePointer, percent);
|
||||
}
|
||||
|
||||
public YogaValue getMinHeight() {
|
||||
return valueFromLong(YogaNative.jni_YGNodeStyleGetMinHeight(mNativePointer));
|
||||
}
|
||||
|
||||
public void setMinHeight(float minHeight) {
|
||||
YogaNative.jni_YGNodeStyleSetMinHeight(mNativePointer, minHeight);
|
||||
}
|
||||
|
||||
public void setMinHeightPercent(float percent) {
|
||||
YogaNative.jni_YGNodeStyleSetMinHeightPercent(mNativePointer, percent);
|
||||
}
|
||||
|
||||
public YogaValue getMaxWidth() {
|
||||
return valueFromLong(YogaNative.jni_YGNodeStyleGetMaxWidth(mNativePointer));
|
||||
}
|
||||
|
||||
public void setMaxWidth(float maxWidth) {
|
||||
YogaNative.jni_YGNodeStyleSetMaxWidth(mNativePointer, maxWidth);
|
||||
}
|
||||
|
||||
public void setMaxWidthPercent(float percent) {
|
||||
YogaNative.jni_YGNodeStyleSetMaxWidthPercent(mNativePointer, percent);
|
||||
}
|
||||
|
||||
public YogaValue getMaxHeight() {
|
||||
return valueFromLong(YogaNative.jni_YGNodeStyleGetMaxHeight(mNativePointer));
|
||||
}
|
||||
|
||||
public void setMaxHeight(float maxheight) {
|
||||
YogaNative.jni_YGNodeStyleSetMaxHeight(mNativePointer, maxheight);
|
||||
}
|
||||
|
||||
public void setMaxHeightPercent(float percent) {
|
||||
YogaNative.jni_YGNodeStyleSetMaxHeightPercent(mNativePointer, percent);
|
||||
}
|
||||
|
||||
public float getAspectRatio() {
|
||||
return YogaNative.jni_YGNodeStyleGetAspectRatio(mNativePointer);
|
||||
}
|
||||
|
||||
public void setAspectRatio(float aspectRatio) {
|
||||
YogaNative.jni_YGNodeStyleSetAspectRatio(mNativePointer, aspectRatio);
|
||||
}
|
||||
|
||||
public abstract boolean getDoesLegacyStretchFlagAffectsLayout();
|
||||
|
||||
public void setMeasureFunction(YogaMeasureFunction measureFunction) {
|
||||
mMeasureFunction = measureFunction;
|
||||
YogaNative.jni_YGNodeSetHasMeasureFunc(mNativePointer, measureFunction != null);
|
||||
}
|
||||
|
||||
// Implementation Note: Why this method needs to stay final
|
||||
//
|
||||
// We cache the jmethodid for this method in Yoga code. This means that even if a subclass
|
||||
// were to override measure, we'd still call this implementation from layout code since the
|
||||
// overriding method will have a different jmethodid. This is final to prevent that mistake.
|
||||
@DoNotStrip
|
||||
public final long measure(float width, int widthMode, float height, int heightMode) {
|
||||
if (!isMeasureDefined()) {
|
||||
throw new RuntimeException("Measure function isn't defined!");
|
||||
}
|
||||
|
||||
return mMeasureFunction.measure(
|
||||
this,
|
||||
width,
|
||||
YogaMeasureMode.fromInt(widthMode),
|
||||
height,
|
||||
YogaMeasureMode.fromInt(heightMode));
|
||||
}
|
||||
|
||||
public void setBaselineFunction(YogaBaselineFunction baselineFunction) {
|
||||
mBaselineFunction = baselineFunction;
|
||||
YogaNative.jni_YGNodeSetHasBaselineFunc(mNativePointer, baselineFunction != null);
|
||||
}
|
||||
|
||||
@DoNotStrip
|
||||
public final float baseline(float width, float height) {
|
||||
return mBaselineFunction.baseline(this, width, height);
|
||||
}
|
||||
|
||||
public boolean isMeasureDefined() {
|
||||
return mMeasureFunction != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBaselineDefined() {
|
||||
return mBaselineFunction != null;
|
||||
}
|
||||
|
||||
public void setData(Object data) {
|
||||
mData = data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @Nullable Object getData() {
|
||||
return mData;
|
||||
}
|
||||
|
||||
/**
|
||||
* Use the set logger (defaults to adb log) to print out the styles, children, and computed
|
||||
* layout of the tree rooted at this node.
|
||||
*/
|
||||
public void print() {
|
||||
YogaNative.jni_YGNodePrint(mNativePointer);
|
||||
}
|
||||
|
||||
public void setStyleInputs(float[] styleInputsArray, int size) {
|
||||
YogaNative.jni_YGNodeSetStyleInputs(mNativePointer, styleInputsArray, size);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method replaces the child at childIndex position with the newNode received by parameter.
|
||||
* This is different than calling removeChildAt and addChildAt because this method ONLY replaces
|
||||
* the child in the mChildren datastructure. @DoNotStrip: called from JNI
|
||||
*
|
||||
* @return the nativePointer of the newNode {@linl YogaNode}
|
||||
*/
|
||||
@DoNotStrip
|
||||
private final long replaceChild(YogaNodeJNIBase newNode, int childIndex) {
|
||||
if (mChildren == null) {
|
||||
throw new IllegalStateException("Cannot replace child. YogaNode does not have children");
|
||||
}
|
||||
mChildren.remove(childIndex);
|
||||
mChildren.add(childIndex, newNode);
|
||||
newNode.mOwner = this;
|
||||
return newNode.mNativePointer;
|
||||
}
|
||||
|
||||
private static YogaValue valueFromLong(long raw) {
|
||||
return new YogaValue(Float.intBitsToFloat((int) raw), (int) (raw >> 32));
|
||||
}
|
||||
}
|
177
java/com/facebook/yoga/YogaNodeJNIBatching.java
Normal file
177
java/com/facebook/yoga/YogaNodeJNIBatching.java
Normal file
@@ -0,0 +1,177 @@
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the LICENSE
|
||||
* file in the root directory of this source tree.
|
||||
*/
|
||||
package com.facebook.yoga;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import com.facebook.proguard.annotations.DoNotStrip;
|
||||
|
||||
@DoNotStrip
|
||||
public class YogaNodeJNIBatching extends YogaNodeJNIBase {
|
||||
|
||||
/* Those flags needs be in sync with YGJNI.cpp */
|
||||
private static final byte MARGIN = 1;
|
||||
private static final byte PADDING = 2;
|
||||
private static final byte BORDER = 4;
|
||||
private static final byte DOES_LEGACY_STRETCH_BEHAVIOUR = 8;
|
||||
private static final byte HAS_NEW_LAYOUT = 16;
|
||||
|
||||
private static final byte LAYOUT_EDGE_SET_FLAG_INDEX = 0;
|
||||
private static final byte LAYOUT_WIDTH_INDEX = 1;
|
||||
private static final byte LAYOUT_HEIGHT_INDEX = 2;
|
||||
private static final byte LAYOUT_LEFT_INDEX = 3;
|
||||
private static final byte LAYOUT_TOP_INDEX = 4;
|
||||
private static final byte LAYOUT_DIRECTION_INDEX = 5;
|
||||
private static final byte LAYOUT_MARGIN_START_INDEX = 6;
|
||||
private static final byte LAYOUT_PADDING_START_INDEX = 10;
|
||||
private static final byte LAYOUT_BORDER_START_INDEX = 14;
|
||||
|
||||
@DoNotStrip
|
||||
private @Nullable float[] arr = null;
|
||||
|
||||
@DoNotStrip
|
||||
private int mLayoutDirection = 0;
|
||||
|
||||
private boolean mHasNewLayout = true;
|
||||
|
||||
public YogaNodeJNIBatching() {
|
||||
super();
|
||||
}
|
||||
|
||||
public YogaNodeJNIBatching(YogaConfig config) {
|
||||
super(config);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
super.reset();
|
||||
arr = null;
|
||||
mHasNewLayout = true;
|
||||
mLayoutDirection = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getLayoutX() {
|
||||
return arr != null ? arr[LAYOUT_LEFT_INDEX] : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getLayoutY() {
|
||||
return arr != null ? arr[LAYOUT_TOP_INDEX] : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getLayoutWidth() {
|
||||
return arr != null ? arr[LAYOUT_WIDTH_INDEX] : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getLayoutHeight() {
|
||||
return arr != null ? arr[LAYOUT_HEIGHT_INDEX] : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getDoesLegacyStretchFlagAffectsLayout() {
|
||||
return arr != null && (((int) arr[LAYOUT_EDGE_SET_FLAG_INDEX] & DOES_LEGACY_STRETCH_BEHAVIOUR) == DOES_LEGACY_STRETCH_BEHAVIOUR);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getLayoutMargin(YogaEdge edge) {
|
||||
if (arr != null && ((int) arr[LAYOUT_EDGE_SET_FLAG_INDEX] & MARGIN) == MARGIN) {
|
||||
switch (edge) {
|
||||
case LEFT:
|
||||
return arr[LAYOUT_MARGIN_START_INDEX];
|
||||
case TOP:
|
||||
return arr[LAYOUT_MARGIN_START_INDEX + 1];
|
||||
case RIGHT:
|
||||
return arr[LAYOUT_MARGIN_START_INDEX + 2];
|
||||
case BOTTOM:
|
||||
return arr[LAYOUT_MARGIN_START_INDEX + 3];
|
||||
case START:
|
||||
return getLayoutDirection() == YogaDirection.RTL ? arr[LAYOUT_MARGIN_START_INDEX + 2] : arr[LAYOUT_MARGIN_START_INDEX];
|
||||
case END:
|
||||
return getLayoutDirection() == YogaDirection.RTL ? arr[LAYOUT_MARGIN_START_INDEX] : arr[LAYOUT_MARGIN_START_INDEX + 2];
|
||||
default:
|
||||
throw new IllegalArgumentException("Cannot get layout margins of multi-edge shorthands");
|
||||
}
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getLayoutPadding(YogaEdge edge) {
|
||||
if (arr != null && ((int) arr[LAYOUT_EDGE_SET_FLAG_INDEX] & PADDING) == PADDING) {
|
||||
int paddingStartIndex = LAYOUT_PADDING_START_INDEX - ((((int)arr[LAYOUT_EDGE_SET_FLAG_INDEX] & MARGIN) == MARGIN) ? 0 : 4);
|
||||
switch (edge) {
|
||||
case LEFT:
|
||||
return arr[paddingStartIndex];
|
||||
case TOP:
|
||||
return arr[paddingStartIndex + 1];
|
||||
case RIGHT:
|
||||
return arr[paddingStartIndex + 2];
|
||||
case BOTTOM:
|
||||
return arr[paddingStartIndex + 3];
|
||||
case START:
|
||||
return getLayoutDirection() == YogaDirection.RTL ? arr[paddingStartIndex + 2] : arr[paddingStartIndex];
|
||||
case END:
|
||||
return getLayoutDirection() == YogaDirection.RTL ? arr[paddingStartIndex] : arr[paddingStartIndex + 2];
|
||||
default:
|
||||
throw new IllegalArgumentException("Cannot get layout paddings of multi-edge shorthands");
|
||||
}
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getLayoutBorder(YogaEdge edge) {
|
||||
if (arr != null && ((int) arr[LAYOUT_EDGE_SET_FLAG_INDEX] & BORDER) == BORDER) {
|
||||
int borderStartIndex = LAYOUT_BORDER_START_INDEX - ((((int) arr[LAYOUT_EDGE_SET_FLAG_INDEX] & MARGIN) == MARGIN) ? 0 : 4) - ((((int) arr[LAYOUT_EDGE_SET_FLAG_INDEX] & PADDING) == PADDING) ? 0 : 4);
|
||||
switch (edge) {
|
||||
case LEFT:
|
||||
return arr[borderStartIndex];
|
||||
case TOP:
|
||||
return arr[borderStartIndex + 1];
|
||||
case RIGHT:
|
||||
return arr[borderStartIndex + 2];
|
||||
case BOTTOM:
|
||||
return arr[borderStartIndex + 3];
|
||||
case START:
|
||||
return getLayoutDirection() == YogaDirection.RTL ? arr[borderStartIndex + 2] : arr[borderStartIndex];
|
||||
case END:
|
||||
return getLayoutDirection() == YogaDirection.RTL ? arr[borderStartIndex] : arr[borderStartIndex + 2];
|
||||
default:
|
||||
throw new IllegalArgumentException("Cannot get layout border of multi-edge shorthands");
|
||||
}
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public YogaDirection getLayoutDirection() {
|
||||
return YogaDirection.fromInt(arr != null ? (int) arr[LAYOUT_DIRECTION_INDEX] : mLayoutDirection);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasNewLayout() {
|
||||
if (arr != null) {
|
||||
return (((int) arr[LAYOUT_EDGE_SET_FLAG_INDEX]) & HAS_NEW_LAYOUT) == HAS_NEW_LAYOUT;
|
||||
} else {
|
||||
return mHasNewLayout;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void markLayoutSeen() {
|
||||
if (arr != null) {
|
||||
arr[LAYOUT_EDGE_SET_FLAG_INDEX] = ((int) arr[LAYOUT_EDGE_SET_FLAG_INDEX]) & ~(HAS_NEW_LAYOUT);
|
||||
}
|
||||
mHasNewLayout = false;
|
||||
}
|
||||
}
|
@@ -1,9 +1,8 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc.
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the LICENSE
|
||||
* file in the root directory of this source tree.
|
||||
*
|
||||
*/
|
||||
package com.facebook.yoga;
|
||||
|
||||
|
@@ -1,9 +1,8 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc.
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the LICENSE
|
||||
* file in the root directory of this source tree.
|
||||
*
|
||||
*/
|
||||
package com.facebook.yoga;
|
||||
|
||||
|
@@ -1,9 +1,8 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc.
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the LICENSE
|
||||
* file in the root directory of this source tree.
|
||||
*
|
||||
*/
|
||||
package com.facebook.yoga;
|
||||
|
||||
|
@@ -1,9 +1,8 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc.
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the LICENSE
|
||||
* file in the root directory of this source tree.
|
||||
*
|
||||
*/
|
||||
package com.facebook.yoga;
|
||||
|
||||
|
53
java/com/facebook/yoga/YogaStyleInputs.java
Normal file
53
java/com/facebook/yoga/YogaStyleInputs.java
Normal file
@@ -0,0 +1,53 @@
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the LICENSE
|
||||
* file in the root directory of this source tree.
|
||||
*/
|
||||
package com.facebook.yoga;
|
||||
|
||||
import com.facebook.proguard.annotations.DoNotStrip;
|
||||
|
||||
@DoNotStrip
|
||||
public class YogaStyleInputs {
|
||||
public static final short LAYOUT_DIRECTION = 0;
|
||||
public static final short FLEX_DIRECTION = 1;
|
||||
public static final short FLEX = 2;
|
||||
public static final short FLEX_GROW = 3;
|
||||
public static final short FLEX_SHRINK = 4;
|
||||
public static final short FLEX_BASIS = 5;
|
||||
public static final short FLEX_BASIS_PERCENT = 6;
|
||||
public static final short FLEX_BASIS_AUTO = 7;
|
||||
public static final short FLEX_WRAP = 8;
|
||||
public static final short WIDTH = 9;
|
||||
public static final short WIDTH_PERCENT = 10;
|
||||
public static final short WIDTH_AUTO = 11;
|
||||
public static final short MIN_WIDTH = 12;
|
||||
public static final short MIN_WIDTH_PERCENT = 13;
|
||||
public static final short MAX_WIDTH = 14;
|
||||
public static final short MAX_WIDTH_PERCENT = 15;
|
||||
public static final short HEIGHT = 16;
|
||||
public static final short HEIGHT_PERCENT = 17;
|
||||
public static final short HEIGHT_AUTO = 18;
|
||||
public static final short MIN_HEIGHT = 19;
|
||||
public static final short MIN_HEIGHT_PERCENT = 20;
|
||||
public static final short MAX_HEIGHT = 21;
|
||||
public static final short MAX_HEIGHT_PERCENT = 22;
|
||||
public static final short JUSTIFY_CONTENT = 23;
|
||||
public static final short ALIGN_ITEMS = 24;
|
||||
public static final short ALIGN_SELF = 25;
|
||||
public static final short ALIGN_CONTENT = 26;
|
||||
public static final short POSITION_TYPE = 27;
|
||||
public static final short ASPECT_RATIO = 28;
|
||||
public static final short OVERFLOW = 29;
|
||||
public static final short DISPLAY = 30;
|
||||
public static final short MARGIN = 31;
|
||||
public static final short MARGIN_PERCENT = 32;
|
||||
public static final short MARGIN_AUTO = 33;
|
||||
public static final short PADDING = 34;
|
||||
public static final short PADDING_PERCENT = 35;
|
||||
public static final short BORDER = 36;
|
||||
public static final short POSITION = 37;
|
||||
public static final short POSITION_PERCENT = 38;
|
||||
public static final short IS_REFERENCE_BASELINE = 39;
|
||||
}
|
@@ -1,9 +1,8 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc.
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the LICENSE
|
||||
* file in the root directory of this source tree.
|
||||
*
|
||||
*/
|
||||
package com.facebook.yoga;
|
||||
|
||||
|
@@ -1,15 +1,11 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc.
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the LICENSE
|
||||
* file in the root directory of this source tree.
|
||||
*
|
||||
*/
|
||||
package com.facebook.yoga;
|
||||
|
||||
import com.facebook.proguard.annotations.DoNotStrip;
|
||||
|
||||
@DoNotStrip
|
||||
public class YogaValue {
|
||||
static final YogaValue UNDEFINED = new YogaValue(YogaConstants.UNDEFINED, YogaUnit.UNDEFINED);
|
||||
static final YogaValue ZERO = new YogaValue(0, YogaUnit.POINT);
|
||||
@@ -23,7 +19,6 @@ public class YogaValue {
|
||||
this.unit = unit;
|
||||
}
|
||||
|
||||
@DoNotStrip
|
||||
YogaValue(float value, int unit) {
|
||||
this(value, YogaUnit.fromInt(unit));
|
||||
}
|
||||
|
@@ -1,9 +1,8 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc.
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the LICENSE
|
||||
* file in the root directory of this source tree.
|
||||
*
|
||||
*/
|
||||
package com.facebook.yoga;
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
44
java/jni/YGJTypes.cpp
Normal file
44
java/jni/YGJTypes.cpp
Normal file
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the LICENSE
|
||||
* file in the root directory of this source tree.
|
||||
*/
|
||||
#include "YGJTypes.h"
|
||||
|
||||
using facebook::jni::alias_ref;
|
||||
using facebook::jni::local_ref;
|
||||
|
||||
jfloat JYogaNode::baseline(jfloat width, jfloat height) {
|
||||
static auto javaMethod =
|
||||
javaClassLocal()->getMethod<jfloat(jfloat, jfloat)>("baseline");
|
||||
return javaMethod(self(), width, height);
|
||||
}
|
||||
|
||||
jlong JYogaNode::measure(
|
||||
jfloat width,
|
||||
jint widthMode,
|
||||
jfloat height,
|
||||
jint heightMode) {
|
||||
static auto javaMethod =
|
||||
javaClassLocal()->getMethod<jlong(jfloat, jint, jfloat, jint)>("measure");
|
||||
return javaMethod(self(), width, widthMode, height, heightMode);
|
||||
}
|
||||
|
||||
facebook::jni::local_ref<JYogaLogLevel> JYogaLogLevel::fromInt(jint logLevel) {
|
||||
static auto javaMethod =
|
||||
javaClassStatic()->getStaticMethod<alias_ref<JYogaLogLevel>(jint)>(
|
||||
"fromInt");
|
||||
return javaMethod(javaClassStatic(), logLevel);
|
||||
}
|
||||
|
||||
void JYogaLogger::log(
|
||||
facebook::jni::alias_ref<JYogaNode> node,
|
||||
facebook::jni::alias_ref<JYogaLogLevel> logLevel,
|
||||
jstring message) {
|
||||
static auto javaMethod =
|
||||
javaClassLocal()
|
||||
->getMethod<void(
|
||||
alias_ref<JYogaNode>, alias_ref<JYogaLogLevel>, jstring)>("log");
|
||||
javaMethod(self(), node, logLevel, message);
|
||||
}
|
63
java/jni/YGJTypes.h
Normal file
63
java/jni/YGJTypes.h
Normal file
@@ -0,0 +1,63 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the LICENSE
|
||||
* file in the root directory of this source tree.
|
||||
*/
|
||||
#include <fb/fbjni.h>
|
||||
#include <yoga/YGValue.h>
|
||||
#include <yoga/Yoga.h>
|
||||
#include <map>
|
||||
|
||||
using namespace facebook::jni;
|
||||
using namespace std;
|
||||
|
||||
struct JYogaNode : public facebook::jni::JavaClass<JYogaNode> {
|
||||
static constexpr auto kJavaDescriptor = "Lcom/facebook/yoga/YogaNodeJNIBase;";
|
||||
|
||||
jfloat baseline(jfloat width, jfloat height);
|
||||
jlong measure(jfloat width, jint widthMode, jfloat height, jint heightMode);
|
||||
};
|
||||
|
||||
struct JYogaLogLevel : public facebook::jni::JavaClass<JYogaLogLevel> {
|
||||
static constexpr auto kJavaDescriptor = "Lcom/facebook/yoga/YogaLogLevel;";
|
||||
|
||||
static facebook::jni::local_ref<JYogaLogLevel> fromInt(jint);
|
||||
};
|
||||
|
||||
struct JYogaLogger : public facebook::jni::JavaClass<JYogaLogger> {
|
||||
static constexpr auto kJavaDescriptor = "Lcom/facebook/yoga/YogaLogger";
|
||||
|
||||
void log(
|
||||
facebook::jni::alias_ref<JYogaNode>,
|
||||
facebook::jni::alias_ref<JYogaLogLevel>,
|
||||
jstring);
|
||||
};
|
||||
|
||||
class PtrJNodeMap {
|
||||
using JNodeArray = JArrayClass<JYogaNode::javaobject>;
|
||||
std::map<YGNodeRef, size_t> ptrsToIdxs_;
|
||||
alias_ref<JNodeArray> javaNodes_;
|
||||
|
||||
public:
|
||||
PtrJNodeMap() : ptrsToIdxs_{}, javaNodes_{} {}
|
||||
PtrJNodeMap(
|
||||
alias_ref<JArrayLong> nativePointers,
|
||||
alias_ref<JNodeArray> javaNodes)
|
||||
: javaNodes_{javaNodes} {
|
||||
auto pin = nativePointers->pinCritical();
|
||||
auto ptrs = pin.get();
|
||||
for (size_t i = 0, n = pin.size(); i < n; ++i) {
|
||||
ptrsToIdxs_[(YGNodeRef) ptrs[i]] = i;
|
||||
}
|
||||
}
|
||||
|
||||
local_ref<JYogaNode> ref(YGNodeRef node) {
|
||||
auto idx = ptrsToIdxs_.find(node);
|
||||
if (idx == ptrsToIdxs_.end()) {
|
||||
return local_ref<JYogaNode>{};
|
||||
} else {
|
||||
return javaNodes_->getElement(idx->second);
|
||||
}
|
||||
}
|
||||
};
|
@@ -1,10 +1,9 @@
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
* This source code is licensed under the MIT license found in the LICENSE
|
||||
* file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
package com.facebook.proguard.annotations;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
|
500
java/tests/com/facebook/yoga/BatchingAPITests.java
Normal file
500
java/tests/com/facebook/yoga/BatchingAPITests.java
Normal file
@@ -0,0 +1,500 @@
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the LICENSE
|
||||
* file in the root directory of this source tree.
|
||||
*/
|
||||
package com.facebook.yoga;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Parameterized;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
@RunWith(Parameterized.class)
|
||||
public class BatchingAPITests {
|
||||
|
||||
@Parameterized.Parameters(name = "{0}")
|
||||
public static Iterable<TestParametrization.NodeFactory> nodeFactories() {
|
||||
return TestParametrization.nodeFactories();
|
||||
}
|
||||
|
||||
@Parameterized.Parameter public TestParametrization.NodeFactory mNodeFactory;
|
||||
|
||||
@Test
|
||||
public void testStyleInputLayoutDirection() {
|
||||
YogaConfig config = new YogaConfig();
|
||||
final YogaNode root = createNode(config);
|
||||
float[] arr = new float[]{YogaStyleInputs.LAYOUT_DIRECTION, YogaDirection.LTR.intValue()};
|
||||
root.setStyleInputs(arr, 2);
|
||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||
assertEquals(root.getLayoutDirection(), YogaDirection.LTR);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStyleInputFlexDirection() {
|
||||
YogaConfig config = new YogaConfig();
|
||||
final YogaNode root = createNode(config);
|
||||
float[] arr = new float[]{YogaStyleInputs.FLEX_DIRECTION, YogaFlexDirection.ROW.intValue()};
|
||||
root.setStyleInputs(arr, 2);
|
||||
assertEquals(root.getFlexDirection(), YogaFlexDirection.ROW);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStyleInputFlex() {
|
||||
YogaConfig config = new YogaConfig();
|
||||
final YogaNode root = createNode(config);
|
||||
float[] arr = new float[]{YogaStyleInputs.FLEX, 5f};
|
||||
root.setStyleInputs(arr, 2);
|
||||
assertEquals(root.getFlex(), 5f, 0.0f);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStyleInputFlexGrow() {
|
||||
YogaConfig config = new YogaConfig();
|
||||
final YogaNode root = createNode(config);
|
||||
float[] arr = new float[]{YogaStyleInputs.FLEX_GROW, 5f};
|
||||
root.setStyleInputs(arr, 2);
|
||||
assertEquals(root.getFlexGrow(), 5f, 0.0f);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStyleInputFlexShrink() {
|
||||
YogaConfig config = new YogaConfig();
|
||||
final YogaNode root = createNode(config);
|
||||
float[] arr = new float[]{YogaStyleInputs.FLEX_SHRINK, 5f};
|
||||
root.setStyleInputs(arr, 2);
|
||||
assertEquals(root.getFlexShrink(), 5f, 0.0f);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStyleInputFlexBasis() {
|
||||
YogaConfig config = new YogaConfig();
|
||||
final YogaNode root = createNode(config);
|
||||
float[] arr = new float[]{YogaStyleInputs.FLEX_BASIS, 5f};
|
||||
root.setStyleInputs(arr, 2);
|
||||
assertEquals(root.getFlexBasis(), new YogaValue(5f, YogaUnit.POINT));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStyleInputFlexBasisPercent() {
|
||||
YogaConfig config = new YogaConfig();
|
||||
final YogaNode root = createNode(config);
|
||||
float[] arr = new float[]{YogaStyleInputs.FLEX_BASIS_PERCENT, 5f};
|
||||
root.setStyleInputs(arr, 2);
|
||||
assertEquals(root.getFlexBasis(), new YogaValue(5f, YogaUnit.PERCENT));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStyleInputFlexBasisAuto() {
|
||||
YogaConfig config = new YogaConfig();
|
||||
final YogaNode root = createNode(config);
|
||||
float[] arr = new float[]{YogaStyleInputs.FLEX_BASIS_AUTO};
|
||||
root.setStyleInputs(arr, 1);
|
||||
assertEquals(root.getFlexBasis(), YogaValue.AUTO);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStyleInputFlexWrap() {
|
||||
YogaConfig config = new YogaConfig();
|
||||
final YogaNode root = createNode(config);
|
||||
float[] arr = new float[]{YogaStyleInputs.FLEX_WRAP, YogaWrap.WRAP.intValue()};
|
||||
root.setStyleInputs(arr, 2);
|
||||
assertEquals(root.getWrap(), YogaWrap.WRAP);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStyleInputWidth() {
|
||||
YogaConfig config = new YogaConfig();
|
||||
final YogaNode root = createNode(config);
|
||||
float[] arr = new float[]{YogaStyleInputs.WIDTH, 50f};
|
||||
root.setStyleInputs(arr, 2);
|
||||
assertEquals(root.getWidth(), new YogaValue(50f, YogaUnit.POINT));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStyleInputWidthPercent() {
|
||||
YogaConfig config = new YogaConfig();
|
||||
final YogaNode root = createNode(config);
|
||||
float[] arr = new float[]{YogaStyleInputs.WIDTH_PERCENT, 5f};
|
||||
root.setStyleInputs(arr, 2);
|
||||
assertEquals(root.getWidth(), new YogaValue(5f, YogaUnit.PERCENT));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStyleInputWidthAuto() {
|
||||
YogaConfig config = new YogaConfig();
|
||||
final YogaNode root = createNode(config);
|
||||
float[] arr = new float[]{YogaStyleInputs.WIDTH_AUTO};
|
||||
root.setStyleInputs(arr, 1);
|
||||
assertEquals(root.getWidth(), YogaValue.AUTO);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStyleInputMinWidth() {
|
||||
YogaConfig config = new YogaConfig();
|
||||
final YogaNode root = createNode(config);
|
||||
float[] arr = new float[]{YogaStyleInputs.MIN_WIDTH, 50f};
|
||||
root.setStyleInputs(arr, 2);
|
||||
assertEquals(root.getMinWidth(), new YogaValue(50f, YogaUnit.POINT));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStyleInputMinWidthPercent() {
|
||||
YogaConfig config = new YogaConfig();
|
||||
final YogaNode root = createNode(config);
|
||||
float[] arr = new float[]{YogaStyleInputs.MIN_WIDTH_PERCENT, 5f};
|
||||
root.setStyleInputs(arr, 2);
|
||||
assertEquals(root.getMinWidth(), new YogaValue(5f, YogaUnit.PERCENT));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStyleInputMaxWidth() {
|
||||
YogaConfig config = new YogaConfig();
|
||||
final YogaNode root = createNode(config);
|
||||
float[] arr = new float[]{YogaStyleInputs.MAX_WIDTH, 50f};
|
||||
root.setStyleInputs(arr, 2);
|
||||
assertEquals(root.getMaxWidth(), new YogaValue(50f, YogaUnit.POINT));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStyleInputMaxWidthPercent() {
|
||||
YogaConfig config = new YogaConfig();
|
||||
final YogaNode root = createNode(config);
|
||||
float[] arr = new float[]{YogaStyleInputs.MAX_WIDTH_PERCENT, 5f};
|
||||
root.setStyleInputs(arr, 2);
|
||||
assertEquals(root.getMaxWidth(), new YogaValue(5f, YogaUnit.PERCENT));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStyleInputHeight() {
|
||||
YogaConfig config = new YogaConfig();
|
||||
final YogaNode root = createNode(config);
|
||||
float[] arr = new float[]{YogaStyleInputs.HEIGHT, 50f};
|
||||
root.setStyleInputs(arr, 2);
|
||||
assertEquals(root.getHeight(), new YogaValue(50f, YogaUnit.POINT));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStyleInputHeightPercent() {
|
||||
YogaConfig config = new YogaConfig();
|
||||
final YogaNode root = createNode(config);
|
||||
float[] arr = new float[]{YogaStyleInputs.HEIGHT_PERCENT, 5f};
|
||||
root.setStyleInputs(arr, 2);
|
||||
assertEquals(root.getHeight(), new YogaValue(5f, YogaUnit.PERCENT));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStyleInputHeightAuto() {
|
||||
YogaConfig config = new YogaConfig();
|
||||
final YogaNode root = createNode(config);
|
||||
float[] arr = new float[]{YogaStyleInputs.HEIGHT_AUTO};
|
||||
root.setStyleInputs(arr, 1);
|
||||
assertEquals(root.getHeight(), YogaValue.AUTO);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStyleInputMinHeight() {
|
||||
YogaConfig config = new YogaConfig();
|
||||
final YogaNode root = createNode(config);
|
||||
float[] arr = new float[]{YogaStyleInputs.MIN_HEIGHT, 50f};
|
||||
root.setStyleInputs(arr, 2);
|
||||
assertEquals(root.getMinHeight(), new YogaValue(50f, YogaUnit.POINT));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStyleInputMinHeightPercent() {
|
||||
YogaConfig config = new YogaConfig();
|
||||
final YogaNode root = createNode(config);
|
||||
float[] arr = new float[]{YogaStyleInputs.MIN_HEIGHT_PERCENT, 5f};
|
||||
root.setStyleInputs(arr, 2);
|
||||
assertEquals(root.getMinHeight(), new YogaValue(5f, YogaUnit.PERCENT));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStyleInputMaxHeight() {
|
||||
YogaConfig config = new YogaConfig();
|
||||
final YogaNode root = createNode(config);
|
||||
float[] arr = new float[]{YogaStyleInputs.MAX_HEIGHT, 50f};
|
||||
root.setStyleInputs(arr, 2);
|
||||
assertEquals(root.getMaxHeight(), new YogaValue(50f, YogaUnit.POINT));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStyleInputMaxHeightPercent() {
|
||||
YogaConfig config = new YogaConfig();
|
||||
final YogaNode root = createNode(config);
|
||||
float[] arr = new float[]{YogaStyleInputs.MAX_HEIGHT_PERCENT, 5f};
|
||||
root.setStyleInputs(arr, 2);
|
||||
assertEquals(root.getMaxHeight(), new YogaValue(5f, YogaUnit.PERCENT));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStyleInputJustiyContent() {
|
||||
YogaConfig config = new YogaConfig();
|
||||
final YogaNode root = createNode(config);
|
||||
float[] arr = new float[]{YogaStyleInputs.JUSTIFY_CONTENT, YogaJustify.CENTER.intValue()};
|
||||
root.setStyleInputs(arr, 2);
|
||||
assertEquals(root.getJustifyContent(), YogaJustify.CENTER);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStyleInputAlignItems() {
|
||||
YogaConfig config = new YogaConfig();
|
||||
final YogaNode root = createNode(config);
|
||||
float[] arr = new float[]{YogaStyleInputs.ALIGN_ITEMS, YogaAlign.BASELINE.intValue()};
|
||||
root.setStyleInputs(arr, 2);
|
||||
assertEquals(root.getAlignItems(), YogaAlign.BASELINE);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStyleInputAlignSelf() {
|
||||
YogaConfig config = new YogaConfig();
|
||||
final YogaNode root = createNode(config);
|
||||
float[] arr = new float[]{YogaStyleInputs.ALIGN_SELF, YogaAlign.BASELINE.intValue()};
|
||||
root.setStyleInputs(arr, 2);
|
||||
assertEquals(root.getAlignSelf(), YogaAlign.BASELINE);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStyleInputAlignContent() {
|
||||
YogaConfig config = new YogaConfig();
|
||||
final YogaNode root = createNode(config);
|
||||
float[] arr = new float[]{YogaStyleInputs.ALIGN_CONTENT, YogaAlign.BASELINE.intValue()};
|
||||
root.setStyleInputs(arr, 2);
|
||||
assertEquals(root.getAlignContent(), YogaAlign.BASELINE);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStyleInputPositionType() {
|
||||
YogaConfig config = new YogaConfig();
|
||||
final YogaNode root = createNode(config);
|
||||
float[] arr = new float[]{YogaStyleInputs.POSITION_TYPE, YogaPositionType.ABSOLUTE.intValue()};
|
||||
root.setStyleInputs(arr, 2);
|
||||
assertEquals(root.getPositionType(), YogaPositionType.ABSOLUTE);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStyleInputAspectRatio() {
|
||||
YogaConfig config = new YogaConfig();
|
||||
final YogaNode root = createNode(config);
|
||||
float[] arr = new float[]{YogaStyleInputs.ASPECT_RATIO, 2f};
|
||||
root.setStyleInputs(arr, 2);
|
||||
assertEquals(root.getAspectRatio(), 2f, 0.0f);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStyleInputOverflow() {
|
||||
YogaConfig config = new YogaConfig();
|
||||
final YogaNode root = createNode(config);
|
||||
float[] arr = new float[]{YogaStyleInputs.OVERFLOW, YogaOverflow.HIDDEN.intValue()};
|
||||
root.setStyleInputs(arr, 2);
|
||||
assertEquals(root.getOverflow(), YogaOverflow.HIDDEN);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStyleInputDisplay() {
|
||||
YogaConfig config = new YogaConfig();
|
||||
final YogaNode root = createNode(config);
|
||||
float[] arr = new float[]{YogaStyleInputs.DISPLAY, YogaDisplay.NONE.intValue()};
|
||||
root.setStyleInputs(arr, 2);
|
||||
assertEquals(root.getDisplay(), YogaDisplay.NONE);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStyleInputMargin() {
|
||||
YogaConfig config = new YogaConfig();
|
||||
final YogaNode root = createNode(config);
|
||||
float[] arr = new float[]{YogaStyleInputs.MARGIN, YogaEdge.LEFT.intValue(), 12f};
|
||||
root.setStyleInputs(arr, 3);
|
||||
assertEquals(root.getMargin(YogaEdge.LEFT), new YogaValue(12f, YogaUnit.POINT));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStyleInputMarginPercent() {
|
||||
YogaConfig config = new YogaConfig();
|
||||
final YogaNode root = createNode(config);
|
||||
float[] arr = new float[]{YogaStyleInputs.MARGIN_PERCENT, YogaEdge.LEFT.intValue(), 12f};
|
||||
root.setStyleInputs(arr, 3);
|
||||
assertEquals(root.getMargin(YogaEdge.LEFT), new YogaValue(12f, YogaUnit.PERCENT));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStyleInputMarginAuto() {
|
||||
YogaConfig config = new YogaConfig();
|
||||
final YogaNode root = createNode(config);
|
||||
float[] arr = new float[]{YogaStyleInputs.MARGIN_AUTO, YogaEdge.LEFT.intValue()};
|
||||
root.setStyleInputs(arr, 2);
|
||||
assertEquals(root.getMargin(YogaEdge.LEFT), YogaValue.AUTO);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStyleInputPadding() {
|
||||
YogaConfig config = new YogaConfig();
|
||||
final YogaNode root = createNode(config);
|
||||
float[] arr = new float[]{YogaStyleInputs.PADDING, YogaEdge.LEFT.intValue(), 12f};
|
||||
root.setStyleInputs(arr, 3);
|
||||
assertEquals(root.getPadding(YogaEdge.LEFT), new YogaValue(12f, YogaUnit.POINT));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStyleInputPaddingPercent() {
|
||||
YogaConfig config = new YogaConfig();
|
||||
final YogaNode root = createNode(config);
|
||||
float[] arr = new float[]{YogaStyleInputs.PADDING_PERCENT, YogaEdge.LEFT.intValue(), 12f};
|
||||
root.setStyleInputs(arr, 3);
|
||||
assertEquals(root.getPadding(YogaEdge.LEFT), new YogaValue(12f, YogaUnit.PERCENT));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStyleInputBorder() {
|
||||
YogaConfig config = new YogaConfig();
|
||||
final YogaNode root = createNode(config);
|
||||
float[] arr = new float[]{YogaStyleInputs.BORDER, YogaEdge.LEFT.intValue(), 12f};
|
||||
root.setStyleInputs(arr, 3);
|
||||
assertEquals(root.getBorder(YogaEdge.LEFT), 12f, 0.0f);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStyleInputPosition() {
|
||||
YogaConfig config = new YogaConfig();
|
||||
final YogaNode root = createNode(config);
|
||||
float[] arr = new float[]{YogaStyleInputs.POSITION, YogaEdge.LEFT.intValue(), 12f};
|
||||
root.setStyleInputs(arr, 3);
|
||||
assertEquals(root.getPosition(YogaEdge.LEFT), new YogaValue(12f, YogaUnit.POINT));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStyleInputPositionPercent() {
|
||||
YogaConfig config = new YogaConfig();
|
||||
final YogaNode root = createNode(config);
|
||||
float[] arr = new float[]{YogaStyleInputs.POSITION_PERCENT, YogaEdge.LEFT.intValue(), 12f};
|
||||
root.setStyleInputs(arr, 3);
|
||||
assertEquals(root.getPosition(YogaEdge.LEFT), new YogaValue(12f, YogaUnit.PERCENT));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStyleInputIsReferenceBaseline() {
|
||||
YogaConfig config = new YogaConfig();
|
||||
final YogaNode root = createNode(config);
|
||||
float[] arr = new float[]{YogaStyleInputs.IS_REFERENCE_BASELINE, 1f};
|
||||
root.setStyleInputs(arr, 2);
|
||||
assertEquals(root.isReferenceBaseline(), true);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStyleInputs() {
|
||||
YogaConfig config = new YogaConfig();
|
||||
final YogaNode root = createNode(config);
|
||||
int count = 0;
|
||||
float[] arr = new float[100];
|
||||
arr[count++] = YogaStyleInputs.FLEX_DIRECTION;
|
||||
arr[count++] = YogaFlexDirection.ROW.intValue();
|
||||
|
||||
arr[count++] = YogaStyleInputs.FLEX;
|
||||
arr[count++] = 5f;
|
||||
|
||||
arr[count++] = YogaStyleInputs.FLEX_GROW;
|
||||
arr[count++] = 5f;
|
||||
|
||||
arr[count++] = YogaStyleInputs.FLEX_SHRINK;
|
||||
arr[count++] = 5f;
|
||||
|
||||
arr[count++] = YogaStyleInputs.FLEX_BASIS_AUTO;
|
||||
|
||||
arr[count++] = YogaStyleInputs.FLEX_WRAP;
|
||||
arr[count++] = YogaWrap.WRAP.intValue();
|
||||
|
||||
arr[count++] = YogaStyleInputs.WIDTH;
|
||||
arr[count++] = 50f;
|
||||
|
||||
arr[count++] = YogaStyleInputs.MIN_WIDTH;
|
||||
arr[count++] = 50f;
|
||||
|
||||
arr[count++] = YogaStyleInputs.MAX_WIDTH;
|
||||
arr[count++] = 50f;
|
||||
|
||||
arr[count++] = YogaStyleInputs.HEIGHT;
|
||||
arr[count++] = 5f;
|
||||
|
||||
arr[count++] = YogaStyleInputs.MIN_HEIGHT;
|
||||
arr[count++] = 50f;
|
||||
|
||||
arr[count++] = YogaStyleInputs.MAX_HEIGHT;
|
||||
arr[count++] = 50f;
|
||||
|
||||
arr[count++] = YogaStyleInputs.JUSTIFY_CONTENT;
|
||||
arr[count++] = YogaJustify.CENTER.intValue();
|
||||
|
||||
arr[count++] = YogaStyleInputs.ALIGN_ITEMS;
|
||||
arr[count++] = YogaAlign.BASELINE.intValue();
|
||||
|
||||
arr[count++] = YogaStyleInputs.ALIGN_SELF;
|
||||
arr[count++] = YogaAlign.BASELINE.intValue();
|
||||
|
||||
arr[count++] = YogaStyleInputs.ALIGN_CONTENT;
|
||||
arr[count++] = YogaAlign.BASELINE.intValue();
|
||||
|
||||
arr[count++] = YogaStyleInputs.POSITION_TYPE;
|
||||
arr[count++] = YogaPositionType.ABSOLUTE.intValue();
|
||||
|
||||
arr[count++] = YogaStyleInputs.ASPECT_RATIO;
|
||||
arr[count++] = 2f;
|
||||
|
||||
arr[count++] = YogaStyleInputs.OVERFLOW;
|
||||
arr[count++] = YogaOverflow.HIDDEN.intValue();
|
||||
|
||||
arr[count++] = YogaStyleInputs.DISPLAY;
|
||||
arr[count++] = YogaDisplay.NONE.intValue();
|
||||
|
||||
arr[count++] = YogaStyleInputs.MARGIN_AUTO;
|
||||
arr[count++] = YogaEdge.LEFT.intValue();
|
||||
|
||||
arr[count++] = YogaStyleInputs.PADDING;
|
||||
arr[count++] = YogaEdge.LEFT.intValue();
|
||||
arr[count++] = 12f;
|
||||
|
||||
arr[count++] = YogaStyleInputs.BORDER;
|
||||
arr[count++] = YogaEdge.LEFT.intValue();
|
||||
arr[count++] = 12f;
|
||||
|
||||
arr[count++] = YogaStyleInputs.POSITION_PERCENT;
|
||||
arr[count++] = YogaEdge.LEFT.intValue();
|
||||
arr[count++] = 12f;
|
||||
|
||||
arr[count++] = YogaStyleInputs.IS_REFERENCE_BASELINE;
|
||||
arr[count++] = 1f;
|
||||
|
||||
root.setStyleInputs(arr, count);
|
||||
|
||||
assertEquals(root.getFlexDirection(), YogaFlexDirection.ROW);
|
||||
assertEquals(root.getFlex(), 5f, 0.0f);
|
||||
assertEquals(root.getFlexGrow(), 5f, 0.0f);
|
||||
assertEquals(root.getFlexShrink(), 5f, 0.0f);
|
||||
assertEquals(root.getFlexBasis(), YogaValue.AUTO);
|
||||
assertEquals(root.getWrap(), YogaWrap.WRAP);
|
||||
assertEquals(root.getWidth(), new YogaValue(50f, YogaUnit.POINT));
|
||||
assertEquals(root.getMinWidth(), new YogaValue(50f, YogaUnit.POINT));
|
||||
assertEquals(root.getMaxWidth(), new YogaValue(50f, YogaUnit.POINT));
|
||||
assertEquals(root.getHeight(), new YogaValue(5f, YogaUnit.POINT));
|
||||
assertEquals(root.getMinHeight(), new YogaValue(50f, YogaUnit.POINT));
|
||||
assertEquals(root.getMaxHeight(), new YogaValue(50f, YogaUnit.POINT));
|
||||
assertEquals(root.getJustifyContent(), YogaJustify.CENTER);
|
||||
assertEquals(root.getAlignItems(), YogaAlign.BASELINE);
|
||||
assertEquals(root.getAlignSelf(), YogaAlign.BASELINE);
|
||||
assertEquals(root.getAlignContent(), YogaAlign.BASELINE);
|
||||
assertEquals(root.getPositionType(), YogaPositionType.ABSOLUTE);
|
||||
assertEquals(root.getAspectRatio(), 2f, 0.0f);
|
||||
assertEquals(root.getOverflow(), YogaOverflow.HIDDEN);
|
||||
assertEquals(root.getDisplay(), YogaDisplay.NONE);
|
||||
assertEquals(root.getMargin(YogaEdge.LEFT), YogaValue.AUTO);
|
||||
assertEquals(root.getPadding(YogaEdge.LEFT), new YogaValue(12f, YogaUnit.POINT));
|
||||
assertEquals(root.getBorder(YogaEdge.LEFT), 12f, 0.0f);
|
||||
assertEquals(root.getPosition(YogaEdge.LEFT), new YogaValue(12f, YogaUnit.PERCENT));
|
||||
assertEquals(root.isReferenceBaseline(), true);
|
||||
}
|
||||
|
||||
private YogaNode createNode(YogaConfig config) {
|
||||
return mNodeFactory.create(config);
|
||||
}
|
||||
}
|
@@ -1,9 +1,8 @@
|
||||
/*
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the LICENSE
|
||||
* file in the root directory of this source tree.
|
||||
*
|
||||
*/
|
||||
package com.facebook.yoga;
|
||||
|
||||
@@ -15,12 +14,12 @@ public class TestParametrization {
|
||||
NodeFactory nodeFactory = new NodeFactory() {
|
||||
@Override
|
||||
public YogaNode create() {
|
||||
return new YogaNode();
|
||||
return YogaNode.create();
|
||||
}
|
||||
|
||||
@Override
|
||||
public YogaNode create(YogaConfig config) {
|
||||
return new YogaNode(config);
|
||||
return YogaNode.create(config);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -1,10 +1,9 @@
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
* This source code is licensed under the MIT license found in the LICENSE
|
||||
* file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
// @Generated by gentest/gentest.rb from gentest/fixtures/YGAbsolutePositionTest.html
|
||||
|
||||
package com.facebook.yoga;
|
||||
|
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
* This source code is licensed under the MIT license found in the LICENSE
|
||||
* file in the root directory of this source tree.
|
||||
*/
|
||||
package com.facebook.yoga;
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user