Commit Graph

254 Commits

Author SHA1 Message Date
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
Jonathan Dann 0b085a80bd Pass-by-reference in YGNode::setStyle() ::setChildren() ::setLayout()
Reviewed By: priteshrnandgaonkar

Differential Revision: D7291096

fbshipit-source-id: 7a4025831811d622050adbb5f86608855b94d68e
2018-03-21 16:40:06 -07:00
Orta cf036dbc7a Updates Yoga to handle being in a Xcode framework project
Summary:
Updates the Yoga Podspec to work with Cocoa frameworks. Replicated a2's work over on Yoga https://github.com/facebook/yoga/pull/726

(Which should also get merged too please ❤️ )

Set it manually in my own project and tested 👍

Only https://github.com/facebook/yoga/pull/726

[IOS] [BUGFIX] [Yoga] - Fixes to yoga.podspec when integrating into an iOS app using Cocoa frameworks.
Closes https://github.com/facebook/react-native/pull/18492

Differential Revision: D7355907

Pulled By: hramos

fbshipit-source-id: 6986d2bc560a23bb7f0f20b80e88bb440079891a
2018-03-21 14:15:33 -07:00
Pritesh Nandgaonkar 9102ff94e7 Moved YGFloatOptional from C struct to C++ struct
Reviewed By: emilsjolander

Differential Revision: D7288555

fbshipit-source-id: f61cc92c8fd0d48d2fc1f4d0e6fcef155f19ff8a
2018-03-15 12:41:16 -07:00
Pritesh Nandgaonkar ce92b8592b Fixed a typo and added a test case
Reviewed By: emilsjolander

Differential Revision: D7289221

fbshipit-source-id: 48ee9ccfac4adee51d515a366b5a11790f7236fc
2018-03-15 12:41:16 -07:00
Pritesh Nandgaonkar da2d410122 Fix getters and setters if min and max Dimension
Reviewed By: emilsjolander

Differential Revision: D7274807

fbshipit-source-id: 7c1a4c19e8d0552b089a410c3330392cb26a6a47
2018-03-15 07:23:13 -07:00
Pritesh Nandgaonkar 040642dba3 Fix setter and getter of margin, position, border and padding
Reviewed By: emilsjolander

Differential Revision: D7274115

fbshipit-source-id: 942a91e6562ef789ae79102a828f397889468fa7
2018-03-15 07:23:13 -07:00
Pritesh Nandgaonkar 321b107685 Expose layout diffing flag to java
Reviewed By: emilsjolander

Differential Revision: D7272067

fbshipit-source-id: e67e82eb057e4c7124904c715f9dca4dcfea21ea
2018-03-14 08:48:52 -07:00
Pritesh Nandgaonkar f3ef8f8510 Remove the use of YGUndefined for flex-basis
Reviewed By: emilsjolander

Differential Revision: D7243924

fbshipit-source-id: 2bfaca1a5e3da40d5292a273cabf705f59c9d666
2018-03-14 04:34:04 -07:00
Pritesh Nandgaonkar e3af1508c8 Change the type of flexShrink to YGFloatOptional
Reviewed By: emilsjolander

Differential Revision: D7232171

fbshipit-source-id: 3111119d3d74a7035c01132bff61b30cf44e120a
2018-03-14 04:34:04 -07:00
Pritesh Nandgaonkar 3274e9fa51 Change the type of flexGrow to YGFloatOptional
Reviewed By: emilsjolander

Differential Revision: D7215355

fbshipit-source-id: 1298ee332551d44e4d070169a1e4103d005c4f43
2018-03-14 04:34:04 -07:00
Pritesh Nandgaonkar 5b3d59598a Change the type of flex to YGFloatOptional
Reviewed By: emilsjolander

Differential Revision: D7211327

fbshipit-source-id: 0d979b6ba00317317b98bbc6e63979c7f1feb2da
2018-03-14 04:34:04 -07:00
Pritesh Nandgaonkar 9f7e70363a Changed the return type of YGResolveValue
Reviewed By: emilsjolander

Differential Revision: D7195099

fbshipit-source-id: 72c4163cd08691cf6e40df05394cc52e83b0de14
2018-03-14 04:34:03 -07:00
Pritesh Nandgaonkar af4a36337d Remove the usage of YGUndefined in the default values of Border in YGStyle
Reviewed By: emilsjolander

Differential Revision: D7195115

fbshipit-source-id: e635cf55ac94d8a90caef6cafce281579da2cbfc
2018-03-14 04:34:02 -07:00
Héctor Ramos b181b7797f Check PATENTS does not creep into files
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
2018-03-01 08:22:05 -08:00
Pritesh Nandgaonkar d174ab8a7a Change NaN with large number
Reviewed By: emilsjolander

Differential Revision: D6969537

fbshipit-source-id: bdc09eaf703e0d313ca65c25a4fb44c99203d9bf
2018-03-01 04:02:01 -08:00
Pritesh Nandgaonkar 22cf81571b Added default constructor for YGCachedMeasurement
Reviewed By: emilsjolander

Differential Revision: D7020337

fbshipit-source-id: e084e234bf6a2ae22e53e739959683abca169b88
2018-02-20 05:55:36 -08:00
Pritesh Nandgaonkar c75ce8146f Add constructor in YGLayout
Reviewed By: emilsjolander

Differential Revision: D7019653

fbshipit-source-id: 5a2655626db0915fcebe7d4517e2d0b2e2484460
2018-02-20 05:55:36 -08:00
Pritesh Nandgaonkar b9991d33e3 Move YGStyle to seperate file and add constructors
Reviewed By: emilsjolander

Differential Revision: D7016575

fbshipit-source-id: eb28df0ffb4cc813b23edaff80d7d4ebc56ce6af
2018-02-20 05:55:36 -08:00
Sophie Alpert 26684cf3ad Update to MIT license
Summary: Manual changes.

Reviewed By: TheSavior, yungsters

Differential Revision: D7012152

fbshipit-source-id: de7459be3db13c687868b45059856f125c4f2eb1
2018-02-16 18:31:53 -08:00
Sophie Alpert 1490ab12ef Update license headers for MIT license
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
2018-02-16 18:31:53 -08:00
Yuichi ONO f751c3460e Fix main size calculation from the aspect ratio
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
2018-02-15 07:26:52 -08:00
Pritesh Nandgaonkar fdef3784f0 Add flag in YGConfig for running experiments
Reviewed By: emilsjolander

Differential Revision: D6948702

fbshipit-source-id: 009fe2d64b6098f8c3a0289f0e6939dea5ce0d37
2018-02-09 06:16:36 -08:00
Pritesh Nandgaonkar 400a29e151 Fix memory leak by not duplicating the YGConfig
Reviewed By: emilsjolander

Differential Revision: D6945022

fbshipit-source-id: 5fd3c3e2ac1cd94d459d5aa06e0daa8f107779ac
2018-02-09 04:56:49 -08:00