Commit Graph

872 Commits

Author SHA1 Message Date
Lukas Woehrl
1d9855b405 shortcut if node is column direction 2017-01-05 22:07:36 +01:00
Lukas Woehrl
9e44f0f4d4 code review changes 2017-01-05 22:03:17 +01:00
Lukas Woehrl
0a708e18c0 use YGFlexDirectionColumn explicit 2017-01-05 21:02:47 +01:00
Lukas Woehrl
2595e082d6 use height explicit 2017-01-05 20:54:27 +01:00
Lukas Woehrl
b790bf7dba crash if custom baseline function returns undefined 2017-01-05 20:52:55 +01:00
Lukas Woehrl
11825ad303 break instead of continue if on second line 2017-01-05 20:48:27 +01:00
Lukas Woehrl
fc834e8296 add testcase where align-self can't override if on second line 2017-01-05 20:42:47 +01:00
Lukas Woehrl
315161743f code review changes and tests for child firstline and per baseline override 2017-01-05 20:40:46 +01:00
Lukas Woehrl
cf7a7c5b83 added tests for margin and removed unused function argument 2017-01-05 19:48:31 +01:00
Lukas Woehrl
1c52ff1b4f wrong comparions 2017-01-05 18:21:06 +01:00
Lukas Woehrl
9d035cd16a added additional tests 2017-01-05 17:50:25 +01:00
Lukas Woehrl
e87edbf206 adjusted text and fixed alignment on column/row direction difference 2017-01-05 17:33:49 +01:00
Lukas Woehrl
d10d050a2e renamed files and moved tests to accoriding fixtures 2017-01-05 17:02:28 +01:00
Lukas Woehrl
60861a3b81 more tests for row and column directions 2017-01-05 15:19:07 +01:00
Lukas Woehrl
e4f70d0fa3 delete tmp 2017-01-05 15:12:04 +01:00
Lukas Woehrl
87abbc0935 added test for align-self: baseline 2017-01-05 15:11:32 +01:00
Lukas Woehrl
17ef313d09 renamed to YGBaseline 2017-01-05 14:47:21 +01:00
Lukas Woehrl
23ad2df59c fix layout with explicit top specified 2017-01-05 14:29:26 +01:00
Lukas Woehrl
00ab30e337 get baseline of the same direction 2017-01-05 14:11:49 +01:00
Lukas Woehrl
b721fb3a54 delete tmp file 2017-01-05 13:54:38 +01:00
Lukas Woehrl
d4e45958d0 remove unneeded function 2017-01-05 13:50:53 +01:00
Lukas Woehrl
49ffda5431 cleanup 2017-01-05 13:45:01 +01:00
Lukas Woehrl
e99e7b93d5 format 2017-01-05 13:36:25 +01:00
Lukas Woehrl
3e5e01f6e1 renamed variables correctly and used correct values 2017-01-05 13:35:54 +01:00
Lukas Woehrl
45f0011065 run format.sh 2017-01-05 13:22:59 +01:00
Lukas Woehrl
eaa2501c76 fix multiline baseline layout 2017-01-05 11:47:38 +01:00
Lukas Woehrl
5803ba4e5b fix nodes with margin 2017-01-05 11:03:36 +01:00
Lukas Woehrl
d4ccb44c07 use flexdirection 2017-01-05 00:27:03 +01:00
Lukas Woehrl
29bce98fd9 enums for csharp and java 2017-01-04 22:39:46 +01:00
Lukas Woehrl
09f347092b more whitespace cleanup 2017-01-04 22:34:55 +01:00
Lukas Woehrl
71a23ef987 fix whitespace indent 2017-01-04 22:32:05 +01:00
Lukas Woehrl
3b20c24fa3 remove background color from tests 2017-01-04 22:22:45 +01:00
Lukas Woehrl
3d840e533b added baseline support 2017-01-04 22:21:29 +01:00
Dustin Shahidehpour
663a93912b Add Overflow API.
Summary: We need this for scrollviews, bring on the overflow!

Reviewed By: emilsjolander

Differential Revision: D4376759

fbshipit-source-id: a427432da5e8679dbf9fdbfe4250707e727368f4
2017-01-03 06:39:40 -08:00
Lukas Woehrl
a85bd4ad2a Add feature to use percentage as value unit
Summary:
Adds the feature to use percentage as a value unit.

You can use the function ```YGPx(float)``` and ```YGPercent(float)``` for convenience.

I did some benchmarks:

```
Without Percentage Feature - Release x86:

Stack with flex: median: 0.000000 ms, stddev: 0.146683 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.136525 ms
Nested flex: median: 0.000000 ms, stddev: 0.490101 ms
Huge nested layout: median: 23.000000 ms, stddev: 0.928291 ms

Stack with flex: median: 0.000000 ms, stddev: 0.170587 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.143384 ms
Nested flex: median: 0.000000 ms, stddev: 0.477791 ms
Huge nested layout: median: 22.000000 ms, stddev: 2.129779 ms

With Percentage Feature - Release x86:

Stack with flex: median: 0.000000 ms, stddev: 0.132951 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.136525 ms
Nested flex: median: 0.000000 ms, stddev: 0.489570 ms
Huge nested layout: median: 21.000000 ms, stddev: 1.390476 ms
Closes https://github.com/facebook/yoga/pull/258

Reviewed By: dshahidehpour

Differential Revision: D4361945

Pulled By: emilsjolander

fbshipit-source-id: a8f5bc63ad352eb9410d792729e56664468cd76a
2017-01-02 05:24:35 -08:00
Maël Nison
6f462a72bf Adds Javascript Support
Summary:
- As mentioned in the title, this PR adds Javascript support to Yoga. Two different builds are included in this PR thanks to [nbind](https://github.com/charto/nbind), which conveniently allow to target both Node.js' native addons and browser environments via asmjs with approximately the same codebase. That should solve #215.

- All tests successfully pass on both codepaths. You can run `yarn test:all` inside the `javascript` directory to test it.

- Because of a bug in nbind, the [following PR](https://github.com/charto/nbind/pull/57) needs to be merged and a new version released before this one can be safely merged as well.

- I had to use `double` types instead of `float` in the C++ bindings because of an Emscripten [bug](https://github.com/kripken/emscripten/issues/3592) where symbols aren't correctly exported when using floats.

- There's some tweaks to do before this PR is 100% ready to merge, but I wanted to have your opinion first. What do you think of this?

 ---

To do:

- [x] Ensure th
Closes https://github.com/facebook/yoga/pull/304

Reviewed By: mikearmstrong001

Differential Revision: D4375187

Pulled By: emilsjolander

fbshipit-source-id: 47248558a9506b7c512b5ef281cd12fe1a60cab7
2017-01-02 02:24:38 -08:00
Emil Sjolander
352f592767 Allow decimal measurements on java
Summary: Preserve floating point values when passing them across the JNI bridge.

Differential Revision: D4366605

fbshipit-source-id: 0b94ee87a03a6ed918360dd9998930e780fc865d
v2017.01.02.00
2016-12-29 04:55:56 -08:00
Emil Sjolander
f2080e520f Move yoga docs into docs folder on master branch
Summary: Move yoga docs into master branch so that pull requests are able to include doc updates as part of other changes.

Reviewed By: JoelMarcey

Differential Revision: D4365700

fbshipit-source-id: 2f46a88974104c454c00bcdf1257abb5c4075a68
2016-12-28 04:09:48 -08:00
Lukas Woehrl
cd78291de5 C# use YogaSize throughout the measure call chain
Summary:
Java still has the same problem (see #296)

Also there is no need to have double in the method signature as we only use float internally, which could confuse some.
Closes https://github.com/facebook/yoga/pull/300

Reviewed By: splhack

Differential Revision: D4365993

Pulled By: emilsjolander

fbshipit-source-id: 681f8b1725e63eddcfb9a6c756f2ae215a44425a
v2016.12.26.00
2016-12-24 02:54:38 -08:00
Emil Sjolander
ab595d1875 ignore .buckversion
Summary: ignore .buckversion file from source control

Reviewed By: vjeux

Differential Revision: D4366002

fbshipit-source-id: 910173bab5f3235673a8686ae6b606624380df09
2016-12-24 02:54:38 -08:00
Emil Sjolander
597544e30a Add note about gtest submodule to readme
Summary: Add note about gtest submodule to readme

Reviewed By: vjeux

Differential Revision: D4366004

fbshipit-source-id: 13ddc040faa251d52aa4c253caff9f5478e12ca6
2016-12-24 02:54:38 -08:00
Kazuki Sakamoto
9f59a13836 Remove unused P/Invoke interface
Summary:
- Remove YGNodeGetContext and YGNodeSetContext from Native.cs
- https://github.com/facebook/yoga/pull/297#discussion_r93789907

Reviewed By: emilsjolander

Differential Revision: D4365845

fbshipit-source-id: 89b41ec773baa1b4901f637f5e83427c9fba4aed
2016-12-23 12:09:40 -08:00
Kazuki Sakamoto
12017e49bd Update .git/hgignore
Summary: Fix paths

Reviewed By: emilsjolander

Differential Revision: D4365853

fbshipit-source-id: 1eb5b1046f4bb7a18b8f29d2876c0d560c3fad49
2016-12-23 12:09:40 -08:00
Kazuki Sakamoto
abad796c44 Fix BUCK
Summary: Remove internal arg

Reviewed By: emilsjolander

Differential Revision: D4365827

fbshipit-source-id: 705855732146e03da65f21cbaa746277719b72f4
2016-12-23 11:24:37 -08:00
desmondyao
92137273a2 Not re-calculate value in Step1.
Summary:
Not re-calculate `paddingAndBorderAxisMain`/`paddingAndBorderAxisCross`/`paddingAndBorderAxisRow`/`paddingAndBorderAxisColumn` in Step1 of `YGNodelayoutImpl`.

They can be figure out by values calculated before.
Closes https://github.com/facebook/yoga/pull/298

Reviewed By: dshahidehpour

Differential Revision: D4365533

Pulled By: emilsjolander

fbshipit-source-id: 6caf60bc6ef3addd49915b39b48f01a8b4926e9c
2016-12-23 10:24:32 -08:00
Kazuki Sakamoto
f1ab289022 Run unit tests before building Unity package
Summary:
- Enable destructor unit tests in Unity Editor
- Exit pack.sh immediately if a command exits with a non-zero status
- Run unit tests before building Unity package

Reviewed By: emilsjolander

Differential Revision: D4365773

fbshipit-source-id: 20d0a51f4cef791154c17d329ac36598dc333a60
2016-12-23 09:54:32 -08:00
David Hart
a302b76d59 Added gitignore rule for Xcode xcuserdata
Summary: Closes https://github.com/facebook/yoga/pull/294

Reviewed By: dshahidehpour

Differential Revision: D4365534

Pulled By: emilsjolander

fbshipit-source-id: ff899d3526156ce9bbe8cba07418ca77b2f38ac8
2016-12-23 08:54:37 -08:00
Filip Frącz
4717594e93 Switched to using SafeHandle for native code interrupt
Summary:
This PR fixes issue #295

- Created a new internal YGNodeHandle class extending SafeHandle.
- YogaNode now stores a reference to YGNodeHandle.
- Removed finalizer from YogaNode.
- Pulling in System.Runtime.Handles 4.3.0.
Closes https://github.com/facebook/yoga/pull/297

Reviewed By: emilsjolander

Differential Revision: D4365462

Pulled By: splhack

fbshipit-source-id: 73293b105962cbedb71f4e3d8d1244251db1ea79
2016-12-23 08:39:33 -08:00
Hannes Verlinde
df0f76bba5 Run unit tests on Sandcastle
Summary:
- Change the CI config so it runs the tests for Editor on Sandcastle
- Don't run tests for effects-framework and yoga libraries when building for Mac (triggers code signing issues that I don't want to deal with right now)
- Add target for unit tests (aka EditorTests)
- Make the existing unit tests build and pass. These include both Objective-C and Swift (we should probably get rid of some of these though). I will convert these to Swift 3 before landing (after the migration is complete).
- Exclude the EditorUITests target for now. It only contains a single dummy test and it causes a code signing failure on Sandcastle. I did not manage to work around that yet but there is a separate task for it.

Reviewed By: Perspx

Differential Revision: D4352670

fbshipit-source-id: 0295004a72953bd8e7ae83895b2e5712bab7bd32
2016-12-23 02:09:35 -08:00
Kazuki Sakamoto
e43c9f66ff Add script to build Unity package
Summary:
Added Bash script and bat file to build a package of Yoga in order to import Yoga for Unity easily.
Closes https://github.com/facebook/yoga/pull/288

Reviewed By: emilsjolander

Differential Revision: D4344198

Pulled By: splhack

fbshipit-source-id: 49ae27dbc513b4a2d161840ca5c5f4c9df2ab227
2016-12-22 08:39:35 -08:00