Summary: If some test previous to this test fails to de-allocate a node we don't want this test to fail.
Reviewed By: dshahidehpour
Differential Revision: D4182179
fbshipit-source-id: 229dd5736d6d7b9c1b22b181e022c788584b9c17
Summary: Talked with emilsjolander offline, and we want to keep the prefixes standardized in this lib. Changing CLK prefixes to CSS.
Reviewed By: emilsjolander
Differential Revision: D4175634
fbshipit-source-id: 7152268b9312df3fdb8eaee7ce3f6baabc5de937
Summary: We want to start experimenting with changes to the library in a more controlled and easier to measure manner. This diff adds the basics of an experiment layer to csslayout.
Reviewed By: gkassabli
Differential Revision: D4174260
fbshipit-source-id: ad3667183810c02833fba9a1276f89286e848fcd
Summary: Java and csharp already use CSSWrap and not CSSWrapType. Let's consolidate and stick with the shorter of the two.
Reviewed By: gkassabli
Differential Revision: D4174257
fbshipit-source-id: ba0bfab996ba158b07863d8c72cf2a41262c9592
Summary:
Fixes issue brought up in https://github.com/facebook/react-native/issues/10603
The gist of the problem is that in css it is fine for a child to overflow a parent if it feels the need to, we were not respecting this.
Reviewed By: gkassabli
Differential Revision: D4157971
fbshipit-source-id: 3cfae15ac8b65b70f01789444099ee684e1b099a
Summary: There is a little bit of tidying that was needed for this class. The documentation was inconsistent in the header, the static functions were prefixed with underscores (discouraged by apple). Cleaned it all up.
Reviewed By: rnystrom
Differential Revision: D4167936
fbshipit-source-id: 6e9a6e7fb78e3cff290b867a1ac0d5dd5cc9de5b
Summary: Just firming up some stuff with more compiler flags.
Reviewed By: rnystrom
Differential Revision: D4168081
fbshipit-source-id: fced407f03944081bdd70cc28c57e3dc842ff7f0
Summary: Previous fix for flex in max size constraint was not entirely correct and was missing a test case for the time when the max constraint is not applied. This diff addresses that.
Reviewed By: gkassabli
Differential Revision: D4162104
fbshipit-source-id: 08feba6cb4e789c9aa12179e2cdeadc66b011841
Summary:
When trying to integrate this into an Xcode project that already included CSSLayout.[c|h], we were getting a linker error.
Upon digging in, I found out that Xcode was becoming confused because the imports of the uikit library and the c library are both `#import <CSSLayout/CSSLayout.h>`. So, it needed a new name.
Reviewed By: emilsjolander
Differential Revision: D4162621
fbshipit-source-id: b5f7624eb29f1b9eaebbed5104ec9ea8a12ad2e5
Summary: Currently travis logs indicate it is building with the wrong cxx platform. Explicitly set this to and ios simulator for ios tests
Reviewed By: dshahidehpour
Differential Revision: D4162159
fbshipit-source-id: 50f563132456ee4ba4e5b3b4b1f50b636cb94306
Summary: Same as Java, it allows to use float and double values in Make arguments.
Reviewed By: emilsjolander
Differential Revision: D4163347
fbshipit-source-id: f373247b3f37e7940a66044000cca2935068decf
Summary: Pointed out by the Xcode analyzer
Reviewed By: emilsjolander
Differential Revision: D4159938
fbshipit-source-id: 8b9ff3896c0e222e8e89546881129214bc6ba566
Summary: It was always a mistake to have a measure function here but the recent addition of an assertion made us notice it.
Reviewed By: splhack
Differential Revision: D4156754
fbshipit-source-id: 98fcea6e233cb4f5706ebca37028c8d67edb4c09
Summary: Add tests for checking C side asserts in managed
Reviewed By: emilsjolander
Differential Revision: D4154869
fbshipit-source-id: 5203db27eff963d46f188de448f607a24ed63fab
Summary: Travis builds have been broken for a while. This diff fixes some of the issues surrounding bad buck file configuration as well as missing jni.h file.
Reviewed By: astreet
Differential Revision: D4148724
fbshipit-source-id: 1e284db61280326a4bcbb9337e804a4804348aa6
Summary:
If there is a single child which is flex grow and flex shrink then instead of measuring and then shrinking we can just set the flex basis to zero as we know the final result will be that the child take up all remaining space.
This is a re-land of D4147298. I have updated the diff to check explicitly for exact measure mode to also handle at_most case correctly.
Reviewed By: gkassabli
Differential Revision: D4153133
fbshipit-source-id: 2333150a83857cc30078cc8d52761cbd00652830
Summary:
@public
The goal of this diff is to have assertion failures show up as error logs on Android. To do this, I updated the logging API to take calls with log levels. We now have to pass around va_list unfortunately since you can't re-expand or pass along var-args to a subcall.
Reviewed By: emilsjolander
Differential Revision: D4140898
fbshipit-source-id: e0eb9a1f0b08a7d90a8233f66bb857d5b871b6ad
Summary: Default value for positions should be undefined not 0px. Fixing this leads to more correct tests.
Reviewed By: gkassabli
Differential Revision: D4153329
fbshipit-source-id: d0f194f9c47eac93d3815ec7e55568a1016bc7fe
Summary: Within `UIView+CSSLayout`, we often nil out the measure function of a node because view hierarchy can often change. Unfortunately, this causes us to hit an assert which crashes the app. Instead, lets the measure func to be set to NULL, regardless of how many children a node might have.
Reviewed By: emilsjolander
Differential Revision: D4148727
fbshipit-source-id: 79a0f3ef1bf7b1dce9a14de96f870e35c042b78b
Summary: If there is a single child which is flex grow and flex shrink then instead of measuring and then shrinking we can just set the flex basis to zero as we know the final result will be that the child take up all remaining space.
Reviewed By: gkassabli
Differential Revision: D4147298
fbshipit-source-id: 8416508a31e8d317bf59d956abdbe5760b55bb6d
Summary: If there is a single child which is flex grow and flex shrink then instead of measuring and then shrinking we can just set the flex basis to zero as we know the final result will be that the child take up all remaining space.
Reviewed By: gkassabli
Differential Revision: D4147298
fbshipit-source-id: 51152e57eff8e322a833a6d698c30f8c5e2dcc35
Summary:
Max dimension constraints were not correctly passed down to children.
see https://github.com/facebook/css-layout/issues/230 for more info
fixes#230
Reviewed By: gkassabli
Differential Revision: D4147199
fbshipit-source-id: feb335eb8687a1b7939ee8cd8649e455e0c069a9
Summary: Scrolling through feed and logging when this optimization is hit leads to... 0 logs. If anything this just adds to confusion. It was initially added due to instinct and not data, which was a mistake. I am happy to add some similar optimization in the future if we have data that it is useful in real world situations, currently it just leads to bugs and confusion though.
Reviewed By: astreet
Differential Revision: D4146785
fbshipit-source-id: e20d780fbd5759b8f38b809e8cadf29cedee82a8
Summary: Not sure why this didn't catch during my testing, but, this causes a build error. #accept2ship
Reviewed By: emilsjolander
Differential Revision: D4143108
fbshipit-source-id: 01c35c5b91767c95485d615eb06e836b023e125a
Summary: For some reason I didn't get a signal of this breakage. Fixing unit tests.
Reviewed By: emilsjolander
Differential Revision: D4140327
fbshipit-source-id: 95049b510a8869b6f68cc841e7f8731364417af9
Summary: css-layout will only call measure which it is unsure of the size of a node so it will never call measure with both modes equal to exact.
Reviewed By: dshahidehpour
Differential Revision: D4142193
fbshipit-source-id: fb8423cf0d45852ecb9df8fed042b25d1a443eea
Summary:
Not all platforms have gtest death tests. There is a define to check for that.
Bracketed the relevant tests with the define.
Reviewed By: youerkang
Differential Revision: D4141823
fbshipit-source-id: 1396657f3ee83853fcda85d5a51708d4e77642cb
Summary: We don't want to expose this in our first usage. Lets kill it.
Reviewed By: emilsjolander
Differential Revision: D4140377
fbshipit-source-id: 0c53845ec65466692b847a5ce40c3b9823dd9557
Summary: You can lose a lot of performance on UIView's if they are not pixel-aligned. This protects it from happening in views which use css-layout.
Reviewed By: emilsjolander
Differential Revision: D4140306
fbshipit-source-id: 53493c08c084a7e3dcd4e05f6a665a99340ea5a6
Summary:
The inline keyword is available only in C++. The __inline and __forceinline keywords are available in both C and C++. For compatibility with previous versions, _inline is a synonym for __inline.
https://msdn.microsoft.com/en-us/library/z8y1yy88(v=vs.120).aspx
Closes https://github.com/facebook/css-layout/pull/239
Reviewed By: astreet
Differential Revision: D4138941
Pulled By: emilsjolander
fbshipit-source-id: cb59dc91ef285e5378036c4912217fd4ec8d9f79
Summary: As I've begun to integrate this into the codebase, I've found that sometimes our layouts are affected by bad implementations of sizeThatFits:. For example, in certain configurations of UILabel it won't take clipping into account and return a size that is much larger than the max size we requested. This adds some checks to make sure we never return a size that is larger than the one specified by `_measure`. This also fixes the bug where `CSSMeasureModeExactly` won't be applied if the measure mode for other parameter is node `CSSMeasureModeExactly`.
Reviewed By: emilsjolander
Differential Revision: D4131195
fbshipit-source-id: 4659fd83892a2c149b3b70733b06b19217507bf9
Summary:
@public
In the JNI portion of CSSLayout, there's a subtle bug where we were caching the jmethodid of the 'measure' of the first object that had measure called on it. However, if that class had overriden measure, then the jmethodid would be specific to that subclass's implementation and would not work for other classes. Conversely, if a regular CSSNode had been called first, then the super method would be called on the subclass instead of the proper overriden method.
Since there's not really a reason to overriden measure anyway (since you can just provide a different measure function), it's safest to just mark it final and explicitly cache the appropriate methodid
Reviewed By: emilsjolander
Differential Revision: D4132428
fbshipit-source-id: 6fb51597d80f1c03681e6611153b52b73b392245
Summary:
@public
We don't need to allocate a list for every node since leaf nodes don't have children.
Reviewed By: emilsjolander
Differential Revision: D4130818
fbshipit-source-id: 80d3e98fce9d2daa0676fd1cbed0e81edcf7adb3
Summary:
@public
Instead of silently ignorning non-leaf nodes with measure functions, we should assert that we don't create those kinds of trees.
Reviewed By: emilsjolander
Differential Revision: D4130770
fbshipit-source-id: a3ef10a2e63bbc12b5aa07977e4b84c8d59e3ffe
Summary: flex is just shorthand for flexBasis, flexGrow and flexShrink, and I don't want to expose overflow yet, so, removing them from the API.
Reviewed By: ryanolsonk
Differential Revision: D4126773
fbshipit-source-id: e3b9ef714832cb5665bd20d7fa92f97a266c9210
Summary: Currently, when we try to remove a child from a node, that node is mark dirty //regardless of whether or not anything was actually removed//. This fixes it.
Reviewed By: gkassabli
Differential Revision: D4125453
fbshipit-source-id: 745cfc55269415fea106a80c72401eb3074f2d31
Summary: This exposes an API so people can find out the resulting size of a layout calculation without changing the frame of the view.
Reviewed By: emilsjolander
Differential Revision: D4124630
fbshipit-source-id: f2b28d8a5474857cb1c92e021a1f161806826cda
Summary: We need to expose CSSLayout caching check to CKFlexboxComponent to enable performant bridging to CKComponentKit
Reviewed By: emilsjolander
Differential Revision: D4124705
fbshipit-source-id: 23284967900585fa20dcb51c9cc1bee829b32975
Summary: With the current implementation, as long as you had set a value on usesFlexbox (YES or NO), it would return YES. This fixes it.
Reviewed By: amonshiz
Differential Revision: D4124485
fbshipit-source-id: 32fe4ec0109b5c8678a112f9d4295bd17a6f6dc2
Summary: We don't want people to somehow change the underlying cnode on our CSSNodeBridge. Making it readonly.
Reviewed By: rnystrom
Differential Revision: D4124496
fbshipit-source-id: f88ed82c1df17d401aeca6f6341e429c95e55624
Summary:
Even so the problem of #236 has been fixed via ced779b there is still a case where you have a out of bound array access of undefined behaviour. This PR prevents the out of bound access of the underlying c array. The out of bound access happens if you already have 4 subViews and add another one. Then you will access CSSNodeGetChild with 4 which points into uninitialized memory.
Closes https://github.com/facebook/css-layout/pull/237
Reviewed By: dshahidehpour
Differential Revision: D4107743
Pulled By: emilsjolander
fbshipit-source-id: 0f21397f3a77308369acfea7327733f74eb72e00