Summary: this diff re-add the assertion to check for owner reference before adding child that was removed by mistake in previous diff
Reviewed By: emilsjolander
Differential Revision: D7495417
fbshipit-source-id: b81174aeea3f2796d76ccdae4a8eddd0beace0aa
Summary:
This PR fixes the compilation on MSVC. I moved the `YGConfig` creation to a C++ constructor.
Addionally it removes the "dot" notation on `YGValue`, I didn't want to change that type to a C++ constructor, because I think this will break the ABI.
Closes https://github.com/facebook/yoga/pull/746
Differential Revision: D7498141
Pulled By: emilsjolander
fbshipit-source-id: 5f5308ff838dcd803065785ddc08b2404524acb9
Summary: Remove experimental setup of fast-math and add `-ffast-math` as a compiler flag for yoga.
Reviewed By: emilsjolander
Differential Revision: D7414228
fbshipit-source-id: 320e1b1953f6af867b13e617af7872eb8999160e
Summary: Change the return type of getMarginForAxis to YGFloatOptional
Reviewed By: emilsjolander
Differential Revision: D7350337
fbshipit-source-id: dd1ee2fcd295ccd14f7d414ab0c24090b24e91e0
Summary: Change the return type of getTrailingMargin to YGFloatOptional
Reviewed By: emilsjolander
Differential Revision: D7350221
fbshipit-source-id: 61a67364c1975ec6dd1883bc2cb4968b830c73df
Summary: Changed the return type of getLeadingMargin to YGFloatOptional
Reviewed By: emilsjolander
Differential Revision: D7349907
fbshipit-source-id: b20894fbc33fd5b29a28f3c9174d1b5f406774ab
Summary: Change the type of getTrailingPosition to YGFloatOptional
Reviewed By: emilsjolander
Differential Revision: D7344710
fbshipit-source-id: eb4c422b6e0f55d90b083221aa8ff1ab797d58a8
Summary: Changed the type of return value of getLeadingPosition to YGFloatOptional
Reviewed By: emilsjolander
Differential Revision: D7344367
fbshipit-source-id: 0f5a667ca357b2ce056c86763aa3e9e4c54b82f0
Summary: Changed the type of computedFlexBasis to YGFloatOptional in YGLayout
Reviewed By: emilsjolander
Differential Revision: D7340413
fbshipit-source-id: 39247b2b582a682e602f49f58b4bbd2bf0c995af
Summary: Changed the return type of trailing padding to YGFloatOptional
Reviewed By: emilsjolander
Differential Revision: D7339712
fbshipit-source-id: 483c5886838c14b17cb731c81abb9fc80f519956
Summary: Changed the arguments for the getter of leading padding to avoid copies. Added an assetion in getter of leading padding, as padding would always be defined even in the case when the user has not explicitly defined the value. In these cases it would take the default value of 0. So changing the type of `getLayoutPadding` to `YGFloatOptional`, doesn't make sense.
Reviewed By: emilsjolander
Differential Revision: D7336690
fbshipit-source-id: b2a2f010026f26fc2cc9fb35ad921da8f7017c9f
Summary: Make the return type of YGNodeBoundAxisWithinMinAndMax to YGFloatOptional
Reviewed By: emilsjolander
Differential Revision: D7323382
fbshipit-source-id: 8e3eb4f3744b5f3f9e2b353f56184905f7557191
Summary: Remove the use of YGUnwrapOptional from YGConstrainedMaxSizeForMode
Reviewed By: emilsjolander
Differential Revision: D7322743
fbshipit-source-id: d825c60bcdc9ecdc0c784a215dc6b1b8a7a7860e
Summary:
This PR fixes a type mismatch on `endOfLineIndex` where it should be of type `uint32_t` while it is of type `float`
Additonally it fixes some `double` casting in the rounding methods.
Closes https://github.com/facebook/yoga/pull/745
Differential Revision: D7494519
Pulled By: emilsjolander
fbshipit-source-id: 30a86574ce163458a6888f61a902d0640c1874fb
Summary: Changed the return type of YGResolveValueMargin to YGFloatOptional
Reviewed By: emilsjolander
Differential Revision: D7304090
fbshipit-source-id: cbec03a9367cf34976d083ad475d4da0b736e6d2
Summary: Move equaltiy function from utils to an operator on YGFloatOptional
Reviewed By: emilsjolander
Differential Revision: D7303460
fbshipit-source-id: 41ec0076ace621ec1a5bdbab00b72eea57780fff
Summary: Change the type of aspect Ratio to YGFloatOptional
Reviewed By: emilsjolander
Differential Revision: D7302651
fbshipit-source-id: 53e3b4c9627207a379f927b1f3485e36a9c70601
Summary: Removes the use of YGUndefined from kYGValueAuto. Also fixed the setter and getter of dimensions. This diff also fixes a typo
Reviewed By: emilsjolander
Differential Revision: D7302453
fbshipit-source-id: e002a1ddd75bfc6fe142a7275e7913c064972e16
Summary:
This diff includes the following changes:
1 ) I extended the Java implementation of YogaNode to be able to get a full copy of a YogaNode object without copying the List of children of the original YogaNode. In other words, the new copy of the YogaNode will have the same data of the original YogaNode, but with an empty list of children.
2 ) We created a new method in Yoga.cpp called YGNodeInsertSharedChild. This new method is going to be used by Fabric in order to temporarily share a YogaNode between two "Yoga Trees" (the "current Yoga" tree and a partial "clone of the current Yoga tree"). We exposed this new functionality in the java implementation of Yoga (method addSharedChildAt)
I'm including sebmarkbage for more context.
Reviewed By: emilsjolander
Differential Revision: D7245421
fbshipit-source-id: 72578c8261f29e4a12fc6c72a91f2f891cd58d48
Summary:
In the persistent version of Yoga, a YogaNode can be shared between two YogaTrees, that means that a YogaNode could have more than one Parent at one point in time. That's why the concept of Parent of a YogaNode is not a 1-1 relationship anymore.
This diff changes the semantic of Parent of a YogaNode to Owner of a Yoga Node. CC sebmarkbage and priteshrnandgaonkar for more context.
Technically this diff renames the field YogaNode.parent to YogaNode.owner (and every internal field, Getter and Setter that is related to parent)
Note that as part of this diff I also modified the CSSLayoutDEPRECATED version of Yoga in order to keep compatibility with the C++ implementation.
Reviewed By: priteshrnandgaonkar
Differential Revision: D7352778
fbshipit-source-id: dcf1af5e72bfc3063b5c4bda197d7952a9194768
Summary:
We had functions for inserting/removing a specific child, but not for simply replacing the child set with another list.
`YGNodeSetChildren()` will unhook child nodes from the parent that don't appear in the new set. We set the disconnected child node layouts to `YGLayout()` b/c that's what the rest of the code does.
`YGTraversePreOrder()` walks the tree and calls a labmda for each node. We could very easily add a post-order traversal and the ability to stop traversal if we ever want, but for now this is an MVP.
Reviewed By: Woody17
Differential Revision: D7360203
fbshipit-source-id: 32df8e1213ead03bc0a026ec4bf453bc799bb9ce
Summary:
Podspec to push yoga 1.8.0 to cocoapods. There is an issue with cocoapods and it fails to lint those projects with C++ in its header, which is the case with yoga too.
Follow this thread https://github.com/CocoaPods/CocoaPods/issues/5152. To make the lint pass, one would have to change `app_target_helper.rb` cocoapod source file in the local machine. Follow my [gist](https://gist.github.com/priteshrnandgaonkar/dcca9639a3bc0a3b9adecae3a2b3b0c4).
I am able to pass the lint, but not able to push the pod in cocoapods as I am not the admin. @[759512522:emilsj], please push it on Cocoapods or give me permission.
Podspec now also exposes public header explicitly.
Reviewed By: gkassabli
Differential Revision: D7375018
fbshipit-source-id: 4e82e1c0b6340c3f8d3b8a96ecadbcb711d4bcd8
Summary: Adds an example of how to use yoga from JavaScript to the documentation pages.
Reviewed By: priteshrnandgaonkar
Differential Revision: D7354390
fbshipit-source-id: 0dbc08e5341c06b621acd99bfb9ce7e789b67a45
Summary: These don't need to be copied twice.
Reviewed By: priteshrnandgaonkar
Differential Revision: D7291363
fbshipit-source-id: 22e606d0b3fa1133d7e0334c8cf9f5f1f32fe64b
Summary: These shouldn't be copying the arguments when they pass by value. Instead these only get copied when assigning the value to the member.
Reviewed By: priteshrnandgaonkar
Differential Revision: D7291096
fbshipit-source-id: 7a4025831811d622050adbb5f86608855b94d68e
Summary:
Earlier `YGfloatOptional` was plain struct with no privacy around the variables. This diff adds privacy and also enforces checks when one tries to access value of an undefined `YGFloatOptional`
This diff also adds a behaviour in which when a value of an undefined YGFloatOptional is accessed, it will normally terminate(Several cleanup steps are performed).
Reviewed By: emilsjolander
Differential Revision: D7288555
fbshipit-source-id: f61cc92c8fd0d48d2fc1f4d0e6fcef155f19ff8a
Summary: Fixed a typo of flexshrink and added a test case
Reviewed By: emilsjolander
Differential Revision: D7289221
fbshipit-source-id: 48ee9ccfac4adee51d515a366b5a11790f7236fc
Summary: Fix getters and setters of min and max Dimension to behave exactly the same way as it was before fast math changes
Reviewed By: emilsjolander
Differential Revision: D7274807
fbshipit-source-id: 7c1a4c19e8d0552b089a410c3330392cb26a6a47
Summary:
This diff fixes the setter and getter of margin, position, border and padding to the previous behaviour of yoga, before floatoptional change
This diff also removes the unrequired `#define`
Reviewed By: emilsjolander
Differential Revision: D7274115
fbshipit-source-id: 942a91e6562ef789ae79102a828f397889468fa7
Summary:
Earlier YGUndefined was NAN, but recently it was replaced with 10E20 and the check for `isUndefined` is as follows
```
public static boolean isUndefined(float value) {
return (Float.compare(value, (float) 10E8) >= 0 || Float.compare(value, (float) -10E8) <= 0);
}
```
If the number is in (-inf, -10E8] and [10E8, inf) then it is considered as undefined. Failing test passed values in this range, so thats why the test was failing. Current diff fixes this issue, and passes a big number which is outside the range as the result of measure function.
Reviewed By: emilsjolander
Differential Revision: D7272325
fbshipit-source-id: 81a77117c65c5dc0cec920f50f0735ec0a7433d1
Summary:
This diff exposes `shouldDiffLayoutWithoutLegacyStretchBehaviour` from YGConfig and `doesLegacyStretchFlagAffectsLayout` from YGLayout to YogaConfig and YogaNode respectively
Also added a positive test case. Didn't find the negative test case example. @[508947467:ianc] or @[759512522:emilsj], can you suggest a negative test case example.
Reviewed By: emilsjolander
Differential Revision: D7272067
fbshipit-source-id: e67e82eb057e4c7124904c715f9dca4dcfea21ea
Summary: Remove the use of YGUndefined for default flex-basis value
Reviewed By: emilsjolander
Differential Revision: D7243924
fbshipit-source-id: 2bfaca1a5e3da40d5292a273cabf705f59c9d666
Summary: Change the type of flexShrink to YGFloatOptional
Reviewed By: emilsjolander
Differential Revision: D7232171
fbshipit-source-id: 3111119d3d74a7035c01132bff61b30cf44e120a
Summary: Change the type of flexGrow to YGFloatOptional
Reviewed By: emilsjolander
Differential Revision: D7215355
fbshipit-source-id: 1298ee332551d44e4d070169a1e4103d005c4f43
Summary: Change the type of flex to YGFloatOptional internally, but keeping the public facing API the same as before
Reviewed By: emilsjolander
Differential Revision: D7211327
fbshipit-source-id: 0d979b6ba00317317b98bbc6e63979c7f1feb2da
Summary: Changed the return type of YGResolveValue
Reviewed By: emilsjolander
Differential Revision: D7195099
fbshipit-source-id: 72c4163cd08691cf6e40df05394cc52e83b0de14
Summary: Remove the usage of YGUndefined in the default values of Border in YGStyle. In the getter of Border function, YGUndefined is used just to keep it logically consistent. The proper solution would be to change the api in `Yoga.h` to accept `YGFloatOptional`, but that would require to change lot of the code in client of this library. Will make a separate diff for that.
Reviewed By: emilsjolander
Differential Revision: D7195115
fbshipit-source-id: e635cf55ac94d8a90caef6cafce281579da2cbfc
Summary:
emilsjolander hi,
this PR solves the following common and probable layout pixel scenario:
the older code is presented for reference:
```java
view.measure(
View.MeasureSpec.makeMeasureSpec(
Math.round(node.getLayoutWidth()),
View.MeasureSpec.EXACTLY),
View.MeasureSpec.makeMeasureSpec(
Math.round(node.getLayoutHeight()),
View.MeasureSpec.EXACTLY));
view.layout(
Math.round(xOffset + node.getLayoutX()),
Math.round(yOffset + node.getLayoutY()),
Math.round(xOffset + node.getLayoutX() + node.getLayoutWidth()),
Math.round(yOffset + node.getLayoutY() + node.getLayoutHeight()));
```
suppose now the following:
- `xOffset + node.getLayoutX() = 2.2`
- `node.getLayoutWidth() = 0.4` ==> `Math.round(node.getLayoutWidth()) = 0`
- `Math.round(xOffset + node.getLayoutX() + node.getLayoutWidth()) = Math.round(2.2 + 0.4) = 3`
this induces, the following measurements:
```java
view.measure(
View.MeasureSpec.makeMeasureSpec(
0,
View.MeasureSpec.EXACTLY),
View.MeasureSpec.makeMeasureSpec(
Math.round(node.getLayoutHeight()),
View.MeasureSpec.EXACTLY));
view.layout(
2,
Math.round(yOffset + node.getLayoutY()),
3,
Math.round(yOffset + node.getLayoutY() + node.getLayoutHeight()));
```
the width measurement of the view is 0, while the layout is `(3 - 2 = 1)`.
my proposed solution is to measure the view the way it is now, but when layouting
I use the `#getMeasuredWidth/Height()` methods, this will stop this problem
from happening.
I also want to note that this bug happens with high probability.
Closes https://github.com/facebook/yoga/pull/712
Reviewed By: emilsjolander
Differential Revision: D7231798
Pulled By: priteshrnandgaonkar
fbshipit-source-id: 171da519639dbecd75416a574bccc4456aa22f31
Summary: When we don't explicitly set header_namespace, we can get differing behavior between Android and iOS. Even when it is not explicitly necessary, we are going to try to enforce this properly.
Reviewed By: scottrice
Differential Revision: D7141155
fbshipit-source-id: 74d1488c3909f89ad9d6d0ee0de335b789dc2ccd
Summary:
Some files have crept into the repo with the old license header. These are usually from PRs that were opened prior to the re-licensing of the project.
Let the script run, prior to fixing the errant files. The script outputs the following:
```
PATENTS crept into some new files?
--- /dev/fd/63 2018-03-01 01:42:48.250153746 +0000
+++ /dev/fd/62 2018-03-01 01:42:48.250153746 +0000
@@ -1 +1,9 @@
+Libraries/NativeAnimation/Nodes/RCTTrackingAnimatedNode.h
+Libraries/NativeAnimation/Nodes/RCTTrackingAnimatedNode.m
+ReactAndroid/src/main/java/com/facebook/react/animated/TrackingAnimatedNode.java
+ReactAndroid/src/main/java/com/facebook/react/views/text/CustomLetterSpacingSpan.java
+ReactCommon/yoga/yoga/YGLayout.cpp
+ReactCommon/yoga/yoga/YGLayout.h
+ReactCommon/yoga/yoga/YGStyle.cpp
+ReactCommon/yoga/yoga/YGStyle.h
scripts/circleci/check_license.sh
Exited with code 1
```
Fix the headers in these files and run the script again. No output, exit code 0.
Closes https://github.com/facebook/react-native/pull/18143
Reviewed By: sophiebits
Differential Revision: D7119356
Pulled By: hramos
fbshipit-source-id: d238e4d4a3ae320a2c8e625c2fa29690057a4814
Summary:
Changed NaN with large number to support `-ffast-math` compiler flag.For `-ffast-math` to work, all floating point numbers should be finite. Reason for not going with `FLT_MAX`, is that, it may cause number overflow during math operations. So thats why I opted for big number smaller than `FLT_MAX`. Earlier we used NaN, while NaN is involved in comparision the comparision operator behaves differently, it always returns false. Also operators like, fmaxf,fminf etc. have wierd beahviours. This diff takes care of those things as far as possible, and all tests are passing.
Running ./instrumentation_tests/run instrumentation_tests/com/facebook/feed/ctacoalescing:ctacoalescing --class AttachmentCallToActionSelectorBenchmarkTest --benchmark --extra-arg iterations=100 shows the perf gain of 13-15%
Reviewed By: emilsjolander
Differential Revision: D6969537
fbshipit-source-id: bdc09eaf703e0d313ca65c25a4fb44c99203d9bf
Summary: removing the old `docs` folder as we are switching to `gh-pages` branch.
Reviewed By: emilsjolander
Differential Revision: D7110147
fbshipit-source-id: a27e6fc3a115f2f62b8a0dd5833d872e24698021
Summary: Tracks a Google Analytics event once the code generator is opened.
Reviewed By: emilsjolander
Differential Revision: D7097182
fbshipit-source-id: 637a96db981f5e90c9f7ce155ba8669b8dac98fa
Summary: Travis builds for the website were failing. The problem was due to `yoga-layout` not compiling. However, we don't need to compile `yoga-layout` at all, because we are only using the asm.js version. This adds the `--ignore-scripts` flag to the `yarn` command, to ignore the post-install script which tries to compile yoga.
Reviewed By: emilsjolander
Differential Revision: D7097154
fbshipit-source-id: 3bf9efda0e2ae6166181dad66621cf6fc9586e88
Summary: Travis defaults to node version 0.10 (!). Explicitly setting the node version to 8.
Reviewed By: emilsjolander
Differential Revision: D7056888
fbshipit-source-id: f6e31cc75009dc4f322c1750c2ce540afdd641ce
Summary: Removes travis build as they were currently not in use and prevented website from being deployed.
Reviewed By: emilsjolander
Differential Revision: D7055369
fbshipit-source-id: f227b1da1fea748c526b9faeedef063f9eeff61f
Summary: Adds a deploy step to travis.yml file to depoly the docs to github pages.
Reviewed By: emilsjolander
Differential Revision: D7028804
fbshipit-source-id: bb91c6b1ad2a306a6957a48679f164128c5b1be1
Summary:
"feature" should be "features" but it's already used twice in that paragraph so
I replaced it with "showcases" instead.
Reviewed By: emilsjolander
Differential Revision: D7042770
fbshipit-source-id: 0287f8746feca5c9f651950c8e9c24d2e86d55e9
Summary: Specify that the jni rule is really for android
Reviewed By: emilsjolander
Differential Revision: D7015911
fbshipit-source-id: 5fbff4bb15d2d1256261b13417653b68bb6dc5aa
Summary: Added default constructor for YGCachedMeasurement. This diff uses the default initialiser to get rid off the older designated initializer syntax. This diff also addresses https://github.com/facebook/yoga/pull/700
Reviewed By: emilsjolander
Differential Revision: D7020337
fbshipit-source-id: e084e234bf6a2ae22e53e739959683abca169b88
Summary: Add default constructor in YGLayout and moved to separate file. This diff also addresses https://github.com/facebook/yoga/pull/700
Reviewed By: emilsjolander
Differential Revision: D7019653
fbshipit-source-id: 5a2655626db0915fcebe7d4517e2d0b2e2484460
Summary: Moved YGStyle to separate file and added default constructor to it. This diff also gets rid off of the default values, which were earlier declared in Yoga-interna.h and instead uses default constructor. This diff also addresses https://github.com/facebook/yoga/pull/700
Reviewed By: emilsjolander
Differential Revision: D7016575
fbshipit-source-id: eb28df0ffb4cc813b23edaff80d7d4ebc56ce6af
Summary:
Includes React Native and its dependencies Fresco, Metro, and Yoga. Excludes samples/examples/docs.
find: ^(?:( *)|( *(?:[\*~#]|::))( )? *)?Copyright (?:\(c\) )?(\d{4})\b.+Facebook[\s\S]+?BSD[\s\S]+?(?:this source tree|the same directory)\.$
replace: $1$2$3Copyright (c) $4-present, Facebook, Inc.\n$2\n$1$2$3This source code is licensed under the MIT license found in the\n$1$2$3LICENSE file in the root directory of this source tree.
Reviewed By: TheSavior, yungsters
Differential Revision: D7007050
fbshipit-source-id: 37dd6bf0ffec0923bfc99c260bb330683f35553e
Summary: Yoga logo was hotlinked from the old pages. This adds the logo to the sources
Reviewed By: emilsjolander
Differential Revision: D7009804
fbshipit-source-id: d913223e042b1bd9cf2ddab7c74d864e482d94b3
Summary: The position record defaulted to 0, which was wrong. No it defaults to NaN, which is the same as not having a value at all.
Reviewed By: emilsjolander
Differential Revision: D7009783
fbshipit-source-id: 83810da87e983f8d4d3e428f1f5fab0928bce58d
Summary: select the value of any input element once the field gets focus.
Reviewed By: emilsjolander
Differential Revision: D7009723
fbshipit-source-id: e1bc0f4b219958d8bdb79ef1a583cad86157b050
Summary: This is now possible with the changes to centering the content
Reviewed By: danielbuechele
Differential Revision: D7009506
fbshipit-source-id: e2ff11d25dd6c388c82983d615e2a4c50b992583
Summary: Generated code modal now has a copy to clipboard button
Reviewed By: emilsjolander
Differential Revision: D7009716
fbshipit-source-id: 7a9b083d7067aa66ffa5b9d9c23741321547c4f6
Summary: Code generators now can handle percentage and auto values as well as numeric values (DIP)
Reviewed By: emilsjolander
Differential Revision: D7009344
fbshipit-source-id: 64ddcb61a2dce01e68e38a16e4d5865d8e4c6d5b
Summary:
- fixes a but where `auto` was passed to properties that don't support auto as a value
- fixes errors in flow typing
- Re-adds accidentally removed scripts to package.json
Reviewed By: emilsjolander, arcanis
Differential Revision: D6999447
fbshipit-source-id: df66976c74c4af082a1ca0527e3e1ce54bdeb732
Summary: This is an older version of the standalone playground which is outdated and not used anymore
Reviewed By: emilsjolander
Differential Revision: D6998970
fbshipit-source-id: a27bee81b6f85f70c35a8d3e7ea7b06486c52626
Summary: root node is now centerwed between edge and editor
Reviewed By: emilsjolander
Differential Revision: D6989159
fbshipit-source-id: ce2621402d380843125fabc43452c64ea3b563dd
Summary:
When the following conditions are met, the main size become smaller by the margins in the main axis.
* The aspect ratio is defined
* The main size is not defined
* The cross size is defined
* The main margin is defined
This is because the main margin size is not included when calculating the main size from the aspect ratio.
Closes https://github.com/facebook/yoga/pull/715
Reviewed By: emilsjolander
Differential Revision: D6998988
Pulled By: priteshrnandgaonkar
fbshipit-source-id: f6f69c47ece17bd7c5e41517b96032bf0c149356
Summary:
This diff exposes the YogaNode clone operation to JNI in order to be able to clone Java YogaNode objects.
The clone method performs a shallow copy of the java YogaNode.
I made YogaNode to implement Cloneable, I know that this might not be a good idea but in this case it simplifies the cloning mechanism. I am open to suggestions.
IMPORTANT NOTES:
- The current implementation IS NOT making a deep copy of the mData instance variable.
- The mParent Java instance variable will reference the parent of the original Java YogaNode, is that ok sebmarkbage?
Reviewed By: priteshrnandgaonkar
Differential Revision: D6935971
fbshipit-source-id: a2008f1eb849b5074585b48699b7de56d5ac90d4
Summary: This diff extends the JNI version of yoga in order to allow Java instances of the YogaConfig class to receive a callback when a Yoga node is cloned.
Reviewed By: priteshrnandgaonkar
Differential Revision: D6918605
fbshipit-source-id: e424c78680c04e21154ebe21405671c4e90f6529
Summary: editing numerical values didn't work. this fixes it and cleans up the API of the playground
Reviewed By: emilsjolander
Differential Revision: D6976128
fbshipit-source-id: 9b1ace9d93ba8e597bdfb4842ed6adcaf8b77fd9
Summary: Inserting or deleting nodes threw an error, due to some changes I made earlier. This fixes the error.
Reviewed By: emilsjolander
Differential Revision: D6975950
fbshipit-source-id: d04df08260ab8ab248726809329e69f4d264decd
Summary: The bundling of gatsby is done in node. This caused the node-libs from yoga being loaded. This directly imports the browser version.
Reviewed By: emilsjolander
Differential Revision: D6975779
fbshipit-source-id: 0257a86733c5552259b171309e59cc676786621e
Summary:
Sets up a skeleton for the new yoga website using gatsby static site generator
allow-large-files
Reviewed By: emilsjolander
Differential Revision: D6952326
fbshipit-source-id: 7579bc80bec21552689da5b78f3d960910ff13bb
Summary:
YGConfig isn't owned by the YGNode, and thus isn't freed when freeing the node (`YGNodeFreeRecursive`)
This fixes a memory leak caused by D6856812
Reviewed By: emilsjolander
Differential Revision: D6945022
fbshipit-source-id: 5fd3c3e2ac1cd94d459d5aa06e0daa8f107779ac
Summary: Expose a function which marks all descendants dirty
Reviewed By: emilsjolander
Differential Revision: D6911869
fbshipit-source-id: e0a3abcf5653f921297edfdca473d83b947cc627
Summary: While moving a function as a method in YGNode, there was an error in which I mistakenly called a method on node, whereas I had to call it on child.
Reviewed By: emilsjolander
Differential Revision: D6918367
fbshipit-source-id: cee90e015f9e45a717a7307f59fd3b9ef6f399b6
Summary: There was a slight error in main axis justification which caused the regression
Reviewed By: emilsjolander
Differential Revision: D6923178
fbshipit-source-id: d8f81b06d9127c75daecffb73b5e6c5abbad8ade
Summary: Moved margin axis function as a method in YGNode
Reviewed By: emilsjolander
Differential Revision: D6900003
fbshipit-source-id: a42da3bcd3126bf8c432c6740987b5ec0b572172
Summary: Moved trailing padding and border function as a method on YGNode
Reviewed By: emilsjolander
Differential Revision: D6899571
fbshipit-source-id: 7f686e8771d5a94aae502191516557b20c557d7c
Summary: Moved out main axis justification logic to seperate function
Reviewed By: emilsjolander
Differential Revision: D6845997
fbshipit-source-id: fdb64e00de39427ce1d66d4fbfd06c23c0d32bcf
Summary:
This adds a web-based playground to try out Yoga. The playground uses yogas javascript bindings to use yoga within the browser. The layout tree can be modified and shared. Code generators for litho, ComponentKit and React Native allow the layout to be copied into any app.
allow-large-files
Reviewed By: emilsjolander
Differential Revision: D6871601
fbshipit-source-id: 3b97c87e91d6bafe8e1c38b8b7eca8d372324c0b
Summary: Made a separate function for resolving flexible length
Reviewed By: emilsjolander
Differential Revision: D6834269
fbshipit-source-id: 954bc7fe8eb9256d353cdda27e5c64c076808e25
Summary: Added a separate function which does the second pass to distribute the free space amongst the views which can be flexed.
Reviewed By: emilsjolander
Differential Revision: D6833635
fbshipit-source-id: 7680a67db8bfe22f8fb86407159888882f3a3353
Summary: Added a function which does the first pass to determine the free space based on flex items whose min and max constraints are triggered
Reviewed By: emilsjolander
Differential Revision: D6819719
fbshipit-source-id: e5e77c21d1dca2255433da3388887d9db3f7b642
Summary: Moved out logic to calculate size consumed on a line into seperate function
Reviewed By: emilsjolander
Differential Revision: D6797640
fbshipit-source-id: ad9757e7d603c0ce57f452b1e5c404037605bed9
Summary: Check if the layout tree is different if we do not use legacy flags. If they are different then report to the client
Reviewed By: emilsjolander
Differential Revision: D6856812
fbshipit-source-id: e4724d80702cc75c1894e348e137b24e663573d2
Summary: Since a `YGNodeRef` is created with `new`, it needs to be deleted using `delete` instead of `free`.
Reviewed By: richardjrossiii
Differential Revision: D6866064
fbshipit-source-id: a44828cedb5045b6c97179fb30ffd8c8dafcbfbe
Summary: Previously the logging logic assumed fixed number of characters in the string to be logged. With this diff the logging logic is made dynamic, catering to variable length of the string to be logged
Reviewed By: emilsjolander
Differential Revision: D6784491
fbshipit-source-id: 26e4520a84be355ff992b808297ce7a95b3d09e3
Summary: Added a benchmark tests along with the usual gentest in yoga for a complex yoga android news feed view.
Reviewed By: emilsjolander
Differential Revision: D6753544
fbshipit-source-id: 23b8da9785990a86248ff4708ac61e12411eb489
Summary: These are already considered immutable, but not marked in their class.
Reviewed By: emilsjolander
Differential Revision: D6759564
fbshipit-source-id: 810dc8a9730fb330760d2aedecafcea81cf25cb1
Summary: Package is already published via NPM. This is just the version bump.
Reviewed By: emilsjolander
Differential Revision: D6750224
fbshipit-source-id: 6add1ce71714e58e4afacd095265b3e770bc558e
Summary: Currently in the flexbox algorithm we were using linked list for maintaining the nodes which had relative/absolute position types, this diff uses STL vector instead of linked list.
Reviewed By: emilsjolander
Differential Revision: D6722959
fbshipit-source-id: 4e81176802b9a9319bc5f385c824a06be14a83a2
Summary:
@public
Trivial. Those lines were lost during rebasing of the original commit.
Reviewed By: priteshrnandgaonkar
Differential Revision: D6717696
fbshipit-source-id: a5dce25427c8977352b3ae7ea01e546a540e0c13
Summary: Moved leadingpaddingnandborder function as a method on YGNode
Reviewed By: emilsjolander
Differential Revision: D6711991
fbshipit-source-id: 41ad7191bf8df6fe3131106436dc0c87e9dee297
Summary: Move trailing padding function as a method on YGNode
Reviewed By: emilsjolander
Differential Revision: D6711897
fbshipit-source-id: fa2e1a8e31242358a6e94aef51368e2c2c58b79d
Summary: Moved leading padding function as a method on YGNode
Reviewed By: emilsjolander
Differential Revision: D6711830
fbshipit-source-id: d2f6f55ec23b007bb51f8a91385e02236f46dc7b
Summary: Resolve direction function is now as a method on YGNode
Reviewed By: emilsjolander
Differential Revision: D6711755
fbshipit-source-id: a0e80596e10f0c7fb7a31b75377da4db846c4bbb
Summary: Move trailing border function as a method on YGNode
Reviewed By: emilsjolander
Differential Revision: D6711666
fbshipit-source-id: fe4fdfc2db59d03beb763317e1a6f9de52f851d4
Summary: Move leading border function as a method on YGNode
Reviewed By: emilsjolander
Differential Revision: D6711523
fbshipit-source-id: 76e90083a9dd0728dc9557cc3b0a1f431f3afd5d
Summary: Moved YGNodeIsFlex as a method on YGNode
Reviewed By: emilsjolander
Differential Revision: D6711536
fbshipit-source-id: e60be7da55e3e8d254eb253c141d219a37a76087
Summary: Previously flexbasis calculation was doing more than one task of accumulating absolutelypositioned child and flexbasis calculation. So this diff refactors the logic and moves out absolutely positioned child calculation to our step 1(which is calculating the variables which are required for rest of the algorithm). This diff also moves the flexbasis logic into separate function
Reviewed By: emilsjolander
Differential Revision: D6702749
fbshipit-source-id: 15dcc94ae30ac185e4d1c7d6e3744a40cfa47317
Summary: Refactored the logic to calculate available main and cross dimensions
Reviewed By: emilsjolander
Differential Revision: D6693777
fbshipit-source-id: d6c87670e74bdc22b32916c2d77fe423d831b378
Summary: Moved setPosition as a method on YGNode
Reviewed By: emilsjolander
Differential Revision: D6683387
fbshipit-source-id: 83f64101faa700933771c69b222056ec2a6b8d1e
Summary: Moved trailingmargin function as a method on YGNode
Reviewed By: emilsjolander
Differential Revision: D6683313
fbshipit-source-id: 5ee458c2f4698768724901df0e3f5d8805c7c8f5
Summary: Moved getLeadingMargin as a function on YGNode
Reviewed By: emilsjolander
Differential Revision: D6683270
fbshipit-source-id: a26663006419e13cb783e9849183e3c665f59b3c
Summary: Moved getTrailingPosition function as a method on YGNode
Reviewed By: emilsjolander
Differential Revision: D6683205
fbshipit-source-id: d30003d90d634c644d92c833e58165b073d4d13e
Summary: Moved is isTrailingPos defined as a method on YGNode
Reviewed By: emilsjolander
Differential Revision: D6683190
fbshipit-source-id: c37e57d02cc4475eb8181a2bb003c555bdb0aaea
Summary: Moved isLeadingPos defined as a method on YGNode
Reviewed By: emilsjolander
Differential Revision: D6682956
fbshipit-source-id: 31c60e0eae906e1434a6969f3cd786fcaf9097a5
Summary: Moved YGNodeLeading position as a method on YGNode
Reviewed By: emilsjolander
Differential Revision: D6682929
fbshipit-source-id: 3607aab1544b62b1126c5d75b2f6fb8f5ca2d45f
Summary:
@public
Currently, we can dirty leaf nodes with `measure` function, we also can get `dirty` status for any node, but we cannot handle a moment when this change happen. This diff introduces a new call-back-manner handler for it.
We need this to plug Yoga inside and outside other layout systems without maintaining own dirty propagation infrastructure.
Consider using Yoga for flex-box layout in React Native where we can have deeply nested layout like `<View><Text><View><Text/></View></Text></View>` where all content of all <Text> nodes are laid out using native text/inline (not flex-box!) layout system. In this case, when some change dirties some deeply nested Yoga node, we have to propagate the dirty state down to outer one. Having this handler makes possible to wire up `on-dirty` handler on the root node and `setDirtied` for the leaf node.
Removing custom dirting mechanism from React Native should drastically simplify rendering layer and bring a huge performance win.
Reviewed By: emilsjolander
Differential Revision: D6597856
fbshipit-source-id: 6588cd712f9c1dede4af32f3d326f90103e48ff0
Summary: There were warnings of castings and null pointer handling in yoga.cpp. This diff fixes the warnings. The issue was brought up here https://github.com/facebook/react-native/issues/17274
Reviewed By: emilsjolander
Differential Revision: D6675111
fbshipit-source-id: 884659fabb05033b4d43d3aa6629e22481d39b7e
Summary: Moved YGResolveFlexGrow as a method on YGNode
Reviewed By: emilsjolander
Differential Revision: D6611385
fbshipit-source-id: 71660946c469fac77c5ffa0284c793e6adc9db7b
Summary: Moved YGNodeMarkDirtyInternal as a method in YGNode
Reviewed By: emilsjolander
Differential Revision: D6611287
fbshipit-source-id: 54402145d51ea717553ea136be739b9880a79817
Summary:
- Removed the default() static method, instead of this, its zero argument initialiser is used
- Moved `YGCloneChildrenIfNeeded` to `cloneChildrenIfNeeded` as a method on `YGNode`.
Reviewed By: emilsjolander
Differential Revision: D6611155
fbshipit-source-id: 463723a363e0fbd2c7686f65226eca73236bd07e
Summary: With this flag the the workflow successfully passed.
Reviewed By: emilsjolander
Differential Revision: D6619293
fbshipit-source-id: c1632efd97f47696b7f8bb1b3e763de92c707287
Summary: Currently whenever `Yoga.h` is imported by someone we set `FB_ASSERTION_ENABLED`. The use case of this flag is to use assert calls of `FBAssert.h`, since we do not use it anymore, there is no need to set this flag.
Reviewed By: emilsjolander
Differential Revision: D6611904
fbshipit-source-id: f01ac144159c1b333d8deb8cbb5ba0288e4bf7a4
Summary: Moved c implementation of `YGNode` to C++ struct. Not moving to C++ class as the React Classes dependent on `Yoga.h` assume it to be C. Thats why keeping `Yoga.h` C compatible. Sorry for the long diff, didn't thought that it will turn out to be this much big.Will keep an eye on number of lines next time 😉
Reviewed By: emilsjolander
Differential Revision: D6592257
fbshipit-source-id: 641e8b9462ad00731a094511f9f5608b23a6bb21
Summary:
Make default init unavailable, as it will not initialise `YGNode` which is required for the setters
and getters of YGLayout's properties to work properly. In setters and getters we call the corresponding `YGNode`'s setters and getters. Thus the following code will crash
```
let layout = YGLayout()
layout.flexDirection = .row
```
Reviewed By: emilsjolander
Differential Revision: D6597796
fbshipit-source-id: 653d275d7314bfdd7a1106884fa3fbc0a13e1be7
Summary:
Disable assert code in release builds (define DNDEBUG).
This disables assertions in Facebook JNI library - which checks that our references to Yoga JNI objects are correct.
This saves CPU time, since those checks are costly.
Reviewed By: emilsjolander
Differential Revision: D6592023
fbshipit-source-id: eaf869c7990cab3a72ae2bbdc67e709153f5020c
Summary:
Currently we have `-O3` hardcoded inside our BUCK target files, this will allow us afterwards to remove that.
Follow up commit will also add `-DNDEBUG` which will disable `assert` in release builds.
Reviewed By: emilsjolander
Differential Revision: D6592024
fbshipit-source-id: f541ee8728ff44db8e31885f2085dc036a400f70
Summary:
GCC internally aliases isnan and a dozen other math.h primitives to their `__builtin_` counterparts, which compile straight to assembler. Clang does not do this, so calls to `isnan` compile to a function call. The Android libc does not define `isnan` because it assumes all application code compiled `__builtin_isnan` and has no need for the function `isnan`.
This is a temporary kludge: Starting with NDK r16, the math.h header has appropriate `#defines` to alias primitives to their `__builtin_` counterparts. Upon upgrade to NDK r16, this can be reverted.
Reviewed By: passy
Differential Revision: D6527499
fbshipit-source-id: 65d9e43c7e7d973a6c92e9863ebe469b35a24ac8
Summary:
Use clang-5.0 -Oz as default NDK compiler for android.
It does 3 good things:
* brings us into compliance with deprecation of gcc for android NDKs since r13
* yields slightly smaller native code, on the order of many-10s-to-small-100s of KB
* slight improvement in startup performance, on the order of 10s of ms
Reviewed By: mzlee
Differential Revision: D6155682
fbshipit-source-id: 2f64e742f4dc44be171274c2ad0a41fb1e7079d7
Summary:
ComponentKit requires all size geometry provided to be rounded to pixel grid. This ensures
that layout will not truncate provided sizes.
Reviewed By: cuva
Differential Revision: D6466875
fbshipit-source-id: 62a480411e7d2354a6879917c42bbf0ee96cdadd
Summary:
Changes so we are able to reset properties to their initial value.
This is required to reset these properties.
Add the support of YGUnitUndefined to many properties:
* minWidth
* maxWidth
* minHeight
* maxHeight
Also, these properties must be reset to YGUnitAuto.
* width
* height
* flexBasis
This now matches completely how these properties are initialized in Yoga.cpp
Closes https://github.com/facebook/yoga/pull/672
Reviewed By: dshahidehpour
Differential Revision: D6407908
Pulled By: emilsjolander
fbshipit-source-id: ac20c7b2c06349115aea7d31240204d17e2f1b44
Summary:
👋 Hello! Thanks for react-native, it’s a great project.
I was digging into the Android implementation in _ReactAndroid_ and noticed a couple typos in the documentation. I went through and tried to fix all the typos I could find using [aspell](http://aspell.net).
Not applicable: these changes are only to comments, and CI should be skipped.
[ANDROID][ENHANCEMENT][*] - Correct comment and docblock typos
Closes https://github.com/facebook/react-native/pull/17049
Differential Revision: D6472182
Pulled By: shergin
fbshipit-source-id: 7e62cab118609596b483d1cf16c3abf651d6753b
Summary:
Fix min/max percentage constraints on measured nodes. Currently we passed in the available size instead of the parent size.
Fixes#611
Closes https://github.com/facebook/yoga/pull/649
Reviewed By: priteshrnandgaonkar
Differential Revision: D6408019
Pulled By: emilsjolander
fbshipit-source-id: 18be5056dbc0dc179970ec231ab8b4e2cdba65c5
Summary: We were using a very out-dated version of watir which did not run with latest ruby
Reviewed By: priteshrnandgaonkar
Differential Revision: D6447029
fbshipit-source-id: ff4ccb8c96947811ff09f7e87cb504e3e7cb834e
Summary:
Because the source files are *.cpp, not *.c. This fixes building issue with gradle.
Closes https://github.com/facebook/yoga/pull/676
Reviewed By: emilsjolander
Differential Revision: D6446545
Pulled By: priteshrnandgaonkar
fbshipit-source-id: 809229057db26665b2d97b3002ade73632dd9117
Summary:
Suppresses the unused warnings on ```YGDefaultLog```. It uses a more generic macro which simply casts the variable to ```(void)```. This is the simples approach to make mutiple different compilers happy. Fixes#650
Closes https://github.com/facebook/yoga/pull/651
Differential Revision: D6407999
Pulled By: emilsjolander
fbshipit-source-id: 19fd78dd8b84eafdbb48875dd003d506a98c4807
Summary:
If you have a measurable node and set ```marign-left: auto``` + ```align-item:stretch``` on it, it won't get measured and they get a width/height of ```-(nan)```. This change fixes that behaviour. Fixes#644.
Closes https://github.com/facebook/yoga/pull/645
Differential Revision: D6413512
Pulled By: emilsjolander
fbshipit-source-id: 755febeb33bb0d4520ca6b3c28d56ac333e4a14d
Summary:
`!Object.prototype.hasOwnProperty.call(methods, unit))` doesn't correctly return `true` when an unsupported value is passed into `setMaxWidth` within an Automator (macOS) javascript/cocoascript environment.
This PR fixes the issue and also adds the `value` information to the returned error to help with debugging
Closes https://github.com/facebook/yoga/pull/643
Differential Revision: D6413569
Pulled By: emilsjolander
fbshipit-source-id: a42a66710a3ca578b5c25ecef8722f9c3f082b73
Summary:
Needed for a project I'm working on to properly render on high dpi screens. I've manually tested against my project to confirm it works.
Closes https://github.com/facebook/yoga/pull/612
Differential Revision: D6413517
Pulled By: emilsjolander
fbshipit-source-id: c298d7f6b58dc45aaaede2bb995df8615911a4a9
Summary:
Adds new ```space-evenly``` for ```justify-content```.
Also adds a typofix in one of the other justify-content tests.
Fixes#657
Closes https://github.com/facebook/yoga/pull/658
Differential Revision: D6407996
Pulled By: emilsjolander
fbshipit-source-id: cc837409e1345624b4bd72c31e25fe68dcb0f6a3
Summary:
This fixes shrinking of elements which are in a non stretch alignment, but keeps the legacy stretch behaviour in place. Additionally this adds a testcase for ```useLegacyStretchBehaviour```
Fixes#633
Closes https://github.com/facebook/yoga/pull/635
Differential Revision: D6408037
Pulled By: emilsjolander
fbshipit-source-id: 377ab0308dd3a75a148a0af31ab5eb3ffb5b5d83
Summary:
If we have a values already set to undefined and set it to undefined again, we invalidate the layout. This change takes this case into account and keeps the layout valid.
Fixes#630
Closes https://github.com/facebook/yoga/pull/648
Differential Revision: D6408013
Pulled By: emilsjolander
fbshipit-source-id: dc2a848d84d3de9f4650fac9e41d7c8169446406
Summary:
Expected to be able to call `YGNodeLayoutGetMargin(node, YGEdgeEnd)`, but instead, the program aborts with `"Cannot get layout properties of multi-edge shorthands"`.
This bug seems to incorrectly prevent properties from YGEdgeEnd for all Layout properties.
Closes https://github.com/facebook/yoga/pull/632
Differential Revision: D6408060
Pulled By: emilsjolander
fbshipit-source-id: 4ab3b2ffb2f1bb6fd3a27f780caf0123abcdb230
Summary:
It is very inconvenient to enter block attribute name for each view in Objective-C.
Closes https://github.com/facebook/yoga/pull/618
Differential Revision: D6408138
Pulled By: emilsjolander
fbshipit-source-id: 71fe8eadda7233e5055560667d0fc3840ab7259b
Summary:
The min/max inner width shouldn't take the margins into account.
Adds a test for both cases.
Fixes#664
Closes https://github.com/facebook/yoga/pull/665
Differential Revision: D6407982
Pulled By: emilsjolander
fbshipit-source-id: ffa549a06f802263e3b8488e90756aa3f722d52d
Summary:
If you run ```enums.py``` it will revert the changes from 835b2bb . This changes the license header for java to not be a javadocs comment.
Closes https://github.com/facebook/yoga/pull/660
Differential Revision: D6407985
Pulled By: emilsjolander
fbshipit-source-id: 49efe555fecb8d740675c6b4631dce2a64f10417
Summary: Refactored the `YGNodeToString` function from c to c++.
Reviewed By: emilsjolander
Differential Revision: D6397372
fbshipit-source-id: 79e701efe7f19db6dac1aea6328ebf0ac84a7ac3
Summary: Changed the extensions of c files to cpp and made the project build successfully
Reviewed By: gkassabli
Differential Revision: D6271299
fbshipit-source-id: 66c0e54ccf019d72d1fd0b4d117826e4e84fdc89
Summary:
**what is the change?:**
Adding a document linking to the Facebook Open Source Code of Conduct,
for visibility and to meet Github community standards.
**why make this change?:**
Facebook Open Source provides a Code of Conduct statement for all
projects to follow.
Exposing the COC via a separate markdown file is a standard being
promoted by Github via the Community Profile in order to meet their Open
Source Guide's recommended community standards.
As you can see, adding this file will complete [Yoga's Community Profile](https://github.com/facebook/yoga/community)
checklist and increase the visibility of our COC.
We also added a link to the COC in the CONTRIBUTING doc because folks may miss the separate CODE_OF_CONDUCT document.
**test plan:**
Viewing it on my branch -


**issue:**
internal task t23481323
Closes https://github.com/facebook/yoga/pull/670
Reviewed By: emilsjolander
Differential Revision: D6384655
Pulled By: flarnie
fbshipit-source-id: 6c5557094719cc8f1b08deb4d477ab56603caf39
Summary: Removed YGSetMemoryFuncs, as it is not used internally and barely externally.
Reviewed By: emilsjolander
Differential Revision: D6374147
fbshipit-source-id: 8c896dce23571268a1a52df5cc72486af9d66df7
Summary: Use internal linting rules instead of the custom once.
Differential Revision: D6284667
fbshipit-source-id: 65aae336f1d7f14dfefed7391b0f5b89b333495e
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
Summary: If the width has an exact dimension, while the left and right edges have a decimal part, that means the decimal part is equal and we can round both down instead of rounding left down and right up. Same for top and bottom.
Reviewed By: emilsjolander
Differential Revision:
D5209073
Tags: accept2ship
fbshipit-source-id: a3a6a43767aa707ebfa5eee62a83adcdd88d7ce6
Summary:
This is a fix on top of 56b10fc. It takes the case into account were you have `wrap-reverse` and `align-items: flex-end` set.
Closes https://github.com/facebook/yoga/pull/568
Differential Revision: D5155521
Pulled By: emilsjolander
fbshipit-source-id: 7e5fcfa2fbb48b6c6279da46cc648a071ff2b079
Summary: Variable name suggest it does not constrain to min dimension but it did indeed. Changing that to match variable name. This required updating code to use fully constraint value again. gkassabli this seems wrong, do you know what is going on?
Reviewed By: gkassabli
Differential Revision: D5144146
fbshipit-source-id: a5d711f8ad7049b0d96ee0f0f3eef1165ab3b4e8
Summary: Previously pointScaleFactor was stored as a divider that opened way to accumulating difference. For instance in ScreenScale=3, pointScaleFactor = 0.3333343 (0.000001 error). When used for width = 300 that error was multiplied by the number of times pointScale contained in width (300 *3 = 900) and we had almost 0.001 error accumulated. With this change Yoga will avoid such issue
Reviewed By: shergin
Differential Revision: D5137923
fbshipit-source-id: 652b59bc3da3f35ee93ffa3695936f623298a023
Summary:
Travis doesn't set encrypted variables in pull requests (for very good reasons),
but openssl fails rather loudly if it doesn't get them. Our artifact publishing
script happily skips PRs anyway, so we don't need these variables in that case.
Reviewed By: emilsjolander
Differential Revision:
D5137092
Tags: accept2ship
fbshipit-source-id: b14d61feba0bb98a1705b2f8232f52ba59a2c734
Summary: Implement the inverse of toString. This allows us to parse a YogaValue from a string inputted from the user in debugging tools.
Reviewed By: kittens
Differential Revision: D5120456
fbshipit-source-id: 6ac7cff2a040778e63a953070e1bd7e768fedaa7
Summary: To fix builds where `sdks =` is not supported.
Reviewed By: splhack
Differential Revision: D5113020
fbshipit-source-id: b716acd6fb88ccb55c72b24f9fcdf20a2ea3693e
Summary: There is a case when measure() function will be called with negative width/height because of margin/padding. This diff fixes that scenario
Reviewed By: emilsjolander
Differential Revision: D5111534
fbshipit-source-id: 99f09b85f0c6a0e5dec89a26baba8f9d560100da
Summary: This makes the output less messy.
Reviewed By: emilsjolander
Differential Revision: D5111279
fbshipit-source-id: c65c7f275e57312fb56c2edfec429cc3d2373e3f
Summary:
Make sure that the gradle tests pass before publishing the snapshot. Also makes
sure that we don't break the gradle build.
Reviewed By: emilsjolander
Differential Revision: D5020044
fbshipit-source-id: dfebd829701717eac3ed078a807cd10f489f4348
Summary:
calculateLayoutWithSize: can be useful when calculating table/collection view sizes before the views are fully laid out by UIKit.
Closes https://github.com/facebook/yoga/pull/558
Differential Revision: D5104863
Pulled By: emilsjolander
fbshipit-source-id: e0e0c6d502f6745be8d84de8c1b6e24cc25a0352
Summary:
This adds the same logic that we have in place with Litho for Yoga, allowing
unit tests to run with Gradle for Yoga. It'll still shell out to Buck to build
the native library, but that's hopefully only until we have found a way to reuse
the NDK build. For CI this shouldn't matter as we want to run `buck build`
anyway and the build step should be a no-op.
FB-Only:
This should unlock D5020044.
Reviewed By: emilsjolander
Differential Revision: D5104154
fbshipit-source-id: 48732fff6c1d100a155452f675de343aaf06427b
Summary:
1, Change bottom to be based� on height of parent.
2, Respect margin value when layout with right/bottom.
Closes https://github.com/facebook/yoga/pull/552
Differential Revision: D5102090
Pulled By: emilsjolander
fbshipit-source-id: dca291413ffc2027d7628f4c8b8eeeb0b4823bc2
Summary:
This is used in a stack where I'm using YogaKit on tvOS. fb_apple_library needs `sdks = ` to get buck to do its thing for tvOS.
This seems like it should be OK since apple_library is a nop on non apple platforms (which makes sense since this is ObjC only) - I think that makes sense anyway?
Reviewed By: emilsjolander
Differential Revision: D5080261
fbshipit-source-id: f08d7e6d2599b9af25fb964ade485aef552f306b
Summary: We should always try to make root node as small as possible, while previously this wasn't functioning this way
Reviewed By: emilsjolander
Differential Revision: D5071164
fbshipit-source-id: b8afef42477d0ed87d0c9fcfd26349e0a0babd6e
Summary: When config was added to YGNodeCanUseCachedMeasurement we didn't account for default 0 scale factor. This diff fixes that
Reviewed By: emilsjolander
Differential Revision: D5061016
fbshipit-source-id: 907ef987bd0ead29cf02f6945a3f03d4ffb58a2e
Summary: We want to be able to use YGConfig to account for possible rounding of width/height
Reviewed By: emilsjolander
Differential Revision: D5059560
fbshipit-source-id: d729e991758a8c668a4b373105b71337961875cd
Summary: Include margin when calculating if children overflow
Reviewed By: passy
Differential Revision: D5044471
fbshipit-source-id: e7c1eb694445ffb898bcf375d9deefc558c49f11
Summary: Fix flex basis not being constraint to the max size in the main direction. Previously this caused the added test to fail due to NaN in child dimensions.
Reviewed By: gkassabli
Differential Revision: D5044314
fbshipit-source-id: d9f9db832e4943a57a89c9d162ff6077b709795a
Summary: This adds very little (no?) new features and mostly just refactors code to live in a singular place. Instead of users having to worry about DebugComponent as well as the DebugInfo object and attaching it correctly to a tree now user's of the DebugComponent API only need to worry about a single class, greatly simplifying its usage.
Reviewed By: passy
Differential Revision: D5027780
fbshipit-source-id: 95a95b3572747aa2088f8f9b35a160257eb59269
Summary: This diff adds node type definition to Yoga and moves rounding to rely on the node type. If the node has measure function we consider that node to be text node, otherwise we have default behavior.
Reviewed By: emilsjolander
Differential Revision: D5025107
fbshipit-source-id: a8d66e2f9c5d02ab080784cc474be583a09b92e2
Summary: Also bumped the version number for the existing dependency examples.
Reviewed By: emilsjolander
Differential Revision: D5044190
fbshipit-source-id: 4199ab114450a256efaa30a811822923beafb378
Summary:
Fix some long-standing issues with the android build on Travis (and elsewhere)
and enable automatic publishing of snapshots.
Reviewed By: emilsjolander
Differential Revision: D5044001
fbshipit-source-id: f00be07f33c8018573af0b98233068ebd93360b4
Summary: The appcompat library was way outdated and failed CI: https://travis-ci.org/facebook/yoga/builds/231065300
Reviewed By: emilsjolander
Differential Revision: D5043967
fbshipit-source-id: a5bb02110cf016972d983f511cf8c31dd9d667e1
Summary: So I can use them from JSBigString whose methods are marked const.
Reviewed By: emilsjolander
Differential Revision: D5020648
fbshipit-source-id: 6e60b80cb3d4718bab25dd6ca9627aee862117db
Summary:
Gets all the pieces in place to automatically publish snapshot artifacts after
successful travis build.
I'll test the actual publishing in a separate branch and then flip the switch in
a separate diff when it's ready.
Reviewed By: emilsjolander
Differential Revision: D5028239
fbshipit-source-id: c57d02a1dee41c84001bd17821b050c8c9aa4134
Summary:
Reuse the gradle setup we've built for Litho which allows for parallel publishing to Bintray and Maven Central in addition to Sonatype Snapshots.
This appears not to break the existing jcenter deploy script which is pretty great.
Reviewed By: emilsjolander
Differential Revision: D5020576
fbshipit-source-id: 3ef163ccbfe91c6858b051d39dcf237ca388e18d
Summary:
fbjni was previously dependency-free but now requires some annotations and
soloader. This unbreaks the gradle build.
Reviewed By: emilsjolander
Differential Revision: D5020069
fbshipit-source-id: b8bde83ce6a70b06e04491f1d70c2a6b568bc99c
Summary:
Moves the `YGLogger` into `YGConfig` and pass the `YGNodeRef` into the logger to be able to associate the log messages and assertions with the specific node.
Tackles facebook/yoga#530 and facebook/yoga#446
Closes https://github.com/facebook/yoga/pull/531
Reviewed By: astreet
Differential Revision: D4970149
Pulled By: emilsjolander
fbshipit-source-id: b7fcdaa273143ea2fa35861620b2e4d79f04f0af
Summary:
ActionBarActivity has been deprecated for 2+ years now.
Closes https://github.com/facebook/yoga/pull/538
Differential Revision: D4985973
Pulled By: emilsjolander
fbshipit-source-id: 09f2a8a12943c9b3ccdaee9cac684276b42ff843
Summary:
ActionBarActivity has been deprecated for 2+ years now.
Closes https://github.com/facebook/yoga/pull/539
Differential Revision: D4985970
Pulled By: emilsjolander
fbshipit-source-id: 2e2fcc5188c08ef1cd78f7e1be71917f0395ff2c
Summary: See blame revision. we are still passing all the added tests from that pull request but with much simpler logic.
Reviewed By: gkassabli
Differential Revision: D4977923
fbshipit-source-id: cb488e63c7c2e15e4c0f0133a16df36580c646fd
Summary: We need to treat measurements from nodes with measure functions as minimum values as to not truncate text.
Reviewed By: shergin
Differential Revision: D4972290
fbshipit-source-id: 0a7bcc7f47b3e5acb8745da5286abcb9c4e44a38
Summary:
We still need to wait for the `YGUnitPoint` PR to be merged :) But please let me know what you think. One caveat: because of a limitation of Swift, a literal value can be automatically understood as a point-based `YGValue`, but variables have to be explicitly cast. I haven't found a way around it yet:
```
view.yoga.width = 10 // value == 10, unit == YGUnitPixel
let a: CGFloat = 100
view.yoga.height = a // Compiler error
view.yoga.height = YGValue(a) // works, not great
```
Closes https://github.com/facebook/yoga/pull/390
Reviewed By: emilsjolander
Differential Revision: D4954021
Pulled By: maxoll
fbshipit-source-id: 5eff6aeb6dd969d0d5dc557b149bb5819b0e31de
Summary:
Fixes the sizing of items so that under most scenarios it calcultes its height by it's content for non exact measurings. This introduces a new useLegacyStretchBehaviour flag on the config to opt out of this change as it is breaking.
See facebook/yoga#505
Closes https://github.com/facebook/yoga/pull/506
Reviewed By: astreet
Differential Revision: D4954016
Pulled By: emilsjolander
fbshipit-source-id: d28bd5d174cd76951fb94df85e3b0cfab7f81ff7
Summary:
Hi! After merging 3db38f2a80 the rounding algorithm become broken in YogaKit because it doesn't configure scale factor.
Closes https://github.com/facebook/yoga/pull/534
Differential Revision: D4969481
Pulled By: emilsjolander
fbshipit-source-id: 57ea42a3b1f37007b2392cda724d509e0b28c4cb
Summary: Rounding has been successfully adopted by multiple products and frameworks. Time to move it out of experimental mode. Rounding can still be turned of by setting the point scale factor to 0 on the config.
Reviewed By: gkassabli
Differential Revision: D4953838
fbshipit-source-id: 3ee5f27d92f95b3ed4a01c98bc35e9157f2e91c5
Summary:
Nodes with a measure function needs to be measured even so it seems there is no available space. So it behaves more like on the web. Fixfacebook/yoga#488
Closes https://github.com/facebook/yoga/pull/499
Reviewed By: astreet
Differential Revision: D4954008
Pulled By: emilsjolander
fbshipit-source-id: 5b6d9afae0cdebe33f8b82b67620b3b4527d1efc
Summary:
Fixes `flex-wrap` with a max constraint and `justify-content`. Fixesfacebook/yoga#514.
Closes https://github.com/facebook/yoga/pull/519
Differential Revision: D4953727
Pulled By: emilsjolander
fbshipit-source-id: 32dec48220be1392ea8dac5f34871d407eb8d49b
Summary: Update yoga's copy of fbjni to include some missing java files.
Reviewed By: IanChilds
Differential Revision: D4953841
fbshipit-source-id: 74d5c617a6fcd11e82c86f03e61448b14a34b86b
Summary:
Fixes#507 . The attribute name format got changed and the docs were left behind.
Closes https://github.com/facebook/yoga/pull/510
Differential Revision: D4953733
Pulled By: emilsjolander
fbshipit-source-id: 6eb02d6745d08fdd8cce669c691794351bd6fbc7
Summary:
Hey there, lets downgrade deployment target of YogaKit pod to iOS7. This days there is a lot of apps that still have support of ios7 (and i'm working on one of them :)). And I didnt't find any reason why it couldn't be done.
Thanks
Closes https://github.com/facebook/yoga/pull/524
Differential Revision: D4953726
Pulled By: emilsjolander
fbshipit-source-id: 9e17a40caaa0a3ae26779c0d08acb59f71df2b23
Summary:
This diff introduces new, little bit sophisticated round-to-pixel-grid algorithm.
**Motivation:**
Previous simple and straightforward solution works in most cases but sometimes produce the not-so-great result. A while ago Nick Lockwood described this problem and proposed the solution in RN's RCTShadowView class:
For example, say you have the following structure:
// +--------+---------+--------+
// | |+-------+| |
// | || || |
// | |+-------+| |
// +--------+---------+--------+
Say the screen width is 320 pts so the three big views will get the following x bounds from our layout system:
{0, 106.667}, {106.667, 213.333}, {213.333, 320}
Assuming screen scale is 2, these numbers must be rounded to the nearest 0.5 to fit the pixel grid:
{0, 106.5}, {106.5, 213.5}, {213.5, 320}
You'll notice that the three widths are 106.5, 107, 106.5.
This is great for the parent views but it gets trickier when we consider rounding for the subview. When we go to round the bounds for the subview in the middle, it's relative bounds are {0, 106.667} which gets rounded to {0, 106.5}. This will cause the subview to be one pixel smaller than it should be. This is why we need to pass in the absolute position in order to do the rounding relative to the screen's grid rather than the view's grid. After passing in the absolutePosition of {106.667, y}, we do the following calculations:
absoluteLeft = round(absolutePosition.x + viewPosition.left) = round(106.667 + 0) = 106.5
absoluteRight = round(absolutePosition.x + viewPosition.left + viewSize.width) + round(106.667 + 0 + 106.667) = 213.5
width = 213.5 - 106.5 = 107
You'll notice that this is the same width we calculated for the parent view because we've taken its position into account.
I believe this is awesome. I also believe that we have to decouple this logic from RN and put it into awesome Yoga. So I did it in this diff.
**Fun fact:**
The original implementation of this algorithm in RN had (and still have) a bug, which was found by Dustin dshahidehpour and fixed in D4133643. Therefore that diff was unlanded because it broke something unrelated inside RN text engine. I will fix that problem in RN later.
**Why do we need to change test methodology?**
Because the way we receive layout metrics from Chrome browser actually directly related to rounding problem. Previously we used `offsetHeight` and `offsetWidth` properties of the DOM node, which contain naively rounded values from `computedStyle` or `getBoundingClientRect`. (Which is we are trying to fix!) So, I added the new function that computes node size using two-step-rounding approach, conceptually similar to one that implemented in Yoga. Note: Chrome browser performs rounding layout as part of rendering process and actual values that can ve computed by counting actual pixel are different from these natively rounded ones.
**Why do some tests now have different desired values?**
These changes actually prove that my approach is correct and more useful for actual view rendering goals. So, let's take a look at test with changed values `rounding_fractial_input_3`:
Previously: 64+25+24=114 (Incorrect!)
Now: 65+24+25=114 (Correct!)
Previously: 64+25+24=114 (Incorrect!)
Now: 65+24+25=114 (Correct!)
Reviewed By: emilsjolander
Differential Revision: D4941266
fbshipit-source-id: 07500f5cc93c628219500e9e07291438e9d5d36c
Summary:
Mark some fields as readonly and reuse index value in RemoveChild.
Closes https://github.com/facebook/yoga/pull/516
Reviewed By: emilsjolander
Differential Revision: D4921809
Pulled By: splhack
fbshipit-source-id: 261a7910675d93be165c16ee53a83c02b15925f1
Summary:
Marks enum with ```[Flags]``` attribute, where they are used as flags.
Closes https://github.com/facebook/yoga/pull/515
Reviewed By: emilsjolander
Differential Revision: D4921807
Pulled By: splhack
fbshipit-source-id: f056189b76ee6e6c042417a7998bfd20a610c27f
Summary:
These only exist to support a deprecated form of project generation which is
about to be removed.
Reviewed By: marcinkosiba
Differential Revision: D4945841
fbshipit-source-id: 3d35b8f8cd902572995ee4f55f9b5930efa186ec
Summary: We don't need to set overflow from litho any more because overflow hidden / visible no longer effects layout.
Reviewed By: marco-cova
Differential Revision: D4938759
fbshipit-source-id: 4cd6bc478dd1f56340f23e8bfe95fe7bb1b5db2d
Summary:
The main container that gets called `applyLayoutPreservingOrigin:` is using its size as a fixed bounding box.
In some cases it's preferrable to let it accomodate its contents.
This diffs extends `applyLayoutPreservingOrigin:` by adding an additional parameter which can be used to sepecify whether width and/or height are fixed or flexible.
Feel free to suggest better names than `YGDimensionFlexibility` & co.
Let me know if you prefet to kill the API without flexiblity specifier - I'll codemod everything then.
Reviewed By: dshahidehpour
Differential Revision: D4929702
fbshipit-source-id: f128f244140b4a54d8ce3b3f4edddbb9756f8fdf
Summary: The `block` paramenter is marked as nonnull, so we can't pass `nil` directly in.
Reviewed By: dshahidehpour
Differential Revision: D4929692
fbshipit-source-id: a35ef2940d6986f4ff55444d8a99ba17eb7c677e
Summary: This diff corrects the fix to be limited only to cases when either element itself or all of it's children can't be flexed
Reviewed By: emilsjolander
Differential Revision: D4915189
fbshipit-source-id: efccee2fe39ed0f474a41dc3250d24c546f3f5d9
Summary:
I'm actually quite excited about this one!
No more buck shelling out for building the Yoga AARs/JARs via Gradle. It's now
all done via Gradle.
This commit is the only one that should actually change anything about the entry
points to the gradle builds and release process. **So if anything goes wrong
with the next release, reverting this one here should be enough!**
Reviewed By: emilsjolander
Differential Revision: D4913600
fbshipit-source-id: 4a54562ad5be69f62a7781d43fddad211f99ab25
Summary:
I put the CMake file in the root directory to avoid moving the actual `yoga/`
dir around, but created a directory for the Android library manifest nonsense
so it works as its own module you can depend on.
Reviewed By: emilsjolander
Differential Revision: D4913601
fbshipit-source-id: 582064264cf0b6b69c03d0e72ed9dd22d217dd16
Summary:
This enables using gradle for building libfb using the NDK. This is 1/3 of what
we need to do. We also need to build yoga itself (which is the easiest as it's
just a static library without external dependencies) and yogajni which relies on
the other two.
Hopefully, this should also make it more obvious why the previous moves were
necessary.
Reviewed By: emilsjolander
Differential Revision: D4913360
fbshipit-source-id: 47658328532fd1ec15f10f8e31ea04691c481011
Summary:
This way we can more easily build it with Gradle. The CMake build for this comes
with the next Diff.
Reviewed By: emilsjolander
Differential Revision: D4913361
fbshipit-source-id: b7958e204a8a4a97a1f60043788d826dd2a4c080
Summary:
Adds two methods ```AddChild``` and ```RemoveChild``` to be able to add/remove children without the need to know there position.
Closes https://github.com/facebook/yoga/pull/513
Reviewed By: emilsjolander
Differential Revision: D4914242
Pulled By: splhack
fbshipit-source-id: df187ba71a1bae0b3b0649624f3c29401d5f8804
Summary:
Rename ```StyleAspectRatio``` to ```AspectRatio``` to be consistent with the other getters and setters.
Closes https://github.com/facebook/yoga/pull/512
Reviewed By: emilsjolander
Differential Revision: D4914236
Pulled By: splhack
fbshipit-source-id: 7b9ebdbf8945c4a8570c61de16d71c8d9d96bf9f
Summary:
As stated in 152074935 by rmarinho the Visual Studio solution didn't compile as ```YGEnums.c/YGEnums.h``` hasn't been added to them. This fixes this problem.
Closes https://github.com/facebook/yoga/pull/511
Reviewed By: emilsjolander
Differential Revision: D4914234
Pulled By: splhack
fbshipit-source-id: 473b6169bfb6576ca8848d4a5079f81692766897
Summary:
We need to use the most recent Android SDK to leverage the cmake-based NDK build
system. Also, since everything seems to be still working - why not?
I also changed the dependency of `yoga-layout` to be the project, not the
pre-published artifact as it no longer compiled due to the changed measure API
signature. I'm not sure if there was a reason to keep the two separate.
By relying on Maven-published artifacts, we generate better POMs when publishing
and people can override dependencies and see them more easily.
A few more cleanups based on what we did with Litho.
Reviewed By: emilsjolander
Differential Revision: D4913208
fbshipit-source-id: 053deb444ce91106afb3b66c3be28d6fcbdea450
Summary:
By declaring the properties first, before using them in the scripts, you no
longer get an exception if you fail to specify them.
You can now build artifacts or run tests without specifying your bintray
password, which is probably what you want.
Reviewed By: emilsjolander
Differential Revision: D4913103
fbshipit-source-id: 8787af8973cebb84cd59e18c63a3a9f28e0ec348
Summary:
I'm trying to get an NDK build set up for Yoga and clean up some of the Gradle
things along the way.
Having a wrapper is not only the preferred way of setting up Android
repositories and more convenient than asking users to install Gradle on their
machines themselves, but also allows for version pinning, which is important
when dealing with Android plugins which usually expect one very specific version
of Gradle.
Reviewed By: emilsjolander
Differential Revision: D4913104
fbshipit-source-id: b14964025271cd16c3c5c05a2fb6dab213227346
Summary: Can we just bump this here?
Reviewed By: emilsjolander
Differential Revision: D4905930
fbshipit-source-id: ea0bd51e32700556ecd1527d2b7fad67d4645366
Summary:
Nodes with a measure function needs to be measured even so it seems there is no available space. So it behaves more like on the web. Fixfacebook/yoga#488
Closes https://github.com/facebook/yoga/pull/499
Differential Revision: D4850458
Pulled By: emilsjolander
fbshipit-source-id: be5e35a670ddcbf3cd426fc3c2a0c9b60a874cdc
Summary:
Fixes the sizing of items so that under most scenarios it calcultes its height by it's content for non exact measurings. See facebook/yoga#505
Closes https://github.com/facebook/yoga/pull/506
Differential Revision: D4878875
Pulled By: emilsjolander
fbshipit-source-id: ab1174ac7a76dcf20aae7b29a3bc396e11077c4d
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
Summary: Bump version of android things
Reviewed By: passy
Differential Revision: D4875213
fbshipit-source-id: 2b229a0dade521ef745852c0096545e7e9fe2c1e
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
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
Summary:
- depends on #496
- For memory leak unit test
- Expose the API for C#
Closes https://github.com/facebook/yoga/pull/497
Reviewed By: emilsjolander
Differential Revision: D4796190
Pulled By: splhack
fbshipit-source-id: 99e4e78e8dfb3d459cf6cd7103ab252c3748e5a6
Summary:
See facebook/yoga#453. Optimizes the node log print by generating some enum text via ```enum.py``` and moving printing to new functions to reduce boilerplate code.
Changes the log output to format the nodes in html to be able to copy paste it into browsers for quick debugging.
Hides all default values.
Closes https://github.com/facebook/yoga/pull/479
Reviewed By: gkassabli
Differential Revision: D4802184
Pulled By: emilsjolander
fbshipit-source-id: 143bd63cbc31fb0755d711062cb4e6a448049ba3
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
Summary:
Fix xmlns import for yoga library by using `apk` instead of `lib` in the comment.
Closes https://github.com/facebook/yoga/pull/495
Reviewed By: emilsjolander
Differential Revision: D4802918
Pulled By: rspencer01
fbshipit-source-id: 9cef7709606e30e8e30af6e396866ac4900168bf
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
Summary: The native build script didn't make the directories it needed, and thus only worked if you'd run it before :O
Reviewed By: emilsjolander
Differential Revision: D4794861
fbshipit-source-id: 69764ef1ddadf63333ce5d91dfa85bc943479fef
Summary: Version bump as we have introduced `setUseWebDefaults`.
Reviewed By: emilsjolander
Differential Revision: D4794772
fbshipit-source-id: 0a42def3bec3f4f76caf6da01e3b9ab3679ebcb0
Summary: Set web defaults when resetting
Reviewed By: astreet
Differential Revision: D4779742
fbshipit-source-id: 5b8c5d7bd432a12984e4ebfd3187da3d680272cd
Summary: Mark nodes as having a new layout when changing display to none recursively.
Reviewed By: astreet
Differential Revision: D4786615
fbshipit-source-id: 2f3a16661d37bc37939e8e7a551445886a06524e
Summary:
The following PR fixes the tests used in the javascript port (it modifies gentest.rb).
These changes don't yet pass, it seems something is segfaulting somewhere. I have to check if it comes from nbind, the yoga library, or the node bridge itself. There's also some fails on the browser build, but it might be the same issue.
Closes https://github.com/facebook/yoga/pull/487
Reviewed By: emilsjolander
Differential Revision: D4778870
Pulled By: astreet
fbshipit-source-id: 936fbca564ec89738c78e50c4402c53eb6867dec
Summary:
- Unity IL2CPP (ENABLE_IL2CPP) requires the same code path with AOT compile.
- Clean up unneeded code in YGConfigHandle.
- YogaNode.Reset makes YGNodeHandle stale. Unmanaged side was reset by YGNodeReset, but YGNodeHandle keeps to retain the old managed handle. Release it.
Closes https://github.com/facebook/yoga/pull/491
Reviewed By: astreet
Differential Revision: D4765683
Pulled By: splhack
fbshipit-source-id: 83bfe19feb0e6ec45dc504e42b0c6c34e10af8e2
Summary:
Move -fPIC from BUCK to YOGA_DEFS, so that it can be overridden when
building yoga inside another build tree (since the larger build tree
may need its own configuration for -fPIC). No change when building yoga
standalone.
Reviewed By: emilsjolander
Differential Revision: D4714782
fbshipit-source-id: c706336cda72b36045e744e4fcaea4c0899bcf38
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
Summary: The layout of a node is invalid once it leaves the tree. Let's reset it for safety in case it is added to another tree.
Reviewed By: astreet
Differential Revision: D4716022
fbshipit-source-id: 399cc64a4b3f5fd3fc469ea37bdd31abe474dc6c
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
Summary: We would like to know some numbers on benchmarking `YogaLayout` against other layouts, particularly `LinearLayout`. This implements a `BenchmarkActivity` to fill that need.
Reviewed By: emilsjolander
Differential Revision: D4565531
fbshipit-source-id: fe1c558beb603c3116ac3d0dd6654b0376dd6b8a
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
Summary: Using the newer/recommended API in the sample project. #accept2ship
Reviewed By: emilsjolander
Differential Revision: D4698936
fbshipit-source-id: 07b61df897524cd38390ba48dfa2a2e10942329b
Summary:
We have some resolve functions with ```YG**Resolve``` and others named ```YGResolve**```. This changes both to be named like the later one, as I think this is the grammatically better readable one.
Closes https://github.com/facebook/yoga/pull/471
Differential Revision: D4688997
Pulled By: emilsjolander
fbshipit-source-id: 38b5f84d4d39ed3effedf08188085b9efd96b4ce
Summary:
Once measure and baseline functions are set, C# layer never calls YGNodeSetMeasure/BaselineFunc with NULL. This diff will fix the issue.
Closes https://github.com/facebook/yoga/pull/468
Reviewed By: emilsjolander
Differential Revision: D4676753
Pulled By: splhack
fbshipit-source-id: da34de2fc28adf320a18de2addffe9671cf1ecf9
Summary:
This adds some improvements to the new ```YGConfig```, it tackles #452 and moves the scalefactor into the config.
Closes https://github.com/facebook/yoga/pull/457
Differential Revision: D4675088
Pulled By: emilsjolander
fbshipit-source-id: 99b2c734d6c5139fe1dc8bdeb014bb038f0e337d
Summary: The android standard is `prefix_camelCase` such as `layout_marginLeft`. This changes attributes like `yg_margin_left` to `yg_marginLeft`.
Reviewed By: emilsjolander
Differential Revision: D4681514
fbshipit-source-id: 76a80c24f19f3ee52329a2a254fe1f5fbcb40b9c
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
Summary:
Fixes a typo in the test class to use the same name as the other tests.
Closes https://github.com/facebook/yoga/pull/469
Differential Revision: D4681340
Pulled By: emilsjolander
fbshipit-source-id: a5e60b5e2aa74dc25e677a5579bb853492708c16
Summary: Until now we've been building only arm-v7 and x86 libraries. This builds 64 bit versions too, and sets up the gradle script to publish them. We also bump up the NDK version, and increase the min API to 21, as this is the first API supporting 64 bit NDK tools.
Reviewed By: emilsjolander
Differential Revision: D4674049
fbshipit-source-id: fbc87541fcaf72b83d376646c7aab70c317125e1
Summary:
For some reason this Universal.csproj wasn't pulled from rozele PR.. i added the missing files.
Added badges for build and nuget for more exposure.
Ignore a failing unit test on MacOS for a green build.
Closes https://github.com/facebook/yoga/pull/464
Reviewed By: emilsjolander
Differential Revision: D4670392
Pulled By: splhack
fbshipit-source-id: 9ea3150b92039cab87ce8696db983fdf373c5388
Summary:
Before:
There was a broken link in ./docs/README.md
CONTRIBUTING didn't render markup on Github
After:
All links to CONTRIBUTING.md are not broken anymore
CONTRIBUTING.md renders markup on Github
Closes https://github.com/facebook/yoga/pull/458
Differential Revision: D4673746
Pulled By: emilsjolander
fbshipit-source-id: 151c1f38789a96b61dfbb544fd11996098dc456d
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
Summary: I accidentally used pngs for the bintray badges. This renders ugly sometimes. This corrects that.
Reviewed By: emilsjolander
Differential Revision: D4666641
fbshipit-source-id: df53f08a77be3067804d7671d673146f208a24fd
Summary: This adds bintray badges to the readme, and creates a readme for the android code.
Reviewed By: emilsjolander
Differential Revision: D4666314
fbshipit-source-id: a2549374f3e9c39c260160d1e32fb37801ff4208
Summary: The gists in the docs have large margins to fit with the front page. This diff specialises that margin setting and sets it to something smaller for other gists.
Reviewed By: emilsjolander
Differential Revision: D4666016
fbshipit-source-id: 5121849a153e78d523b33e10b96641426e794f8d
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
Summary:
The issue is on ARM builds for Windows UWP. For the C# P/Invoke API wrapper, any native method that returns the YogaValue struct throws the AccessViolationException. The issue is not with structs in general, as returning the YogaSize / YGSize struct works fine. The issue seems to be limited to structs that have an enum member.
I tried a number of things to resolve the issue without changing the underlying native API for Windows. I read the ARM documentation and saw reference to variable enum sizes based on the number of enum members, so I tried to use a number of different UnmanagedType values in a [MarsalAs()] attribute on the enum member of the C# struct declaration.
What ultimately worked was to return a pointer to the location of the struct, and use the System.Runtime.InteropServices.PtrToStructure API to read the struct data from that pointer. I added a few new macros that will return the struct address on Windows only, other builds are not affected.
Note, I have not tested the impact of this ch
Closes https://github.com/facebook/yoga/pull/459
Reviewed By: emilsjolander
Differential Revision: D4652278
Pulled By: splhack
fbshipit-source-id: bf7ada4da1781e3f813b3ba331974b7bded476d9
Summary:
If we set ```display:none``` all children are set with layout sizes/values of 0. We need do mark all those children as dirty to force a relayout if we toggle the display on a higher parent node. This fixes#443
Closes https://github.com/facebook/yoga/pull/448
Reviewed By: astreet
Differential Revision: D4642273
Pulled By: emilsjolander
fbshipit-source-id: dfdb920e2049952bd6c7f48cfa53b1448e1f3e8f
Summary:
This sets the new ```YGExperimentalFeatureMinFlexFix``` explicitly to false in the config.
It also a changes a stretch reason to reflect that it is the strech in a multiline.
Closes https://github.com/facebook/yoga/pull/447
Reviewed By: astreet
Differential Revision: D4642275
Pulled By: emilsjolander
fbshipit-source-id: 26777db7008ff6ee86da72ca9ea19e979b916cc9
Summary:
Use ```float``` for calculation, as we would calculate with ```double``` and cast to float afterwards otherwise. So this removes the warning.
Closes https://github.com/facebook/yoga/pull/450
Reviewed By: astreet
Differential Revision: D4642267
Pulled By: emilsjolander
fbshipit-source-id: 184ef24474f2b8a42654a71a8e98839296648b2b
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
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
Summary: To avoid clashes in the `app:` namespace, we prefix all yoga attributes with `yg_`.
Reviewed By: emilsjolander
Differential Revision: D4643080
fbshipit-source-id: 3e9265fd57e56a1df2f687a5d17c5bc66b8befa3
Summary: When some drawing attributes of a view changes how it measures, we need to be able to relayout it correctly. This adds method `invalidate(View)` to `YogaLayout` which will flag the corresponding node as dirty and requiring layout again.
Reviewed By: emilsjolander
Differential Revision: D4634563
fbshipit-source-id: af7f47dce00a31414d0987a58307c5d44c1bcf20
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
Summary: This is a follow up on a recent change which made the constraints passed into conculateLayout describe the parent constraints and not the root node constraints. This broke some assumptions and was not very inuitive if no size was set on the root. Therefor this diff ensure that if the root node does not have any size set then it will adopt the size of the parent constraints.
Reviewed By: dshahidehpour
Differential Revision: D4634616
fbshipit-source-id: 089eb4313c5bb810a6ff56f158cd19cec71808ec
Summary: This diff updates the NDK version from 10 to 12
Reviewed By: emilsjolander
Differential Revision: D4634938
fbshipit-source-id: 6a9cbc48dbcbda4674d6460120c7a0d8abd626ab
Summary: [This commit](1146013e9e) (or diff D4501142) adds an `auto` option for margins. This diff allows you to leverage that in android via attribute `yoga:margin_all="auto"` (and as expected for the other edges).
Reviewed By: emilsjolander
Differential Revision: D4634684
fbshipit-source-id: 158f70ec975b5bb3a666e590b76eb52daeb38f49
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
Summary:
Changed the flex getters to return the values they were actually set. See #421 .
Closes https://github.com/facebook/yoga/pull/431
Reviewed By: astreet
Differential Revision: D4604744
Pulled By: emilsjolander
fbshipit-source-id: 02d79100ef22be866db1c3bd9d53e4447186811f
Summary: The size of the node is already set on the node however there was no way to set the size of the parent to the root so that the root could use percentages. This change fixes this by making the width and height passed to calculate layout be the width and height of the hypothetical parent.
Reviewed By: astreet
Differential Revision: D4611417
fbshipit-source-id: 2fb0eedffa17f0ec89b601722a1717a72e216b9e
Summary: Diff D4501141 added display attributes for Yoga. This exposes them in the android library.
Reviewed By: emilsjolander
Differential Revision: D4605574
fbshipit-source-id: dbad3d6fe924682c6b81f65bbba9727085de2d81
Summary: The android sdk and api installation seems to be timing out on Travis. This should extend the 10 minute limit to 20 minutes. Hopefully this will be enough to download it all. If not, we must just extend the timeout.
Reviewed By: emilsjolander
Differential Revision: D4588245
fbshipit-source-id: fef25c54b081ba4d96d1e0435c6c1f643ff49b66
Summary: This diff adds rounding to the pixel grid feature to Yoga and appropriate property
Reviewed By: emilsjolander
Differential Revision: D4565980
fbshipit-source-id: 9700f6d6ed147f82b19f230fbff2e9ccbd625b25
Facebook has adopted a Code of Conduct that we expect project participants to adhere to. Please [read the full text](https://code.facebook.com/pages/876921332402685/open-source-code-of-conduct) so that you can understand what actions will and will not be tolerated.
We want to make contributing to this project as easy and transparent as
possible.
## Code of Conduct
Facebook has adopted a Code of Conduct that we expect project participants to adhere to. Please [read the full text](https://code.facebook.com/pages/876921332402685/open-source-code-of-conduct) so that you can understand what actions will and will not be tolerated.
## Pull Requests
We actively welcome your pull requests.
1. Fork the repo and create your branch from `master`.
@@ -25,9 +29,6 @@ Facebook has a [bounty program](https://www.facebook.com/whitehat/) for the safe
disclosure of security bugs. In those cases, please go through the process
outlined on that page and do not file a public issue.
## Coding Style
* format.sh
## License
By contributing to yoga, you agree that your contributions will be licensed
Yoga builds with [buck](https://buckbuild.com). Make sure you install buck before contributing to Yoga. Yoga's main implementation is in C, with bindings to supported languages and frameworks. When making changes to Yoga please ensure the changes are also propagated to these bindings when applicable.
@@ -30,8 +23,26 @@ You may need to install the latest watir-webdriver gem (`gem install watir-webdr
### .NET
.NET testing is not integrated in buck yet, you might need to set up .NET testing environment. We have a script which to launch C# test on macOS, `csharp/tests/Facebook.Yoga/test_macos.sh`.
## Code style
For the main C implementation of Yoga clang-format is used to ensure a consistent code style. Please run `bash format.sh` before submitting a pull request. For other languages just try to follow the current code style.
## Benchmarks
Benchmarks are located in `benchmark/YGBenchmark.c` and can be run with `buck run //benchmark:benchmark`. If you think your change has affected performance please run this before and after your change to validate that nothing has regressed. Benchmarks are run on every commit in CI.
### JavaScript
Installing through NPM
```sh
npm install yoga-layout
```
By default this will install the library and try to build for all platforms (node, browser asm, and standalone webpack). You may receive errors if you do not have the required platform development tools already installed. To preset the platform you'd like to build for you can set a .npmrc property first.
```sh
npm config set yoga-layout:platform standalone
```
This will now only run the standalone webpack build upon install.
spec.summary = 'Yoga is a cross-platform layout engine which implements Flexbox.'
spec.description = 'Yoga is a cross-platform layout engine enabling maximum collaboration within your team by implementing an API many designers are familiar with, and opening it up to developers across different platforms.'
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
namespaceFacebook.Yoga
{
[System.Flags]
publicenumYogaPrintOptions
{
Layout=1,
Some files were not shown because too many files have changed in this diff
Show More
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.