Commit Graph

401 Commits

Author SHA1 Message Date
Marc Horowitz 6bce498bbc Tweak CxxMessageQueue to work with unique_ptr
Differential Revision: D4560164

fbshipit-source-id: 8975157f5a14d5849365a9e35922a02ac6dc185b
2017-02-28 14:15:56 -08:00
Lukas Wöhrl 80225fb9e7 Change flex getters to return the set values
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
2017-02-28 09:31:47 -08:00
Emil Sjolander 702564fb60 Pass the parent size to YGNodeCalculateLayout instead of the node size
Reviewed By: astreet

Differential Revision: D4611417

fbshipit-source-id: 2fb0eedffa17f0ec89b601722a1717a72e216b9e
2017-02-28 08:14:51 -08:00
Lukas Wöhrl f52d66c311 Fix percentage in flexing parent
Summary:
If we don't measure exactly, percentage values aren't exactly either. Fix for #414.
Closes https://github.com/facebook/yoga/pull/416
Closes https://github.com/facebook/yoga/pull/414

Reviewed By: astreet

Differential Revision: D4604729

Pulled By: emilsjolander

fbshipit-source-id: 66880230073209cbe89668b838c2a82e7f9b34df
2017-02-28 07:02:32 -08:00
Ashok Menon bf429f03a9 Get rid of code gated behind `JSC_HAS_EXTERNAL_CACHE`
Reviewed By: bnham

Differential Revision: D4608754

fbshipit-source-id: 9214c4d20720e5aa1cd65381a4837ff06943376e
2017-02-27 14:04:57 -08:00
Michael Bolin 48cb932c6e Apply auto-formatter for BUCK files in fbandroid.
fbshipit-source-id: 278ce6f67f5df830b2218e3aca69be103d3c56a6
2017-02-27 14:04:56 -08:00
Georgiy Kassabli 387ec8ce37 Add rounding to the pixel grid to Yoga
Reviewed By: emilsjolander

Differential Revision: D4565980

fbshipit-source-id: 9700f6d6ed147f82b19f230fbff2e9ccbd625b25
2017-02-24 10:08:04 -08:00
Ashok Menon a0f2ca8668 Migrating over CompiledSourceCode to new SourceProvider APIs.
Reviewed By: michalgr

Differential Revision: D4598042

fbshipit-source-id: ac6460c9156cc72e7925edac675a0b6ed57196f5
2017-02-23 11:45:57 -08:00
Lukas Wöhrl 1f456365e8 Fix align-content:strech overriding align-item
Summary:
Fix for #413. This was a hangover from a previous attept to fix other align-content problems.
Closes https://github.com/facebook/yoga/pull/417

Reviewed By: astreet

Differential Revision: D4604727

Pulled By: emilsjolander

fbshipit-source-id: 92fd31a385d8182c6b201c891d5ae478372d525d
2017-02-23 08:30:54 -08:00
Charles Dick a151fce1ca refactor jscMemoryMetrics to use HeapStats
Reviewed By: amnn

Differential Revision: D4558963

fbshipit-source-id: 8b729c6ce288d30b8d069be34f9db7572d8b3ec4
2017-02-22 11:16:13 -08:00
Emil Sjolander 6ac6bf007a Fix behaviour of wrapping container within align-items: not stretch
Reviewed By: astreet

Differential Revision: D4578614

fbshipit-source-id: 5d22a3a673735587384d775189158a87bb1d457d
2017-02-20 07:32:06 -08:00
Pieter De Baets ebe3355de7 Create NSDataBigString
Reviewed By: bnham

Differential Revision: D4559734

fbshipit-source-id: 6766093524ae79ed2a41285d33eb2207993a7d0e
2017-02-20 05:00:58 -08:00
Ashok Menon 1635c02e92 Simplifying Struct definition.
Summary:
Since we are reading from a file, we should make sure this struct is packed, just in case we change it down the line and the compiler decides it might want to introduce padding, we're now protected against that.

There was also a discussion about the fact that people might use `ptr += sizeof(BundleHeader)` as an idiom in their code, which would currently be incorrect, if padding was introduced at the end of the file. Actually, it remains incorrect to do that now, because a RAM bundle header is a different size to a BC Bundle header. If people are properly testing their code, they should spot this pretty quickly, because it will always be an incorrect thing to do with a RAM bundle, so this isn't as bad as previously thought: where the code only succeeds when the compiler deigns to not pad the struct at the end.

This diff also cleans up how headers are initialised. `BundleHeader` has a constructor that explicitly zero-initialises it so we can rely on the default initializer to do the right thing now.

Reviewed By: mhorowitz

Differential Revision: D4572032

fbshipit-source-id: 7dc50cfa9438dfdfb9f842dc39d8f15334813c63
2017-02-20 04:30:19 -08:00
Mathieu Baudet 4a893ee071 remove unused includes in fbobjc/Libraries
Reviewed By: swolchok

Differential Revision: D4507573

fbshipit-source-id: 7fc6df52bc37c39698c7897be567758469417218
2017-02-19 18:33:49 -08:00
Ashok Menon 3148cc09ae Fix CI runs
Summary: I broke Circle CI builds by moving a file, so I am updating the OSS build setup with details of the move. Whilst I was testing the change, I noticed that the UI Explorer build was also already broken, so this diff also changes some of its configuration to make it build again.

Reviewed By: javache

Differential Revision: D4579137

fbshipit-source-id: 4cbb1ef148075280b991cbc5bb47bf96ec3d543a
2017-02-17 09:17:19 -08:00
Alexey Lang ba029becbe Support QuickPerformanceLogger.js in CxxBridge
Reviewed By: javache

Differential Revision: D4573567

fbshipit-source-id: 3ef9da38fb178cf4c1400b4a991a9e85f3ec3755
2017-02-17 06:00:54 -08:00
Ashok Menon 14dc219810 Deleting Optimized Bundle!
Reviewed By: javache

Differential Revision: D4566164

fbshipit-source-id: 1fbd3dd04f24399e93e3c6ec58956e6e18f1683f
2017-02-16 13:30:55 -08:00
Lukas Wöhrl 167ac4993a Removed duplicate code by calculating with mainSize/crossSize
Summary:
This PR removes some duplicate code by calculating with ```mainSize```/```crossSize``` and converting that to ```width``` or ```height``` at the end. See #395 .
Closes https://github.com/facebook/yoga/pull/396

Reviewed By: astreet

Differential Revision: D4564713

Pulled By: emilsjolander

fbshipit-source-id: 0b24e69cc9dc75cdf93deeb6c076dcacf134c6d8
2017-02-16 07:45:18 -08:00
Emil Sjolander 1b5eb36e2f Fix up some small issues with YGUnitAuto
Reviewed By: wwjholmes

Differential Revision: D4567045

fbshipit-source-id: ace5fd89bd534a6bb5ec7dba0c3afbf13d62d7c9
2017-02-16 06:59:33 -08:00
Pieter De Baets 53b387638e Move JSBigString to its own header
Reviewed By: mhorowitz

Differential Revision: D4551162

fbshipit-source-id: 2374e05e60942211e50af86ed42eb194e5e82bbe
2017-02-16 06:59:30 -08:00
Lukas Wöhrl 30f8380095 flex-wrap: wrap-reverse support
Summary:
I couldn't resist to do this 😄 #394

This adds ```flex-wrap: wrap-reverse```

I think we hit a edge case here:
https://stackoverflow.com/questions/33891709/when-flexbox-items-wrap-in-column-mode-container-does-not-grow-its-width

as is differs here from chrome, but I think that yoga is here more correct.

So I haven't added this test yet as this would fail against chrome, as chrome outputs a width of 30 for root, whereas yoga gets a width of 60 here, which I think is correct. Strangely the output of ```flex-wrap:wrap``` is in jsfiddle also only with a (visual) width of 30 on chrome, while the tests gets generated with 60.

```html
<div id="wrap_reverse_column" style="height: 100px; flex-wrap: wrap-reverse">
  <div style="height: 30px; width: 30px;"></div>
  <div style="height: 30px; width: 30px;"></div>
  <div style="height: 30px; width: 30px;"></div>
  <div style="height: 30px; width: 30px;"></div>
</div>
```

Looking forward what you think here emilsjolander
Closes https://github.com/facebook/yoga/pull/398

Reviewed By: astreet

Differential Revision: D4564711

Pulled By: emilsjolander

fbshipit-source-id: 33dc055abd8444b2aa7796ef90bd7ec99e961bb8
2017-02-15 13:47:51 -08:00
Sean Kinsey c38d56d9db Expose the bridge instance to CxxModule via a weak_ptr
Summary:
In order for `CxxModule` modules to be able to do things like emit events, we need to expose the bridge instance.

To allow classes derived from `CxxModule` in other projects to include `<cxxreact/Instance.h> I also needed to convert all the header includes to non-relative  ones.

Reviewed By: javache

Differential Revision: D4564145

fbshipit-source-id: a5bc28dd9b40e2b141af9e867105c56083fbdcdc
2017-02-15 10:04:17 -08:00
Lukas Wöhrl ffb6daad4a Remove no longer valid limitiation hints
Summary:
Remove no longer valid limitiation hints, according to percentag, auto margins and flex values.
Closes https://github.com/facebook/yoga/pull/402

Reviewed By: astreet

Differential Revision: D4564709

Pulled By: emilsjolander

fbshipit-source-id: ef7f37921644b4d315c7a84552861713061b33e1
2017-02-15 08:32:10 -08:00
Pieter De Baets 61785ee00c Support BC in JSCExecutor on iOS
Reviewed By: amnn

Differential Revision: D4558676

fbshipit-source-id: 1ec2b1a5a8df08074ba06162ab2585f02d1d214b
2017-02-15 07:14:57 -08:00
Pieter De Baets 8987d86718 Fix error handling for nested exceptions
Reviewed By: mhorowitz

Differential Revision: D4551110

fbshipit-source-id: e593c1ef0dea27e95a387bcde6250aeb22d2e9cc
2017-02-15 06:15:11 -08:00
David Hart 67f6b32409 Rename YGUnitPixel to YGPoint...
Summary:
...to reflect the modern world we live in with dynamic DPI platforms :)
Closes https://github.com/facebook/yoga/pull/375

Reviewed By: dshahidehpour

Differential Revision: D4528518

Pulled By: emilsjolander

fbshipit-source-id: e422bd4ae148e02c598a7b484a6adfa8c0e1e0c9
2017-02-14 14:31:31 -08:00
Lukas Wöhrl dbaa687518 Feature auto margin
Summary:
Even so I know there are some opinions against ```margin: 0 auto``` it's still part of the spec: https://www.w3.org/TR/css-flexbox-1/#auto-margins and pretty usefull if you have to position via ```justify-content```.

This PR adds an implementation for that.

It adds an additonal ```YGUnitAuto``` and margins got ```YGNodeStyleSetMarginAuto``` functions as well.
Closes https://github.com/facebook/yoga/pull/357

Reviewed By: astreet

Differential Revision: D4501142

Pulled By: emilsjolander

fbshipit-source-id: 86519f8632496f46e78a7c9dbc5b21e212e3e0c7
2017-02-14 14:31:31 -08:00
Emil Sjolander 0ea47424ff Fix align-content strech with multiple lines
Reviewed By: astreet

Differential Revision: D4551234

fbshipit-source-id: 2964f19cf415991dc55dfa2caa4868cb00c56bd0
2017-02-14 09:17:53 -08:00
Michael Bolin f294f61eeb Replace top-level `elif` with `if` in BUCK files.
Reviewed By: mzlee

Differential Revision: D4550165

fbshipit-source-id: 65d636c2e9e273bf45e093fe2c07aec18659e733
2017-02-13 22:32:37 -08:00
Emil Sjolander 4ea355a362 Revert D4528559: [yoga][PR] Fix align-content strech with multiple lines
Differential Revision: D4528559

fbshipit-source-id: 4bd82b399cb36acb348f2c6fedcae6b360513424
2017-02-13 01:16:47 -08:00
Lukas Wöhrl f288368cef Fix align-content strech with multiple lines
Summary:
Fixes ```align-content:strech``` on nodes without specified cross dimension, if there are multiple lines. Currently it uses the full height of the parent, but it has to use the line height. As we don't know the number of lines until here, we need to realign the relevant children.
Closes https://github.com/facebook/yoga/pull/368

Reviewed By: gkassabli

Differential Revision: D4528559

Pulled By: emilsjolander

fbshipit-source-id: 019e6f85fa452d0c3412f711e3886f0c4452da47
2017-02-11 08:48:24 -08:00
Lukas Wöhrl 8d695e1147 Fix resolving bug on changing layout and optimized memory usage
Summary:
Due to the changes in 46817a38. We have a bug if the layout changes.

This PR fixes this bug and adds a test for it.

Additionally it correctly marks negative percentage values as undefined dim.

It also changes the ```resolvedDimensions``` to use a reference instead of the full value in order to minimize the memory requirement of a ```YGNode``` and reduces the copying of the ```YGValue```.
Closes https://github.com/facebook/yoga/pull/379

Reviewed By: gkassabli

Differential Revision: D4528552

Pulled By: emilsjolander

fbshipit-source-id: c024fe3a009c3788af319b689858ea3374c46477
2017-02-11 08:48:24 -08:00
Lukas Wöhrl 17604ec6fe Add support for space-between and space-around on align-content
Summary:
Adds the two missing alignments ```space-between``` and ```space-around``` for ```align-content``` . Those values are a noop on ```align-items``` in order to prevent a breaking changes for an additional enum.

Fix #229
Closes https://github.com/facebook/yoga/pull/364

Reviewed By: gkassabli

Differential Revision: D4528561

Pulled By: emilsjolander

fbshipit-source-id: ea6291b6dd22cef05d9eec03893250d50371236e
2017-02-11 08:48:24 -08:00
Emil Sjolander aac7b19a7c Fix min/max not overriding width/height
Differential Revision: D4537576

fbshipit-source-id: c003f723f424afbca63170d41e54fd5ff837926d
2017-02-11 05:32:26 -08:00
Georgiy Kassabli 016969df49 Revert D4456312: Fix for Yoga test failure for flexing with min stack dimension
Differential Revision: D4456312

fbshipit-source-id: 6b396f0a8b67619308456599377238b75d0c1ab3
2017-02-07 05:15:25 -08:00
Eloy Durán 031cb2045d Make podspec great again.
Summary:
Fixes #11272
Fixes #11572
Fixes #11781

The main changes here are:

* This depends on the latest CocoaPods (1.2.0). It’s currently in RC, but if I’m not mistaken a proper release is expected soon. /cc dantoml
* Adds required header search paths for the jschelpers and cxxreact subspecs.
* Makes the jschelpers and cxxreact headers private to building React Native, not visible to the user’s project.
* It uses the canonical upstream Yoga v1.0.0 podspec: https://github.com/facebook/yoga/blob/master/Yoga.podspec
* Consistent styling.

I have been able to get our app to build again using this https://github.com/artsy/emission/pull/437. The spec has some warnings, but otherwise fully passes lint.

rh389 sjmueller Could you please test with your projects?
Closes https://github.com/facebook/react-native/pull/12089

Differential Revision: D4518605

fbshipit-source-id: ecf86232d8b1af52d139eadd1acc10f5c1d42c29
2017-02-06 16:30:00 -08:00
Antonio Corrado 4c3f03e4c5 Setting min=max dimension is treated as setting dimension
Reviewed By: emilsjolander

Differential Revision: D4492395

fbshipit-source-id: 3f4293548399e006aa808b9586d24e77c7df1f21
2017-02-06 14:45:43 -08:00
Georgiy Kassabli d963e3dd7f Fix for Yoga test failure for flexing with min stack dimension
Reviewed By: emilsjolander

Differential Revision: D4456312

fbshipit-source-id: 82a39bc93cf3bf2374b968e9f7403397e752908e
2017-02-06 13:01:44 -08:00
Lukas Wöhrl ccc56bba8f Added property display: flex and none
Summary:
Fix #241 and successor for #302

Added new property ```display``` with ```YGDisplayFlex``` and ```YGDisplayNone```. Allows to hide nodes from the layout without the need to remove it from the DOM.
Closes https://github.com/facebook/yoga/pull/369

Reviewed By: astreet

Differential Revision: D4501141

Pulled By: emilsjolander

fbshipit-source-id: 0dfeee381f6d1e4bbba81926126b83dd7abab9d6
2017-02-06 09:43:27 -08:00
Emil Sjolander 00efe02c5b Return raw edge style value now that we have layout outputs for them
Reviewed By: astreet

Differential Revision: D4500892

fbshipit-source-id: e7c26bdda9ecbfc76b6cf1f384f8cf9f38284120
2017-02-03 11:28:48 -08:00
Emil Sjolander 61848ea2f3 Fix percentage calculation when parent size is undefined
Reviewed By: gkassabli

Differential Revision: D4494265

fbshipit-source-id: 9efef9e39a1b66af2d0f144575a96c919d60dbf7
2017-02-03 05:43:41 -08:00
Emil Sjolander eb54290a3a Take parent size into account when determining if style dim is defined
Reviewed By: gkassabli

Differential Revision: D4494258

fbshipit-source-id: 36c31444cbd113a820b067fe9e7b9560ae1d4df7
2017-02-03 05:43:41 -08:00
Lukas Wöhrl 95420152a6 Generate enums in sorted order
Summary:
This PR forces the order of the generated enums in alphabetically order. This is needed to have a predictable order of the enums across different python versions. Which reduces the pain for merging multiple enum additions.
Closes https://github.com/facebook/yoga/pull/370

Reviewed By: gkassabli

Differential Revision: D4501140

Pulled By: emilsjolander

fbshipit-source-id: 66c0ed9e4ea7a5990578b53b0a7e400c13dd53a9
2017-02-03 04:28:42 -08:00
Pieter De Baets 4d2512aef9 Replace MethodCallResult with folly::Optional
Reviewed By: AaaChiuuu

Differential Revision: D4481987

fbshipit-source-id: 945dd671eb2482f3c6b626192aa2181c5bfd906f
2017-02-02 05:13:33 -08:00
Marc Horowitz 5bc7e3934b make JSCExecutor compile on iOS without android hacks
Reviewed By: javache

Differential Revision: D4434041

fbshipit-source-id: 88439384b1471ea5bd96d7cc39e681ddd3959243
2017-02-01 14:14:32 -08:00
Marc Horowitz ad549c067a small fixes to ReactCommon
Summary: unneeded or overly generic header files, stuff like that.

Reviewed By: javache

Differential Revision: D4434029

fbshipit-source-id: f25c702e7fc8d8debbd865cf3822696bf9b61c81
2017-02-01 14:14:32 -08:00
Pieter De Baets f8c72f5441 Support invoking and returning arbitrary types from Java sync hooks
Reviewed By: mhorowitz

Differential Revision: D4409900

fbshipit-source-id: 347e33c442b32f64355d343308c218c15cf5a70f
2017-01-31 05:28:35 -08:00
Pieter De Baets 919e49a8b8 Pass expanded folly::dynamic as argument to sync nativeHook
Reviewed By: mhorowitz

Differential Revision: D4409865

fbshipit-source-id: f99e02e36bf691fa5b4a5affce1fa4fd4cf321a6
2017-01-30 06:43:48 -08:00
Emil Sjolander 81fe1a3618 Fix aspectratio with margins
Reviewed By: astreet

Differential Revision: D4473024

fbshipit-source-id: 5a747e2f267b077203bb3b63e4c152847dc30774
2017-01-27 09:58:29 -08:00
Emil Sjolander 3d1c8694d0 Format and run codegen
Reviewed By: dshahidehpour

Differential Revision: D4459455

fbshipit-source-id: fc1eca58fe897c8f4a2571638b4f7035d023b479
2017-01-26 13:43:35 -08:00
Maël Nison 3a476a8321 Add YGLayoutGetBorder, counterpart of YGLayoutGetPadding
Summary:
Followup of #335, fix #326. This commit add the `YGLayoutGetBorder(node, edge)` function, which correctly takes RTL/LTR into account when resolving `EDGE_START` & `EDGE_END`.
Closes https://github.com/facebook/yoga/pull/344

Reviewed By: dshahidehpour

Differential Revision: D4459950

Pulled By: emilsjolander

fbshipit-source-id: b57eb7a5b1c181a364913c3200a3794a2b7b31a6
2017-01-26 13:43:35 -08:00
Lukas Wöhrl 48e346193a Fix absolute position if align-item or justify-content is center or flex-end
Summary:
Fix #310 (```center```)

additionally fixes if ```flex-end``` is set.
Closes https://github.com/facebook/yoga/pull/349

Reviewed By: dshahidehpour

Differential Revision: D4458528

Pulled By: emilsjolander

fbshipit-source-id: f073c80bfc3ea6675cb95b00283074d10e91a042
2017-01-26 13:43:35 -08:00
Pieter De Baets a407ff94ee Add option to start sampling profiler on app launch
Reviewed By: mhorowitz

Differential Revision: D4415989

fbshipit-source-id: 30704c2b618656cb7cc0ccdf87dec315b30b62f3
2017-01-25 14:43:30 -08:00
Pieter De Baets e97ffc469c Use NoAutomaticPrototype everywhere
Reviewed By: michalgr

Differential Revision: D4462794

fbshipit-source-id: 53585741c1d35ca31e3429f2de56455ea5dea902
2017-01-25 11:43:30 -08:00
Emil Sjolander 018b853b9b Dont constrain absolute children to zero sized parents
Reviewed By: gkassabli

Differential Revision: D4453612

fbshipit-source-id: e8269521560d2f42b2d6f0f0ff264a1605a57d79
2017-01-24 17:13:42 -08:00
Ashok Menon 4aac5cd02e RN] Removing `ReactAndroid/CONSTANTS`
Reviewed By: javache

Differential Revision: D4446455

fbshipit-source-id: d9d3eb7127bbb88227ebd2a963ce508040183974
2017-01-23 09:43:25 -08:00
Ashok Menon 76c4faee5e CatalystInstanceImpl.setSourceURL
Reviewed By: javache

Differential Revision: D4422416

fbshipit-source-id: bc49485ac64064909f32375b6b8360a0a505975b
2017-01-18 08:58:41 -08:00
Lukas Woehrl e93ccfd57a Fix wraping calculation if min-size constraint exists
Summary:
Fixes #261
Closes https://github.com/facebook/css-layout/pull/262

Reviewed By: splhack

Differential Revision: D4245200

Pulled By: emilsjolander

fbshipit-source-id: 77d802d71010ed426511d6a01e6de1e7c9194179
2017-01-16 16:13:34 -08:00
Emil Sjolander 8d2a034f9c BREAKING - Fix sizing of container with child overflowing parent
Reviewed By: mmmulani

Differential Revision: D4182141

fbshipit-source-id: c73fd15d2577ab846fc8a202d529d0e6e1207b75
2017-01-16 11:13:29 -08:00
Maël Nison ae4fa4b012 Add YGLayoutGetMargin
Summary:
Fix #326. I'll open another PR once this one gets accepted to add support for `YGLayoutGetBorder` 👌
Closes https://github.com/facebook/yoga/pull/335

Reviewed By: gkassabli

Differential Revision: D4409399

Pulled By: emilsjolander

fbshipit-source-id: 8153f6701cab60b55a485f6d2e0b9f7767481090
2017-01-15 15:28:34 -08:00
Ashok Menon 154e183344 Fixing RN Debugger
Reviewed By: cwdick, javache

Differential Revision: D4409257

fbshipit-source-id: 062c798d1a1c9ad90884599ed262412c1dd51359
2017-01-12 16:28:36 -08:00
Dan Caspi ad0493c6c2 Fixing a crash caused by D4393955
Reviewed By: javache

Differential Revision: D4403858

fbshipit-source-id: c930aa108d27c1bd1b36364530d2953bcd4664ad
2017-01-11 09:43:34 -08:00
Stephen Girdlestone a0dd54b4d7 Adding method for JSCreateSourceCodeFromFile.
Reviewed By: amnn

Differential Revision: D4365790

fbshipit-source-id: b62ee9c7d3fa3f89c22a10a6fde21cd9c30fceb2
2017-01-11 06:13:28 -08:00
Emil Sjolander 3f49e743be Add percentage support to react native
Summary:
Adds support for percentage value in react native.

syntax: property: 100 | property | '100%'

supported properties:
padding
margin
width
height
minWidth
minHeight
maxWidth
maxHeight
flexBasis

```
class Playground extends React.Component {
  render() {
    return (
      <View style={{backgroundColor: 'white', padding: 10, paddingTop: 30, height: '100%'}}>
        <Text>
          If you want to quickly test out something,
          open the Playground.js file and start coding.
        </Text>
        <View style={{backgroundColor: 'red', height: 50, width: 50}}/>
        <View style={{backgroundColor: 'blue', height: '50%', width: '50%'}}/>
      </View>
    );
  }
}
```

Reviewed By: astreet

Differential Revision: D4376549

fbshipit-source-id: c41d68a7555396f95d063a7527ee081773ac56dc
2017-01-11 03:58:37 -08:00
Dan Caspi b50f55026a Adding support in the new RN bridge on iOS
Differential Revision: D4393955

fbshipit-source-id: e5f3fb6773908678773a5dd4fdea568bcc200336
2017-01-10 11:28:44 -08:00
Emil Sjolander 7c2f8a9e14 Allow aspect ratio to expand beyond bounds of parent
Reviewed By: passy

Differential Revision: D4397547

fbshipit-source-id: d2b1ca7b096f2f17b3efbd8f47a50678bfe7bb5f
2017-01-10 08:28:26 -08:00
Ashok Menon da428d6c3d Exposing Recoverable Errors
Differential Revision: D4383792

fbshipit-source-id: e6d0f57fcaacf242e95bfcf589a4fa840c317fe5
2017-01-10 07:13:40 -08:00
Ashok Menon 24f3add010 Use JSExecutor's file-based Loading API in NativeToJsBridge and Instance
Reviewed By: javache

Differential Revision: D4320773

fbshipit-source-id: fa46728ba0d45818737b32952efbfae7bc8ef9f1
2017-01-10 07:13:40 -08:00
Ashok Menon 8819bef56b Getting rid of File descriptor based loading APIs
Reviewed By: javache

Differential Revision: D4333725

fbshipit-source-id: ba8591c7380e8eb90660a912f6fc86fc3d2d4774
2017-01-10 07:13:40 -08:00
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
Lukas Woehrl 1c69b61c26 Added feature to use rounded values
Summary:
Added an experimental feature to allow to use only rounded values. See #184. It's not a perfect solution and definitely  can be further improved. I'm looking forward to your ideas.
Closes https://github.com/facebook/css-layout/pull/256

Reviewed By: splhack

Differential Revision: D4214168

Pulled By: emilsjolander

fbshipit-source-id: 6293352d479b7b4dad258eb3f9e0afaa11cf7236
2016-11-22 05:43:26 -08:00
Michał Gregorczyk 2ca507bf9e Remove supported platforms from JSC and all the things that depends on it
Reviewed By: bnham

Differential Revision: D4213580

fbshipit-source-id: 3830c15b0097030a4e4611aac814b12e1d6ae696
2016-11-21 16:43:31 -08:00
Emil Sjolander 6526548b50 Move measure code for known dimensions out of main layout function
Reviewed By: gkassabli

Differential Revision: D4213339

fbshipit-source-id: 5ca35ca307594f3419fd0dee81321d3c2e06710f
2016-11-21 11:13:40 -08:00
Emil Sjolander 85d0dab9bf Move measure code for empty containers out of main layout function
Reviewed By: gkassabli

Differential Revision: D4213313

fbshipit-source-id: 2061a809202f7f948bff1b3ee8dc4c230692a223
2016-11-21 11:13:40 -08:00
Emil Sjolander cf796248ec Move custom measure code out of main layout function
Reviewed By: gkassabli

Differential Revision: D4213302

fbshipit-source-id: df4bc43848325e99ad338a2fa6d5c9404315b0e6
2016-11-21 11:13:39 -08:00
Emil Sjolander e1df3c8782 Add aspectRatio style property
Reviewed By: gkassabli

Differential Revision: D4211458

fbshipit-source-id: f8d0d318369c7b529ee29e61a52b17d0cf3b396d
2016-11-21 10:13:34 -08:00
Andy Street d63ba47b59 BREAKING [react_native] Move to new C-based implementation of css-layout in RN Android
Summary:
Moves from CSSNodeDEPRECATED to CSSNode. This has shown to be a huge performance win for layout time within FB.

This is BREAKING because CSSNode contains bug fixes that were not migrated to CSSNodeDEPRECATED which may change the way your layout appears. The most common of these by far involves `flex: 1`.

Previously, developers had to put `flex: 1` in many places it didn't belong in order to work around a bug in css-layout. Now `flex: 1` is treated properly and, unfortunately, this means that your layout may no longer look correct. Specifically, you may see that your layout looks collapsed, or children don't render. The fix is to simply remove `flex: 1` from those containers.

Reviewed By: emilsjolander

Differential Revision: D3992787

fbshipit-source-id: 7a3a2a34a8941c0524e6ba3c5379e434d3e03247
2016-11-21 06:28:30 -08:00
Pieter De Baets 0c03b788d7 Create JSCWrapper in C++ bridge
Reviewed By: bnham

Differential Revision: D4082204

fbshipit-source-id: 03bff2ac53e6df931063fcd6ba6ad28dc5ae9562
2016-11-21 04:43:42 -08:00
Emil Sjolander 15f848e8d8 Only skip updating computed flex basis within the same generation
Reviewed By: dshahidehpour

Differential Revision: D4207106

fbshipit-source-id: fc1063ca79ecf75f6101aadded53bca96cb0585d
2016-11-20 05:13:28 -08:00
Pieter De Baets 2a04569926 Fix usage of old String constructor
Reviewed By: amnn

Differential Revision: D4204575

fbshipit-source-id: ea0309ec9bf2c8a4c480188efb00408fcc399e2e
2016-11-18 07:28:24 -08:00
Pieter De Baets 20514e3482 Add JSContextRef param to String constructor
Reviewed By: bnham

Differential Revision: D4197300

fbshipit-source-id: 306ffc85e3ced24047b68499f7cdf5e2d31fc052
2016-11-18 06:28:48 -08:00
Pieter De Baets b1c91606ff Implement Value.is* using getType
Reviewed By: mhorowitz

Differential Revision: D4197286

fbshipit-source-id: 893077a661bbf39b46ef9b10aa9ee552788882a6
2016-11-18 06:28:48 -08:00
Pieter De Baets 674d86cdcb Add some more helper methods to Value
Reviewed By: mhorowitz

Differential Revision: D4197278

fbshipit-source-id: 9a538ff2747d32a54d42627a9f78e4a348dce639
2016-11-18 06:28:48 -08:00
Ashok Menon 9e00a42fd7 Experimental App Bundle API
Reviewed By: michalgr

Differential Revision: D4198629

fbshipit-source-id: b96a4b3ad3e5ab6b4cb8892442c6077edf7058a3
2016-11-18 05:13:31 -08:00
Lukas Wöhrl 687ae48cc7 use fmaxf to prevent casting from and to double
Summary:
Use ```fmaxf``` to prevent double casting.
Closes https://github.com/facebook/css-layout/pull/251

Reviewed By: emilsjolander

Differential Revision: D4199342

Pulled By: splhack

fbshipit-source-id: c04bc68a3c9c97b92e910e885457cf2fe00da28b
2016-11-17 20:43:44 -08:00
Lukas Wöhrl ee285876d2 Change more method arguments to const
Summary:
Change more method arguments to ```const```
Closes https://github.com/facebook/css-layout/pull/252

Reviewed By: emilsjolander

Differential Revision: D4199335

Pulled By: splhack

fbshipit-source-id: f54fccaea8051a49c6cdf0fcaf1a68c025ba26da
2016-11-17 20:43:44 -08:00
Lukas Wöhrl fb4d9f204a do not redefine isnan if already defined via math.h
Summary:
```isnan``` is already defined in ```math.h``` (at least when using VS13) so there is no need to redefine it. it also is a nan for float and not for double opposed to ```_isnan```
Closes https://github.com/facebook/css-layout/pull/253

Reviewed By: emilsjolander

Differential Revision: D4199331

Pulled By: splhack

fbshipit-source-id: 139fb0efd68dd5df79bbaef863a8e8b9246c795d
2016-11-17 20:43:44 -08:00
Lukas Wöhrl 1430458906 use size_t instead of unsigned long
Summary:
Use ```size_t```instead of ```unsinged long``` as this is the "offical" return type of ```strlen```. Is VS13 ```size_t``` is defined as ```unsigned long long``` which leads to a compiler warning.
Closes https://github.com/facebook/css-layout/pull/254

Reviewed By: emilsjolander

Differential Revision: D4199327

Pulled By: splhack

fbshipit-source-id: 5e1a91f282bf776e4d9f5806e6467dfe36c7a633
2016-11-17 20:43:43 -08:00
Kazuki Sakamoto 39a59caac1 Introduce CSSNodeCopyStyle
Reviewed By: emilsjolander

Differential Revision: D4188514

fbshipit-source-id: af8d7fb5e8688c64aea05ce7ad23fff9233fb441
2016-11-17 09:13:31 -08:00
Kazuki Sakamoto c5f6e864f9 Workaround fix for Visual Studio
Reviewed By: emilsjolander

Differential Revision: D4191268

fbshipit-source-id: 53fdcc388292e76c2b97ad071f0d7c27d0613ecf
2016-11-17 08:58:55 -08:00
Kazuki Sakamoto 0d0f44439c Fix memory func test
Reviewed By: emilsjolander

Differential Revision: D4193712

fbshipit-source-id: a4aba84d054d98a7baf438e213a90bd7ef34e979
2016-11-17 07:43:27 -08:00
Ashok Menon 2de1c3507a Introducing `JSBigFileString`
Reviewed By: michalgr

Differential Revision: D4189896

fbshipit-source-id: 0f3cebcd7e76d5c763c29ebc1119ae24b643e5ad
2016-11-16 15:13:39 -08:00
Ashok Menon 79fa6d41a1 Rename JSBigMmapString -> JSBigOptimizedBundleString
Summary:
`JSBigMmapString` needs to know too much about the details of the "optimized bundle" format. In honour of this fact, I'm renaming it to `JSBigOptimizedBundleString`. In a following diff, I will introduce a new class just for File-backed Strings, whose only responsibility is dealing with an mmaped region.

This diff already pulls in some fixes for formatting reference and pointer declarations from the linter.

Reviewed By: michalgr

Differential Revision: D4189391

fbshipit-source-id: b376c2a8d9ae5b83575da8457e607bbbfc648ebd
2016-11-16 15:13:39 -08:00
Ashok Menon 89d81b34db Use folly for error checking
Summary: Small refactor, making error checking clearer.

Reviewed By: lexs

Differential Revision: D4189090

fbshipit-source-id: f3a24eacfe6dd154d29662f510ce19dbe55f89a6
2016-11-16 15:13:39 -08:00
Ashok Menon f22dfa3efb Make Bytecode Header errors non-fatal
Reviewed By: michalgr

Differential Revision: D4182575

fbshipit-source-id: 1e7c229bb6d0bdbfdfc01e93af53441ba2cba9f9
2016-11-16 15:13:39 -08:00
Kazuki Sakamoto e864c40be8 Introduce CSSLayoutSetMemoryFuncs
Reviewed By: emilsjolander

Differential Revision: D4178386

fbshipit-source-id: a79dbdaf82a512f42cc43f99dbc49faba296903b
2016-11-15 20:28:30 -08:00
Emil Sjolander ffcdf25281 Autogenerate enum defenitions for all languages
Reviewed By: gkassabli

Differential Revision: D4174263

fbshipit-source-id: 478961a8f683e196704d3c6ea1505a05c85fcb10
2016-11-15 08:44:30 -08:00
Andy Street c04ab92192 Use -O3 to compile CSSLayout in open source
Summary: This is how we compile internally

Reviewed By: emilsjolander

Differential Revision: D4182691

fbshipit-source-id: 314b1a1ead7d299677ce7f71549c986e1b796b3b
2016-11-15 08:28:56 -08:00
Andy Street 3b20a39f7b Move ReactCommon/CSSLayout to ReactCommon/CSSLayout/CSSLayout
Reviewed By: emilsjolander

Differential Revision: D4182345

fbshipit-source-id: 05cb4f0b0e7971d4f66e656ea89d876264a61bd4
2016-11-15 06:28:45 -08:00
Fred Liu 1f125e3d41 Revert D4157971: [csslayout] BREAKING - Fix sizing of container with child overflowing parent
Differential Revision: D4157971

fbshipit-source-id: be055cf018fd39b3cee9af0bc777831fcf757190
2016-11-14 12:28:40 -08:00
Andy Street 07ef5a8fe9 Build C-version of CSSLayout in open source
Summary: Builds and ships libcsslayout.so with Android builds. This is not used yet, but a follow up diff will shortly move us from CSSNodeDEPRECATED to CSSNode (which uses libcsslayout)

Reviewed By: emilsjolander

Differential Revision: D4168140

fbshipit-source-id: d72bded88df81e4d54df31a08e4b101834770a73
2016-11-14 06:13:48 -08:00
Emil Sjolander 307871e854 Implement standard interface for toggling experimental features
Reviewed By: gkassabli

Differential Revision: D4174260

fbshipit-source-id: ad3667183810c02833fba9a1276f89286e848fcd
2016-11-14 03:28:39 -08:00
Emil Sjolander a2cafb062e rename CSSWrapType to shorter CSSWrap matching java and csharp
Reviewed By: gkassabli

Differential Revision: D4174257

fbshipit-source-id: ba0bfab996ba158b07863d8c72cf2a41262c9592
2016-11-14 03:28:38 -08:00
Emil Sjolander e2e3a27571 BREAKING - Fix sizing of container with child overflowing parent
Reviewed By: gkassabli

Differential Revision: D4157971

fbshipit-source-id: 3cfae15ac8b65b70f01789444099ee684e1b099a
2016-11-14 02:13:51 -08:00
Andy Street 974eec8264 Add CSSLayout to ReactCommon
Summary: First step to sharing CSSLayout code between iOS and Android.

Reviewed By: emilsjolander

Differential Revision: D4160286

fbshipit-source-id: 976f5820b19a7011e0a14317c858465f932e1f59
2016-11-11 10:58:55 -08:00
Pieter De Baets 96cf9bb0c0 Support null messageQueueThread in JSCExecutor
Reviewed By: michalgr

Differential Revision: D4119253

fbshipit-source-id: 2956434451bf4e649cfe4c0ee0a9b7339a5422a3
2016-11-02 14:28:36 -07:00
Alexander Blom fbc8410d86 Add some documentation
Summary: Adds documentation about the Inspector.

Reviewed By: passy, foghina

Differential Revision: D4114673

fbshipit-source-id: fb1182c89c94f10a74d4589b6a24a06b376db92e
2016-11-02 12:29:15 -07:00
Alexander Blom 6a1783210b Add JS agent support
Summary:
Adds the possibility to define agents in Javascript. Javascript agents are simple classes that extend `InspectorAgent` and pass down the
given `EventSender` to the super constructor. The library will then call methods on the object for each received method call over the protocol.

Reviewed By: davidaurelio

Differential Revision: D4021508

fbshipit-source-id: bbe609e92ea726cbbbec833df81705ebd3346c77
2016-11-02 12:29:15 -07:00
Alexander Blom 27f504e9e3 Add Console agent
Summary: Adds the Console agent which we hook from our console polyfill. It captures the stack and strips the frames of the polyfill.

Reviewed By: davidaurelio

Differential Revision: D4021502

fbshipit-source-id: 49cb700a139270485b7595e85e52d50c9a620db6
2016-11-02 12:29:15 -07:00
Alexander Blom 0ac7bf29af Add Page, Runtime, Debugger agents
Summary: Runtime and Debugger agents are shipped with JSC so we reuse them. Messages are routed to them through the `LegacyDispatcher` which also handles translating their events. The Page agent emits the `Page.getResourceTree` method that the Chrome inspector expects.

Reviewed By: michalgr

Differential Revision: D4021499

fbshipit-source-id: a93d0add01cee732401f8e8db1d43205bfbd4cd4
2016-11-02 12:29:14 -07:00
Alexander Blom 156e5d9837 Add on-device JSC inspector
Summary:
Introduces the inspector library supporting the Chrome Debugging Protocol for JavaScriptCore. Eventually this will mean that it is possible to attach
the Chrome inspector directly to the JSC instance running on the device. This library doesn't define the actual transport but leaves that up to the platform
layer.

The main entry point (and the only exported header) is `Inspector.h`.

This diff only introduces the basics supporting the `Schema` and `Inspector` domains meaning it doesn't have any features yet. These will come in following
diffs.

Reviewed By: michalgr

Differential Revision: D4021490

fbshipit-source-id: 517fd9033051c11ba97d312b16382445ae85d3f3
2016-11-02 12:29:14 -07:00
Pieter De Baets 4082a54649 Don't mask exceptions generated from loadModule
Reviewed By: davidaurelio

Differential Revision: D4112447

fbshipit-source-id: e9b3a5cefb166fe00c04b6126c9878e71f1413ec
2016-11-01 16:13:33 -07:00
Alexander Blom a0c550d5c0 Allow creating JS functions from std::function
Reviewed By: mhorowitz

Differential Revision: D4043376

fbshipit-source-id: 65b4f025835dbae34e764015743c2616d9eb9379
2016-11-01 11:44:10 -07:00
Alexander Blom ddb8cb7cf0 Move JSCHelpers.h and Value.h into separate package
Reviewed By: javache

Differential Revision: D3950748

fbshipit-source-id: 6315ea07f3217b485aeb4374b5f6e36333957848
2016-11-01 11:44:10 -07:00
Ben Nham c089761f9b Use JSCExecutor to manage loading js script in JSContext
Reviewed By: jaegs

Differential Revision: D4021624

fbshipit-source-id: 8e46052ad246e842a88715d55059a233196a4a6b
2016-10-31 15:13:49 -07:00
Giuseppe Ottaviano dc02907039 Fix a folly::dynamic deprecated pattern
Reviewed By: javache

Differential Revision: D4075622

fbshipit-source-id: 4a6b6c4068d762dce2b1535bfd9630e185f5489f
2016-10-26 09:43:56 -07:00
Nikhilesh Sigatapu c67225818d Add a way to access the underlying JavaScriptCore context
Summary:
**Motivation**

I'm working on a project that uses React Native and needs to add direct synchronous bindings to native stuff through the JavaScriptCore C API. This is because it's performance-sensitive and would benefit from the quickest JS->C path. It does this using cross-platform C++ code that works on both iOS and Android. Most of the infrastructure for getting access to the JSC context is already in React Native actually, just had to add a few more things.

(lexs you mentioned to tag you in this pull request)

**Test plan**

Modify the JavaScriptCore context through the `JSContextRef` returned (eg. add an object at global scope) and verify that it exists in JavaScript.
Closes https://github.com/facebook/react-native/pull/10399

Differential Revision: D4080945

Pulled By: lexs

fbshipit-source-id: 6659b7a01e09fd84475adde183c1d3aca2d4cf09
2016-10-26 03:43:44 -07:00
Scott Wolchok 3f472e0bfa Fix cxxreact build error with -Wmissing-prototypes
Differential Revision: D4022143

fbshipit-source-id: 6afbd29a030ff51915cfb552f74737e9146b2ffd
2016-10-14 13:28:36 -07:00
Pieter De Baets 8355ef91ad Add a default context name to RCTJSCExecutor
Reviewed By: mmmulani

Differential Revision: D4015748

fbshipit-source-id: 077287b8438aa13f2a1479d68eacb0662bf295aa
2016-10-14 11:43:43 -07:00
Pieter De Baets 9ed9bca0bf Lazily instantiate native modules
Summary: Instead of sending a list of modules over to JS on startup (and actually blocking script execution) instead provide a proxy object that constructs each of these lazily.

Reviewed By: lexs

Differential Revision: D3936979

fbshipit-source-id: 71bde822f01eb17a29f56c5e60e95e98e207d74d
2016-10-11 07:28:42 -07:00
Emil Sjolander b7ded130df Dont use explicit .so file name to support more platforms
Reviewed By: dreiss

Differential Revision: D3981166

fbshipit-source-id: 0b19f73e6de48a30613419ccc54735c968701532
2016-10-08 09:28:42 -07:00
Pieter De Baets 5200ac1ee9 Add check for nil nativeToJS bridge
Reviewed By: mhorowitz

Differential Revision: D3980922

fbshipit-source-id: ba8ba283cd186a28cd9d5c1c35d4828829864a6a
2016-10-07 08:13:38 -07:00
leeight 9a7e4b4902 Dump invalid json when call Value::fromJSON failed
Summary:
See #9117
Closes https://github.com/facebook/react-native/pull/10231

Differential Revision: D3974063

Pulled By: javache

fbshipit-source-id: 63d3ae02ae731cd5a63fcb3a645c612c57cbb8b4
2016-10-05 04:43:45 -07:00
Pieter De Baets d7d89172c2 Expose ModuleRegistry on ExecutorDelegate
Differential Revision: D3944588

fbshipit-source-id: f8450a6735e1f6283c3bfe9d2ce883327172621c
2016-10-03 05:13:38 -07:00
Hoa Dinh 5a24ea0b42 Create headers symlinks for FBReactKit
Reviewed By: javache, skotchvail

Differential Revision: D3946452

fbshipit-source-id: c6354f529bec2f9635a0ecf5f65e21dc4e17b1e4
2016-09-30 14:28:41 -07:00
Pieter De Baets 5b52dab781 Remove follySupport.h
Reviewed By: lexs

Differential Revision: D3944918

fbshipit-source-id: 702907a12e3916f9d6edde7362416188df909d70
2016-09-30 12:28:41 -07:00
Pieter De Baets 6ee319d8eb Only configure nativeInjectHMRUpdate in DEBUG builds
Reviewed By: martinbigio

Differential Revision: D3944601

fbshipit-source-id: 8b98b7ae9a10c1e95d0ae80f6bbd90675d7c3ef5
2016-09-30 12:28:41 -07:00
Michał Gregorczyk 67f9d92478 Do not use bare file descriptors
Reviewed By: nadavrot

Differential Revision: D3945330

fbshipit-source-id: f3a28e2632c7f17a0b6394f3dd3de183bc9e97af
2016-09-30 12:13:51 -07:00
Pieter De Baets 4b70c66a27 Use glob in cxxreact BUCK rule
Reviewed By: lexs

Differential Revision: D3944546

fbshipit-source-id: 73cb3eeff3b3f5f543e69893f5071c4bd3e78be4
2016-09-30 09:28:47 -07:00
Michał Gregorczyk b1fdac47b5 Wire compiled bundle API
Differential Revision: D3887878

fbshipit-source-id: 212fc3188f059d7378ecd61bb5e31fc87a857e8a
2016-09-29 09:13:39 -07:00
Michael Lee fc154fcd74 Add `sign-compare` suppression for warning coming from `gtest.h`
Differential Revision: D3935414

fbshipit-source-id: 5f531cc65e74cae4cb23a0706b92dac0f3ef272d
2016-09-28 14:43:46 -07:00
Marc Horowitz d7a2d3a957 Add API for sync function calls
Reviewed By: javache

Differential Revision: D3897526

fbshipit-source-id: cadead316996ca7c1dd2b0d60d87945f5452640c
2016-09-26 16:14:11 -07:00
Marc Horowitz 6071e8ca2c Support sync loading of the initial bundle/source
Reviewed By: javache

Differential Revision: D3897521

fbshipit-source-id: a4f234c7003a5f4be952d315eb62f382836e24dc
2016-09-26 16:14:11 -07:00
Marc Horowitz 971cda8794 Move thread jump for js loading into NativeToJSBridge, out of platform code
Reviewed By: javache

Differential Revision: D3906009

fbshipit-source-id: b9782a6c209e3c1626899dac7fd50233cdef87f3
2016-09-26 16:14:10 -07:00
leeight 7fd9e77837 Remove duplicate call delegate->moduleNames()
Summary: Closes https://github.com/facebook/react-native/pull/9962

Differential Revision: D3923050

fbshipit-source-id: 59e05e673835beb7409512195170c9a1e20a9ea1
2016-09-26 01:43:41 -07:00
Pieter De Baets ff79224d37 Simplify ModuleConfig array format
Reviewed By: lexs, mhorowitz

Differential Revision: D3901563

fbshipit-source-id: 70aea19db1b01170be57b74ccfa1a306dfa1f362
2016-09-23 11:14:10 -07:00
Pieter De Baets 145109fc6d Remove additional JSON encoding for native->JS communication
Reviewed By: mhorowitz

Differential Revision: D3857323

fbshipit-source-id: 4386cc107b8a1425ecb7297b0f659f6c47f01a78
2016-09-19 04:44:12 -07:00
Chris Hopman 77e533cb9f Fix value.cpp tests and add tests for bad utf8/16
Reviewed By: mhorowitz

Differential Revision: D3699086

fbshipit-source-id: f8e4628a324602c786d6dfeb8f55736f9fc757cd
2016-09-12 16:43:36 -07:00
Chris Hopman c507a05f70 Use c++1y for cxxreact
Reviewed By: mhorowitz

Differential Revision: D3852279

fbshipit-source-id: a7b80170d6b86428db47c15bbf02d68d293112fc
2016-09-12 16:43:36 -07:00
Pieter De Baets 99e0267c25 Cleanup and document native module configuration
Summary: Get rid of the old behaviour of JSON encoding in `nativeRequireModuleConfig` and consistently use the same names for function types "async/promise/sync"

Reviewed By: lexs

Differential Revision: D3819348

fbshipit-source-id: fc798a5abcaf6a3ef9d95bd8654afa7825c83967
2016-09-08 04:13:51 -07:00
Marc Horowitz 3940f06211 Add more profiling, fix existing profiling, perf fix
Reviewed By: javache

Differential Revision: D3807467

fbshipit-source-id: 3ff6feebd6d7966952152bac708389506de721e6
2016-09-02 12:43:48 -07:00
Marc Horowitz 1d571c5ed5 Don't use the same throw for calling into JSC, and calling into native modules
Differential Revision: D3779181

fbshipit-source-id: 7fb17c9c90abd9302137dad3a326c6ce30e7ca86
2016-09-01 15:13:51 -07:00
Adam Ernst 708efcffba Codemod away buck_flags in Libraries/FBR*
Reviewed By: ryu2

fbshipit-source-id: cc2d82a691b67aebfbb8ee8e40ba1ee4b49a0c44
2016-08-29 13:28:44 -07:00
Adam Ernst 2cd9939206 Even less deep copying of flags
Reviewed By: yiding

Differential Revision: D3760126

fbshipit-source-id: 590173773f65372c6aa4f4814a7d247ef23015d3
2016-08-29 10:13:48 -07:00
Chris Hopman ccdc57dd96 Fix handling of bad utf16 passed out of JS
Summary:
JSC's utf16 -> utf8 conversion crashes on encountering bad utf16. Instead, use our own conversion (conveniently copied from fbjni).

Original fix thanks to rigdern (https://github.com/facebook/react-native/pull/9302)

Reviewed By: mhorowitz

Differential Revision: D3746947

fbshipit-source-id: 29887ca720f6a2b074f01f853bad28a083b273bc
2016-08-23 17:13:38 -07:00
Kellie Medlin 2bd1f627ea Test building with clang 3.9
Reviewed By: compnerd

Differential Revision: D3667327

fbshipit-source-id: f3ad04360068ee26aeec6f1c2dbe0ed96ba32ad0
2016-08-10 13:13:34 -07:00
Ben Nham 94ac3e4d08 fix static jsc build for ios
Reviewed By: dcaspi

Differential Revision: D3693192

fbshipit-source-id: dca500262e698e02c27c840e74c421ec6bc006fe
2016-08-10 04:28:26 -07:00
Michał Gregorczyk 5405aeb2a3 First step to boot rn apps with hot bytecode cache
Reviewed By: tadeuzagallo

Differential Revision: D3561565

fbshipit-source-id: dc1cf580d7b31f30939b180aec38d9b8d0dd0f58
2016-08-04 15:58:36 -07:00
Marc Horowitz 5d0131d31b Android instrumentation tests for C++ module sync methods.
Differential Revision: D3574896

fbshipit-source-id: 8cd4c55b7a472c77cc86fd5cbfe43bc4541ba6ba
2016-08-04 11:43:54 -07:00
Marc Horowitz e5ccdc4c2d add support for registering and calling sync methods in C++ modules
Differential Revision: D3574800

fbshipit-source-id: 4c238fd96c8f83e9424c8e2bf2c8ebb1d39d397a
2016-08-03 18:13:44 -07:00
Marc Horowitz da2684f0e7 Refactor CxxNativeModule out of android-specific code into common code
Differential Revision: D3574789

fbshipit-source-id: 0cb5965d20dcf7accb6a94514486b8fda1126b7b
2016-08-03 16:01:24 -07:00