Commit Graph

277 Commits

Author SHA1 Message Date
Dulmandakh 6117a6c720 Bump Android NDK to r17b (#20357)
Summary:
This PR bumps Android NDK version to r17b (latest). Cleaned up redundant **LOCAL_EXPORT_CPPFLAGS** rules in .mk files
Pull Request resolved: https://github.com/facebook/react-native/pull/20357

Differential Revision: D9068424

Pulled By: hramos

fbshipit-source-id: 8578637e38e807288b819a36cb75ea9feefcc09f
2018-07-30 14:02:11 -07:00
Amir Shalem 374fd7c0cd Deallocate the YogaConfig memory with correct method
Summary: We've mistakenly used `free()` to free the memory, where `delete` should have been used

Reviewed By: davidaurelio

Differential Revision: D9042347

fbshipit-source-id: e15cec0f498409066521a6de1e3fe4b7404ec46c
2018-07-29 14:16:35 -07:00
Valentin Shergin 6bf9024107 Implementation of `operator==` for YGValue
Summary:
@public
It's very useful sometimes for product code to compare `YGValue`s (e.g. in Fabric).

Reviewed By: priteshrnandgaonkar

Differential Revision: D8937594

fbshipit-source-id: b93e1ab4a6419ada6746f233b587e8c9cb32c6d4
2018-07-23 13:33:28 -07:00
David Aurelio 709e3bc1fe Replace `YG_NODE_STYLE_PROPERTY_IMPL` macro with template
Summary:
@public

Replacing the `YG_NODE_STYLE_PROPERTY_IMPL` macro with template code, in order to make code easier to edit and grep.

Reviewed By: astreet

Differential Revision: D8868184

fbshipit-source-id: f52537376fa8d4dd53aa98bb43e93279699dbdd5
2018-07-19 10:02:27 -07:00
David Aurelio 95b7fd9de6 Yoga.h: inline function declaring macros
Summary:
@public

Inlines macros used for declarations of `YGNodeStyle*` and `YGNodeLayout*` functions.
Benefits easier grepping and code base navigation.

Reviewed By: astreet

Differential Revision: D8868168

fbshipit-source-id: d6b1b70981a59a2214dc7d166435a1d1a844e1b7
2018-07-19 10:02:27 -07:00
David Aurelio ce4c2de3a3 Run lint on `Yoga.cpp`/`Yoga.h`
Summary:
@public

auto-fixes formatting for `Yoga.cpp`/`Yoga.h`.
Submitted separately to keep other diffs cleaner.

Reviewed By: astreet

Differential Revision: D8868179

fbshipit-source-id: d0667f8bb909bb5ada1263aac6e22b0a8f8875ad
2018-07-19 10:02:27 -07:00
David Aurelio 1d7a24ff0c inline trivial constructors / methods
Summary:
@public

inlines some trivial constructors, destructors, and methods.

Reviewed By: astreet

Differential Revision: D8912691

fbshipit-source-id: 79840ef3322676deebed99391390d6c1796963b5
2018-07-19 10:02:27 -07:00
David Aurelio dfc7b2fd03 auto-lint YGLayout.h YGNode.h YGStyle.cpp YGStyle.h
Summary:
@public

automatically applies lint fixes to  YGLayout.h YGNode.h YGStyle.cpp YGStyle.h

Reviewed By: astreet

Differential Revision: D8913432

fbshipit-source-id: 488bf25db041ddb527565c26c1762c6ee4cae736
2018-07-19 10:02:27 -07:00
Scott Wolchok 165dd40bea Explicitly default YGNode copy ctor
Summary: No need to type out the old version. This is exactly equivalent (unless I've misread and the old version did something other than memberwise copy).

Reviewed By: davidaurelio

Differential Revision: D8842326

fbshipit-source-id: c575ea4cee6caef9ea15aaf5967597385ed26ec3
2018-07-18 15:47:55 -07:00
Scott Wolchok 46fb04e746 Delete YGNode ctor w/arg per member
Summary: It doesn't seem to be used internally, it hurts greppability, and there are setters for these properties as needed anyway.

Reviewed By: davidaurelio

Differential Revision: D8842084

fbshipit-source-id: f0275b490e585ea94df341c97c34b441ed91c4fb
2018-07-18 15:47:55 -07:00
David Aurelio 04aaa01991 Make `YGFloatIsUndefined` inlineable
Summary:
@public

Makes `YGFloatIsUndefined` inlineable

Reviewed By: swolchok

Differential Revision: D8875520

fbshipit-source-id: 7ac653e002512b1a8d5f9c04e0a21381aeb02e67
2018-07-18 02:39:20 -07:00
David Aurelio b330579204 Lint Utils.cpp YGLayout.cpp YGNode.cpp Yoga-internal.h
Summary:
@public

Auto-fixes formatting of YGLayout.cpp YGNode.cpp Yoga-internal.h

Reviewed By: astreet

Differential Revision: D8875514

fbshipit-source-id: 38d709831349c4ad015f20451421aea89fc6f007
2018-07-18 01:01:56 -07:00
Scott Wolchok 6ab52ff90d Remove some unnecessary `const float &` uses
Summary: Holding floats by reference is unnecessary at best and may be detrimental to performance.

Reviewed By: davidaurelio

Differential Revision: D8826496

fbshipit-source-id: 2391f8aa26ebfbb440f6e4b7d57975be688f791c
2018-07-13 12:48:02 -07:00
Scott Wolchok 727ee92de5 Tidy up YGFloatOptional further
Summary: I missed these two things: inline default ctor, getValue() should return a float.

Reviewed By: priteshrnandgaonkar

Differential Revision: D8826640

fbshipit-source-id: e6324dea0268ef276e6fa1722e72dffb5241e676
2018-07-13 12:48:02 -07:00
Scott Wolchok e589595bc9 YGNode::getChildren() should return const ref
Summary:
It's wasteful to do it by value. I'm fairly sure this is
safe, especially because
fbd332dee8 (diff-ade2a4bbd6582e2898cbd9e0fa142ab5R215)
shows that we did access by reference before.

Reviewed By: priteshrnandgaonkar, davidaurelio

Differential Revision: D8822697

fbshipit-source-id: 791bcf0fa37453f67795af727c85c8adce3b0f69
2018-07-13 12:48:02 -07:00
Scott Wolchok 7eb419d4bf Tidy up YGFloatOptional
Summary: Just some convention/weird style things. `float` should be passed by value, weird use of ?: operator instead of ||.

Reviewed By: priteshrnandgaonkar

Differential Revision: D8804407

fbshipit-source-id: e0d67363ccde36ec5bccec7497ed0ffd364b3fcf
2018-07-12 08:46:36 -07:00
Scott Wolchok 40cdda3166 Inline simple YGNode getters/setters
Summary: Simple getters/setters are usually inlined like this.

Reviewed By: priteshrnandgaonkar, davidaurelio

Differential Revision: D8793588

fbshipit-source-id: 436bd54880e41a5e403e3f4ae0d9dd4a413df79c
2018-07-11 09:02:21 -07:00
Scott Wolchok 4858454718 Remove unused YGNode::*nextChild
Summary: This linked list was never used, and YGNodeDeepClone was doing scary things to maintain it.

Reviewed By: davidaurelio

Differential Revision: D8792864

fbshipit-source-id: c578fabe65c837f0791aa9ac3e18f31d93691abd
2018-07-11 09:02:21 -07:00
Pritesh Nandgaonkar 90a408ea6f Fix SingleFlex Child condition
Summary:
Fixes the improper `singleFlexChild` optimization. In the case when all the childs have `flex-grow:0 flex-grow:0` except one child with `flex-grow:1 flex-shrink:1`, then one can simply measure all the non-flexing children and then give the flexing child all the remaining space.

Also added a test case which reproduced the bug

Reviewed By: IanChilds

Differential Revision: D8782684

fbshipit-source-id: ffd4d35b6122f82111b987540efb23bd2a8da5a2
2018-07-11 06:02:16 -07:00
David Vacca 2f3f1b02cd Avoid cleaning up Owner of YGNode during clonning
Summary:
This diff refactors the cloning mechanism for YogaNode used from Fabric UI renderer and RN iOS graphs.
Previously, we were cleaning the owner of the child's cloned node inside the C++ implementation of YogaNode. This was a mistake because this modified the last commited YogaTree, causing side effect in RN iOS graphs.

Reviewed By: shergin

Differential Revision: D8672627

fbshipit-source-id: c9902d00690e0361fd58aed84b506c42258bd995
2018-06-28 22:48:35 -07:00
David Vacca f19c36116c Clean-up parent / owner reference of children during clonning
Summary: This diff cleans up the parent / owner references for children of ReactShadowNode / YogaNode during cloning. The reason of this behavior is to avoid retaining every generation of trees during cloning. This fixes a memory leak detected when running the ProgressBarExample.android.js in catalyst app

Reviewed By: fkgozali

Differential Revision: D8019894

fbshipit-source-id: b0d38f0c836ffec534f64fa1adbd7511ecf3473d
2018-06-22 11:36:04 -07:00
Vince Mi c3c5c3cbce Add back deprecated getParent methods for non-breaking API change (#775)
Summary:
I'm not totally sure what I'm doing so if this needs changes let me know.
Closes https://github.com/facebook/yoga/pull/775

Reviewed By: emilsjolander

Differential Revision: D8331892

Pulled By: passy

fbshipit-source-id: eb1023e666322d2472e4081fd4a4e72a7b43d049
2018-06-11 04:24:34 -07:00
Kevin Gozali 092103e752 iOS OSS: update podspec's to target iOS 9.0
Summary: A few more places to update to target iOS 9.0 (upgraded from 8.0)

Reviewed By: shergin

Differential Revision: D8108719

fbshipit-source-id: f17aa5e5aa34fdad57196202bf67a842735d4cdc
2018-05-23 06:16:00 -07:00
David Vacca 3cd2b43426 [yoga re-add assertion to check for owner reference before adding child.
Reviewed By: emilsjolander

Differential Revision: D7495417

fbshipit-source-id: b81174aeea3f2796d76ccdae4a8eddd0beace0aa
2018-04-04 10:54:35 -07:00
Lukas Wöhrl 24f574032a Fix compilation on MSVC by moving YGConfig to C++
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
2018-04-04 10:00:53 -07:00
Pritesh Nandgaonkar 4841aed82c Change the return type of getMarginForAxis to YGFloatOptional
Reviewed By: emilsjolander

Differential Revision: D7350337

fbshipit-source-id: dd1ee2fcd295ccd14f7d414ab0c24090b24e91e0
2018-04-04 08:31:53 -07:00
Pritesh Nandgaonkar 3a65fa56c5 Change the return type of getTrailingMargin to YGFloatOptional
Reviewed By: emilsjolander

Differential Revision: D7350221

fbshipit-source-id: 61a67364c1975ec6dd1883bc2cb4968b830c73df
2018-04-04 08:31:53 -07:00
Pritesh Nandgaonkar 1024e98b95 Changed the return type of getLeadingMargin to YGFloatOptional
Reviewed By: emilsjolander

Differential Revision: D7349907

fbshipit-source-id: b20894fbc33fd5b29a28f3c9174d1b5f406774ab
2018-04-04 08:31:53 -07:00
Pritesh Nandgaonkar f0490d1217 Refactored relativePosition private method to YGFloatOptional return type
Reviewed By: emilsjolander

Differential Revision: D7344939

fbshipit-source-id: 72443d38426a211d3e84be814e6a61baf4d26703
2018-04-04 08:31:53 -07:00
Pritesh Nandgaonkar de70bc74d5 Change the type of getTrailingPosition to YGFloatOptional
Reviewed By: emilsjolander

Differential Revision: D7344710

fbshipit-source-id: eb4c422b6e0f55d90b083221aa8ff1ab797d58a8
2018-04-04 08:31:52 -07:00
Pritesh Nandgaonkar f3c2ab306c Changed the type of return value of getLeadingPosition to YGFloatOptional
Reviewed By: emilsjolander

Differential Revision: D7344367

fbshipit-source-id: 0f5a667ca357b2ce056c86763aa3e9e4c54b82f0
2018-04-04 08:31:52 -07:00
Pritesh Nandgaonkar 0186ccf006 Changed the type of computedFlexBasis to YGFloatOptional in YGLayout
Reviewed By: emilsjolander

Differential Revision: D7340413

fbshipit-source-id: 39247b2b582a682e602f49f58b4bbd2bf0c995af
2018-04-04 08:31:52 -07:00
Pritesh Nandgaonkar fe3a9d4013 Fixed types of getLeadingPaddingAndBorder and getTrailingPaddingAndBorder to YGFloatOptional
Reviewed By: emilsjolander

Differential Revision: D7339998

fbshipit-source-id: aa24335c2db1cd895b9711214b72195add718c32
2018-04-04 08:31:52 -07:00
Pritesh Nandgaonkar ee0d621d2a Changed the return type of trailing padding to YGFloatOptional
Reviewed By: emilsjolander

Differential Revision: D7339712

fbshipit-source-id: 483c5886838c14b17cb731c81abb9fc80f519956
2018-04-04 08:31:52 -07:00
Pritesh Nandgaonkar 51f5cd4810 Updated the implementation of leading padding
Reviewed By: emilsjolander

Differential Revision: D7336690

fbshipit-source-id: b2a2f010026f26fc2cc9fb35ad921da8f7017c9f
2018-04-04 08:31:52 -07:00
Pritesh Nandgaonkar 20e5193207 Make the return type of YGNodeBoundAxisWithinMinAndMax to YGFloatOptional
Reviewed By: emilsjolander

Differential Revision: D7323382

fbshipit-source-id: 8e3eb4f3744b5f3f9e2b353f56184905f7557191
2018-04-04 08:31:52 -07:00
Pritesh Nandgaonkar dbb2c6b0fd Remove the use of YGUnwrapOptional from YGConstrainedMaxSizeForMode
Reviewed By: emilsjolander

Differential Revision: D7322743

fbshipit-source-id: d825c60bcdc9ecdc0c784a215dc6b1b8a7a7860e
2018-04-04 08:31:52 -07:00
Pritesh Nandgaonkar 2ace555972 Made the acccessors method to return const references
Reviewed By: emilsjolander

Differential Revision: D7321801

fbshipit-source-id: 9fc4da724bc2f58a0d95824ca3c0b5bf1690bccf
2018-04-04 08:31:52 -07:00
Lukas Wöhrl d4add3fc1c Fix float type mismatch on endOfLineIndex and inside rounding
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
2018-04-04 06:49:19 -07:00
Pritesh Nandgaonkar f84f4fd04a Changed the return type of YGResolveValueMargin to YGFloatOptional
Reviewed By: emilsjolander

Differential Revision: D7304090

fbshipit-source-id: cbec03a9367cf34976d083ad475d4da0b736e6d2
2018-04-03 15:02:57 -07:00
Pritesh Nandgaonkar 63c073d994 Move equaltiy function from utils to an operator on YGFloatOptional
Reviewed By: emilsjolander

Differential Revision: D7303460

fbshipit-source-id: 41ec0076ace621ec1a5bdbab00b72eea57780fff
2018-04-03 15:02:57 -07:00
Pritesh Nandgaonkar bcd12f1e87 Change the type of aspect Ratio to YGFloatOptional
Reviewed By: emilsjolander

Differential Revision: D7302651

fbshipit-source-id: 53e3b4c9627207a379f927b1f3485e36a9c70601
2018-04-03 15:02:57 -07:00
Pritesh Nandgaonkar e5a4d59244 Remove the usage of YGUndefined for kYGValueAuto and fix setter and getter of dimensions
Reviewed By: emilsjolander

Differential Revision: D7302453

fbshipit-source-id: e002a1ddd75bfc6fe142a7275e7913c064972e16
2018-04-03 15:02:56 -07:00
David Vacca 5be4ff0261 Extend Yoga to be able clone Yoga Node with new children
Reviewed By: emilsjolander

Differential Revision: D7245421

fbshipit-source-id: 72578c8261f29e4a12fc6c72a91f2f891cd58d48
2018-04-01 18:32:12 -07:00
David Vacca 29ff30c539 Rename YogaNode.parent -> YogaNode.owner
Reviewed By: priteshrnandgaonkar

Differential Revision: D7352778

fbshipit-source-id: dcf1af5e72bfc3063b5c4bda197d7952a9194768
2018-04-01 18:32:12 -07:00
David Vacca aff5a75d8e Refactor cloning of YogaNode
Reviewed By: priteshrnandgaonkar

Differential Revision: D7339832

fbshipit-source-id: 2de6f47ae7601ac083d3b9fbe10ffaf6307ae760
2018-04-01 18:32:12 -07:00
Héctor Ramos 979c01ed2d Build yoga in OSS
Differential Revision: D7417644

fbshipit-source-id: 2641c1abc1083db83cbb304f8dcc7b781e329041
2018-03-27 15:19:20 -07:00
Jonathan Dann 2cc75f7d47 Add YGNodeSetChildren(), YGNodeTraversePreOrder()
Reviewed By: Woody17

Differential Revision: D7360203

fbshipit-source-id: 32df8e1213ead03bc0a026ec4bf453bc799bb9ce
2018-03-25 14:35:04 -07:00
Jonathan Dann cb3103ce09 Mark more member functions as const
Reviewed By: priteshrnandgaonkar

Differential Revision: D7291364

fbshipit-source-id: 2e7d96cfe0345692ffa411bb21a80eb7a859880b
2018-03-21 16:40:06 -07:00
Jonathan Dann ed0ba1bfc7 Pass some constructor argumetns by const-reference
Reviewed By: priteshrnandgaonkar

Differential Revision: D7291363

fbshipit-source-id: 22e606d0b3fa1133d7e0334c8cf9f5f1f32fe64b
2018-03-21 16:40:06 -07:00