Summary: Clearly mark java CSSNode as deprecated. It will go away very soon.
Reviewed By: lucasr
Differential Revision: D3992775
fbshipit-source-id: b3ceca277e5c7426eb51f8cbeacf5e2fe451c6ec
Summary: Ensure all native memory is released once gc deallocates the java object reference.
Reviewed By: lucasr
Differential Revision: D3992759
fbshipit-source-id: f648b72ead5bdb7257a5197496b19795f71f3788
Summary: This diff resolves some differences in behaviour between jni and java css nodes. This ensures certain test cases pass with both implementations.
Reviewed By: lucasr
Differential Revision: D3960755
fbshipit-source-id: 3e13a9435208851a96a619c07625ef2a5402f5ec
Summary:
@public
This fixes measuring of items in the main axis of a container. Previously items were in a lot of cases measured with UNSPECIFIED instead of AT_MOST. This was to support scrolling containers. The correct way to handle scrolling containers is to instead provide them with their own overflow value to activate this behavior. This is also similar to how the web works.
This is a breaking change. Most of your layouts will continue to function as before however some of them might not. Typically this is due to having a `flex: 1` style where it is currently a no-op due to being measured with an undefined size but after this change it may collapse your component to take zero size due to the implicit `flexBasis: 0` now being correctly treated. Removing the bad `flex: 1` style or changing it to `flexGrow: 1` should solve most if not all layout issues your see after this diff.
Reviewed By: majak
Differential Revision: D3876927
fbshipit-source-id: 81ea1c9d6574dd4564a3333f1b3617cf84b4022f
Summary:
@public
Introduce `overflow:scroll` so that scrolling can be implemented without the current overflow:visible hackiness. Currently we use AT_MOST to measure in the cross axis but not in the main axis. This was done to enable scrolling containers where children are not constraint in the main axis by their parent. This caused problems for non-scrolling containers though as it meant that their children cannot be measured correctly in the main axis. Introducing `overflow:scroll` fixes this.
Reviewed By: astreet
Differential Revision: D3855801
fbshipit-source-id: 3c365f9e6ef612fd9d9caaaa8c650e9702176e77
Summary:
@public
Introduce `overflow:scroll` so that scrolling can be implemented without the current overflow:visible hackiness. Currently we use AT_MOST to measure in the cross axis but not in the main axis. This was done to enable scrolling containers where children are not constraint in the main axis by their parent. This caused problems for non-scrolling containers though as it meant that their children cannot be measured correctly in the main axis. Introducing `overflow:scroll` fixes this.
Reviewed By: astreet
Differential Revision: D3855801
fbshipit-source-id: 6077b0bcb68fe5ddd4aa22926acab40ff4d83949
Summary:
When an absolutely positioned node appeared inside an overflow:hidden
parent, we were limiting its height. This is inconsistent with how
layout behaves on the web.
Closes https://github.com/facebook/css-layout/pull/218
Reviewed By: lucasr
Differential Revision: D3797285
Pulled By: emilsjolander
fbshipit-source-id: 98f98e77aa26edce86b9882c1cac284799b69a27
Summary: Use fbjni for safer and easier jni bridging. This diff includes all of fbjni as it currently does not live as its own open source project. The code was copied from the react-native open source distribution.
Reviewed By: ritzau
Differential Revision: D3764065
fbshipit-source-id: 7ff566af314dcb5279460c322c476ef6f6ed8131
Summary: So that it can be reset when Spacing is used outside CSSNode.
Differential Revision: D3763593
fbshipit-source-id: 27436c0dbd292b38cfc98f4cfb8e2d12787b85d6
Summary: Revert changes to flex-basis as it broke some specific layouts. Will update later with a more comprehensive set of tests
Differential Revision: D3776987
fbshipit-source-id: 06bd154a36f895782f45511cd8cf49cc6d7cbe7d
Summary: Generate tests for flex-properties and fix bug where flex basis was not taken into account when parent main dimension was undefined.
Differential Revision: D3771513
fbshipit-source-id: 1b5edc7a28bb26217e8a6d10d1829d9031c3ae2e
Summary: Implement flexShrink flexGrow and flexBasis in java as well because it will take a bit until the java code is removed
Reviewed By: lucasr
Differential Revision: D3753231
fbshipit-source-id: ea41d887cd99d1f03d2bc876a2fd7141dbe48320
Summary: Use const where possible. This does not use const for all variables as that would require too much refactoring for one diff. It does however use const where currently possible as well as does some small refactoring to enable const usage in more locations. Striving for 100% const usage leads to code with is easier to reason about as a reference will always reference the same value. The compiler will also assist if you accidentally override a reference.
Reviewed By: IanChilds
Differential Revision: D3741999
fbshipit-source-id: 1ba7da5784c3047f2d4c03746890192f724aa65e
Summary: The concept of default padding was confusing and only used by react-native android. Makes more sense to let them manage this themselve.
Reviewed By: foghina
Differential Revision: D3709574
fbshipit-source-id: 6e0277bd97407a5c642d742f93ca2ac70d7307da
Summary: Pointers are 64 bit on 64 bit platforms so using an int might truncate the pointer. Using longs supports 32 bit platforms as well.
Reviewed By: davidaurelio
Differential Revision: D3722479
fbshipit-source-id: c132f24c92c8476b328713861ad30670a43040c4
Summary: JNI code isn't covered by tests yet so I accidentally passed the spacing constant as a pointer value. oops.
Differential Revision: D3722391
fbshipit-source-id: 9adaf7b80d7bad93887a122c10eb06159a5189c2
Summary:
marginLeft(node, margin) -> margin(node, CSSEdgeLeft, margin)
This reduces the api surface of CSSLayout as well as puts the api more in line with the java version. This also adds support for CSSEdgeAll which java has had support for for a while. This also open up the possibility of doing margin(node, CSSEdgeLeft | CSSEdgeTop, margin) in the future.
Reviewed By: lucasr
Differential Revision: D3715201
fbshipit-source-id: ea81ed426f0f7853bb542355c01fc16ae4360238
Summary: We don't want to format files in lib/ for example. For some reason java/jni and tests/CSSLayoutTestUtils folders were previously ignored. This change formats those folders as well.
Reviewed By: lucasr
Differential Revision: D3715203
fbshipit-source-id: 37bcbd36bcf8535cfca73d6a806ab0f1d097dde7
Summary: Add support for flex-grow, flex-shrink, and flex-basis properties. The flex property behavior is preserved for backwards compatibility.
Reviewed By: lucasr
Differential Revision: D3714520
fbshipit-source-id: 80d3a9a1e2b6f74b863bbe22357f2c9865fa290e
Summary: Use spacing for position in public api. This was already the case internally
Differential Revision: D3690235
fbshipit-source-id: 4c04952e6ded32fd5fbfdccf63736cf025ae470e
Summary:
As they're were not available yet.
Emil, I'm going to wait for your diffs to land before pushing this to
avoid disruptions on your side.
Differential Revision: D3669177
fbshipit-source-id: b06f382cb89546e817a2475298cf2cad17d95a2c
Summary: The C version already has this ability via the same name 'context'. This can be used to attach arbitrary data about your view hierarchy to a CSSNode. Previously this could only be done in java via subclassing CSSNode.
Reviewed By: lucasr
Differential Revision: D3662065
fbshipit-source-id: 560a768092f17381e99b349d08bd4a8b365541be
Summary: To make the library easier to get started with we don't want to force people to use SoLoader. If SoLoader is not initialized we will fall back to the standard System.loadLibrary() method.
Reviewed By: lucasr
Differential Revision: D3661990
fbshipit-source-id: f2003577aa3d2f89ec579b6f889fdfb684110b60
Summary: This caches the class and method id references between calls. The class lookup is done once per method still but I think that is ok for now as the code becomes somewhat cleaner and more self contained.
Reviewed By: lucasr
Differential Revision: D3661989
fbshipit-source-id: 68d4557364bb8957400aefb2603c2e46424ccec3
Summary: Add jni bindings for csslayout. First step in many of removing LayoutEngine.java and performing all layout in native.
Reviewed By: lucasr
Differential Revision: D3648793
fbshipit-source-id: d0e696e196fa7c63109c9117a65645ca3d6c9c00
Summary:
@public The make current RCTShadowView support RTL layout.
1 Change all left/right to start/end for margin, padding, boarder and position
2 Calculate position in the same way as margin, padding and boarder
Reviewed By: fkgozali
Differential Revision: D3619292
fbshipit-source-id: eaaa6faeee93c964d59bb6f498d89effc09ed567
Summary:
@public The current CSSLayout can't support RTL because wrong calculation for absolute position.
This change is mainly to fix the issue: https://github.com/facebook/css-layout/issues/197
Three main problems I fixed:
1. Calculate the position in the same way as margin, boarder, and padding. So that to fix the absolute problem.
2. Fix one wrong calculation for leading value when we only know the trailing value. It was hard code for the LTR situation. Now I changed it to depends on the main Axis.
3. Expose getter and setter function for RN to read layout direction and start/end position value.
Reviewed By: fkgozali
Differential Revision: D3616949
fbshipit-source-id: ae7a47cc0a5d02b42b95f87232be51ab144056d9