Summary: For our -objc efforts we'll be excluding vendorlibs from these changes for now and then working on getting them to not have to be fully linked as a second effort. The way -objc flag works is its an all or nothing flag for the app and thus for any library we still want to link completely we'll have to add a link_whole = True to the BUCK file. (Otherwise we'll have crashes in these libraries :P).
Reviewed By: kastiglione
Differential Revision: D6252740
fbshipit-source-id: fe074977a11b70c4aa63a4c69cb7518906c98eb9
Summary: We'll need these libraries for rainbow, and none of them exist in fbcode.
Reviewed By: mzlee
Differential Revision: D5897801
fbshipit-source-id: c379b76fef2ab204555ceded0834efc6ba932f90
Summary: YGRoundValueToPixelGrid does not handle float point values correctly. It causes layout bugs in arm 32 devices. The way values are rounded to pixel grid is the following: if value is close to the left pixel - discard error and set it equal to left pixel. If value is close to right pixel - set it equal to the right pixel. Otherwise if value is closer to the left - set it equal to the left, closer to the right - set it equal to the right. The problem is when values are close to the middle. Old implementation could produce either left or right boundaries. This patch moves all values that are close to the middle to right boundary. This way results are consistent.
Reviewed By: emilsjolander
Differential Revision: D6202484
fbshipit-source-id: bb80235452208caec388775574cc4f07bfd649c4
Summary: Yoga has an edge case that cause layout to return NaN. This happened when we used absolute position with percentage and infinite constraint in that dimension. This diff fixes that case to default to border+padding
Reviewed By: emilsjolander
Differential Revision: D6199731
fbshipit-source-id: f40ddf00614b2f507848fb35f348a9dfef14b323
Summary:
More fine grained dirty marking
Currently a node's dirty flag propagates to the root of the tree ensuring that when any node is invalidated its whole subtree will be re-calculated. This is often times not needed. There are many properties which only effects a node's children and would not need to propagate all the way to the root such as align-items. Also in cases where the style does change layout it may not need to propagate all the way to the root but can often stop at the nearest position: absolute parent.
This change has the potential of greatly improving performance of re-calculating a tree.
This might require adding a second dirty flag named hasDirtyDescendants ensuring that traversal still works even though a parent is not marked as dirty.
Reviewed By: emilsjolander
Differential Revision: D6134754
fbshipit-source-id: bbcfee14058140b946401de756a3f130de0f51cd
Summary:
Source-only ABIs are a new feature of Buck that allows massive parallelism
by generating ABI jars from just the source code (without looking at most
dependencies). Because dependencies are not available, the generator
makes assumptions about how we write Java code. This commit updates
Instagram's code to conform to those assumptions.
These changes were generated by Buck's automatic migration script.
Reviewed By: dreiss
Differential Revision: D6168048
fbshipit-source-id: 0e51319d93fd697db01ea3933f48cd06a6ffac12
Summary:
This is meant to show a possible route format for a persistent form of Yoga. Where previous layouts can remain intact while still taking advantage of incremental layout by reusing previous subtrees.
```c
YGNodeRef YGNodeClone(const YGNodeRef node);
```
The core of this functionality is a new API to clone an existing node. This makes a new detached node with all the same values as the previous one. Conceptually this makes the original node "frozen" from that point on. It's now immutable. (This is not yet enforced at runtime in this PR but something we should add.)
Since the original is frozen, we reuse the children set from the original node. Their parent pointers still point back to the original tree though.
The cloned node is still mutable. It can have its styles updated, and nodes can be inserted or deleted. If an insertion/deletion happens on a cloned node whose children were reused, it'll first shallow clone its children automatically.
As a convenience I also added an API to clear all children:
```c
void YGNodeRemoveAllChildren(const YGNodeRef node);
```
During insert/delete, or as a result of layout a set of reused children may need to be first cloned. A kind of copy-on-write. When that happens, the host may want to respond. E.g. by updating the `context` such as by cloning any wrapper objects and attaching them to the new node.
```c
typedef void (*YGNodeClonedFunc)(YGNodeRef oldNode,
YGNodeRef newNode,
YGNodeRef parent,
int childIndex);
void YGConfigSetNodeClonedFunc(YGConfigRef config,
YGNodeClonedFunc callback);
```
This PR doesn't change any existing semantics for trees that are not first cloned.
It's possible for a single node to exist in two trees at once and be used by multiple threads. Therefore it's not safe to recursively free a whole tree when you use persistence. To solve this, any user of the library has to manually manage ref counting or tracing GC. E.g. by replicating the tree structure in a wrapper.
In a follow up we could consider moving ref counting into Yoga.
Closes https://github.com/facebook/yoga/pull/636
Reviewed By: emilsjolander
Differential Revision: D5941921
Pulled By: sebmarkbage
fbshipit-source-id: c8e93421824c112d09c4773bed4e3141b6491ccf
Summary:
After about 500MB, Travis seems to kill the TLS connection. Could be a traffic
limit, could be a timeout. I've only seen this for their MacOS boxes. We're now
retrying a few times with curl, which seems to work.
Reviewed By: emilsjolander
Differential Revision: D6051024
fbshipit-source-id: feb73bfb9fd81b2a8b9b4d33d4e9f230a9899a66
Summary: This seems to have changed upstream.
Reviewed By: emilsjolander
Differential Revision: D6050471
fbshipit-source-id: b453831c1d5a5974572265a78da40b0612b1d1f2
Summary:
The native-dependencies plugin seems unused. Upgrade to the latest
gradle-bintray-plugin version that's supported for the current Gradle version.
I'll hold back the upgrade to Gradle 4 until the Gradle Android Plugin for the
version hits stable.
Reviewed By: IanChilds
Differential Revision: D5986549
fbshipit-source-id: d26aa19e9eba40a2b30b20d5ffa9d2b006450f95
Summary:
Use the `deprecated_prebuilt_cxx_library` wrapper instead of the deprecated
API of `prebuilt_cxx_library`.
Reviewed By: ttsugriy
Differential Revision: D5878523
fbshipit-source-id: 2c8c1fd1d19597ff7459bbd527c89573520db74b
Summary:
The Android logger adds newline automatically, which makes the log ugly on Android.
To avoid that, wrap the android logger, print to a memory buffer. Call __android_log_write() when '\n' is detected.
Reviewed By: emilsjolander
Differential Revision: D5842889
fbshipit-source-id: 8ecc829dc43614934c47fd3a68317259e403325a
Summary:
This fixes shrinking of elements which are in a non stretch alignment
Fixes#633
Closes https://github.com/facebook/yoga/pull/634
Differential Revision: D5874862
Pulled By: emilsjolander
fbshipit-source-id: 1426aa6b60f6ba42c2be702e6f24cea935ab7acb
Summary:
Add a new test named YGZeroOutLayoutRecursivlyTest, which verifies that padding and margin of a child node should be set to 0 when the display is set to none.
Modify YGZeroOutLayoutRecursivly function, use memset to clear the layout struct of the node.
Reviewed By: emilsjolander
Differential Revision: D5842351
fbshipit-source-id: d2c2b6f829588a200525b7ccbdb63003cb4dcc4e
Summary:
Only add UIView nodes to Yoga where they are enabled.
We check for it in `isLeaf` but I think we should also check for them in the check for sub views.
Closes https://github.com/facebook/yoga/pull/609
Reviewed By: emilsjolander
Differential Revision: D5643387
Pulled By: dshahidehpour
fbshipit-source-id: a85c62b6b2e0120b2913e7f2df8b094d43ca49a6
Summary:
This PR fixes a declaration mismatch for `YGNodeCanUseCachedMeasurement` where the last argument is declared non `const` in `.h` and `const` in `.c`.
Additionally it uses explicit `float` for fraction calculation do avoid usage of `double` assignment.
Closes https://github.com/facebook/yoga/pull/607
Differential Revision: D5677931
Pulled By: emilsjolander
fbshipit-source-id: 502da957089e4439ed956987ff8dec10bd033ba3
Summary: At least one compiler seems to care about it.
Reviewed By: emilsjolander
Differential Revision: D5675518
fbshipit-source-id: 72a6e208263dde0b6bb46a78fedb2796d0e0a600
Summary:
@public
== Before ==
- Aspect ratio would do its best to fit within it's parent constraints
- Aspect ratio would prioritize `alignItems: stretch` over other sizing properties.
== After ==
- Aspect ratio is allowed to make a node grow past its parent constraints. This matches many other aspects of flexbox where parent constraints are not treated as hard constraints but rather as suggestions.
- Aspect ratio only takes `alignItems: stretch` into account if no other size definition is defined. This matches the interaction of other properties with `alignItems: stretch`.
== Updating your code ==
**You probably don't need to do anything** but in case something does break in your product it should be as easy as adding `{width: '100%', height: '100%', flexShrink: 1}` to the style declaring the `aspectRatio`.
Reviewed By: gkassabli
Differential Revision: D5639187
fbshipit-source-id: 603e8fcc3373f0b7f2461da2dad1625ab59dcb19
Summary: There was an uncovered edge case where number close to the whole was forced to round down because it was considered non-whole and had forced flooring. This diff covers that + adds a bunch of test cases to cover rounding function
Reviewed By: emilsjolander
Differential Revision: D5465632
fbshipit-source-id: 57e11092a97eba5dd76daad15fa8619535ff9c1b
Summary:
There was one incorrect path and some caching problems. I hope this will take
care of it for good.
Reviewed By: emilsjolander
Differential Revision: D5470120
fbshipit-source-id: 17c9e783c952c92fa5c2ccfb18107a59d8a80e3d
Summary:
Phew, this took a while. Buck had some changes in how it picks up SDK/NDK
configs.
In order to satisfy the new demands, I'm now installing the NDK manually and no
longer through the SDK manager. I'm also trying to cache as much as possible to
reduce the flakiness here.
Reviewed By: emilsjolander
Differential Revision: D5465206
fbshipit-source-id: 61a4b9006fe96fc9a99fb9d75b822589064a9d1a
Summary:
Set to the next snapshot version so automatic snapshot publishing is reenabled.
We need those to keep in sync with the Litho snapshots.
Reviewed By: emilsjolander
Differential Revision: D5442493
fbshipit-source-id: ecb92071ec8edb9c3c6b625c08f5aad20368d0a3
Summary: Yoga had a bug in Rounding calculation that caused text nodes dimensions to be rounded up even when the dimensions didn't need rounding
Reviewed By: emilsjolander
Differential Revision: D5406211
fbshipit-source-id: df1d54ed0805dfc3abbd8f0ceae30f6d8c26d61a
Summary:
Currently the nbind asm.js output generates boilerplate code which can conditionally load node's `fs` and `path` modules. If this output is run directly in the browser there are no issues but if you run it through a bundler the build step will fail trying to resolve the node builtins.
Workarounds currently exist for bundlers like webpack (mentioned in #444) but this is not a safe assumption to make (for example such workarounds don't exist for `metro-bundler`).
I am by no means suggesting that this is the perfect solution but this might provide a stop-gap fix for people who are currently blocked by this issue (like I am).
Closes https://github.com/facebook/yoga/pull/585
Differential Revision: D5388660
Pulled By: emilsjolander
fbshipit-source-id: d3a51eb852df35e3d0610158fe7d9f5754e4e684
Summary:
This fixes the case where we change the layout, so that it doesn't overflow anymore.
This also improves the readability by using `|=` instead of referencing the value twice.
Closes https://github.com/facebook/yoga/pull/587
Differential Revision: D5388657
Pulled By: emilsjolander
fbshipit-source-id: ce1b1ded1feed7314a2c16bf695f62b866c19ea0
Summary:
If we have a fractional measure output which matches the subpixel rounding factor, we still should round both dimension into the same direction.
Fixesfacebook/yoga#580.
Closes https://github.com/facebook/yoga/pull/583
Reviewed By: marco-cova
Differential Revision: D5274212
Pulled By: emilsjolander
fbshipit-source-id: 1febf9194210437ab77f91319d10d4da9b284b79
Summary:
We need to provide Yoga clients with means of detecting overflow in flexbox layout. This information can be used later to identify a non-overflowing layout variant among others.
Flexbox layout considered overflown if (this is *not* an exhaustive list):
- if any child node overflows
- [no-wrap] total flex basis of all child nodes is greater than available space in parent and there are no flexible children
- [no-wrap] after flexing there is still not enough space to layout all child nodes
Reviewed By: gkassabli
Differential Revision: D5336645
fbshipit-source-id: c4f87d1754d7bac848e8d347b31d619393b94d2c
Summary: We don't bundle this library with the yoga source, and it isn't needed.
Reviewed By: emilsjolander
Differential Revision: D5274172
fbshipit-source-id: fec47d2700da86498410fe445d2980f31a563551
Summary:
This is an easy diff to wrap YGPointValue() in an extern "C" block to make sure it compiles
when we are using inside of Objective-C++ classes.
Reviewed By: emilsjolander
Differential Revision: D5242366
fbshipit-source-id: 772aaac056b3a20041926d5f35128716848a271a
Summary:
The only thing I found in the spec for this change is the following. Not exactly sure if this is the thing this PR is about:
> For each flex item, subtract its outer flex base size from its max-content contribution size. If that result is not zero, divide it by (if the result was positive) its **flex grow factor floored at 1** or (if the result was negative) by its scaled flex shrink factor, having **floored the flex shrink factor at 1**. This is the item’s max-content flex fraction.
But at least it seems a required change.
Fixesfacebook/yoga#566
Closes https://github.com/facebook/yoga/pull/572
Differential Revision: D5264388
Pulled By: emilsjolander
fbshipit-source-id: 0004d1c3b9bad070a98cd6766c1adc06a54475f8
Summary:
The library(yoga) has no dependency on android framework. As a matter of
fact this version can change to a lower number which will make yoga
support more old systems.
According to I/O 17, support library has change its minimum SDK version
to 14, so I think 14 is a reasonable min support version for yoga as well.
See
https://developer.android.com/topic/libraries/support-library/revisions.html
Closes https://github.com/facebook/yoga/pull/573
Differential Revision: D5264385
Pulled By: emilsjolander
fbshipit-source-id: cb813a3b643a3f4e2034c6c0ab8b488f94d6a7d0
Summary:
They were set up as javadocs (double-asterisk at the start) but should be normal
block headers.
Reviewed By: IanChilds
Differential Revision: D5255424
fbshipit-source-id: 23439ac035f74f2fd1c756b8185e39199e748e33
Summary:
Same as litho, just for compat with Android Studio. Shouldn't affect the
project.
Reviewed By: emilsjolander
Differential Revision: D5217956
fbshipit-source-id: 32cfec0bf4ab4e51f5e4116149ee091cf1245e95