Georgiy Kassabli b378a685a4 Changed pointScaleFactor usage to avoid accumulating error
Summary: Previously pointScaleFactor was stored as a divider that opened way to accumulating difference. For instance in ScreenScale=3, pointScaleFactor = 0.3333343 (0.000001 error). When used for width = 300 that error was multiplied by the number of times pointScale contained in width (300 *3 = 900) and we had almost 0.001 error accumulated. With this change Yoga will avoid such issue

Reviewed By: shergin

Differential Revision: D5137923

fbshipit-source-id: 652b59bc3da3f35ee93ffa3695936f623298a023
2017-05-26 10:57:12 -07:00
2017-01-30 07:39:38 -08:00
2017-05-09 03:41:51 -07:00
2017-05-22 02:33:05 -07:00
2017-05-09 03:41:51 -07:00
2017-05-11 03:47:15 -07:00
2017-04-19 12:27:32 -07:00
2017-05-23 12:12:45 -07:00
2017-04-18 12:11:15 -07:00
2017-04-19 12:27:32 -07:00
2016-11-16 16:36:36 +01:00
2017-01-26 10:39:36 -08:00
2017-05-26 04:13:01 -07:00
2017-03-17 10:58:42 -07:00
2017-05-22 10:11:49 -07:00
2017-05-11 03:47:16 -07:00
2017-04-19 10:56:48 -07:00
2016-12-07 16:18:13 +00:00
2016-12-07 17:41:50 +00:00
2016-12-07 16:18:13 +00:00
2017-04-26 07:42:40 -07:00
2017-05-10 09:32:26 -07:00
2017-05-10 09:32:26 -07:00

Yoga CocoaPods npm bintray NuGet

C Status Java Status iOS Status .NET Status JavaScript Status Android Status

Visual Studio Team services Visual Studio Team services

Building

Yoga builds with buck. 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 as a submodule. After cloning Yoga run git submodule init followed by git submodule update.

For any changes you make you should ensure that all the tests are passing. In case you make any fixes or additions to the library please also add tests for that change to ensure we don't break anything in the future. Tests are located in the tests directory. Run the tests by executing buck test //:yoga.

Instead of manually writing a test which ensures parity with web implementations of Flexbox you can run gentest/gentest.rb to generated a test for you. You can write html which you want to verify in Yoga, in gentest/fixtures folder, such as the following.

<div id="my_test" style="width: 100px; height: 100px; align-items: center;">
  <div style="width: 50px; height: 50px;"></div>
</div>

Run gentest/gentest.rb to generate test code and re-run buck test //:yoga to validate the behavior. One test case will be generated for every root div in the input html.

You may need to install the latest watir-webdriver gem (gem install watir-webdriver) and ChromeDriver to run gentest/gentest.rb Ruby script.

.NET

.NET testing is not integrated in buck yet, you might need to set up .NET testing environment. We have a script which to launch C# test on macOS, csharp/tests/Facebook.Yoga/test_macos.sh.

Code style

For the main C implementation of Yoga clang-format is used to ensure a consistent code style. Please run bash format.sh before submitting a pull request. For other languages just try to follow the current code style.

Benchmarks

Benchmarks are located in benchmark/YGBenchmark.c and can be run with buck run //benchmark:benchmark. If you think your change has affected performance please run this before and after your change to validate that nothing has regressed. Benchmarks are run on every commit in CI.

Javascript

Installing through NPM

npm install yoga-layout

By default this will install the library and try to build for all platforms (node, browser asm, and standalone webpack). You may receive errors if you do not have the required platform development tools already installed. To preset the platform you'd like to build for you can set a .npmrc property first.

npm config set yoga-layout:platform standalone

This will now only run the standalone webpack build upon install.

Build Platforms

name description
all (default) Builds all of these platforms.
browser Builds asm js browser version.
node Builds node js version.
standalone Runs webpack.
none Does nothing. You can use the prepackaged libs.
Description
Yoga is an embeddable layout engine targeting web standards.
Readme MIT 37 MiB
Yoga 3.2.1 Latest
2024-12-12 17:41:47 -08:00
Languages
C++ 46.4%
Java 25.2%
TypeScript 23.1%
HTML 2.6%
JavaScript 1%
Other 1.6%