602 Commits

Author SHA1 Message Date
Emil Sjolander
c080a46571 Fix some issues with the deploy script and deploy a new version for android
Summary: Fix some issues with the deploy script and deploy a new version for android

Reviewed By: passy

Differential Revision: D4876006

fbshipit-source-id: ddafb8349e1c77ab5afd9a823103fb6a1dfabb1d
2017-04-12 09:56:42 -07:00
Emil Sjolander
5f050cb590 Bump version of android stuff
Summary: Bump version of android things

Reviewed By: passy

Differential Revision: D4875213

fbshipit-source-id: 2b229a0dade521ef745852c0096545e7e9fe2c1e
2017-04-12 03:43:45 -07:00
Lukas Wöhrl
25f14a1917 Fix min constraint incorrectly reducing available space
Summary:
If a min constraint exists. It incorrectly reduces the available space by that amount. This adds a test and fix for this.
Closes https://github.com/facebook/yoga/pull/501

Differential Revision: D4867146

Pulled By: emilsjolander

fbshipit-source-id: ceafe070bfe7f501929d316656ac44c4e1753059
2017-04-11 13:11:08 -07:00
Lukas Wöhrl
e9927377b5 Fix position on root node with RTL direction
Summary:
If the root node has a position and we have a RTL layout, that position must be like LTR direction. See #477.
Closes https://github.com/facebook/yoga/pull/502

Differential Revision: D4867144

Pulled By: emilsjolander

fbshipit-source-id: b5ad3d87e7054090da12d7665a3d1abe8496a548
2017-04-11 13:11:05 -07:00
Lukas Wöhrl
5112564f08 Don't transfer layout outputs to java for unset edges
Summary:
See facebook/yoga#483. We should not transfer the layout if the layout didn't change. (using ```hasNewLayout```). This also changes that the lock on the java node is only aquired if needed, and it holds the lock only for the time the values are set and not for the time all it's children are set.
Closes https://github.com/facebook/yoga/pull/484

Reviewed By: astreet

Differential Revision: D4802966

Pulled By: emilsjolander

fbshipit-source-id: e8a8f2280ad6b25b98fc68b07eac68e0ec80fe3e
2017-04-01 04:43:09 -07:00
Lukas Wöhrl
5884ab7b76 Don't transfer layout outputs to java for nodes which don't have a new layout
Summary:
As suggested in facebook/yoga#484. This is the PR which only adds the part of using a local bool field for storing the hasLayoutFlag, to be able to pass the layout only if it has really changed.
Closes https://github.com/facebook/yoga/pull/492

Reviewed By: astreet

Differential Revision: D4786961

Pulled By: emilsjolander

fbshipit-source-id: cf3d354b93f6dcc3ef817ef73a47bd29e37d1848
2017-03-29 16:44:13 -07:00
Robert Spencer
6b002bad3d Version bump of java library
Summary: Version bump as we have introduced `setUseWebDefaults`.

Reviewed By: emilsjolander

Differential Revision: D4794772

fbshipit-source-id: 0a42def3bec3f4f76caf6da01e3b9ab3679ebcb0
2017-03-29 06:56:13 -07:00
Emil Sjolander
bc2fb5c7ab Expose UseWebDefaults to java
Summary: Expose UseWebDefaults to java

Reviewed By: astreet

Differential Revision: D4779743

fbshipit-source-id: 65a4184af6fb959fefff5c2014522c551ca440d5
2017-03-29 03:12:33 -07:00
Emil Sjolander
b283572453 Revert D4716024: [yoga] Avoid transfering cached layout information to java
Summary: This reverts commit c30763a6fc7426d653c7a6ca129615cddb4140e9

Differential Revision: D4716024

fbshipit-source-id: 7276b4bbf072aa444c5ae9fd1a3d62ea87a0cec1
2017-03-17 13:27:18 -07:00
Emil Sjolander
a14aeb27bb Avoid transfering cached layout information to java
Summary: Don't transfer layout outputs to java if the layout was cached as this means that it has already been transfered

Reviewed By: astreet

Differential Revision: D4716024

fbshipit-source-id: c30763a6fc7426d653c7a6ca129615cddb4140e9
2017-03-17 09:14:08 -07:00
Pascal Hartig
9b13fdeae4 Add YOGA_ROOTS to permit multiple definitions
Summary:
This changes the `YOGA_ROOT` to `YOGA_ROOTS` in `YOGA_DEFS`. This allows the
inclusion of Yoga in the exported Components libraries directory and
back-references to the nested dependencies within it.

Reviewed By: rspencer01

Differential Revision: D4721745

fbshipit-source-id: 2dc9d4a730076510aed02027cb6713f6326c588d
2017-03-16 10:41:59 -07:00
Lukas Wöhrl
b94466e502 Fix align-content: center, flex-end alignment with margin
Summary:
This fixes ```align-content: center``` and ```align-content: flex-end``` when the child exceeds the parents size. See #476. It also fixes those layouts if the child has ```margin: auto``` set.
Closes https://github.com/facebook/yoga/pull/477

Differential Revision: D4697833

Pulled By: emilsjolander

fbshipit-source-id: d081ec7ea559a5f2bd3271c3a4dc272960beddfa
2017-03-15 05:31:38 -07:00
Lukas Wöhrl
09f0c2d8ce Take margin into account on max dimension
Summary:
We need to take the margin into account if we clip on max dimension. Fixes #466.
Closes https://github.com/facebook/yoga/pull/467

Differential Revision: D4681342

Pulled By: emilsjolander

fbshipit-source-id: 56311df9864a284d553c31f1c6db382f337f1fad
2017-03-09 03:56:00 -08:00
Lukas Wöhrl
01bf8d7b6c Add unittest for percentage width inside absolute layout
Summary:
Added unittest to constraint layout of percentage width inside absolute parent. See #454.
Closes https://github.com/facebook/yoga/pull/456

Differential Revision: D4674103

Pulled By: emilsjolander

fbshipit-source-id: 569a762e5a2b4ac80cd79bfbc9abfe57ada74dc9
2017-03-08 09:26:08 -08:00
Robert Spencer
1bf142e048 Separate annotation processors and include in java as provided
Summary:
With the current setup, the final aar contains `com.facebook.proguard.annotation.DoNotStrip`.  This is not needed (it is only used for proguard), and thus should not get published.

We move proguard annotations into its own project for this, and place it into `java/proguard-annotations`. Here we adopt the gradle convention of `src/main` to make for a nice, clean (one line!) gradle script.  As a different subproject, we can include this to `:yoga` as a `provided` dependency now, which doesn't include it in the output artifact.

Reviewed By: emilsjolander

Differential Revision: D4666572

fbshipit-source-id: a0cb26cb6c264065a0bd355b7d72ba02e3759560
2017-03-08 00:12:05 -08:00
Robert Spencer
32792a0de5 Gradle versionbump
Summary: Version 1.3

Reviewed By: emilsjolander

Differential Revision: D4666239

fbshipit-source-id: fad4b97b9947342ac91718d4f261184e7baf334a
2017-03-07 06:56:26 -08:00
Robert Spencer
abf912b729 Gradle version bump and POM details
Summary: This improves the quality of the published POM files, adding dependencies and marking the object as an 'aar'.  It also bumps the version to 1.2.0 for JCenter.

Reviewed By: emilsjolander

Differential Revision: D4620150

fbshipit-source-id: 968f1cea21af4b2f19aeff3f32ad575b185fa1bb
2017-03-07 03:56:46 -08:00
Emil Sjolander
e7d2792009 Add another nested percentage test
Summary: Add test covering a nested percentage container inside of a unconstraint container. This is something we ran into recently and want to make sure to cover in tests.

Reviewed By: astreet

Differential Revision: D4637519

fbshipit-source-id: a8fe3c7702c2ea0ad954cce80fbdf953bb23c997
2017-03-03 10:26:40 -08:00
Emil Sjolander
0fde1424f0 re-generate tests. Something was missed when rebasing
Summary: Some of the tests were not generated correctly. most likely due to a rebase.

Reviewed By: astreet

Differential Revision: D4637539

fbshipit-source-id: 196478d7e5197519af9ab05e5134e6fb7d22b992
2017-03-03 10:26:40 -08:00
Lukas Wöhrl
37c48257ae Move configuration to new YGConfig and pass them down to CalculateLayout
Summary:
Move configuration to new ```YGConfig``` and pass them down to CalculateLayout. See #418 .

Adds ```YGConfigNew()``` + ```YGConfigFree```, and changed ```YGSetExperimentalFeatureEnabled``` to use the config.

New function for calculation is ```YGNodeCalculateLayoutWithConfig```.
Closes https://github.com/facebook/yoga/pull/432

Reviewed By: astreet

Differential Revision: D4611359

Pulled By: emilsjolander

fbshipit-source-id: a1332f0e1b21cec02129dd021ee57408449e10b0
2017-03-01 09:27:53 -08:00
Emil Sjolander
8668e43f6d Fix margin auto for start and end values
Summary: Margin auto was not handling start/end margins correctly

Reviewed By: astreet

Differential Revision: D4627339

fbshipit-source-id: eebf64e79a34331e79cffcfa3662d4938fbd6c13
2017-03-01 09:27:52 -08:00
Emil Sjolander
3790635af1 Re-generate wrap tests
Summary: Seems someone forgot to run the generation script

Reviewed By: astreet

Differential Revision: D4627337

fbshipit-source-id: 17dd1e1fed938a049ae820a9a4ac913667073d09
2017-03-01 06:27:16 -08:00
Georgiy Kassabli
3ef2970032 Yoga test failure for flexing with min stack dimension
Summary: Test fails when we have flexible child and min/max layout dimension. Yoga should flex the child to minimal size, while in reality Yoga flexes it to maximal size

Reviewed By: emilsjolander

Differential Revision: D4558653

fbshipit-source-id: 06b38d7ed43aee063cc881f38b84558641f043f3
2017-02-28 16:28:54 -08:00
Lukas Wöhrl
17e3dca9f9 Fix percentage in flexing parent
Summary:
If we don't measure exactly, percentage values aren't exactly either. Fix for #414.
Closes https://github.com/facebook/yoga/pull/416
Closes https://github.com/facebook/yoga/pull/414

Reviewed By: astreet

Differential Revision: D4604729

Pulled By: emilsjolander

fbshipit-source-id: 66880230073209cbe89668b838c2a82e7f9b34df
2017-02-28 07:12:05 -08:00
Michael Bolin
47d8d9d22b Apply auto-formatter for BUCK files in fbandroid.
Summary:
For more background, see:

https://fb.facebook.com/groups/303159406399348/permalink/1334977403217538/
https://fburl.com/auto-format-build-files
D4527873

fbshipit-source-id: 278ce6f67f5df830b2218e3aca69be103d3c56a6
2017-02-24 21:44:02 -08:00
Lukas Wöhrl
4f5c7ed6af Fix align-content:strech overriding align-item
Summary:
Fix for #413. This was a hangover from a previous attept to fix other align-content problems.
Closes https://github.com/facebook/yoga/pull/417

Reviewed By: astreet

Differential Revision: D4604727

Pulled By: emilsjolander

fbshipit-source-id: 92fd31a385d8182c6b201c891d5ae478372d525d
2017-02-23 08:31:05 -08:00
Robert Spencer
60ffa1953b Gradle for android library
Summary: Adds a buildscript for gradle as well as bintray upload capabilities for the YogaLayout library

Reviewed By: emilsjolander

Differential Revision: D4604712

fbshipit-source-id: bacbcc20b7ed6ee8689130287a48bd5d3826298c
2017-02-23 05:07:20 -08:00
Robert Spencer
5519a73087 Gradle for java library
Summary: This builds the java bindings with gradle, and adds a script for Facebook employees to upload the generated artifacts to JCenter.

Reviewed By: emilsjolander

Differential Revision: D4597335

fbshipit-source-id: 4c01695a8638000a417bfb49deba4b9b9b4e114b
2017-02-23 05:07:20 -08:00
Emil Sjolander
6b39165801 Fix behaviour of wrapping container within align-items: not stretch
Summary: When a container's children wrap the container should match the parent size and not wrap to the new size of the children. This is confirmed behavior in chrome.

Reviewed By: astreet

Differential Revision: D4578614

fbshipit-source-id: 5d22a3a673735587384d775189158a87bb1d457d
2017-02-20 07:28:42 -08:00
Lukas Wöhrl
20536923d6 flex-wrap: wrap-reverse support
Summary:
I couldn't resist to do this 😄 #394

This adds ```flex-wrap: wrap-reverse```

I think we hit a edge case here:
https://stackoverflow.com/questions/33891709/when-flexbox-items-wrap-in-column-mode-container-does-not-grow-its-width

as is differs here from chrome, but I think that yoga is here more correct.

So I haven't added this test yet as this would fail against chrome, as chrome outputs a width of 30 for root, whereas yoga gets a width of 60 here, which I think is correct. Strangely the output of ```flex-wrap:wrap``` is in jsfiddle also only with a (visual) width of 30 on chrome, while the tests gets generated with 60.

```html
<div id="wrap_reverse_column" style="height: 100px; flex-wrap: wrap-reverse">
  <div style="height: 30px; width: 30px;"></div>
  <div style="height: 30px; width: 30px;"></div>
  <div style="height: 30px; width: 30px;"></div>
  <div style="height: 30px; width: 30px;"></div>
</div>
```

Looking forward what you think here emilsjolander
Closes https://github.com/facebook/yoga/pull/398

Reviewed By: astreet

Differential Revision: D4564711

Pulled By: emilsjolander

fbshipit-source-id: 33dc055abd8444b2aa7796ef90bd7ec99e961bb8
2017-02-15 13:42:47 -08:00
David Hart
9d2839f8ca Rename YGUnitPixel to YGPoint...
Summary:
...to reflect the modern world we live in with dynamic DPI platforms :)
Closes https://github.com/facebook/yoga/pull/375

Reviewed By: dshahidehpour

Differential Revision: D4528518

Pulled By: emilsjolander

fbshipit-source-id: e422bd4ae148e02c598a7b484a6adfa8c0e1e0c9
2017-02-14 14:27:48 -08:00
Lukas Wöhrl
1146013e9e Feature auto margin
Summary:
Even so I know there are some opinions against ```margin: 0 auto``` it's still part of the spec: https://www.w3.org/TR/css-flexbox-1/#auto-margins and pretty usefull if you have to position via ```justify-content```.

This PR adds an implementation for that.

It adds an additonal ```YGUnitAuto``` and margins got ```YGNodeStyleSetMarginAuto``` functions as well.
Closes https://github.com/facebook/yoga/pull/357

Reviewed By: astreet

Differential Revision: D4501142

Pulled By: emilsjolander

fbshipit-source-id: 86519f8632496f46e78a7c9dbc5b21e212e3e0c7
2017-02-14 14:27:48 -08:00
Emil Sjolander
a1c75454e9 Fix align-content strech with multiple lines
Summary: This is an update of facebook/yoga#368 which was reverted. It fixes support for align-content: strech with multiple lines. The problem with the last attempt at solving this was that align-items:stretch was interfering. We handle this now by detecting when the flex basis of the children hints at them overflowing. This is not 100% correct as the size of the items could change when remeasuring but it will work in 99% of cases.

Reviewed By: astreet

Differential Revision: D4551234

fbshipit-source-id: 2964f19cf415991dc55dfa2caa4868cb00c56bd0
2017-02-14 09:26:10 -08:00
Emil Sjolander
0d2749a3fd Revert D4528559: [yoga][PR] Fix align-content strech with multiple lines
Summary: This reverts commit 019e6f85fa452d0c3412f711e3886f0c4452da47

Differential Revision: D4528559

fbshipit-source-id: 4bd82b399cb36acb348f2c6fedcae6b360513424
2017-02-13 01:11:16 -08:00
Lukas Wöhrl
063f65d065 Fix align-content strech with multiple lines
Summary:
Fixes ```align-content:strech``` on nodes without specified cross dimension, if there are multiple lines. Currently it uses the full height of the parent, but it has to use the line height. As we don't know the number of lines until here, we need to realign the relevant children.
Closes https://github.com/facebook/yoga/pull/368

Reviewed By: gkassabli

Differential Revision: D4528559

Pulled By: emilsjolander

fbshipit-source-id: 019e6f85fa452d0c3412f711e3886f0c4452da47
2017-02-11 08:41:45 -08:00
Lukas Wöhrl
6a7ad2125d Add support for space-between and space-around on align-content
Summary:
Adds the two missing alignments ```space-between``` and ```space-around``` for ```align-content``` . Those values are a noop on ```align-items``` in order to prevent a breaking changes for an additional enum.

Fix #229
Closes https://github.com/facebook/yoga/pull/364

Reviewed By: gkassabli

Differential Revision: D4528561

Pulled By: emilsjolander

fbshipit-source-id: ea6291b6dd22cef05d9eec03893250d50371236e
2017-02-11 08:41:45 -08:00
Emil Sjolander
e0e2a61dfc Use Float.compare in java equals
Summary: Handles nans. Also if the unit is undefined there is no need to check the value.

Reviewed By: astreet

Differential Revision: D4531805

fbshipit-source-id: 723e15381e9fa39837a4c99f726501eda26af11b
2017-02-11 06:27:15 -08:00
Emil Sjolander
168ae4099d Always return undefined value if nothing is set
Summary: This reflects a check to native code where style values will always return the value that was set on them and default to undefined.

Reviewed By: astreet

Differential Revision: D4531779

fbshipit-source-id: 97a789e70dcf0fb5174e2039991e7a2b27f45f01
2017-02-11 06:27:12 -08:00
Emil Sjolander
6ceb4af2d4 Expose layout border to java
Summary: Expose layout border to java

Reviewed By: astreet

Differential Revision: D4543284

fbshipit-source-id: 6030915fc6f758e785a688f94c8ffbec7fbac8b8
2017-02-11 06:27:04 -08:00
Emil Sjolander
240c2dd657 Fix min/max not overriding width/height
Summary:
Two bugs:
1. Min/Max width/height should have higher priority than width/height
2. custom measure nodes percentages should be based in parent size like everything else.

Differential Revision: D4537576

fbshipit-source-id: c003f723f424afbca63170d41e54fd5ff837926d
2017-02-11 05:28:10 -08:00
Georgiy Kassabli
b5c2b09780 Revert D4456312: Fix for Yoga test failure for flexing with min stack dimension
Summary: This reverts commit 82a39bc93cf3bf2374b968e9f7403397e752908e

Differential Revision: D4456312

fbshipit-source-id: 6b396f0a8b67619308456599377238b75d0c1ab3
2017-02-07 05:18:19 -08:00
Antonio Corrado
46817a38c3 Setting min=max dimension is treated as setting dimension
Summary: If a node has minDimension and maxDimension set at the same value, yoga will treat it as having a set dimension, doing less calculations.

Reviewed By: emilsjolander

Differential Revision: D4492395

fbshipit-source-id: 3f4293548399e006aa808b9586d24e77c7df1f21
2017-02-06 14:41:37 -08:00
Georgiy Kassabli
52f3471405 Fix for Yoga test failure for flexing with min stack dimension
Summary: Test fails when we have flexible child and min/max layout dimension. Yoga should flex the child to minimal size, while in reality Yoga flexes it to maximal size

Reviewed By: emilsjolander

Differential Revision: D4456312

fbshipit-source-id: 82a39bc93cf3bf2374b968e9f7403397e752908e
2017-02-06 13:00:42 -08:00
Lukas Wöhrl
e567502750 Added property display: flex and none
Summary:
Fix #241 and successor for #302

Added new property ```display``` with ```YGDisplayFlex``` and ```YGDisplayNone```. Allows to hide nodes from the layout without the need to remove it from the DOM.
Closes https://github.com/facebook/yoga/pull/369

Reviewed By: astreet

Differential Revision: D4501141

Pulled By: emilsjolander

fbshipit-source-id: 0dfeee381f6d1e4bbba81926126b83dd7abab9d6
2017-02-06 09:39:37 -08:00
Emil Sjolander
56d06e27cf Pass parent with down with calculateLayout to allow percentages on root node
Summary: For percentage paddings/margins/sizes to work on the root node we need to have the ability to pass down the parent sizes. This has always been possible with the C API but was never exposed to java. This diff exposes this functionality.

Reviewed By: astreet

Differential Revision: D4501016

fbshipit-source-id: 0c9502e86ff200c021c78afb7ac4b48cf11b3bdb
2017-02-03 11:24:57 -08:00
Emil Sjolander
cfeac79130 Fix percentage calculation when parent size is undefined
Summary: If parent size was undefined and node specified percentage size it would pass does an exact measure mode with an undefined value which broke an assertion.

Reviewed By: gkassabli

Differential Revision: D4494265

fbshipit-source-id: 9efef9e39a1b66af2d0f144575a96c919d60dbf7
2017-02-03 05:40:00 -08:00
Emil Sjolander
4227e36ca5 Add tests for wrapping to child size
Summary: Add tests for container wrapping child size

Reviewed By: gkassabli

Differential Revision: D4494263

fbshipit-source-id: bebfdd4a180b0ccd8dbb14e566613f1e64fabd7a
2017-02-03 05:40:00 -08:00
Emil Sjolander
d62ca8c518 Use fromInt() instead of indexing values() as it allocates a new array
Summary: values() create a shallow copy of the underlying array every time as there are no immutable arrays in java. By using fromInt() we avoid this allocation.

Reviewed By: pasqualeanatriello

Differential Revision: D4494371

fbshipit-source-id: 11cff65114803e185bc67a96da0bf2a2c4a3e6d9
2017-02-02 15:39:33 -08:00
Pascal Hartig
9afb65da34 Regenerate test comments
Reviewed By: emilsjolander

Differential Revision: D4482049

fbshipit-source-id: c30a6550ed175811df29c24ba03af92f3bd32713
2017-01-31 09:40:19 -08:00
Lukas Wöhrl
7c77b0e48c Fix syntax error in YGMarginTest.html
Summary:
Fixes wrongly used  ```;``` inside style declaration.
Closes https://github.com/facebook/yoga/pull/360

Reviewed By: astreet

Differential Revision: D4476067

Pulled By: emilsjolander

fbshipit-source-id: 332cdcd9a832eebc68a6d73840c1d5a10078eb66
2017-01-30 08:39:35 -08:00