Commit Graph

182 Commits

Author SHA1 Message Date
Emil Sjolander 618a14b228 Use int instead of NSInteger for ABI compatibility
Summary: Cannot use NSInteger as NSInteger has a different size than int (which is the default type of a enum). Therefor when linking the Yoga C library into obj-c the header is a missmatch for the Yoga ABI.

Reviewed By: cwdick

Differential Revision: D4392272

fbshipit-source-id: 22b92ac8f3eb7114e81dbd9b0bec9044c3d43da5
2017-01-09 08:43:35 -08:00
David Hart 7d3aaddf6e Improved the objective-c and swift api
Summary:
Compared to what was planned, I added the `overflow` value which seemed missing. I had to modify the implementation a bit for all values which are backed by a `YGValue`, but we should probably enable the pixel dimensions in Objective-C and Swift somehow later.
Closes https://github.com/facebook/yoga/pull/322

Reviewed By: cosmin1123

Differential Revision: D4391434

Pulled By: emilsjolander

fbshipit-source-id: e33f6f7b2bbaad29553100b7a5bb424496372110
2017-01-08 11:43:33 -08:00
Ben Holcomb 23819dd8b5 Revert D4386906: [YogaKit] Improved the objective-c and swift api
Differential Revision: D4386906

fbshipit-source-id: adac0d8e71ce9f3442f3bfd14b5157f88367c998
2017-01-07 10:28:33 -08:00
David Hart e0cb6dff76 Improved the objective-c and swift api
Summary:
Compared to what was planned, I added the `overflow` value which seemed missing. I had to modify the implementation a bit for all values which are backed by a `YGValue`, but we should probably enable the pixel dimensions in Objective-C and Swift somehow later.
Closes https://github.com/facebook/yoga/pull/322

Reviewed By: dshahidehpour

Differential Revision: D4386906

Pulled By: emilsjolander

fbshipit-source-id: 05ac0e571ef3a8ff0be31469e449a7b23f102218
2017-01-07 08:28:30 -08:00
Lukas Woehrl 7cfb7b8d0f Baseline support
Summary:
Added baseline support (see #132)

You have the ability for a custom baseline function (```float(*YGBaselineFunc)(YGNodeRef node);```) to return whatever baseline you want.
Closes https://github.com/facebook/yoga/pull/317

Reviewed By: splhack

Differential Revision: D4385061

Pulled By: emilsjolander

fbshipit-source-id: cb8a59a09237c840fa3e21753ab68239997dab0c
2017-01-06 06:58:25 -08:00
Emil Sjolander d9c35e8952 Add api for retrieving computed padding
Differential Revision: D4376572

fbshipit-source-id: 3ffb66e77090fc1257511bec5c933f9b0c304b9f
2017-01-05 12:58:34 -08:00
Lukas Woehrl 16359ec8ee Add feature to use percentage as value unit
Summary:
Adds the feature to use percentage as a value unit.

You can use the function ```YGPx(float)``` and ```YGPercent(float)``` for convenience.

I did some benchmarks:

```
Without Percentage Feature - Release x86:

Stack with flex: median: 0.000000 ms, stddev: 0.146683 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.136525 ms
Nested flex: median: 0.000000 ms, stddev: 0.490101 ms
Huge nested layout: median: 23.000000 ms, stddev: 0.928291 ms

Stack with flex: median: 0.000000 ms, stddev: 0.170587 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.143384 ms
Nested flex: median: 0.000000 ms, stddev: 0.477791 ms
Huge nested layout: median: 22.000000 ms, stddev: 2.129779 ms

With Percentage Feature - Release x86:

Stack with flex: median: 0.000000 ms, stddev: 0.132951 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.136525 ms
Nested flex: median: 0.000000 ms, stddev: 0.489570 ms
Huge nested layout: median: 21.000000 ms, stddev: 1.390476 ms
Closes https://github.com/facebook/yoga/pull/258

Reviewed By: dshahidehpour

Differential Revision: D4361945

Pulled By: emilsjolander

fbshipit-source-id: a8f5bc63ad352eb9410d792729e56664468cd76a
2017-01-02 05:28:30 -08:00
desmondyao bc285de799 Not re-calculate value in Step1.
Summary:
Not re-calculate `paddingAndBorderAxisMain`/`paddingAndBorderAxisCross`/`paddingAndBorderAxisRow`/`paddingAndBorderAxisColumn` in Step1 of `YGNodelayoutImpl`.

They can be figure out by values calculated before.
Closes https://github.com/facebook/yoga/pull/298

Reviewed By: dshahidehpour

Differential Revision: D4365533

Pulled By: emilsjolander

fbshipit-source-id: 6caf60bc6ef3addd49915b39b48f01a8b4926e9c
2016-12-23 10:28:26 -08:00
Emil Sjolander f625437ee9 Declaratively initialize default values of nodes
Reviewed By: passy

Differential Revision: D4356994

fbshipit-source-id: ebbe52163e0c86230bfa4131b657941afe16fbf1
2016-12-22 02:58:59 -08:00
David Hart c1aff605ed Transform the Count enum values into private constants
Summary:
Hides implementation details for the C, Objective-C and Swift APIs.
Closes https://github.com/facebook/yoga/pull/292

Differential Revision: D4351523

Pulled By: emilsjolander

fbshipit-source-id: 18a1149d169f0d52bd078714295000b5d07434dd
2016-12-22 02:58:59 -08:00
Emil Sjolander 05e0b6719b Convert max cache count into a define
Differential Revision: D4346529

fbshipit-source-id: 8641c4c5017d915d64e5884cae09ac8f01861337
2016-12-22 02:58:59 -08:00
Emil Sjolander b8e79d171a BREAKING - Increase priority of AspectRatio to override flex, align stretch, and fixed sizes if specified.
Summary: AspectRatio is a new addition and soon after introduction we noticed use cases which is did not support. Specifically we wanted to support a node being as large as possible within a container while maintaining an arbitrary aspect ratio. This was not possible due to the low priority of AspectRatio, by increasing the priority of AspectRatio this is now possible as FlexGrow will grow an item to fit its parent unless the AspectRatio makes it too big in the cross axis, the AspectRatio will now override the FlexGrow in the main axis in that case.

Differential Revision: D4346720

fbshipit-source-id: 1f15613604190e3ad5ff4a467ba57db4bcfd2741
2016-12-22 02:58:59 -08:00
Emil Sjolander 710391597b BREAKING - Change aspect ratio to always be width/height
Summary: Aspect ratio being defined as width/height or height/width depending on the situation it was used in turned out to be very confusing. This diff makes aspect ratio always be defined as width/height irregardless of the usage.

Differential Revision: D4339132

fbshipit-source-id: e5da32750b55ddaf6acaf1cbd7662d86f2b480c3
2016-12-22 02:58:59 -08:00
Emil Sjolander 18a2c2322b Correctly check if child is flex by also accounting for undefined
Differential Revision: D4346712

fbshipit-source-id: 69ef0bb3fe5b4fcd3b3e2fe5aa348529be40252a
2016-12-22 02:58:58 -08:00
Georgiy Kassabli 67628d5407 Test for minHeight with flexing
Reviewed By: emilsjolander

Differential Revision: D4313632

fbshipit-source-id: 35be7d86b50a9ae08c81891a889a74e4b61f2d27
2016-12-21 11:43:30 -08:00
Ashok Menon 6ca6b4988a Propagate Load Errors through JSExecutor API
Reviewed By: mhorowitz

Differential Revision: D4315204

fbshipit-source-id: ae282e0a0398a602dd790de3a2b1adb5fdc1f50c
2016-12-17 04:58:31 -08:00
Ashok Menon fa082796a5 Make file backed strings dup the provided file descriptor.
Reviewed By: mhorowitz

Differential Revision: D4326645

fbshipit-source-id: 2741f1fead4f42ae76787f8a70c1e787445b827d
2016-12-16 06:13:40 -08:00
Emil Sjolander 45fdcdc93a YGNodeChildCount -> YGNodeGetChildCount for consistency
Reviewed By: gkassabli

Differential Revision: D4333480

fbshipit-source-id: 17058f18fa9e26b3e02f7a1651f7295cae59acad
2016-12-16 04:44:18 -08:00
Emil Sjolander 23e2610f4f Add YGNodeGetParent api
Reviewed By: gkassabli

Differential Revision: D4333456

fbshipit-source-id: 388afd0a01c19a6db73c175bf24c566278832cb9
2016-12-15 09:29:16 -08:00
Ashok Menon fb5678e33a Generalising JSCompiledSourceError to JSLoadSourceError
Reviewed By: javache

Differential Revision: D4312888

fbshipit-source-id: de38066247f52eeb64efa48807882b96e3737d0e
2016-12-12 08:43:43 -08:00
Ashok Menon f3dbf3ea89 Removing default parameters to functions in `JSBase.h`
Differential Revision: D4309440

fbshipit-source-id: f4f795d5736c6d6e5297e2773538df66139e9b84
2016-12-10 05:58:31 -08:00
Michał Gregorczyk 46919095aa Simplify bundle loading a little bit.
Reviewed By: amnn

Differential Revision: D4306559

fbshipit-source-id: 9733c508aa5a905251e96855794a59ef79d61cfa
2016-12-09 17:58:32 -08:00
Michael Lee f99f10c7ab Move gmock to shared xplat
Reviewed By: capickett

Differential Revision: D4017736

fbshipit-source-id: 46d9b936fe210040835e4b7222053c1520cb7318
2016-12-09 11:13:33 -08:00
Ashok Menon 30213757d9 Making CompiledSourceError a C enum, to keep `JSBase.h` as a C header
Reviewed By: javache

Differential Revision: D4299281

fbshipit-source-id: 14cdc6d4502a70300919dc6a98a5f274076134c7
2016-12-08 16:28:27 -08:00
Ashok Menon 624104fd0c Listen to Compiled Source Errors in JSCExecutor fallback code.
Reviewed By: javache

Differential Revision: D4284537

fbshipit-source-id: 247717ef55fb6bc0a34a01626c790bd23fd18598
2016-12-08 05:13:40 -08:00
Emil Sjolander 7f8c2985a8 Rename directories
Reviewed By: gkassabli

Differential Revision: D4284681

fbshipit-source-id: f0c6855c2c6e4389b7867f48f72cbb697830fc5a
2016-12-07 05:14:12 -08:00
Emil Sjolander a47678b3e9 Remove init from api
Reviewed By: gkassabli

Differential Revision: D4276177

fbshipit-source-id: c4404d0534f381dfacee0625b2847d38de58e038
2016-12-06 14:43:36 -08:00
Emil Sjolander 1ed114e549 Fix an error initializing needsCrossTrailingPos
Reviewed By: gkassabli

Differential Revision: D4271422

fbshipit-source-id: e8d72af742d96829684958780eb56e2c375df20c
2016-12-05 09:43:32 -08:00
Emil Sjolander f4cde4f65c Add #pragma once and extern C to YGEnums.h
Reviewed By: gkassabli

Differential Revision: D4274156

fbshipit-source-id: 9fa0ae146bb9e5bd40d93fa3c56f83424ebd2bf9
2016-12-05 05:13:30 -08:00
David Aurelio f9f32eb426 Load Indexed RAM format on android
Reviewed By: javache

Differential Revision: D4268243

fbshipit-source-id: fc969cfc69810d0477c926ffc79c23584fcbd7eb
2016-12-04 16:13:30 -08:00
Emil Sjolander fd2fb6cd65 Update yoga library name
Reviewed By: bestander

Differential Revision: D4273387

fbshipit-source-id: 91373c6ef1e94b330fa249235ba97fec480e17c7
2016-12-04 05:28:29 -08:00
Emil Sjolander 85ac5fc354 Rename C api
Differential Revision: D4259190

fbshipit-source-id: 26c8b356ca464d4304f5f9dc4192bff10cea2dc9
2016-12-03 04:44:10 -08:00
David Aurelio b1a23914fa JSIndexedRAMBundle: Don't read null bytes for scripts
Summary:
`JSIndexedRAMBundle` used to read scripts including the terminating null bytes. That worked on iOS, but not on Android, where we have an ascii-only optimization.
This changes that behavior to only read the actual script data excluding the terminal null.

Reviewed By: javache

Differential Revision: D4265374

fbshipit-source-id: 7e6f943666aee610d79939cef09b103305803c69
2016-12-03 02:28:37 -08:00
Emil Sjolander 779508c0ba Rename enums
Differential Revision: D4244360

fbshipit-source-id: c9fcbdd231098c9ff230a6055676bbc7cbd11001
2016-12-02 05:58:45 -08:00
Emil Sjolander 8117a029cb Fix error from refactor of setMeasuredDimensionsIfEmptyOrFixedSize
Reviewed By: gkassabli

Differential Revision: D4258254

fbshipit-source-id: e22e36e67260114081e483527fc7ce378f7f0df9
2016-12-01 07:28:30 -08:00
Pieter De Baets 0e6895f270 Fix typo
Reviewed By: amnn

Differential Revision: D4258150

fbshipit-source-id: d41c5426b801d32db6099cf8b29596689f369ba6
2016-12-01 06:58:31 -08:00
Max Sherman 65fe3eaa03 Get inspector compiling
Reviewed By: lexs

Differential Revision: D4189469

fbshipit-source-id: 2b4278105fe6d632a79c030fcb789ec50918a278
2016-11-28 17:13:31 -08:00
Pieter De Baets 118e981174 Improve configuration of custom JSC
Reviewed By: amnn

Differential Revision: D4237462

fbshipit-source-id: ef16b7f81d3158c63a12e32e2e35204635a57543
2016-11-28 12:43:34 -08:00
Lukas Piatkowski bd524bd6e8 BREAKING: Change the toValue in JSCExecutor to ValueEncoder<T>::toValue
Summary:
The C++ standard requires that when a function is used in a template it's prototype needs to be defined not only before the template specialization, but also before the template itself.

Because of that one needs to (in certain compilers) be aware of the proper order of includes so that the function prototype is defined before the JSCExecutor.h is included.

As a workaround the toValue might be written as a template (ValueEncoder<T>::toValue) defined in JSCExecutor.h instead of being an non-existing symbol.
Thanks to that the JSCExecutor.h does not have to be included before the specialization of the ValueEncoder template.

Reviewed By: mhorowitz

Differential Revision: D4182724

fbshipit-source-id: 9bdf239ae66ef7a7d2c82daf7db5926472687bde
2016-11-24 09:28:29 -08:00
Pieter De Baets 8f03969011 Export some RN functs
Reviewed By: majak

Differential Revision: D4230417

fbshipit-source-id: 06845ff8aa0d05d9a4b997ced35cc017650d9d2e
2016-11-24 05:43:38 -08:00
Pieter De Baets 23c9cf1db6 Ensure jscWrapper is always non-null
Reviewed By: bnham

Differential Revision: D4231224

fbshipit-source-id: 3400a0c57f1014baa8a59210f33f262625854da8
2016-11-24 04:13:27 -08:00
Pieter De Baets f2a46b17d4 Replace RCTJSCWrapper with JSCWrapper from ReactCommon
Reviewed By: mhorowitz

Differential Revision: D4204516

fbshipit-source-id: 6bcb122daf2848035dfae404ee7a2e9aca0f8087
2016-11-23 11:43:48 -08:00
Pieter De Baets e1577df1fd Move all header imports to "<React/..>"
Summary:
To make React Native play nicely with our internal build infrastructure we need to properly namespace all of our header includes.

Where previously you could do `#import "RCTBridge.h"`, you must now write this as `#import <React/RCTBridge.h>`. If your xcode project still has a custom header include path, both variants will likely continue to work, but for new projects, we're defaulting the header include path to `$(BUILT_PRODUCTS_DIR)/usr/local/include`, where the React and CSSLayout targets will copy a subset of headers too. To make Xcode copy headers phase work properly, you may need to add React as an explicit dependency to your app's scheme and disable "parallelize build".

Reviewed By: mmmulani

Differential Revision: D4213120

fbshipit-source-id: 84a32a4b250c27699e6795f43584f13d594a9a82
2016-11-23 07:58:39 -08:00
David Aurelio 5db7484e8d Move `ScriptTag` and `RCTJSModulesUnbundle` to `cxxreact`
Reviewed By: javache

Differential Revision: D4213662

fbshipit-source-id: fc2ec9717c24fe77bb022a48777049f88173ebeb
2016-11-23 06:43:50 -08:00
Emil Sjolander dad520476e Fixup recent fix to flex basis and put it behind an experimental flag
Reviewed By: gkassabli

Differential Revision: D4222910

fbshipit-source-id: d693482441fcc4d37a288e2e3529057a04f60541
2016-11-23 05:28:48 -08:00
Pieter De Baets cb3e575deb Allow bridge delegate to specify whether to use custom JSC wrapper
Reviewed By: mhorowitz

Differential Revision: D4197657

fbshipit-source-id: 09e050f802b41c9a7016456c25381018b2123553
2016-11-23 03:58:41 -08:00
Pieter De Baets 55a615bf98 Poison all system JSC identifiers on iOS to prevent accidental usage
Reviewed By: mhorowitz

Differential Revision: D4197375

fbshipit-source-id: 216cd5cfc52fa4d242c8822faf08eb98a35fa43f
2016-11-23 03:58:41 -08:00
Pieter De Baets 333cf3bc99 Fix global constructor warning
Reviewed By: davidaurelio

Differential Revision: D4220267

fbshipit-source-id: 37a6ff51609aaa129683d57f853f59758ff55012
2016-11-22 09:43:27 -08:00
Pieter De Baets 3f50a887d9 Move JSC API usage in ReactCommon to our wrapper methods
Reviewed By: bnham

Differential Revision: D4197374

fbshipit-source-id: 107a129cff35dddfe06104b607441ad412f83d90
2016-11-22 06:13:33 -08:00
Pieter De Baets e541d9b108 Define wrapper versions of all JSC methods
Reviewed By: bnham

Differential Revision: D4197369

fbshipit-source-id: 53869fe1b56010c8a5330025d06ef557369e4957
2016-11-22 06:13:33 -08:00