Compare commits
158 Commits
1.12.0-pre
...
1.15.0
Author | SHA1 | Date | |
---|---|---|---|
|
26dbe8b4ff | ||
|
a5c2f7f27a | ||
|
10811e1a94 | ||
|
10f4bceac0 | ||
|
47717324d4 | ||
|
1043c35f2b | ||
|
fde89b056d | ||
|
a08a57b33c | ||
|
31de91bbac | ||
|
e6e224ce48 | ||
|
a04a6b5e8f | ||
|
442d84ccfc | ||
|
4a2ccc658e | ||
|
58622fa747 | ||
|
90cded3819 | ||
|
d1e188341b | ||
|
0f2350308e | ||
|
9b120eded9 | ||
|
a218880216 | ||
|
1a2802028b | ||
|
a37b286bae | ||
|
dcfdb955b3 | ||
|
72cefead02 | ||
|
884e064a99 | ||
|
3ed9bec05c | ||
|
dadf0473b7 | ||
|
947230958d | ||
|
095c991b85 | ||
|
825da1e868 | ||
|
5a25805cb5 | ||
|
adff8d96dd | ||
|
8c270e68cc | ||
|
a2aa1b7fca | ||
|
ae956f06fb | ||
|
8c0eed3c75 | ||
|
4e4ef06de1 | ||
|
a53c14dc75 | ||
|
c99fc9c4da | ||
|
2fb857d73d | ||
|
e6dfe04388 | ||
|
5e40e4b682 | ||
|
7c891db9af | ||
|
6d916ab063 | ||
|
59d680f4e9 | ||
|
be305b5d0f | ||
|
d676d917e3 | ||
|
838fc3f019 | ||
|
296982a29e | ||
|
1d0668692b | ||
|
39e512f691 | ||
|
0f250490d4 | ||
|
eeae39d707 | ||
|
ce517689ff | ||
|
9c82ba783f | ||
|
1c8e8d3aec | ||
|
cc27d85110 | ||
|
cd5324378d | ||
|
c6ae314202 | ||
|
73224c62b5 | ||
|
2c6a4485f5 | ||
|
cf005df828 | ||
|
f539d68049 | ||
|
39996512fc | ||
|
2dc5a16d1f | ||
|
d667ebd66e | ||
|
2b8217ce8d | ||
|
9dac56e824 | ||
|
a7e8aec3d9 | ||
|
6b5bf570c8 | ||
|
a130ac2f9c | ||
|
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 |
@@ -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
|
||||
|
@@ -1,5 +1,6 @@
|
||||
language: java
|
||||
os: linux
|
||||
dist: trusty
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
|
22
BUCK
22
BUCK
@@ -9,21 +9,17 @@ 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"]),
|
||||
header_namespace = "",
|
||||
exported_headers = subdir_glob([("", "yoga/*.h")]),
|
||||
compiler_flags = COMPILER_FLAGS,
|
||||
srcs = glob(["yoga/**/*.cpp"]),
|
||||
compiler_flags = LIBRARY_COMPILER_FLAGS,
|
||||
public_include_directories = ["."],
|
||||
raw_headers = glob(["yoga/**/*.h"]),
|
||||
soname = "libyogacore.$(ext)",
|
||||
tests = [":YogaTests"],
|
||||
visibility = ["PUBLIC"],
|
||||
@@ -34,14 +30,15 @@ yoga_cxx_library(
|
||||
|
||||
yoga_cxx_library(
|
||||
name = "yogaForDebug",
|
||||
srcs = glob(["yoga/*.cpp"]),
|
||||
header_namespace = "",
|
||||
exported_headers = subdir_glob([("", "yoga/*.h")]),
|
||||
srcs = glob(["yoga/**/*.cpp"]),
|
||||
compiler_flags = TEST_COMPILER_FLAGS,
|
||||
public_include_directories = ["."],
|
||||
raw_headers = glob(["yoga/**/*.h"]),
|
||||
soname = "libyogacore.$(ext)",
|
||||
tests = [":YogaTests"],
|
||||
visibility = ["PUBLIC"],
|
||||
deps = [
|
||||
":yoga",
|
||||
yoga_dep("lib/fb:ndklog"),
|
||||
],
|
||||
)
|
||||
@@ -55,6 +52,7 @@ yoga_cxx_test(
|
||||
visibility = ["PUBLIC"],
|
||||
deps = [
|
||||
":yogaForDebug",
|
||||
yoga_dep("testutil:testutil"),
|
||||
GTEST_TARGET,
|
||||
],
|
||||
)
|
||||
|
@@ -9,7 +9,9 @@ cmake_minimum_required(VERSION 3.4.1)
|
||||
|
||||
set(CMAKE_VERBOSE_MAKEFILE on)
|
||||
|
||||
file(GLOB yogacore_SRC yoga/*.cpp)
|
||||
file(GLOB_RECURSE yogacore_SRC yoga/*.cpp)
|
||||
add_library(yogacore STATIC ${yogacore_SRC})
|
||||
|
||||
target_include_directories(yogacore PUBLIC .)
|
||||
target_link_libraries(yogacore android log)
|
||||
set_target_properties(yogacore PROPERTIES CXX_STANDARD 11)
|
||||
|
@@ -1,3 +1,77 @@
|
||||
# Code of Conduct
|
||||
|
||||
Facebook has adopted a Code of Conduct that we expect project participants to adhere to. Please [read the full text](https://code.fb.com/codeofconduct/) so that you can understand what actions will and will not be tolerated.
|
||||
## Our Pledge
|
||||
|
||||
In the interest of fostering an open and welcoming environment, we as
|
||||
contributors and maintainers pledge to make participation in our project and
|
||||
our community a harassment-free experience for everyone, regardless of age, body
|
||||
size, disability, ethnicity, sex characteristics, gender identity and expression,
|
||||
level of experience, education, socio-economic status, nationality, personal
|
||||
appearance, race, religion, or sexual identity and orientation.
|
||||
|
||||
## Our Standards
|
||||
|
||||
Examples of behavior that contributes to creating a positive environment
|
||||
include:
|
||||
|
||||
* Using welcoming and inclusive language
|
||||
* Being respectful of differing viewpoints and experiences
|
||||
* Gracefully accepting constructive criticism
|
||||
* Focusing on what is best for the community
|
||||
* Showing empathy towards other community members
|
||||
|
||||
Examples of unacceptable behavior by participants include:
|
||||
|
||||
* The use of sexualized language or imagery and unwelcome sexual attention or
|
||||
advances
|
||||
* Trolling, insulting/derogatory comments, and personal or political attacks
|
||||
* Public or private harassment
|
||||
* Publishing others' private information, such as a physical or electronic
|
||||
address, without explicit permission
|
||||
* Other conduct which could reasonably be considered inappropriate in a
|
||||
professional setting
|
||||
|
||||
## Our Responsibilities
|
||||
|
||||
Project maintainers are responsible for clarifying the standards of acceptable
|
||||
behavior and are expected to take appropriate and fair corrective action in
|
||||
response to any instances of unacceptable behavior.
|
||||
|
||||
Project maintainers have the right and responsibility to remove, edit, or
|
||||
reject comments, commits, code, wiki edits, issues, and other contributions
|
||||
that are not aligned to this Code of Conduct, or to ban temporarily or
|
||||
permanently any contributor for other behaviors that they deem inappropriate,
|
||||
threatening, offensive, or harmful.
|
||||
|
||||
## Scope
|
||||
|
||||
This Code of Conduct applies within all project spaces, and it also applies when
|
||||
an individual is representing the project or its community in public spaces.
|
||||
Examples of representing a project or community include using an official
|
||||
project e-mail address, posting via an official social media account, or acting
|
||||
as an appointed representative at an online or offline event. Representation of
|
||||
a project may be further defined and clarified by project maintainers.
|
||||
|
||||
## Enforcement
|
||||
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
||||
reported by contacting the project team at <opensource-conduct@fb.com>. All
|
||||
complaints will be reviewed and investigated and will result in a response that
|
||||
is deemed necessary and appropriate to the circumstances. The project team is
|
||||
obligated to maintain confidentiality with regard to the reporter of an incident.
|
||||
Further details of specific enforcement policies may be posted separately.
|
||||
|
||||
Project maintainers who do not follow or enforce the Code of Conduct in good
|
||||
faith may face temporary or permanent repercussions as determined by other
|
||||
members of the project's leadership.
|
||||
|
||||
## Attribution
|
||||
|
||||
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
||||
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
|
||||
|
||||
[homepage]: https://www.contributor-covenant.org
|
||||
|
||||
For answers to common questions about this code of conduct, see
|
||||
https://www.contributor-covenant.org/faq
|
||||
|
||||
|
@@ -1,7 +1,7 @@
|
||||
# Yoga [](http://cocoapods.org/pods/YogaKit) [](https://www.npmjs.com/package/yoga-layout) [](https://bintray.com/facebook/maven/com.facebook.yoga%3Ayoga/_latestVersion) [](https://www.nuget.org/packages/Facebook.Yoga)
|
||||
|
||||
## Building
|
||||
Yoga builds with [buck](https://buckbuild.com). Make sure you install buck before contributing to Yoga. Yoga's main implementation is in C, with bindings to supported languages and frameworks. When making changes to Yoga please ensure the changes are also propagated to these bindings when applicable.
|
||||
Yoga builds with [buck](https://buckbuild.com). Make sure you install buck before contributing to Yoga. Yoga's main implementation is in C++, with bindings to supported languages and frameworks. When making changes to Yoga please ensure the changes are also propagated to these bindings when applicable.
|
||||
|
||||
## Testing
|
||||
For testing we rely on [gtest](https://github.com/google/googletest) as a submodule. After cloning Yoga run `git submodule init` followed by `git submodule update`.
|
||||
|
5212
ReactYoga.xcodeproj/project.pbxproj
Normal file
5212
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.12.0-pre.1'
|
||||
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.12.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 (YGNodeHasMeasureFunc(node)) {
|
||||
if (!YGNodeHasMeasureFunc(node)) {
|
||||
YGNodeSetMeasureFunc(node, YGMeasureView);
|
||||
}
|
||||
|
||||
|
@@ -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;
|
||||
|
@@ -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,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
|
||||
|
@@ -12,7 +12,7 @@ load(
|
||||
"yoga_dep",
|
||||
)
|
||||
|
||||
COMPILER_FLAGS = BASE_COMPILER_FLAGS + ["-std=c++14"]
|
||||
COMPILER_FLAGS = BASE_COMPILER_FLAGS + ["-std=c++11"]
|
||||
|
||||
fb_native.csharp_library(
|
||||
name = "yogalibnet46",
|
||||
|
@@ -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);
|
||||
});
|
||||
}
|
||||
@@ -157,9 +156,9 @@ function setupTestTree(e, parent, node, genericNode, nodeName, parentName, index
|
||||
style == 'width' ||
|
||||
style == 'height')) {
|
||||
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':
|
||||
defaultStyle = new Set(['undefined']);
|
||||
break;
|
||||
|
||||
case 'min-height':
|
||||
case 'min-width':
|
||||
defaultStyle = new Set(['0', '0px', 'auto']);
|
||||
break;
|
||||
|
||||
default:
|
||||
var node = document.getElementById('default');
|
||||
defaultStyle = new Set([getComputedStyle(node, null)[style]]);
|
||||
break;
|
||||
}
|
||||
DEFAULT_STYLES.set(style, defaultStyle);
|
||||
}
|
||||
switch (style) {
|
||||
case 'left':
|
||||
case 'top':
|
||||
case 'right':
|
||||
case 'bottom':
|
||||
case 'start':
|
||||
case 'end':
|
||||
return 'undefined';
|
||||
}
|
||||
var node = document.getElementById('default');
|
||||
return getComputedStyle(node, null).getPropertyValue(style);
|
||||
return DEFAULT_STYLES.get(style).has(value);
|
||||
}
|
||||
|
||||
function getRoundedSize(node) {
|
||||
|
@@ -9,7 +9,7 @@
|
||||
|
||||
org.gradle.jvmargs=-Xmx1536M
|
||||
|
||||
VERSION_NAME=1.13.1-SNAPSHOT
|
||||
VERSION_NAME=1.16.0
|
||||
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
|
||||
|
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
|
17
java/BUCK
17
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",
|
||||
@@ -18,7 +23,7 @@ yoga_cxx_library(
|
||||
"-Wall",
|
||||
"-Werror",
|
||||
"-Os",
|
||||
"-std=c++14",
|
||||
"-std=c++11",
|
||||
],
|
||||
platforms = ANDROID,
|
||||
preprocessor_flags = [
|
||||
@@ -45,6 +50,7 @@ yoga_java_library(
|
||||
visibility = ["PUBLIC"],
|
||||
deps = [
|
||||
":jni",
|
||||
FBJNI_JAVA_TARGET,
|
||||
INFER_ANNOTATIONS_TARGET,
|
||||
JSR_305_TARGET,
|
||||
PROGRUARD_ANNOTATIONS_TARGET,
|
||||
@@ -55,11 +61,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,
|
||||
],
|
||||
)
|
||||
|
@@ -62,6 +62,7 @@ dependencies {
|
||||
compileOnly project(':yoga:proguard-annotations')
|
||||
implementation 'com.facebook.soloader:soloader:0.5.1'
|
||||
testImplementation 'junit:junit:4.12'
|
||||
testCompile project(':testutil')
|
||||
}
|
||||
|
||||
task sourcesJar(type: Jar) {
|
||||
|
42
java/com/facebook/yoga/LayoutPassReason.java
Normal file
42
java/com/facebook/yoga/LayoutPassReason.java
Normal file
@@ -0,0 +1,42 @@
|
||||
/**
|
||||
* 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;
|
||||
|
||||
public enum LayoutPassReason {
|
||||
INITIAL(0),
|
||||
ABS_LAYOUT(1),
|
||||
STRETCH(2),
|
||||
MULTILINE_STRETCH(3),
|
||||
FLEX_LAYOUT(4),
|
||||
MEASURE(5),
|
||||
ABS_MEASURE(6),
|
||||
FLEX_MEASURE(7);
|
||||
|
||||
private final int mIntValue;
|
||||
|
||||
LayoutPassReason(int intValue) {
|
||||
mIntValue = intValue;
|
||||
}
|
||||
|
||||
public int intValue() {
|
||||
return mIntValue;
|
||||
}
|
||||
|
||||
public static LayoutPassReason fromInt(int value) {
|
||||
switch (value) {
|
||||
case 0: return INITIAL;
|
||||
case 1: return ABS_LAYOUT;
|
||||
case 2: return STRETCH;
|
||||
case 3: return MULTILINE_STRETCH;
|
||||
case 4: return FLEX_LAYOUT;
|
||||
case 5: return MEASURE;
|
||||
case 6: return ABS_MEASURE;
|
||||
case 7: return FLEX_MEASURE;
|
||||
default: throw new IllegalArgumentException("Unknown enum value: " + value);
|
||||
}
|
||||
}
|
||||
}
|
7
java/com/facebook/yoga/YogaConfigFactory.java
Normal file
7
java/com/facebook/yoga/YogaConfigFactory.java
Normal file
@@ -0,0 +1,7 @@
|
||||
package com.facebook.yoga;
|
||||
|
||||
public abstract class YogaConfigFactory {
|
||||
public static YogaConfig create() {
|
||||
return new YogaConfig();
|
||||
}
|
||||
}
|
34
java/com/facebook/yoga/YogaLayoutType.java
Normal file
34
java/com/facebook/yoga/YogaLayoutType.java
Normal file
@@ -0,0 +1,34 @@
|
||||
/**
|
||||
* 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;
|
||||
|
||||
public enum YogaLayoutType {
|
||||
LAYOUT(0),
|
||||
MEASURE(1),
|
||||
CACHED_LAYOUT(2),
|
||||
CACHED_MEASURE(3);
|
||||
|
||||
private final int mIntValue;
|
||||
|
||||
YogaLayoutType(int intValue) {
|
||||
mIntValue = intValue;
|
||||
}
|
||||
|
||||
public int intValue() {
|
||||
return mIntValue;
|
||||
}
|
||||
|
||||
public static YogaLayoutType fromInt(int value) {
|
||||
switch (value) {
|
||||
case 0: return LAYOUT;
|
||||
case 1: return MEASURE;
|
||||
case 2: return CACHED_LAYOUT;
|
||||
case 3: return CACHED_MEASURE;
|
||||
default: throw new IllegalArgumentException("Unknown enum value: " + value);
|
||||
}
|
||||
}
|
||||
}
|
@@ -28,7 +28,6 @@ public class YogaNative {
|
||||
|
||||
|
||||
// YGNode related
|
||||
static native int jni_YGNodeGetInstanceCount();
|
||||
static native long jni_YGNodeNew();
|
||||
static native long jni_YGNodeNewWithConfig(long configPointer);
|
||||
static native void jni_YGNodeFree(long nativePointer);
|
||||
@@ -69,40 +68,40 @@ public class YogaNative {
|
||||
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 Object jni_YGNodeStyleGetFlexBasis(long nativePointer);
|
||||
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 Object jni_YGNodeStyleGetMargin(long nativePointer, int edge);
|
||||
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 Object jni_YGNodeStyleGetPadding(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 Object jni_YGNodeStyleGetPosition(long nativePointer, int edge);
|
||||
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 Object jni_YGNodeStyleGetWidth(long nativePointer);
|
||||
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 Object jni_YGNodeStyleGetHeight(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 Object jni_YGNodeStyleGetMinWidth(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 Object jni_YGNodeStyleGetMinHeight(long nativePointer);
|
||||
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 Object jni_YGNodeStyleGetMaxWidth(long nativePointer);
|
||||
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 Object jni_YGNodeStyleGetMaxHeight(long nativePointer);
|
||||
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);
|
||||
@@ -111,4 +110,5 @@ public class YogaNative {
|
||||
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);
|
||||
}
|
||||
|
@@ -10,11 +10,11 @@ import javax.annotation.Nullable;
|
||||
|
||||
public abstract class YogaNode {
|
||||
public static YogaNode create() {
|
||||
return new YogaNodeJNI();
|
||||
return new YogaNodeJNIFinalizer();
|
||||
}
|
||||
|
||||
public static YogaNode create(YogaConfig config) {
|
||||
return new YogaNodeJNI(config);
|
||||
return new YogaNodeJNIFinalizer(config);
|
||||
}
|
||||
|
||||
public abstract void reset();
|
||||
@@ -211,11 +211,16 @@ public abstract class YogaNode {
|
||||
|
||||
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();
|
||||
}
|
||||
|
11
java/com/facebook/yoga/YogaNodeFactory.java
Normal file
11
java/com/facebook/yoga/YogaNodeFactory.java
Normal file
@@ -0,0 +1,11 @@
|
||||
package com.facebook.yoga;
|
||||
|
||||
public abstract class YogaNodeFactory {
|
||||
public static YogaNode create() {
|
||||
return new YogaNodeJNIFinalizer();
|
||||
}
|
||||
|
||||
public static YogaNode create(YogaConfig config) {
|
||||
return new YogaNodeJNIFinalizer(config);
|
||||
}
|
||||
}
|
@@ -1,21 +0,0 @@
|
||||
/**
|
||||
* 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 {
|
||||
|
||||
public YogaNodeJNI() {
|
||||
super();
|
||||
}
|
||||
|
||||
public YogaNodeJNI(YogaConfig config) {
|
||||
super(config);
|
||||
}
|
||||
}
|
@@ -12,114 +12,62 @@ import java.util.List;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
@DoNotStrip
|
||||
public abstract class YogaNodeJNIBase extends YogaNode {
|
||||
|
||||
private YogaNodeJNIBase mOwner;
|
||||
@Nullable private List<YogaNodeJNIBase> mChildren;
|
||||
private YogaMeasureFunction mMeasureFunction;
|
||||
private YogaBaselineFunction mBaselineFunction;
|
||||
private long mNativePointer;
|
||||
private Object mData;
|
||||
public abstract class YogaNodeJNIBase extends YogaNode implements Cloneable {
|
||||
|
||||
/* 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;
|
||||
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;
|
||||
|
||||
@Nullable private YogaNodeJNIBase mOwner;
|
||||
@Nullable private List<YogaNodeJNIBase> mChildren;
|
||||
@Nullable private YogaMeasureFunction mMeasureFunction;
|
||||
@Nullable private YogaBaselineFunction mBaselineFunction;
|
||||
protected long mNativePointer;
|
||||
@Nullable private Object mData;
|
||||
|
||||
@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;
|
||||
private @Nullable float[] arr = null;
|
||||
|
||||
@DoNotStrip
|
||||
private int mLayoutDirection = 0;
|
||||
@DoNotStrip
|
||||
|
||||
private boolean mHasNewLayout = true;
|
||||
@DoNotStrip private boolean mDoesLegacyStretchFlagAffectsLayout = false;
|
||||
|
||||
public YogaNodeJNIBase() {
|
||||
mNativePointer = YogaNative.jni_YGNodeNew();
|
||||
if (mNativePointer == 0) {
|
||||
private YogaNodeJNIBase(long nativePointer) {
|
||||
if (nativePointer == 0) {
|
||||
throw new IllegalStateException("Failed to allocate native memory");
|
||||
}
|
||||
mNativePointer = nativePointer;
|
||||
}
|
||||
|
||||
public YogaNodeJNIBase(YogaConfig config) {
|
||||
mNativePointer = YogaNative.jni_YGNodeNewWithConfig(config.mNativePointer);
|
||||
if (mNativePointer == 0) {
|
||||
throw new IllegalStateException("Failed to allocate native memory");
|
||||
}
|
||||
YogaNodeJNIBase() {
|
||||
this(YogaNative.jni_YGNodeNew());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void finalize() throws Throwable {
|
||||
try {
|
||||
freeNatives();
|
||||
} finally {
|
||||
super.finalize();
|
||||
}
|
||||
YogaNodeJNIBase(YogaConfig config) {
|
||||
this(YogaNative.jni_YGNodeNewWithConfig(config.mNativePointer));
|
||||
}
|
||||
|
||||
/* 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() {
|
||||
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;
|
||||
|
||||
mMeasureFunction = null;
|
||||
mBaselineFunction = null;
|
||||
mData = null;
|
||||
mDoesLegacyStretchFlagAffectsLayout = false;
|
||||
arr = null;
|
||||
mHasNewLayout = true;
|
||||
mLayoutDirection = 0;
|
||||
|
||||
YogaNative.jni_YGNodeReset(mNativePointer);
|
||||
}
|
||||
@@ -157,6 +105,21 @@ public abstract class YogaNodeJNIBase extends YogaNode {
|
||||
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);
|
||||
@@ -219,10 +182,6 @@ public abstract class YogaNodeJNIBase extends YogaNode {
|
||||
YogaNative.jni_YGNodeCalculateLayout(mNativePointer, width, height, nativePointers, nodes);
|
||||
}
|
||||
|
||||
public boolean hasNewLayout() {
|
||||
return mHasNewLayout;
|
||||
}
|
||||
|
||||
public void dirty() {
|
||||
YogaNative.jni_YGNodeMarkDirty(mNativePointer);
|
||||
}
|
||||
@@ -240,10 +199,6 @@ public abstract class YogaNodeJNIBase extends YogaNode {
|
||||
YogaNative.jni_YGNodeCopyStyle(mNativePointer, ((YogaNodeJNIBase) srcNode).mNativePointer);
|
||||
}
|
||||
|
||||
public void markLayoutSeen() {
|
||||
mHasNewLayout = false;
|
||||
}
|
||||
|
||||
public YogaDirection getStyleDirection() {
|
||||
return YogaDirection.fromInt(YogaNative.jni_YGNodeStyleGetDirection(mNativePointer));
|
||||
}
|
||||
@@ -349,7 +304,7 @@ public abstract class YogaNodeJNIBase extends YogaNode {
|
||||
}
|
||||
|
||||
public YogaValue getFlexBasis() {
|
||||
return (YogaValue) YogaNative.jni_YGNodeStyleGetFlexBasis(mNativePointer);
|
||||
return valueFromLong(YogaNative.jni_YGNodeStyleGetFlexBasis(mNativePointer));
|
||||
}
|
||||
|
||||
public void setFlexBasis(float flexBasis) {
|
||||
@@ -365,7 +320,7 @@ public abstract class YogaNodeJNIBase extends YogaNode {
|
||||
}
|
||||
|
||||
public YogaValue getMargin(YogaEdge edge) {
|
||||
return (YogaValue) YogaNative.jni_YGNodeStyleGetMargin(mNativePointer, edge.intValue());
|
||||
return valueFromLong(YogaNative.jni_YGNodeStyleGetMargin(mNativePointer, edge.intValue()));
|
||||
}
|
||||
|
||||
public void setMargin(YogaEdge edge, float margin) {
|
||||
@@ -381,7 +336,7 @@ public abstract class YogaNodeJNIBase extends YogaNode {
|
||||
}
|
||||
|
||||
public YogaValue getPadding(YogaEdge edge) {
|
||||
return (YogaValue) YogaNative.jni_YGNodeStyleGetPadding(mNativePointer, edge.intValue());
|
||||
return valueFromLong(YogaNative.jni_YGNodeStyleGetPadding(mNativePointer, edge.intValue()));
|
||||
}
|
||||
|
||||
public void setPadding(YogaEdge edge, float padding) {
|
||||
@@ -401,7 +356,7 @@ public abstract class YogaNodeJNIBase extends YogaNode {
|
||||
}
|
||||
|
||||
public YogaValue getPosition(YogaEdge edge) {
|
||||
return (YogaValue) YogaNative.jni_YGNodeStyleGetPosition(mNativePointer, edge.intValue());
|
||||
return valueFromLong(YogaNative.jni_YGNodeStyleGetPosition(mNativePointer, edge.intValue()));
|
||||
}
|
||||
|
||||
public void setPosition(YogaEdge edge, float position) {
|
||||
@@ -413,7 +368,7 @@ public abstract class YogaNodeJNIBase extends YogaNode {
|
||||
}
|
||||
|
||||
public YogaValue getWidth() {
|
||||
return (YogaValue) YogaNative.jni_YGNodeStyleGetWidth(mNativePointer);
|
||||
return valueFromLong(YogaNative.jni_YGNodeStyleGetWidth(mNativePointer));
|
||||
}
|
||||
|
||||
public void setWidth(float width) {
|
||||
@@ -429,7 +384,7 @@ public abstract class YogaNodeJNIBase extends YogaNode {
|
||||
}
|
||||
|
||||
public YogaValue getHeight() {
|
||||
return (YogaValue) YogaNative.jni_YGNodeStyleGetHeight(mNativePointer);
|
||||
return valueFromLong(YogaNative.jni_YGNodeStyleGetHeight(mNativePointer));
|
||||
}
|
||||
|
||||
public void setHeight(float height) {
|
||||
@@ -445,7 +400,7 @@ public abstract class YogaNodeJNIBase extends YogaNode {
|
||||
}
|
||||
|
||||
public YogaValue getMinWidth() {
|
||||
return (YogaValue) YogaNative.jni_YGNodeStyleGetMinWidth(mNativePointer);
|
||||
return valueFromLong(YogaNative.jni_YGNodeStyleGetMinWidth(mNativePointer));
|
||||
}
|
||||
|
||||
public void setMinWidth(float minWidth) {
|
||||
@@ -457,7 +412,7 @@ public abstract class YogaNodeJNIBase extends YogaNode {
|
||||
}
|
||||
|
||||
public YogaValue getMinHeight() {
|
||||
return (YogaValue) YogaNative.jni_YGNodeStyleGetMinHeight(mNativePointer);
|
||||
return valueFromLong(YogaNative.jni_YGNodeStyleGetMinHeight(mNativePointer));
|
||||
}
|
||||
|
||||
public void setMinHeight(float minHeight) {
|
||||
@@ -469,7 +424,7 @@ public abstract class YogaNodeJNIBase extends YogaNode {
|
||||
}
|
||||
|
||||
public YogaValue getMaxWidth() {
|
||||
return (YogaValue) YogaNative.jni_YGNodeStyleGetMaxWidth(mNativePointer);
|
||||
return valueFromLong(YogaNative.jni_YGNodeStyleGetMaxWidth(mNativePointer));
|
||||
}
|
||||
|
||||
public void setMaxWidth(float maxWidth) {
|
||||
@@ -481,7 +436,7 @@ public abstract class YogaNodeJNIBase extends YogaNode {
|
||||
}
|
||||
|
||||
public YogaValue getMaxHeight() {
|
||||
return (YogaValue) YogaNative.jni_YGNodeStyleGetMaxHeight(mNativePointer);
|
||||
return valueFromLong(YogaNative.jni_YGNodeStyleGetMaxHeight(mNativePointer));
|
||||
}
|
||||
|
||||
public void setMaxHeight(float maxheight) {
|
||||
@@ -500,87 +455,6 @@ public abstract class YogaNodeJNIBase extends YogaNode {
|
||||
YogaNative.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);
|
||||
}
|
||||
|
||||
public void setMeasureFunction(YogaMeasureFunction measureFunction) {
|
||||
mMeasureFunction = measureFunction;
|
||||
YogaNative.jni_YGNodeSetHasMeasureFunc(mNativePointer, measureFunction != null);
|
||||
@@ -619,11 +493,17 @@ public abstract class YogaNodeJNIBase extends YogaNode {
|
||||
return mMeasureFunction != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBaselineDefined() {
|
||||
return mBaselineFunction != null;
|
||||
}
|
||||
|
||||
public void setData(Object data) {
|
||||
mData = data;
|
||||
}
|
||||
|
||||
public Object getData() {
|
||||
@Override
|
||||
public @Nullable Object getData() {
|
||||
return mData;
|
||||
}
|
||||
|
||||
@@ -656,4 +536,128 @@ public abstract class YogaNodeJNIBase extends YogaNode {
|
||||
newNode.mOwner = this;
|
||||
return newNode.mNativePointer;
|
||||
}
|
||||
|
||||
private static YogaValue valueFromLong(long raw) {
|
||||
return new YogaValue(Float.intBitsToFloat((int) raw), (int) (raw >> 32));
|
||||
}
|
||||
|
||||
@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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
34
java/com/facebook/yoga/YogaNodeJNIFinalizer.java
Normal file
34
java/com/facebook/yoga/YogaNodeJNIFinalizer.java
Normal file
@@ -0,0 +1,34 @@
|
||||
/**
|
||||
* 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;
|
||||
|
||||
public class YogaNodeJNIFinalizer extends YogaNodeJNIBase {
|
||||
public YogaNodeJNIFinalizer() {
|
||||
super();
|
||||
}
|
||||
|
||||
public YogaNodeJNIFinalizer(YogaConfig config) {
|
||||
super(config);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void finalize() throws Throwable {
|
||||
try {
|
||||
freeNatives();
|
||||
} finally {
|
||||
super.finalize();
|
||||
}
|
||||
}
|
||||
|
||||
public void freeNatives() {
|
||||
if (mNativePointer != 0) {
|
||||
long nativePointer = mNativePointer;
|
||||
mNativePointer = 0;
|
||||
YogaNative.jni_YGNodeFree(nativePointer);
|
||||
}
|
||||
}
|
||||
}
|
@@ -6,9 +6,6 @@
|
||||
*/
|
||||
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);
|
||||
@@ -22,7 +19,6 @@ public class YogaValue {
|
||||
this.unit = unit;
|
||||
}
|
||||
|
||||
@DoNotStrip
|
||||
YogaValue(float value, int unit) {
|
||||
this(value, YogaUnit.fromInt(unit));
|
||||
}
|
||||
|
@@ -1,14 +1,16 @@
|
||||
/**
|
||||
/*
|
||||
* 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 <fbjni/fbjni.h>
|
||||
#include <yoga/YGNode.h>
|
||||
#include <yoga/Yoga.h>
|
||||
#include <yoga/Yoga-internal.h>
|
||||
#include <yoga/log.h>
|
||||
#include <cstdint>
|
||||
#include <cstring>
|
||||
#include <iostream>
|
||||
#include <map>
|
||||
|
||||
@@ -61,33 +63,15 @@ enum YGStyleInput {
|
||||
IsReferenceBaseline,
|
||||
};
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
};
|
||||
const short int LAYOUT_EDGE_SET_FLAG_INDEX = 0;
|
||||
const short int LAYOUT_WIDTH_INDEX = 1;
|
||||
const short int LAYOUT_HEIGHT_INDEX = 2;
|
||||
const short int LAYOUT_LEFT_INDEX = 3;
|
||||
const short int LAYOUT_TOP_INDEX = 4;
|
||||
const short int LAYOUT_DIRECTION_INDEX = 5;
|
||||
const short int LAYOUT_MARGIN_START_INDEX = 6;
|
||||
const short int LAYOUT_PADDING_START_INDEX = 10;
|
||||
const short int LAYOUT_BORDER_START_INDEX = 14;
|
||||
|
||||
namespace {
|
||||
|
||||
@@ -96,6 +80,9 @@ union YGNodeContext {
|
||||
void* asVoidPtr;
|
||||
};
|
||||
|
||||
const int DOES_LEGACY_STRETCH_BEHAVIOUR = 8;
|
||||
const int HAS_NEW_LAYOUT = 16;
|
||||
|
||||
class YGNodeEdges {
|
||||
uintptr_t edges_;
|
||||
|
||||
@@ -118,14 +105,27 @@ public:
|
||||
node->setContext(context.asVoidPtr);
|
||||
}
|
||||
|
||||
bool has(Edge edge) {
|
||||
return (edges_ & edge) == edge;
|
||||
}
|
||||
bool has(Edge edge) { return (edges_ & edge) == edge; }
|
||||
|
||||
YGNodeEdges& add(Edge edge) {
|
||||
edges_ |= edge;
|
||||
return *this;
|
||||
}
|
||||
|
||||
int get() { return edges_; }
|
||||
};
|
||||
|
||||
struct YogaValue {
|
||||
static constexpr jint NAN_BYTES = 0x7fc00000;
|
||||
|
||||
static jlong asJavaLong(const YGValue& value) {
|
||||
uint32_t valueBytes = 0;
|
||||
memcpy(&valueBytes, &value.value, sizeof valueBytes);
|
||||
return ((jlong) value.unit) << 32 | valueBytes;
|
||||
}
|
||||
constexpr static jlong undefinedAsJavaLong() {
|
||||
return ((jlong) YGUnitUndefined) << 32 | NAN_BYTES;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace
|
||||
@@ -163,82 +163,57 @@ static void YGTransferLayoutOutputsRecursive(
|
||||
|
||||
auto edgesSet = YGNodeEdges{root};
|
||||
|
||||
static auto widthField = obj->getClass()->getField<jfloat>("mWidth");
|
||||
static auto heightField = obj->getClass()->getField<jfloat>("mHeight");
|
||||
static auto leftField = obj->getClass()->getField<jfloat>("mLeft");
|
||||
static auto topField = obj->getClass()->getField<jfloat>("mTop");
|
||||
bool marginFieldSet = edgesSet.has(YGNodeEdges::MARGIN);
|
||||
bool paddingFieldSet = edgesSet.has(YGNodeEdges::PADDING);
|
||||
bool borderFieldSet = edgesSet.has(YGNodeEdges::BORDER);
|
||||
|
||||
static auto marginLeftField =
|
||||
obj->getClass()->getField<jfloat>("mMarginLeft");
|
||||
static auto marginTopField = obj->getClass()->getField<jfloat>("mMarginTop");
|
||||
static auto marginRightField =
|
||||
obj->getClass()->getField<jfloat>("mMarginRight");
|
||||
static auto marginBottomField =
|
||||
obj->getClass()->getField<jfloat>("mMarginBottom");
|
||||
|
||||
static auto paddingLeftField =
|
||||
obj->getClass()->getField<jfloat>("mPaddingLeft");
|
||||
static auto paddingTopField =
|
||||
obj->getClass()->getField<jfloat>("mPaddingTop");
|
||||
static auto paddingRightField =
|
||||
obj->getClass()->getField<jfloat>("mPaddingRight");
|
||||
static auto paddingBottomField =
|
||||
obj->getClass()->getField<jfloat>("mPaddingBottom");
|
||||
|
||||
static auto borderLeftField =
|
||||
obj->getClass()->getField<jfloat>("mBorderLeft");
|
||||
static auto borderTopField = obj->getClass()->getField<jfloat>("mBorderTop");
|
||||
static auto borderRightField =
|
||||
obj->getClass()->getField<jfloat>("mBorderRight");
|
||||
static auto borderBottomField =
|
||||
obj->getClass()->getField<jfloat>("mBorderBottom");
|
||||
|
||||
static auto hasNewLayoutField =
|
||||
obj->getClass()->getField<jboolean>("mHasNewLayout");
|
||||
static auto doesLegacyStretchBehaviour = obj->getClass()->getField<jboolean>(
|
||||
"mDoesLegacyStretchFlagAffectsLayout");
|
||||
|
||||
obj->setFieldValue(widthField, YGNodeLayoutGetWidth(root));
|
||||
obj->setFieldValue(heightField, YGNodeLayoutGetHeight(root));
|
||||
obj->setFieldValue(leftField, YGNodeLayoutGetLeft(root));
|
||||
obj->setFieldValue(topField, YGNodeLayoutGetTop(root));
|
||||
obj->setFieldValue<jboolean>(
|
||||
doesLegacyStretchBehaviour,
|
||||
YGNodeLayoutGetDidLegacyStretchFlagAffectLayout(root));
|
||||
obj->setFieldValue<jboolean>(hasNewLayoutField, true);
|
||||
YGTransferLayoutDirection(root, obj);
|
||||
|
||||
if (edgesSet.has(YGNodeEdges::MARGIN)) {
|
||||
obj->setFieldValue(
|
||||
marginLeftField, YGNodeLayoutGetMargin(root, YGEdgeLeft));
|
||||
obj->setFieldValue(marginTopField, YGNodeLayoutGetMargin(root, YGEdgeTop));
|
||||
obj->setFieldValue(
|
||||
marginRightField, YGNodeLayoutGetMargin(root, YGEdgeRight));
|
||||
obj->setFieldValue(
|
||||
marginBottomField, YGNodeLayoutGetMargin(root, YGEdgeBottom));
|
||||
int fieldFlags = edgesSet.get();
|
||||
fieldFlags |= HAS_NEW_LAYOUT;
|
||||
if (YGNodeLayoutGetDidLegacyStretchFlagAffectLayout(root)) {
|
||||
fieldFlags |= DOES_LEGACY_STRETCH_BEHAVIOUR;
|
||||
}
|
||||
|
||||
if (edgesSet.has(YGNodeEdges::PADDING)) {
|
||||
obj->setFieldValue(
|
||||
paddingLeftField, YGNodeLayoutGetPadding(root, YGEdgeLeft));
|
||||
obj->setFieldValue(
|
||||
paddingTopField, YGNodeLayoutGetPadding(root, YGEdgeTop));
|
||||
obj->setFieldValue(
|
||||
paddingRightField, YGNodeLayoutGetPadding(root, YGEdgeRight));
|
||||
obj->setFieldValue(
|
||||
paddingBottomField, YGNodeLayoutGetPadding(root, YGEdgeBottom));
|
||||
const int arrSize = 6 + (marginFieldSet ? 4 : 0) + (paddingFieldSet ? 4 : 0) +
|
||||
(borderFieldSet ? 4 : 0);
|
||||
float arr[18];
|
||||
arr[LAYOUT_EDGE_SET_FLAG_INDEX] = fieldFlags;
|
||||
arr[LAYOUT_WIDTH_INDEX] = YGNodeLayoutGetWidth(root);
|
||||
arr[LAYOUT_HEIGHT_INDEX] = YGNodeLayoutGetHeight(root);
|
||||
arr[LAYOUT_LEFT_INDEX] = YGNodeLayoutGetLeft(root);
|
||||
arr[LAYOUT_TOP_INDEX] = YGNodeLayoutGetTop(root);
|
||||
arr[LAYOUT_DIRECTION_INDEX] =
|
||||
static_cast<jint>(YGNodeLayoutGetDirection(root));
|
||||
if (marginFieldSet) {
|
||||
arr[LAYOUT_MARGIN_START_INDEX] = YGNodeLayoutGetMargin(root, YGEdgeLeft);
|
||||
arr[LAYOUT_MARGIN_START_INDEX + 1] = YGNodeLayoutGetMargin(root, YGEdgeTop);
|
||||
arr[LAYOUT_MARGIN_START_INDEX + 2] =
|
||||
YGNodeLayoutGetMargin(root, YGEdgeRight);
|
||||
arr[LAYOUT_MARGIN_START_INDEX + 3] =
|
||||
YGNodeLayoutGetMargin(root, YGEdgeBottom);
|
||||
}
|
||||
if (paddingFieldSet) {
|
||||
int paddingStartIndex =
|
||||
LAYOUT_PADDING_START_INDEX - (marginFieldSet ? 0 : 4);
|
||||
arr[paddingStartIndex] = YGNodeLayoutGetPadding(root, YGEdgeLeft);
|
||||
arr[paddingStartIndex + 1] = YGNodeLayoutGetPadding(root, YGEdgeTop);
|
||||
arr[paddingStartIndex + 2] = YGNodeLayoutGetPadding(root, YGEdgeRight);
|
||||
arr[paddingStartIndex + 3] = YGNodeLayoutGetPadding(root, YGEdgeBottom);
|
||||
}
|
||||
|
||||
if (edgesSet.has(YGNodeEdges::BORDER)) {
|
||||
obj->setFieldValue(
|
||||
borderLeftField, YGNodeLayoutGetBorder(root, YGEdgeLeft));
|
||||
obj->setFieldValue(borderTopField, YGNodeLayoutGetBorder(root, YGEdgeTop));
|
||||
obj->setFieldValue(
|
||||
borderRightField, YGNodeLayoutGetBorder(root, YGEdgeRight));
|
||||
obj->setFieldValue(
|
||||
borderBottomField, YGNodeLayoutGetBorder(root, YGEdgeBottom));
|
||||
if (borderFieldSet) {
|
||||
int borderStartIndex = LAYOUT_BORDER_START_INDEX -
|
||||
(marginFieldSet ? 0 : 4) - (paddingFieldSet ? 0 : 4);
|
||||
arr[borderStartIndex] = YGNodeLayoutGetBorder(root, YGEdgeLeft);
|
||||
arr[borderStartIndex + 1] = YGNodeLayoutGetBorder(root, YGEdgeTop);
|
||||
arr[borderStartIndex + 2] = YGNodeLayoutGetBorder(root, YGEdgeRight);
|
||||
arr[borderStartIndex + 3] = YGNodeLayoutGetBorder(root, YGEdgeBottom);
|
||||
}
|
||||
|
||||
static auto arrField = obj->getClass()->getField<jfloatArray>("arr");
|
||||
local_ref<jfloatArray> arrFinal = make_float_array(arrSize);
|
||||
arrFinal->setRegion(0, arrSize, arr);
|
||||
obj->setFieldValue<jfloatArray>(arrField, arrFinal.get());
|
||||
|
||||
root->setHasNewLayout(false);
|
||||
|
||||
for (uint32_t i = 0; i < YGNodeGetChildCount(root); i++) {
|
||||
@@ -278,6 +253,14 @@ static inline YGConfigRef _jlong2YGConfigRef(jlong addr) {
|
||||
return reinterpret_cast<YGConfigRef>(static_cast<intptr_t>(addr));
|
||||
}
|
||||
|
||||
jlong jni_YGNodeClone(alias_ref<jobject> thiz, jlong nativePointer) {
|
||||
auto node = _jlong2YGNodeRef(nativePointer);
|
||||
const YGNodeRef clonedYogaNode = YGNodeClone(node);
|
||||
clonedYogaNode->setContext(node->getContext());
|
||||
|
||||
return reinterpret_cast<jlong>(clonedYogaNode);
|
||||
}
|
||||
|
||||
static YGSize YGJNIMeasureFunc(
|
||||
YGNodeRef node,
|
||||
float width,
|
||||
@@ -340,7 +323,7 @@ static int YGJNILogFunc(
|
||||
return result;
|
||||
}
|
||||
|
||||
jlong jni_YGNodeNew(alias_ref<jclass>) {
|
||||
jlong jni_YGNodeNew(alias_ref<jobject> thiz) {
|
||||
const YGNodeRef node = YGNodeNew();
|
||||
node->setContext(YGNodeContext{}.asVoidPtr);
|
||||
node->setPrintFunc(YGPrint);
|
||||
@@ -472,9 +455,8 @@ void jni_YGNodeCopyStyle(jlong dstNativePointer, jlong srcNativePointer) {
|
||||
}
|
||||
|
||||
#define YG_NODE_JNI_STYLE_UNIT_PROP(name) \
|
||||
local_ref<jobject> jni_YGNodeStyleGet##name( \
|
||||
alias_ref<jclass>, jlong nativePointer) { \
|
||||
return JYogaValue::create( \
|
||||
jlong jni_YGNodeStyleGet##name(jlong nativePointer) { \
|
||||
return YogaValue::asJavaLong( \
|
||||
YGNodeStyleGet##name(_jlong2YGNodeRef(nativePointer))); \
|
||||
} \
|
||||
\
|
||||
@@ -509,9 +491,8 @@ void jni_YGNodeCopyStyle(jlong dstNativePointer, jlong srcNativePointer) {
|
||||
}
|
||||
|
||||
#define YG_NODE_JNI_STYLE_EDGE_UNIT_PROP(name) \
|
||||
local_ref<jobject> jni_YGNodeStyleGet##name( \
|
||||
alias_ref<jclass>, jlong nativePointer, jint edge) { \
|
||||
return JYogaValue::create(YGNodeStyleGet##name( \
|
||||
jlong jni_YGNodeStyleGet##name(jlong nativePointer, jint edge) { \
|
||||
return YogaValue::asJavaLong(YGNodeStyleGet##name( \
|
||||
_jlong2YGNodeRef(nativePointer), static_cast<YGEdge>(edge))); \
|
||||
} \
|
||||
\
|
||||
@@ -837,19 +818,12 @@ void jni_YGNodeSetStyleInputs(
|
||||
YGNodeSetStyleInputs(_jlong2YGNodeRef(nativePointer), result, size);
|
||||
}
|
||||
|
||||
jint jni_YGNodeGetInstanceCount() {
|
||||
return YGNodeGetInstanceCount();
|
||||
}
|
||||
|
||||
local_ref<jobject> jni_YGNodeStyleGetMargin(
|
||||
alias_ref<jclass>,
|
||||
jlong nativePointer,
|
||||
jint edge) {
|
||||
jlong jni_YGNodeStyleGetMargin(jlong nativePointer, jint edge) {
|
||||
YGNodeRef yogaNodeRef = _jlong2YGNodeRef(nativePointer);
|
||||
if (!YGNodeEdges{yogaNodeRef}.has(YGNodeEdges::MARGIN)) {
|
||||
return JYogaValue::create(YGValueUndefined);
|
||||
return YogaValue::undefinedAsJavaLong();
|
||||
}
|
||||
return JYogaValue::create(
|
||||
return YogaValue::asJavaLong(
|
||||
YGNodeStyleGetMargin(yogaNodeRef, static_cast<YGEdge>(edge)));
|
||||
}
|
||||
|
||||
@@ -876,15 +850,12 @@ void jni_YGNodeStyleSetMarginAuto(jlong nativePointer, jint edge) {
|
||||
YGNodeStyleSetMarginAuto(yogaNodeRef, static_cast<YGEdge>(edge));
|
||||
}
|
||||
|
||||
local_ref<jobject> jni_YGNodeStyleGetPadding(
|
||||
alias_ref<jclass>,
|
||||
jlong nativePointer,
|
||||
jint edge) {
|
||||
jlong jni_YGNodeStyleGetPadding(jlong nativePointer, jint edge) {
|
||||
YGNodeRef yogaNodeRef = _jlong2YGNodeRef(nativePointer);
|
||||
if (!YGNodeEdges{yogaNodeRef}.has(YGNodeEdges::PADDING)) {
|
||||
return JYogaValue::create(YGValueUndefined);
|
||||
return YogaValue::undefinedAsJavaLong();
|
||||
}
|
||||
return JYogaValue::create(
|
||||
return YogaValue::asJavaLong(
|
||||
YGNodeStyleGetPadding(yogaNodeRef, static_cast<YGEdge>(edge)));
|
||||
}
|
||||
|
||||
@@ -972,46 +943,46 @@ jint JNI_OnLoad(JavaVM* vm, void*) {
|
||||
YGMakeCriticalNativeMethod(jni_YGNodeStyleSetFlexGrow),
|
||||
YGMakeCriticalNativeMethod(jni_YGNodeStyleGetFlexShrink),
|
||||
YGMakeCriticalNativeMethod(jni_YGNodeStyleSetFlexShrink),
|
||||
YGMakeNativeMethod(jni_YGNodeStyleGetFlexBasis),
|
||||
YGMakeCriticalNativeMethod(jni_YGNodeStyleGetFlexBasis),
|
||||
YGMakeCriticalNativeMethod(jni_YGNodeStyleSetFlexBasis),
|
||||
YGMakeCriticalNativeMethod(jni_YGNodeStyleSetFlexBasisPercent),
|
||||
YGMakeCriticalNativeMethod(jni_YGNodeStyleSetFlexBasisAuto),
|
||||
YGMakeNativeMethod(jni_YGNodeStyleGetMargin),
|
||||
YGMakeCriticalNativeMethod(jni_YGNodeStyleGetMargin),
|
||||
YGMakeCriticalNativeMethod(jni_YGNodeStyleSetMargin),
|
||||
YGMakeCriticalNativeMethod(jni_YGNodeStyleSetMarginPercent),
|
||||
YGMakeCriticalNativeMethod(jni_YGNodeStyleSetMarginAuto),
|
||||
YGMakeNativeMethod(jni_YGNodeStyleGetPadding),
|
||||
YGMakeCriticalNativeMethod(jni_YGNodeStyleGetPadding),
|
||||
YGMakeCriticalNativeMethod(jni_YGNodeStyleSetPadding),
|
||||
YGMakeCriticalNativeMethod(jni_YGNodeStyleSetPaddingPercent),
|
||||
YGMakeCriticalNativeMethod(jni_YGNodeStyleGetBorder),
|
||||
YGMakeCriticalNativeMethod(jni_YGNodeStyleSetBorder),
|
||||
YGMakeNativeMethod(jni_YGNodeStyleGetPosition),
|
||||
YGMakeCriticalNativeMethod(jni_YGNodeStyleGetPosition),
|
||||
YGMakeCriticalNativeMethod(jni_YGNodeStyleSetPosition),
|
||||
YGMakeCriticalNativeMethod(jni_YGNodeStyleSetPositionPercent),
|
||||
YGMakeNativeMethod(jni_YGNodeStyleGetWidth),
|
||||
YGMakeCriticalNativeMethod(jni_YGNodeStyleGetWidth),
|
||||
YGMakeCriticalNativeMethod(jni_YGNodeStyleSetWidth),
|
||||
YGMakeCriticalNativeMethod(jni_YGNodeStyleSetWidthPercent),
|
||||
YGMakeCriticalNativeMethod(jni_YGNodeStyleSetWidthAuto),
|
||||
YGMakeNativeMethod(jni_YGNodeStyleGetHeight),
|
||||
YGMakeCriticalNativeMethod(jni_YGNodeStyleGetHeight),
|
||||
YGMakeCriticalNativeMethod(jni_YGNodeStyleSetHeight),
|
||||
YGMakeCriticalNativeMethod(jni_YGNodeStyleSetHeightPercent),
|
||||
YGMakeCriticalNativeMethod(jni_YGNodeStyleSetHeightAuto),
|
||||
YGMakeNativeMethod(jni_YGNodeStyleGetMinWidth),
|
||||
YGMakeCriticalNativeMethod(jni_YGNodeStyleGetMinWidth),
|
||||
YGMakeCriticalNativeMethod(jni_YGNodeStyleSetMinWidth),
|
||||
YGMakeCriticalNativeMethod(jni_YGNodeStyleSetMinWidthPercent),
|
||||
YGMakeNativeMethod(jni_YGNodeStyleGetMinHeight),
|
||||
YGMakeCriticalNativeMethod(jni_YGNodeStyleGetMinHeight),
|
||||
YGMakeCriticalNativeMethod(jni_YGNodeStyleSetMinHeight),
|
||||
YGMakeCriticalNativeMethod(jni_YGNodeStyleSetMinHeightPercent),
|
||||
YGMakeNativeMethod(jni_YGNodeStyleGetMaxWidth),
|
||||
YGMakeCriticalNativeMethod(jni_YGNodeStyleGetMaxWidth),
|
||||
YGMakeCriticalNativeMethod(jni_YGNodeStyleSetMaxWidth),
|
||||
YGMakeCriticalNativeMethod(jni_YGNodeStyleSetMaxWidthPercent),
|
||||
YGMakeNativeMethod(jni_YGNodeStyleGetMaxHeight),
|
||||
YGMakeCriticalNativeMethod(jni_YGNodeStyleGetMaxHeight),
|
||||
YGMakeCriticalNativeMethod(jni_YGNodeStyleSetMaxHeight),
|
||||
YGMakeCriticalNativeMethod(jni_YGNodeStyleSetMaxHeightPercent),
|
||||
YGMakeCriticalNativeMethod(jni_YGNodeStyleGetAspectRatio),
|
||||
YGMakeCriticalNativeMethod(jni_YGNodeStyleSetAspectRatio),
|
||||
YGMakeCriticalNativeMethod(jni_YGNodeGetInstanceCount),
|
||||
YGMakeCriticalNativeMethod(jni_YGNodePrint),
|
||||
YGMakeNativeMethod(jni_YGNodeClone),
|
||||
YGMakeNativeMethod(jni_YGNodeSetStyleInputs),
|
||||
YGMakeNativeMethod(jni_YGConfigNew),
|
||||
YGMakeNativeMethod(jni_YGConfigFree),
|
||||
|
@@ -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,11 +1,16 @@
|
||||
/**
|
||||
/*
|
||||
* 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 <fbjni/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;";
|
||||
@@ -29,10 +34,30 @@ struct JYogaLogger : public facebook::jni::JavaClass<JYogaLogger> {
|
||||
jstring);
|
||||
};
|
||||
|
||||
struct JYogaValue : public facebook::jni::JavaClass<JYogaValue> {
|
||||
constexpr static auto kJavaDescriptor = "Lcom/facebook/yoga/YogaValue;";
|
||||
class PtrJNodeMap {
|
||||
using JNodeArray = JArrayClass<JYogaNode::javaobject>;
|
||||
std::map<YGNodeRef, size_t> ptrsToIdxs_;
|
||||
alias_ref<JNodeArray> javaNodes_;
|
||||
|
||||
static facebook::jni::local_ref<javaobject> create(YGValue value) {
|
||||
return newInstance(value.value, static_cast<int>(value.unit));
|
||||
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);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@@ -6,3 +6,8 @@
|
||||
*/
|
||||
|
||||
apply plugin: 'java'
|
||||
|
||||
sourceCompatibility = '1.7'
|
||||
targetCompatibility = '1.7'
|
||||
|
||||
apply from: rootProject.file('gradle/release.gradle')
|
||||
|
12
java/proguard-annotations/gradle.properties
Normal file
12
java/proguard-annotations/gradle.properties
Normal file
@@ -0,0 +1,12 @@
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
GROUP=com.facebook.yoga
|
||||
POM_NAME=Proguard Annotations
|
||||
POM_DESCRIPTION=Shared annotations for use with Proguard
|
||||
POM_ARTIFACT_ID=proguard-annotations
|
||||
POM_PACKAGING=jar
|
@@ -3,13 +3,13 @@
|
||||
# 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", "YOGA_ROOTS", "yoga_java_library")
|
||||
load("//tools/build_defs/oss:yoga_defs.bzl", "yoga_java_library")
|
||||
|
||||
yoga_java_library(
|
||||
name = "annotations",
|
||||
srcs = glob(["*.java"]),
|
||||
source = "1.7",
|
||||
target = "1.7",
|
||||
visibility = YOGA_ROOTS,
|
||||
visibility = ["PUBLIC"],
|
||||
deps = [],
|
||||
)
|
||||
|
@@ -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;
|
||||
|
@@ -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.
|
||||
/**
|
||||
* 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,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;
|
||||
|
||||
|
@@ -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
|
||||
|
||||
package com.facebook.yoga;
|
||||
@@ -367,39 +366,6 @@ public class YGAlignContentTest {
|
||||
assertEquals(100f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(10f, root_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(10f, root_child1.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child2.getLayoutX(), 0.0f);
|
||||
assertEquals(20f, root_child2.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root_child2.getLayoutWidth(), 0.0f);
|
||||
assertEquals(10f, root_child2.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child3.getLayoutX(), 0.0f);
|
||||
assertEquals(30f, root_child3.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root_child3.getLayoutWidth(), 0.0f);
|
||||
assertEquals(10f, root_child3.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child4.getLayoutX(), 0.0f);
|
||||
assertEquals(40f, root_child4.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root_child4.getLayoutWidth(), 0.0f);
|
||||
assertEquals(10f, root_child4.getLayoutHeight(), 0.0f);
|
||||
|
||||
root.setDirection(YogaDirection.RTL);
|
||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||
|
||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||
assertEquals(100f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(50f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
|
||||
@@ -424,6 +390,39 @@ public class YGAlignContentTest {
|
||||
assertEquals(40f, root_child4.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root_child4.getLayoutWidth(), 0.0f);
|
||||
assertEquals(10f, root_child4.getLayoutHeight(), 0.0f);
|
||||
|
||||
root.setDirection(YogaDirection.RTL);
|
||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||
|
||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||
assertEquals(100f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(10f, root_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(10f, root_child1.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child2.getLayoutX(), 0.0f);
|
||||
assertEquals(20f, root_child2.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root_child2.getLayoutWidth(), 0.0f);
|
||||
assertEquals(10f, root_child2.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child3.getLayoutX(), 0.0f);
|
||||
assertEquals(30f, root_child3.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root_child3.getLayoutWidth(), 0.0f);
|
||||
assertEquals(10f, root_child3.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child4.getLayoutX(), 0.0f);
|
||||
assertEquals(40f, root_child4.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root_child4.getLayoutWidth(), 0.0f);
|
||||
assertEquals(10f, root_child4.getLayoutHeight(), 0.0f);
|
||||
}
|
||||
|
||||
@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
|
||||
|
||||
package com.facebook.yoga;
|
||||
|
@@ -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
|
||||
|
||||
package com.facebook.yoga;
|
||||
|
@@ -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
|
||||
|
||||
package com.facebook.yoga;
|
||||
@@ -60,8 +59,7 @@ public class YGAndroidNewsFeed {
|
||||
root_child0_child0_child0_child0_child0_child0.setAlignContent(YogaAlign.STRETCH);
|
||||
root_child0_child0_child0_child0_child0_child0.setWidth(120f);
|
||||
root_child0_child0_child0_child0_child0_child0.setHeight(120f);
|
||||
root_child0_child0_child0_child0_child0.addChildAt(
|
||||
root_child0_child0_child0_child0_child0_child0, 0);
|
||||
root_child0_child0_child0_child0_child0.addChildAt(root_child0_child0_child0_child0_child0_child0, 0);
|
||||
|
||||
final YogaNode root_child0_child0_child0_child0_child1 = createNode(config);
|
||||
root_child0_child0_child0_child0_child1.setAlignContent(YogaAlign.STRETCH);
|
||||
@@ -77,14 +75,12 @@ public class YGAndroidNewsFeed {
|
||||
root_child0_child0_child0_child0_child1_child0.setFlexDirection(YogaFlexDirection.ROW);
|
||||
root_child0_child0_child0_child0_child1_child0.setAlignContent(YogaAlign.STRETCH);
|
||||
root_child0_child0_child0_child0_child1_child0.setFlexShrink(1f);
|
||||
root_child0_child0_child0_child0_child1.addChildAt(
|
||||
root_child0_child0_child0_child0_child1_child0, 0);
|
||||
root_child0_child0_child0_child0_child1.addChildAt(root_child0_child0_child0_child0_child1_child0, 0);
|
||||
|
||||
final YogaNode root_child0_child0_child0_child0_child1_child1 = createNode(config);
|
||||
root_child0_child0_child0_child0_child1_child1.setAlignContent(YogaAlign.STRETCH);
|
||||
root_child0_child0_child0_child0_child1_child1.setFlexShrink(1f);
|
||||
root_child0_child0_child0_child0_child1.addChildAt(
|
||||
root_child0_child0_child0_child0_child1_child1, 1);
|
||||
root_child0_child0_child0_child0_child1.addChildAt(root_child0_child0_child0_child0_child1_child1, 1);
|
||||
|
||||
final YogaNode root_child0_child0_child1 = createNode(config);
|
||||
root_child0_child0_child1.setAlignContent(YogaAlign.STRETCH);
|
||||
@@ -107,8 +103,7 @@ public class YGAndroidNewsFeed {
|
||||
root_child0_child0_child1_child0_child0_child0.setAlignContent(YogaAlign.STRETCH);
|
||||
root_child0_child0_child1_child0_child0_child0.setWidth(72f);
|
||||
root_child0_child0_child1_child0_child0_child0.setHeight(72f);
|
||||
root_child0_child0_child1_child0_child0.addChildAt(
|
||||
root_child0_child0_child1_child0_child0_child0, 0);
|
||||
root_child0_child0_child1_child0_child0.addChildAt(root_child0_child0_child1_child0_child0_child0, 0);
|
||||
|
||||
final YogaNode root_child0_child0_child1_child0_child1 = createNode(config);
|
||||
root_child0_child0_child1_child0_child1.setAlignContent(YogaAlign.STRETCH);
|
||||
@@ -124,14 +119,12 @@ public class YGAndroidNewsFeed {
|
||||
root_child0_child0_child1_child0_child1_child0.setFlexDirection(YogaFlexDirection.ROW);
|
||||
root_child0_child0_child1_child0_child1_child0.setAlignContent(YogaAlign.STRETCH);
|
||||
root_child0_child0_child1_child0_child1_child0.setFlexShrink(1f);
|
||||
root_child0_child0_child1_child0_child1.addChildAt(
|
||||
root_child0_child0_child1_child0_child1_child0, 0);
|
||||
root_child0_child0_child1_child0_child1.addChildAt(root_child0_child0_child1_child0_child1_child0, 0);
|
||||
|
||||
final YogaNode root_child0_child0_child1_child0_child1_child1 = createNode(config);
|
||||
root_child0_child0_child1_child0_child1_child1.setAlignContent(YogaAlign.STRETCH);
|
||||
root_child0_child0_child1_child0_child1_child1.setFlexShrink(1f);
|
||||
root_child0_child0_child1_child0_child1.addChildAt(
|
||||
root_child0_child0_child1_child0_child1_child1, 1);
|
||||
root_child0_child0_child1_child0_child1.addChildAt(root_child0_child0_child1_child0_child1_child1, 1);
|
||||
root.setDirection(YogaDirection.LTR);
|
||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||
|
||||
|
@@ -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
|
||||
|
||||
package com.facebook.yoga;
|
||||
|
@@ -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
|
||||
|
||||
package com.facebook.yoga;
|
||||
|
@@ -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
|
||||
|
||||
package com.facebook.yoga;
|
||||
@@ -219,8 +218,6 @@ public class YGDisplayTest {
|
||||
root_child1_child0.setFlexShrink(1f);
|
||||
root_child1_child0.setFlexBasisPercent(0f);
|
||||
root_child1_child0.setWidth(20f);
|
||||
root_child1_child0.setMinWidth(0f);
|
||||
root_child1_child0.setMinHeight(0f);
|
||||
root_child1.addChildAt(root_child1_child0, 0);
|
||||
|
||||
final YogaNode root_child2 = createNode(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
|
||||
|
||||
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.
|
||||
*/
|
||||
// @Generated by gentest/gentest.rb from gentest/fixtures/YGFlexTest.html
|
||||
|
||||
|
@@ -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
|
||||
|
||||
package com.facebook.yoga;
|
||||
@@ -532,12 +531,12 @@ public class YGFlexWrapTest {
|
||||
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(50f, root_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
|
||||
assertEquals(0f, root_child1.getLayoutHeight(), 0.0f);
|
||||
|
||||
root.setDirection(YogaDirection.RTL);
|
||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||
@@ -550,12 +549,12 @@ public class YGFlexWrapTest {
|
||||
assertEquals(100f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(50f, root_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
|
||||
assertEquals(0f, root_child1.getLayoutHeight(), 0.0f);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@@ -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.
|
||||
*/
|
||||
// @Generated by gentest/gentest.rb from gentest/fixtures/YGJustifyContentTest.html
|
||||
|
||||
|
@@ -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
|
||||
|
||||
package com.facebook.yoga;
|
||||
|
@@ -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
|
||||
|
||||
package com.facebook.yoga;
|
||||
|
@@ -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
|
||||
|
||||
package com.facebook.yoga;
|
||||
|
@@ -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
|
||||
|
||||
package com.facebook.yoga;
|
||||
|
@@ -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
|
||||
|
||||
package com.facebook.yoga;
|
||||
|
@@ -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
|
||||
|
||||
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