Commit Graph

1011 Commits

Author SHA1 Message Date
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
Valentin Shergin 9395485822 Fabric: ContextContainer is now able to store any copyable values
Summary:
@public
Previously, ContextContainer could store only `shared_ptr`s, but now it wraps all values in own `shared_ptr` container.
I wish we can use `unique_ptr` here, but apparently we cannot because `unique_ptr` does not support type-erasure (`std::unique_ptr<void>` is illigal).
Becasue ContextContainer is not supposed to be used in hot paths, the performance aspect of that does not actually matter.

Reviewed By: mdvacca

Differential Revision: D8853446

fbshipit-source-id: e5d0a5595fe44c59f1395d6ffccf9d3fed923c83
2018-07-17 22:53:57 -07:00
Valentin Shergin 07a4a959a7 Fabric: Events related classes were moved to separate buck target
Summary:
@public
We need that because gonna add much more event-related stuff, so it deserves separate buck target.

Reviewed By: mdvacca

Differential Revision: D8831547

fbshipit-source-id: 616581b39b425a49302d5f7f86267e62b0d58389
2018-07-17 22:53:57 -07:00
Valentin Shergin 88b8616437 Fabric: Using `unordered_map` instead of `map` for RawProps
Summary:
@public
We don't need to maintain an order of this collection, so using `unordered_map` is more appropriate.

Reviewed By: mdvacca

Differential Revision: D8826946

fbshipit-source-id: f6890097cc5d6a1e06f6b2cfd1b7d68a388da461
2018-07-17 22:53:56 -07:00
Valentin Shergin 58da98149d Fabric: Support for optional `key` parameter to register/retrieve in ContextContainer
Summary:
@public
We need this in case when we want to store several intances of the same class in the container.

Reviewed By: mdvacca

Differential Revision: D8814808

fbshipit-source-id: 78ab15d78cf3878d03bf0a45bc42b968d87435e7
2018-07-17 22:53:56 -07:00
Valentin Shergin ec5b1fd259 Fabric: Optimized ShadowNode::replaceChild() with `suggestedIndex` argument
Summary:
@public
In most cases callsite knows probable index of replacing child node, hence it makes sense to provide this info to `replaceChild` to illuminate O(n) search in most cases.

Reviewed By: mdvacca

Differential Revision: D8814809

fbshipit-source-id: 0edf82878a72260365e2757beb3886ad07c7464d
2018-07-17 22:53:56 -07:00
Valentin Shergin e906d4cdc9 Simplifying child nodes management in YogaLayoutableShadowNode
Summary:
@public

This diff consists of many interdependent changes which support one simple idea: YogaLayoutableShadowNode is now using YGNode children to iterate on them (it previously relied on `ShadowNode::getChildren()`). All other changes are just an unavoidable consequence of that. Hence we don't need to filter child nodes every single time when we do layout anymore! The logic around `clone callback` is also drastically simpler now.
The new approach also implies that `LayoutableShadowNode` and `YogaLayoutableShadowNode` don't use `shared_ptr`s to refer to ShadowNode objects because new relationship does not imply ownership. No more `SharedShadowNode` objects in those two classes.

Reviewed By: mdvacca

Differential Revision: D8796159

fbshipit-source-id: 6f52f92d1826f3eb13b2f8a132c3ea77de155d82
2018-07-17 22:53:56 -07:00
Valentin Shergin 2d1fabbab2 Fabric: `SharedColor` for Android
Summary:
@public
On Android, a color can be represented as 32 bits integer, so there is no need to instantiate complex color objects and then pass them as shared pointers.  Hense instead of using shared_ptr, we use a simple wrapper class which provides a pointer-like interface.

Reviewed By: mdvacca

Differential Revision: D8742014

fbshipit-source-id: 14109b61fd84a34989538a15bc6fe4e2a8ce83a6
2018-07-17 18:17:27 -07:00
Valentin Shergin 732c3a4f4e Fabric: Propper support for `accessibilityLabel` in RCTParagraphComponentView
Summary:
@public
This approach is basically copying exising implementation that we have in RCTTextView (D5806097).
Changes in `AttributedString` is quite trivial.

Reviewed By: mdvacca

Differential Revision: D8740000

fbshipit-source-id: 276afdf93d777f7ccb99ca8ee5a18a880de2acbf
2018-07-17 17:54:49 -07:00
Taras Tsugrii c68c3a53d4 Fix invalid build file syntax.
Summary: https://buckbuild.com/concept/skylark.html

Reviewed By: shergin

Differential Revision: D8878696

fbshipit-source-id: 33db539701fa84e7391be643f3eabb7e0224aa0b
2018-07-17 17:33:12 -07:00
David Vacca 46164324cd Exclude ios dependencies from Android build in fabric C++
Summary: This diff updates the buck dependencies from fabric to allow cross platform usage

Reviewed By: shergin

Differential Revision: D8755155

fbshipit-source-id: 8501463bb22e5b86e6ad8b6c9f621251c6b6d55a
2018-07-17 01:46:45 -07:00
Valentin Shergin e9e20e6c83 Fabric: <Root> component was decoupled from <View>
Summary:
@public
There is no reason to have it inside View; it deserves that.

Reviewed By: mdvacca

Differential Revision: D8757012

fbshipit-source-id: 881b54008b51614cd203ab97811494fa7c30e4ef
2018-07-15 16:52:26 -07:00
Valentin Shergin 95bd4a0a9e Fabric: `activityindicator` module was moved to `components` subdirectory
Summary:
@public
Trivial. We move all components into `/components/` subdirectory.

Reviewed By: mdvacca

Differential Revision: D8757015

fbshipit-source-id: 9b676728bf1aa4aa14345fa11a5b4a1f9f7ed472
2018-07-15 16:52:26 -07:00
Valentin Shergin 57b0e68a2c Fabric: `view` module was moved to `components` subdirectory
Summary:
@public
Trivial. We move all components into `/components/` subdirectory.

Reviewed By: mdvacca

Differential Revision: D8757011

fbshipit-source-id: 6a7da09e01184d41d37a1e1782c20d3c79371ae3
2018-07-15 16:52:26 -07:00
Valentin Shergin b42e674c2f Fabric: `scrollview` module was moved to `components` subdirectory
Summary:
@public
Trivial. We move all components into `/components/` subdirectory.

Reviewed By: mdvacca

Differential Revision: D8757013

fbshipit-source-id: fe3021862b3a4f8f0799b0dfaf6d3039f8582a7f
2018-07-15 16:52:26 -07:00
Valentin Shergin ecbe9acbaa Fabric: `text` module was moved to `components` subdirectory
Summary:
@public
Trivial. We move all components into `/components/` subdirectory.

Reviewed By: mdvacca

Differential Revision: D8757014

fbshipit-source-id: 9db94d38fe027e9125d017a17cbd4cf79f0bcf88
2018-07-15 16:52:26 -07:00
Valentin Shergin 2c28310267 Fabric: Computed attributed string caching inside <Paragraph>
Summary:
@public
Quite trivial. We had to have this from the day one.
We don't need cache invalidation policy because all subtree is immutable.

Reviewed By: mdvacca

Differential Revision: D8709973

fbshipit-source-id: bd7fcf0ae1dcb23894321cb5d16da18cb1ab788f
2018-07-15 16:52:26 -07:00
Valentin Shergin 0532e01d69 Fabric: Enhancements in ContextContainer
Summary:
@public
Everything is better with C++ templates.
In this cases templates allow us to remove additional parameters and casts on the callsite.

Reviewed By: mdvacca

Differential Revision: D8754523

fbshipit-source-id: 2340b2cd96ab0a60d54d9aa30dea3c072b951a8a
2018-07-15 16:52:26 -07:00
Valentin Shergin 7a7f9601bc Fabric: ShadowNode::getSourceNode() was finally removed
Summary:
@public
Trivial.

Reviewed By: mdvacca

Differential Revision: D8753905

fbshipit-source-id: 0a0e351dc0f8ff52e685c7d7dc79d0185cfac711
2018-07-15 16:52:26 -07:00
Valentin Shergin e78bf723bf Fabric: Removed last two plactical usages of `ShadowNode::sourceNode_`
Summary:
@public
 * In case of `ShadowTree` we just pass original old node as a `commit` method argument;
 * In case of `ConcreteViewShadowNode` we just don't need that because diffing algorithm does not use that information anymore.

Reviewed By: mdvacca

Differential Revision: D8753906

fbshipit-source-id: b8555083c7e72e9b3c0f9a8065745946d4cf44c7
2018-07-15 16:52:25 -07:00
Valentin Shergin fcd72bf34a Fabric: Generalizing cloning of YogaLayoutable approach
Summary:
@public
Non-null owner pointer in Yoga node indicates that this node is already being used by some other subtree, so it must be cloned in case of possible (re)layout.
Theoretically, this node must/can be cloned by Yoga right before applying a new layout to this node, but Yoga has a special optimization that uses that fact that Yoga always cloning *all* children of a particular node altogether. This is not true for React; to meet React and Yoga worlds we double check the owner pointer in `addChild` and clone node preliminary if needed.
See also the previous diff for more context.

Reviewed By: mdvacca

Differential Revision: D8709952

fbshipit-source-id: 84ef0faa0f1d9cc9a8136b550cf325bc20508d53
2018-07-15 16:52:25 -07:00
Taras Tsugrii 12d98db901 Fix conditional load usage.
Summary:
Conditional `load` statements are not allowed in new Buck build file parser - Skylark.
https://buckbuild.com/concept/skylark.html

Reviewed By: mzlee

Differential Revision: D8842756

fbshipit-source-id: f22dff00f594978e4cab5736268ad3225182c39b
2018-07-14 18:32:20 -07:00
Taras Tsugrii 6b1d99686d Skylarkify jni_instrumentation_test.
Summary: https://our.intern.facebook.com/intern/wiki/Buck/python-to-skylark/

Reviewed By: mzlee

Differential Revision: D8842575

fbshipit-source-id: 2de5efa8b00397e751f6c213b8c8630deea21f00
2018-07-13 15:03:15 -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
Valentin Shergin e8ec1cb16a Fabric: The diffing algorithm does not use source nodes anymore
Summary:
@public
... and it's as efficient as it was before.

The previous version of the algorithm used `sourceNode` reference to know the previous state of the node to call the algorithm recursively.
That wasn't so good because of several reasons:
 - It was fragile because we had two different sources of the truth of the "previous state of the tree": committed tree and source node pointer;
 - We had to store weak pointers to source nodes inside cloned nodes. That is not free in terms of performance;
 - The old approach introduced a constraint that all previously used and now reinserted nodes must be cloned to update source node (otherwise, the algorithm would regenerate instructions recreating already existing subtrees);
 - That cloning required access to `isSealed` flag which is supposed to be a debug-only thing (that actually affects performance and must be compile-out for release builds).

The new approach compares nodes with same react tag and naturally cloning-artifacts resilient.

Yes, the new approach uses a map of inserted nodes, but the previous one already had it (otherwise there is no way to tell which nodes should be "deleted"). And anyway, this is a very little map that exists for a very little period of time.

Reviewed By: mdvacca

Differential Revision: D8709953

fbshipit-source-id: 027abb326cf45f00f7bb0bbd7c4e612578268c66
2018-07-06 14:49:07 -07:00
Valentin Shergin e0e9c1549e Fabric: Improved prettyprinting of TreeMutationInstruction
Summary:
@public
Quite trivial... and nice.

Reviewed By: mdvacca

Differential Revision: D8709951

fbshipit-source-id: 63e53eb85361fe3a0a0ecd7f21bf4c7db049d5bf
2018-07-06 14:49:06 -07:00
David Vacca 6292e2707a Revert order of Remove Mount Item operations
Summary: Revert the order of "remove mount items", to ensure views are removed from high index to low index.

Reviewed By: shergin

Differential Revision: D8742796

fbshipit-source-id: 6e04c39386d290bf3958ee83256d4fbe23e2c4ca
2018-07-06 09:17:34 -07:00
Kevin Gozali a09c464585 iOS: avoid crash because of null eventTarget
Summary: We were supposed to pass in proper eventEmitter, but passed in one with null eventTarget instead, causing assertion failures when dispatching event.

Reviewed By: sebmarkbage, shergin

Differential Revision: D8720793

fbshipit-source-id: 891f3b2a2c76a6dd3e40039623c6e86991aad50b
2018-07-02 18:02:35 -07:00
Valentin Shergin ee535fafe3 Fabric: Making `fabric/textlayoutmanager` compilable on Android
Summary:
@public
This compiles, but it works only on iOS for now.

Reviewed By: mdvacca

Differential Revision: D8655540

fbshipit-source-id: 7e9a73fadb317dd62298af6f347344ac4229a8a5
2018-07-01 21:37:00 -07:00
Valentin Shergin 5786db3a26 Fabric: Making `fabric/graphics` compilable on Android
Summary:
@public
This compiles but this does not work.
To make it actually work we have to implement all missing functions in `Color.cpp` and co.

Reviewed By: fkgozali

Differential Revision: D8655537

fbshipit-source-id: 564fb7131445af81cf05407239dc6ba870cf6b83
2018-07-01 21:36:59 -07:00
Sebastian Markbage 5d9326be29 Remove instanceHandle, pass event target instead + add dispatchToEmptyTarget
Summary:
Removes the concept of instance handle. Instead we pass the event target
to createNode and don't pass it to subsequent clones.

The life time of the event target is managed by native (the event emitter).
It has to be released manually.

Reviewed By: shergin

Differential Revision: D8688330

fbshipit-source-id: e11b61f147ea9ca4dfb453fe07063ed06f24b7ac
2018-06-29 15:32:27 -07:00
Valentin Shergin 62f9ced099 Fabric: Subtle changes that make GCC compiler happy
Summary:
@public
Most of them are legit issues which should not be compilable anyways (but Clang tolerates thems).

Reviewed By: mdvacca

Differential Revision: D8655539

fbshipit-source-id: 645729fb9d6a120ce1ab2b07542abcdacd72320d
2018-06-29 12:18:27 -07:00
Valentin Shergin 712c2ed5d2 Fabric: Getting rid of `std::to_string()`
Summary:
@public
Suddenly, it is not supported on Android.
Luckelly `folly:to<std::string>()` is as good as `std::to_string()`.

Reviewed By: mdvacca

Differential Revision: D8655538

fbshipit-source-id: 2b3b970f6a261253aaa6b22dba8338dc66b7195d
2018-06-29 12:18:27 -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
Valentin Shergin 80f7891287 Fabric: Embracing non-trivial default values of some Props
Summary:
@public
This is follow up for D8601600 and D8247652 (the last one has detailed explanation of the problem).
From this commit I propose that we have to follow simple rule:
If some prop has a default value which differs from the default value of its type, we have to specify it as {<value>} in .h file and explicitly in .m file, for all other props the default value must not be specified explicitly (in .h files it must be specified as {}).
The reason is that we have to embrase those cases and establish behaviour: if we change the default value in .h file, it always means that we have to change the value in .cpp file too.

Reviewed By: fkgozali

Differential Revision: D8601776

fbshipit-source-id: 3379aace4e2d72febb2b942a3da1cb24decf54be
2018-06-26 11:48:13 -07:00
Valentin Shergin 97bc0c03ba Fabric: `fromDynamic` for float numbers was moved to `core` module
Summary:
@public
Otherwise, it can mess with implementation for `int`s and causes some errors where `float` implementation was requested but `int` was applied.

Reviewed By: mdvacca

Differential Revision: D8601752

fbshipit-source-id: cfe51b7785ff29ee4ad88f0f1cbfed335557d5ef
2018-06-26 11:48:12 -07:00
Taras Tsugrii 71cd2d79ec Move conditional logic into corresponding build defs.
Summary:
Conditional `load`s are not allowed in Skylark. The logic
that belongs to different environments has to be part of environment
specific build defs and include as part of cell resolution or CI
configuration.
More context: https://buckbuild.com/concept/skylark.html

Differential Revision: D8604673

fbshipit-source-id: 385f2e155c4d80219e6ed3a2e0a82c909ebabb13
2018-06-24 14:46:38 -07:00
Kevin Gozali 1dced3448a iOS: implement <PerformanceLoggerFlag> component
Summary: This is basic impl of <PerformanceLoggerFlag> component without any layout/mounting computation, just TTI.

Reviewed By: shergin, mdvacca

Differential Revision: D8598983

fbshipit-source-id: b938753d6396088735cbbeab26d69c9aaa45608e
2018-06-24 14:17:37 -07:00
Valentin Shergin 802a371c92 Fabric: Fixed missed default value in parsing constructor of ViewProps
Summary:
@public
It fixes a problem when some Views got disaper after they have non-zero opacity.

Reviewed By: mdvacca

Differential Revision: D8601600

fbshipit-source-id: 3da3ee591d4a685a8d7a56b15519d4d5cae4a031
2018-06-23 19:16:09 -07:00
Taras Tsugrii 346ac75ed6 Fix deprecated glob usage.
Summary: https://our.intern.facebook.com/intern/wiki/Buck/python-to-skylark/

Differential Revision: D8595731

fbshipit-source-id: 0e3046a7fd2a25e9b13462713ae9a008ad546770
2018-06-23 18:33:48 -07:00
Valentin Shergin 6942408a47 Fabric: Dispatching `onLayout` events to only nodes which requested it
Summary:
@public
The current Fabric architecture, in general, does not support "subscribing" for events, so all kinds of events are always delivered no matter have JavaScript components `on`-handlers for them or not.
At this point, we are not sure should it be this way or not. But we are sure that for some extremely noisy events (like onLayout) we have to make an exception right now (otherwise overall performance will suffer).
So, this diff implements that for `onLayout`.

Reviewed By: fkgozali

Differential Revision: D8597408

fbshipit-source-id: 6933b7cb96e24f0660bd7850b625ff27e3146a2b
2018-06-22 18:46:39 -07:00
Valentin Shergin 250cc3c594 Fabric: Fixed order of instructions in Differentiator
Summary:
@public
Previously Differentiator might generate some `remove` instruction that refers to already `deleted` node. That diffs fixes that.

Reviewed By: fkgozali

Differential Revision: D8596536

fbshipit-source-id: 88117962f93e52167dbcb6525f2cc36758a367e7
2018-06-22 15:34:47 -07:00
Valentin Shergin 483c45cff0 Fabric: Shadow node shallowing was removed from preventive cloning in UIManager
Summary:
@public
We do preventing cloning in UIManager especially to add a layer to Shadow Node source chain,
so apparently there is no point illuminate that by calling `shallowSourceNode`.

Reviewed By: fkgozali

Differential Revision: D8585163

fbshipit-source-id: 3743edc30bf2183c420fd79ce1e59d68ceaa278b
2018-06-22 11:57:41 -07:00
Valentin Shergin af75d93dad Fabric: Bunch of unimplemented yet component was aliased to <View>
Summary:
@public
We need this temporary for testing until we support them all.

Reviewed By: mdvacca

Differential Revision: D8552361

fbshipit-source-id: 25f48cebcf5a665a24b92803dd7738f947ca74b2
2018-06-22 11:57:41 -07:00
Valentin Shergin 36c052ad96 Fabric: Default support of `displayType` and `layoutDirection` layout metrics
Summary:
@public
Quite trivial.

Reviewed By: mdvacca

Differential Revision: D8528922

fbshipit-source-id: 1e21f988317eecc7aa659fd9b51600b9e2b7d69f
2018-06-22 11:57:40 -07:00
Valentin Shergin 803c14bd98 Fabric: Support for uniformed borders of <View>
Summary:
@public
For now we only support trivial uniformed (all sides are equal) border rendering (which can be direclty mapped to CALayer features).
Support of the more complex and fancy borders is comming soon.

Reviewed By: mdvacca

Differential Revision: D8528923

fbshipit-source-id: 0883cdc2b855fc63d399e1a93010f259f0628f48
2018-06-22 11:57:40 -07:00
Valentin Shergin ad78971569 Fabric: Added support of `accessibilityCustomActions` for <View>
Summary:
@public
Another small but important piece of Accessibility Support.

Reviewed By: mdvacca

Differential Revision: D8528921

fbshipit-source-id: d4ba87bab702d76a90e9ddb751999193243cdc74
2018-06-22 11:57:40 -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
Valentin Shergin 8ef539e0c2 Fabric: `fromDynamic`: Parsing vector type when source has no array
Summary:
@public
If some prop has `std::vector` type, it possible that on JS side we want to pass just one element of the array.
And in this case we sometimes drop array initialization (`[]`) part, so instead of passing `[{x:1, y:1}]` we pass `{x:1, y:1}`.
This diff adds support for that.

Reviewed By: mdvacca

Differential Revision: D8526572

fbshipit-source-id: 33d4369ac48cac3eb1c534f477d8259e76e0c547
2018-06-22 07:32:50 -07:00
Valentin Shergin b09457b4d2 Fabric: <Image> component, xplat part
Summary:
@public
This diff implements basics of cross-platform part of <Image> component.
Known issues:
- Events does not work yet.
- Some quite specific image source parameters (like custom http headers) are not supported yet.

Reviewed By: fkgozali

Differential Revision: D8526575

fbshipit-source-id: ecc97d9fda2b2e65bb1b079af057f8e176a161e5
2018-06-22 07:32:50 -07:00
Valentin Shergin 979ea2094e Fabric: Introducing ImageManager
Summary:
@public
ImageManager coordinates all work related to loading image bitmaps for <Image> component.
The particular iOS implementation uses RCTImageLoader from RCTImage module under the hood.

Reviewed By: fkgozali

Differential Revision: D8526571

fbshipit-source-id: a0d927972d30113eed6e0cd169fceee17610181d
2018-06-22 07:32:49 -07:00
Valentin Shergin eabf29e320 Fabric: Getting rid of many `auto &&`
Summary:
@public
After reading about move-semantic and rvalue refs I realized that we (I) definitely overuse  `auto &&` (aka universal reference) construction. Even if this is harmless, does not look good and idiomatic.
Whenever I used that from a semantical point of view I always meant  "I need an alias for this" which is actually "read-only reference" which is `const auto &`.
This is also fit good to our policy where "everything is const (immutable) by default".
Hence I change that to how it should be.

Reviewed By: fkgozali

Differential Revision: D8475637

fbshipit-source-id: 0a691ededa0e798db8ffa053bff0f400913ab7b8
2018-06-22 07:32:49 -07:00
Valentin Shergin c674303dfd Fabric: Introducing `ContextContainer`
Summary:
@public
`ContextContainer` is general purpose DI container for Fabric.
We need this to communicate some enviroment-specific and/or platform-specific modules down to cross-platform C++ code.
The first one will be ImageManager. Soon.

Reviewed By: fkgozali

Differential Revision: D8475636

fbshipit-source-id: 0afc65063f818d0bab736cd2c55c6fdd21b629ac
2018-06-22 07:32:49 -07:00
Valentin Shergin 0a20f47021 Fabric: Proxying `pointScaleFactor` to Yoga Config
Summary:
@public
This diff changes how we store and manage Yoga Config in layoutable shadow nodes.
Previously we have `shared_ptr` to single shared yoga config (one to many relationships); now we initiate and store yoga config with yoga node (one to one relationship).
Cons:
 - Less memory efficient.
Pros:
 - Much more flexible model. Configuration can be tweaked on a per-node basis.
 - More performant. Dealing with `shared_ptr` is expensive because of atomic ref-counter. (This is not really applicable for the previous approach but would be applicable for any alternate approach where we want to have more granular control of the configuration.) Data locality is also great in the new model which should positively impact performance.
 - Simplicity. Any alternate approach where we manage sets of nodes which share the same configuration is going to be quite complex.

Reviewed By: fkgozali

Differential Revision: D8475638

fbshipit-source-id: 5d73116718ced8e4b2d31d857bb9aac69eb69f2b
2018-06-22 07:32:49 -07:00
Valentin Shergin a3f9ff4f93 Fabric: `pointScaleFactor` is now part of LayoutContext and LayoutMetrics
Summary:
@public
... and we initalize this in Surface.
We need this for requesting images with proper size/pixel-density, setup proper parameters for rasterizing CALayer's and rounding layout metric values.
Then we have to figure out how to wire this up with YGConfig.

Reviewed By: fkgozali

Differential Revision: D8475639

fbshipit-source-id: cec7af581b94efb4595dcf3f232252ce87a1fde3
2018-06-22 07:32:49 -07:00
Valentin Shergin eff76d237b Fabric: Using proper encoding for converting user-facing strings to NSString
Summary:
@public
Trivial.

Reviewed By: fkgozali

Differential Revision: D8473507

fbshipit-source-id: 49c9e66dc6b32b0a5208aeb4c2fb68fbe1f71738
2018-06-22 07:32:49 -07:00
Kevin Gozali 20a8673b48 iOS: create EventTarget when creating EventEmitter and keep it until the emitter is deallocated.
Summary:
@public
There are some race conditions between VM objects getting deallocated and the instanceHandle held by the eventEmitter can point to deallocated memory space, causing undefined behavior like a crash.
For now, keep a strong ref to the eventTarget inside EventEmitter to avoid that scenario. This is a temporary workaround.

Reviewed By: shergin

Differential Revision: D8576785

fbshipit-source-id: 87ef36f716270ceca906b32bb86e0046ceaca19e
2018-06-21 14:35:39 -07:00
Valentin Shergin 9a59428468 Fabric: Fixed `Identity Transform` matrix literal
Summary:
@public
As Janic janicduplessis mentioned on GH the literal should be slightly different.
8df7d51600 (r29390543)

And here is prooflink: https://developer.apple.com/documentation/quartzcore/calayer/identity_transform?language=objc

Thanks Janic!

Created from Diffusion's 'Open in Editor' feature.

Reviewed By: fkgozali

Differential Revision: D8508559

fbshipit-source-id: 7427be36e041bf500bee1e06d2293f7b5ea8cf21
2018-06-18 23:02:41 -07:00
Valentin Shergin 310a2850c5 Fabric: Universal `fromDynamic` for `std::vector<...>`
Summary:
Now, if `fromDynamic` is defined for some type, `fromDynamic` for `std::vector` of this type is also will be defined.
We need this for parsing `ImageSources` (a vector of `ImageSource`) type.

Reviewed By: fkgozali

Differential Revision: D8473508

fbshipit-source-id: d8dc8e3a3273f35b76c7132c553130762f768394
2018-06-17 21:46:22 -07:00
Valentin Shergin d92601be05 Fabric: Improved parsing EdgeInsets and CornerInsets styles
Summary: In case if it's just a number, it is treated as unified insets now.

Reviewed By: mdvacca

Differential Revision: D8473510

fbshipit-source-id: 1034377bc3e4abe55778c2f182360345419f00d5
2018-06-17 21:46:22 -07:00
Valentin Shergin c1e0ea9d38 Fabric: Fixed erratum in "borderRadius" prop name
Summary: Trivial.

Reviewed By: mdvacca

Differential Revision: D8473506

fbshipit-source-id: ce2888edc1052f39a042904c02b3ac347feedbba
2018-06-17 21:46:22 -07:00
Valentin Shergin dca2067b71 Fabric: Fixed error in parsing translateX/translateY prop
Summary: Quite trivial.

Reviewed By: mdvacca

Differential Revision: D8473513

fbshipit-source-id: 5d20244cbaae5ea69c79379e9894adb05cef2eb5
2018-06-17 21:46:22 -07:00
Valentin Shergin 3b20a16703 Fabric: Fixed error in parsing `position` style
Summary: This style/prop is called `position` (not `positionType`) in RN/JS API.

Reviewed By: mdvacca

Differential Revision: D8473509

fbshipit-source-id: f381189e05e6b618f3c74f1bc4610e737981b388
2018-06-17 21:46:22 -07:00
Valentin Shergin 8df7d51600 Fabric: Transform type and <View transform/> prop
Summary: The matrix magic and parsing approach are mixins between current iOS and Android implementation.

Reviewed By: fkgozali

Differential Revision: D8344054

fbshipit-source-id: 524b48c5ab61959ce740373534d0d435eb37b647
2018-06-15 11:47:39 -07:00
Valentin Shergin da55ef1367 Fabric: Definition of the rest <View> props on C++ side
Summary:
Just definition; we don't have an implementation on the native view layer yet.
And we don't have `transform` prop yet (because it's quite complex).

Reviewed By: fkgozali

Differential Revision: D8344058

fbshipit-source-id: 3b7b41480be8295cbc90b95ebe8562e52c6f81d7
2018-06-15 11:47:39 -07:00
Valentin Shergin f65e4e0174 Fabric: Implemetation of <Switch> component
Summary:
This is pretty straightforward implementation uses native `UISwitch`.
Suddenly we need Switch to test a bunch of other things.

Reviewed By: fkgozali

Differential Revision: D8344055

fbshipit-source-id: cfc51b8bc11198eb9d4d5e4745b96fb3a7f14de1
2018-06-15 11:47:39 -07:00
Valentin Shergin e311fbb797 Fabric: CornerInsets: Graphical primitive for rect-corner-specific values
Summary: CornerInsets is something like EdgeInsets but about corners instead of edges.

Reviewed By: fkgozali

Differential Revision: D8344062

fbshipit-source-id: 9bf7a8696fba96e3124cb15e8e84093c1f4f8747
2018-06-15 11:47:39 -07:00
Kevin Gozali cb19621dfe Implementation of JS reload without crashing
Summary:
On JS reload the FabricUIManager and EventDispatcher didn't get release due to a retain cycle. This breaks the cycle.

In addition, force release the Scheduler on reload so that the stale classes get cleaned up properly, avoiding crashes. Also the surface now remounts the content correctly

Reviewed By: shergin

Differential Revision: D8414916

fbshipit-source-id: 4b14031f29b3bc9987d7aa765dc0d930a7de2b1e
2018-06-15 11:02:17 -07:00
Kevin Gozali 2ca4770011 fabric: send events via JS thread
Summary: Calling the event emitters on the main thread seems to be problematic, so let's dispatch it via the JS thread. This requires some changes to make "eventTarget" single-use because otherwise the binding would need to synchronize the actual JS call with the act of releasing the target.

Reviewed By: shergin

Differential Revision: D8375291

fbshipit-source-id: bd2b42731176ae209f4a19c232309c163fb1c01b
2018-06-15 11:02:17 -07:00
Kevin Gozali 119fd1efe7 iOS: Fixed some props conversion errors
Summary:
* numbers in JS are doubles in native land, since there's no notion of int or int64 in JS - so simply convert numbers to int instead of assuming it's int
* the parsing of Yoga props with `'...%'` string value has a bug: it should be copying the number instead of the `%`

Reviewed By: shergin

Differential Revision: D8370873

fbshipit-source-id: 44e9e3f0530c000c963e8e9ca66e8b0a48d80bcd
2018-06-11 20:01:42 -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 f573ea8a66 iOS: fix fabric core test
Reviewed By: shergin

Differential Revision: D8344613

fbshipit-source-id: 10c604e7fbe2ff3b8c47babedea12a197c0c56b2
2018-06-09 21:52:13 -07:00
Valentin Shergin d49ebbcf62 Fabric: All *EventHandlers were renamed to *EventEmitter
Summary:
Using `EventHandlers` name was a bad idea, and I cannot tolerate it anymore.
The worst part of it is that when you have a collection of `EventHandlers` objects you cannot use plural word to describe it because `EventHandlers` is an already plural word.

And, this object is actually an event emitter, the thing on which we call events.

Reviewed By: fkgozali

Differential Revision: D8247723

fbshipit-source-id: b3303a4b9529bd6d32bb8ca0378287ebefaedda8
2018-06-09 13:16:45 -07:00
Valentin Shergin 7f1ed6848f Fabric: `convertRawProp` was extended to accept an optional default value
Summary:
During transforming raw prop (`rawProps[<prop>]`) to typed props (`MyProps.<prop>`) we can face three different cases:
 * `rawProps` collection has proper serialized value for the key. In this case, we have to set a new value of the typed prop converting value using `fromDynamic`.
 * `rawProps` collection does not have value for the key. In this case, we have to copy a value from source prop (`sourceValue`).
 * `rawProps` collection has `null` value for the key. This is the special case which means that the prop was removed from the particular component instance and we have to reset it to some *default* value (which is *not* the same as `sourceValue`). Now the default value of the `defaultValue` (sic!) argument is a default value of the type of the value (which may be different from logical default value).

We didn't handle the last case previously and this caused crashes (and unexpected behavior) because `fromDynamic` often cannot handle `null` value.

And yes, all this mean that we also have to update all `convertRawProp` call sites where logical default values are not equal to type-specific default values. This is a potential error-prone place, especially because now we have to specify logical default values in two places (in a prop declaration and in a parameterized constructor). And seems there is no way to avoid that without performance loss (because both of those places are basically constructors).

My hope is that codegen (where default values are also defined in JavaScript) will help with it eventually.

Reviewed By: fkgozali

Differential Revision: D8247652

fbshipit-source-id: 2cbe65f5f5cccd7a0d34aaa19e385aacebfe8cb1
2018-06-08 20:31:41 -07:00
Valentin Shergin d01290dd34 Fabric: Data model of Touch Events
Summary: The data model of Touch events and payload serialization. The implementation mimics W3C standard and current React Native implementation.

Reviewed By: fkgozali

Differential Revision: D8246711

fbshipit-source-id: 955b2068674f290d8bdb82da1ebfb796dd32971b
2018-06-08 20:31:40 -07:00
Valentin Shergin bb9bf26169 Fabric: Using exact UIFontWeight* constants instead of CGFloat
Summary: SUDDENLY, `-[UIFont systemFontOfSize:weight:]` returns incorrect result if `weight` is not exactly equal to any of built-in constants.

Reviewed By: fkgozali

Differential Revision: D8246712

fbshipit-source-id: 13d59cc8d66a4494437f28d791fd93fa83ebe6fb
2018-06-08 20:31:40 -07:00
Valentin Shergin 8b62e7a550 Fabric: Using Size instead of Point as textShadowOffset's type
Summary:
The current implementation of React Native uses `Size` as the underlying type of `textShadowOffset` which is clearly terribly wrong (especially because negative size values makes no sense). This mistake was borrowed from `NSShadow`, I believe.
I don't have time to fix this in every implementation of RN now, so let's use `Size` in Fabric as well.

Reviewed By: fkgozali

Differential Revision: D8246714

fbshipit-source-id: 1f0bf9b9dfa83802ef3faef2971fed5510494bfd
2018-06-08 20:31:40 -07:00
Robert Sayre 79c5b8eb97 Remove unused include. (#19548)
Summary:
`LayoutableShadowNode.cpp` includes `"LayoutableShadowNode.h"` as well as `<fabric/core/LayoutContext.h>`. In turn, `LayoutContext.h` then includes `<fabric/core/LayoutableShadowNode.h>`. `LayoutContext.h` doesn't actually require `LayoutableShadowNode.h`, but this unnecessary inclusion can cause duplicate definition errors if the two include paths don't map to exactly the same file. This patch removes the unnecessary include.

The CI's build system should cover the testing needed.

[INTERNAL] [MINOR] [fabric] - Remove an unnecessary include in fabric/core/layout.
Closes https://github.com/facebook/react-native/pull/19548

Differential Revision: D8313337

Pulled By: shergin

fbshipit-source-id: 2e01e29ff25131543d9a8601483c2e716c7437be
2018-06-07 08:36:37 -07:00
Marc Horowitz 83c990b25c make logMarker visible for consistency with logTaggedMarker
Differential Revision: D8240294

fbshipit-source-id: 8d056dc89adff41ff43c0df2f752b01ac1fb189f
2018-06-01 15:20:01 -07:00
Valentin Shergin ec265df1d2 Fabric: Removed unused type aliases
Summary: Trivial.

Reviewed By: fkgozali

Differential Revision: D8212287

fbshipit-source-id: 228951742568d28a064ee03b6314a4c01532b9c9
2018-06-01 09:37:46 -07:00
Valentin Shergin beb3fcda34 Fabric: The first version of event dispatching pipeline
Summary:
This is the first attempt to implement some base part of event dispatching pipeline from end-to-end.
Even when it is working, all this is still incomplete and generally up in the air. We are still messing proper implementation of event queue, priority, and synchronization of react reconciliation process with event scheduling.

Reviewed By: fkgozali

Differential Revision: D8212271

fbshipit-source-id: 92f9427d14726441c70ffff294ac95eeb004152a
2018-06-01 09:37:46 -07:00
Valentin Shergin 0fc5a91889 Fabric: Integrating `tag` into `EventHandlers`
Summary:
In order to dispatch event, `EventHandlers` must also know react tag. So we have to store it inside.
We plan to illuminate this requirement (and `tag` from `EventHandlers`) eventually.

Reviewed By: fkgozali

Differential Revision: D8211685

fbshipit-source-id: 2064c0f4a7869cbf4d2c92d0349f4ee3998cb8f5
2018-06-01 09:37:46 -07:00
Héctor Ramos da7873563b Migrate Android sources to MIT license header
Reviewed By: fkgozali

Differential Revision: D8065619

fbshipit-source-id: 719c303b40c96950bab8e5dde9a75f449b2956c6
2018-05-31 15:37:30 -07:00
Valentin Shergin b3b72bbdcf Fabric: Using types `EventTarget`, `EventHandler` & co. instead of `void *` everywhere
Summary:
Nothing actually changed besides type names... which actually helps me found an issue in FabricUIManager!
Now there is no a single `void *` in Fabric/C++ and JavaScript bindings. Yay!

Reviewed By: fkgozali

Differential Revision: D8191420

fbshipit-source-id: b1eb60b6bc34dd25ab200aab854ffbd7ccf5b15d
2018-05-29 15:03:57 -07:00
Dan Zimmerman 2bf47559b5 Export JSExecutor
Reviewed By: rzito

Differential Revision: D8187754

fbshipit-source-id: e0da3781e2b3e24cef04086d15e3f5394e059d30
2018-05-29 12:19:12 -07:00
Valentin Shergin 957ef606b9 Adding `Wrapper` suffix to `EventHandler` and `EventHandler` type names
Summary:
It's maybe not so important/crucial, but this thing bothers me a lot.
We use raw opaque `EventTarget`, `InstanceHandle` and `EventHandler` pointers in application layer quite a lot and we don't have any kind of type-safety here. I believe all those opaque types should be represented as named scalar types which compiler at least can differentiate at compile time.
So I propose introducing named aliases for them which will point to particular empty `struct`s. This will allow us to tag types properly in all functions and methods and ensure that we pass right values as right arguments.
Again, they are *just aliases*, which are effectively still `void *`, no any additional logic or names are involved.

Unfortunately, those nice type names are already taken by `JSIFabricUIManager` local anonymous namespace (even if they are inside anonymous namespace we cannot use them https://stackoverflow.com/questions/3673353/anonymous-namespace-ambiguity).  I think it's fair to rename them because... it's local. And we already use `Wrapper` suffix for them anyways.

Reviewed By: fkgozali

Differential Revision: D8181151

fbshipit-source-id: 9b55b43fb671a56b32a862ac54f78d528e1188ce
2018-05-29 11:41:49 -07:00
Andres Suarez d42697bcf3 Run buildifier over BUCK and TARGETS files
Reviewed By: scottrice

Differential Revision: D8163151

fbshipit-source-id: 700a77c09c6ab1bef8fd24a2a3133a4b50e3b3a3
2018-05-25 11:15:59 -07:00
Valentin Shergin 9b7f6abd87 Fabric: Support for `onLayout` event
Summary: `onLayout` event is fired when some layoutable node got inserted or updated (with changed layout) during commit phase.

Reviewed By: fkgozali

Differential Revision: D8119826

fbshipit-source-id: 831003c88fe5c4358a80328aa715be80e484b52e
2018-05-24 18:27:59 -07:00
Valentin Shergin 0be26092a5 Fabric: Wiring FabricUIManager with JS*FabricUIManager bindings
Summary: Now FabricUIManager is all you (or I) need to deliver an event.

Reviewed By: fkgozali

Differential Revision: D8086627

fbshipit-source-id: 70d783bee291f4c5d19650ac0768a5d2bd778961
2018-05-24 18:27:59 -07:00
Valentin Shergin b13add753b Fabric: Optimizing yogaNodeCloneCallbackConnector in case of correct childIndex
Summary:
YogaLayoutableShadowNode::yogaNodeCloneCallbackConnector is a hot path.
Previous implementation did not use provided `childIndex` which is correct for most cases.
See comments in code for more details.

Reviewed By: fkgozali

Differential Revision: D8070120

fbshipit-source-id: d1a6abe82688387752b66a57b13dc356abb22c96
2018-05-24 18:01:46 -07:00
Kevin Gozali 8bfe78c723 iOS: Support <ActivityIndicator> component
Summary: Setup for using <ActivityIndicator> component in Fabric.

Reviewed By: shergin

Differential Revision: D8107528

fbshipit-source-id: e3ba46d1538f5d5a2fa6f75639caaaa51156c452
2018-05-23 10:22:47 -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
Valentin Shergin 21189be7cb Fabric: ScrollView events
Summary: Note: Some features are not suported yet, e.g. event throttling.

Reviewed By: fkgozali

Differential Revision: D8082771

fbshipit-source-id: d60f6e9011283aeee7aff77dc9178e99f06deb5c
2018-05-22 16:31:59 -07:00
Valentin Shergin 20645681d1 Fabric: Support of accessibility events for <View> component
Summary: This also illustrates how we should use EventHandlers objects.

Reviewed By: fkgozali

Differential Revision: D8053357

fbshipit-source-id: cba084c8a871e40c7536720fce290c3467d33061
2018-05-22 16:31:58 -07:00
Valentin Shergin 2a3025da97 Fabric: Application layer of events infrastructure
Summary: This implements `EventHandlers` abstract class (aka "Events Guy") which encapsulates `eventDispatcher` and `instanceHandle` (and ownership of future `eventTarget`), all of this as part of existing {ShadowNode + Props + LayoutMetrics + LocalData + Descriptor + (and now) EventHandlers} infra. (We don't plan to add anything else to this model. Ever.)

Reviewed By: fkgozali

Differential Revision: D8053351

fbshipit-source-id: 1dd9ccbcbe5a2eb284b59ea351dc8beca645e8bf
2018-05-22 16:31:58 -07:00
Valentin Shergin d94a9e2640 Fabric: Composing YGNode object inside ShadowNode to avoid memory allocation overhead
Summary:
Given that fact that life-time of YGNode and ShadowNode objects must be idential and that we always allocate ShadowNode on heap,
we can embed YGNode object right inside ShadowNode object and use pointer to it safely.
That allows us to save additional memory allocation for every single layoutable shadow node! Whoo-hoo!

Reviewed By: fkgozali

Differential Revision: D8070121

fbshipit-source-id: 6eefbca1b7ac0a8aad235513b4c4899d414835f2
2018-05-22 15:48:17 -07:00
Sebastian Markbage 91f2ffed37 Back out "[JSC] Expose new methods to Custom/System JSC"
Reviewed By: fkgozali

Differential Revision: D8003558

fbshipit-source-id: 0b90153518f849f66d7c713f99cb44c79b27ca19
2018-05-22 09:53:54 -07:00
Kevin Gozali 55724bcc62 make <Image> fallback to <View> temporarily
Summary: <Image> support isn't there, so fallback to <View> instead of crashing.

Reviewed By: shergin

Differential Revision: D8086403

fbshipit-source-id: 16d7fd8023f93cbe25f2bc0f7d0a03e32cd402ce
2018-05-22 01:31:57 -07:00
Kevin Gozali 54489b91ab Fabric: Implementation of ShimmeringView aka <Shimmer>
Reviewed By: shergin

Differential Revision: D8016962

fbshipit-source-id: 5ec598e606f8e4bbf9e5c1db082d6a0b29bed3ee
2018-05-22 01:31:57 -07:00
Valentin Shergin f180300606 Fabric: Support for object notation in dynamic-to-Point/Size/Edges converstions
Summary: Trivial.

Reviewed By: fkgozali

Differential Revision: D8086650

fbshipit-source-id: 0850c799811f7cda2dd6786aada6222dcc28a3e4
2018-05-21 20:03:59 -07:00
Sebastian Markbage 18b8dbb9bb Wire up event handler bindings
Reviewed By: shergin

Differential Revision: D8068507

fbshipit-source-id: 26326416c0b04cd52dc53af5d91010a1b27e0ec7
2018-05-21 12:21:56 -07:00
Dmitry Zakharov 7c5845a5a2 Remove Native Extensions
Reviewed By: michalgr

Differential Revision: D8057885

fbshipit-source-id: 6af7f7729201d26a704adaadb15813979cd035f8
2018-05-21 12:21:56 -07:00
Taras Tsugrii 1a7682b2a1 Re-format BUCK to use recommended style.
Reviewed By: yfeldblum

Differential Revision: D8073585

fbshipit-source-id: 12322aebc09b89d5af9cc257b16c1bc0fbb066c1
2018-05-20 23:24:51 -07:00
Valentin Shergin 06b0dabaa7 Fabric: Deletion of unused files
Summary: We don't use them anymore.

Reviewed By: fkgozali

Differential Revision: D8048545

fbshipit-source-id: c92aa9ca13ac31eaead87a0982ed613710b7af57
2018-05-18 22:00:52 -07:00
Valentin Shergin caaea38ad9 Fabric: Using unique_ptr for storing YGNode inside YogaLayoutableShadowNode
Summary:
I recently realized (Thanks David!) that we should not use `shared_ptr` for storing YGNode*
because ShadowNode does not share ownership of the Yoga node with anybody.
So the lifecycle of shadow node and yoga node must be synchronized (this is already the case but changing to unique_ptr makes this explicit and a bit more performant).

Reviewed By: fkgozali

Differential Revision: D8030417

fbshipit-source-id: c7f85ea309598d2a5ebfed55b1d182d3fe1336ae
2018-05-18 20:34:18 -07:00
Sebastian Markbage 6cc597e6e4 Alternative Instance Handle Approach without JSWeakRef
Reviewed By: fkgozali

Differential Revision: D8003736

fbshipit-source-id: 597378555cc3f9c0ae95e8927460a3c813ebfb45
2018-05-18 20:22:45 -07:00
Kevin Gozali 0afc70b24a iOS: Introduced ComponentDescriptorFactory to provide app specific component registry
Summary: Each app has its own set of components to support, so this mechanism allows each of them to customize the set. Core library only provides the signature (.h file) without any impl.

Reviewed By: shergin

Differential Revision: D8065360

fbshipit-source-id: c123397afda678e84f1d1fa41a6393f25b2c15e1
2018-05-18 19:46:32 -07:00
Valentin Shergin cc09d21e60 Fabric: Simplifying usage of `ConcreteComponentDescriptor`
Summary:
Now ConcreteComponentDescriptor can infer `ComponentName` from `ShadowNodeT` automatically,
so in the most cases we even don't need to create a subclass of that.

Reviewed By: fkgozali

Differential Revision: D8016965

fbshipit-source-id: d910597093c9f4c9f32ca06cb3ef1b12538b9543
2018-05-17 20:28:50 -07:00
Valentin Shergin 8f507280ac Fabric: Removing default arguments from ShadowNode's constructors
Summary: We don't use them at all; moreover they complicate adding/changing signatures of those methods (because arguments with defaults must be grouped at the end and some arguments cannot have defaults).

Reviewed By: fkgozali

Differential Revision: D7981456

fbshipit-source-id: d7dd098e83630d1ab3342d2ca52ade9c4e27b2c3
2018-05-17 20:28:50 -07:00
Valentin Shergin 15cb6540c1 Fabric: ScrollView, the native part
Summary: Note: not all scrollview props and features (especially event listeners and imperative calls) are supported yet.

Reviewed By: fkgozali

Differential Revision: D7961868

fbshipit-source-id: 5277674fe976e089fd963066f78e705ad846d78d
2018-05-17 20:28:50 -07:00
Valentin Shergin bd99d3a6f4 Fabric: ScrollView: xplat part (shadow node, props, localdata, descriptor)
Summary:
All the props of a scrollview, and local data.
LocalData part is probably the most interesting: with it we precompute content size which we use inside native scrollview. Previously we rely on some assumptions like "ScrollView must have only one subview" instead, and that was not so efficient and straight-forward.

Reviewed By: fkgozali

Differential Revision: D7961869

fbshipit-source-id: fa070b8423a3e7739aeb62220e51213683e1a223
2018-05-17 20:28:50 -07:00
Valentin Shergin e3a3999b75 Fabric: ScrollView: primitives and buck target
Summary: Trivial.

Reviewed By: fkgozali

Differential Revision: D7961870

fbshipit-source-id: 3cfd92bd441dbf516ade777e6428924e9634257a
2018-05-17 20:28:50 -07:00
Kevin Gozali 128c9343c4 iOS: fix up RNTesterPods
Summary:
A few fixes:
* missing include: folly/Optional.h
* switch folly::Optional's `has_value()` to `hasValue()` for now until folly is upgraded to newer version
* fix up import for RCTTextAttributes.h
* fix up includes for "conversions.h" to use namespaced includes

Reviewed By: mmmulani

Differential Revision: D8021149

fbshipit-source-id: d3955986d3ab6b1d9b61ac1e385767893ce57e5e
2018-05-16 14:14:41 -07:00
Valentin Shergin 48dccf18b8 Fabric: Making logging in FabricUIManager optional
Summary: Trivial.

Reviewed By: fkgozali

Differential Revision: D7961186

fbshipit-source-id: 703fa3b336e093c430d32ab08eafc42b1f590f32
2018-05-15 23:58:59 -07:00
Valentin Shergin 30d08ea8a4 Fabric: `EdgeInsets` from `dynamic` conversion
Summary: We will need this for several components, first of all for ScrollView.

Reviewed By: fkgozali

Differential Revision: D7958246

fbshipit-source-id: 364b939abe8f0734376448149bbdc735abd00189
2018-05-15 23:58:59 -07:00
Valentin Shergin 545f087b46 Fabric: Several helper functions for `react::Rect`
Summary: Trivial. We will need them soon at least for ScrollView.

Reviewed By: fkgozali

Differential Revision: D7958244

fbshipit-source-id: ce92c6e6181181ac17d817292af18ffa46a4d975
2018-05-15 23:58:59 -07:00
Valentin Shergin 57d69772b7 Fabric: Improved signature of `calculateMutationInstructions`
Summary: Apparently, `calculateMutationInstructions` must also produce mutation instructions for root node as well. To make it possible we have to change the signature of the function and weak some restrictions in TreeMutationInstruction.

Reviewed By: fkgozali

Differential Revision: D7958248

fbshipit-source-id: 4109a6bce3a77f7eb89157201fd0e80f98487dbd
2018-05-15 23:58:59 -07:00
Valentin Shergin 10c5368c37 Fabric: Fixed issue where root shadow node does not layout itself
Summary: Conceptually, it always must be node owner's responsibility, but for the root node, we have to make an exception because there is no another parent node and there is no another component which has access to YogaNode.

Reviewed By: fkgozali

Differential Revision: D7958251

fbshipit-source-id: 0bdaea87adbd323c758bc3c28f325be615aa90f3
2018-05-15 23:58:59 -07:00
Kevin Gozali 4a0243fcd3 iOS: whitelist a few components for testing purpose
Reviewed By: mmmulani

Differential Revision: D7999459

fbshipit-source-id: e56946931997cb51ee66020a97c60f3c85d1d348
2018-05-15 09:28:41 -07:00
Kevin Gozali 42fc87eb8d remove unnecessary ExceptionManager abstraction
Reviewed By: sebmarkbage

Differential Revision: D8002124

fbshipit-source-id: 4e0bce9686549d0dd7b59b1323efd11ea168855b
2018-05-14 20:45:21 -07:00
Sebastian Markbage 4ef099679d Expose new methods to Custom/System JSC
Reviewed By: fkgozali

Differential Revision: D7998298

fbshipit-source-id: f20d5b961db1cc31880d383a67d8bba40dd8008f
2018-05-14 18:58:05 -07:00
Valentin Shergin 858f7f8331 Fabric: Improved printing of Yoga's `Edges` data structure
Summary:
Yoga represents concepts like `margin`, `padding` and `position` as `edges` (aka std::array<YGValue, YGEdgeCount>).
This diff improves conversion of this data structure to string (primarily for debugging purposes).

Reviewed By: fkgozali

Differential Revision: D7958241

fbshipit-source-id: 6931c7b5d2395c28821c8daef62f609b13f112c6
2018-05-14 16:03:49 -07:00
Valentin Shergin 1f9676a1cb Fabric: Final cleanup of define-based props treatment
Summary: Oh, my! No more `#define`s related to props conversions and debug-printing.

Reviewed By: fkgozali

Differential Revision: D7958250

fbshipit-source-id: 86950070c55f134aa3a575b9fd68fc90d865cf44
2018-05-14 16:03:49 -07:00
Valentin Shergin 120dcec621 Fabric: New props treatment in `core` module
Summary:
Same as previous one.
Adopting template-generated `convertRawProp` and `debugStringConvertibleItem` functions in `core` module.
Note, to do so we have to change signatures of some conversions functions to make them more overloading-friendly.

Reviewed By: fkgozali

Differential Revision: D7958243

fbshipit-source-id: 500ee420d9aa562ee3c5810ef625e06541eda8fb
2018-05-14 16:03:49 -07:00
Valentin Shergin c19649cc16 Fabric: New props treatment in `view` module
Summary:
Same as previous one.
Adopting template-generated `convertRawProp` and `debugStringConvertibleItem` functions in `view` module.
Note, to do so we have to change signatures of some conversions functions to make them more overloading-friendly.

Reviewed By: fkgozali

Differential Revision: D7958242

fbshipit-source-id: 10199d1fbb43329de93604aa383c884f5cc64dc5
2018-05-14 16:03:49 -07:00
Valentin Shergin 9f85873c9f Fabric: New props treatment in `graphics` module
Summary:
Same as previous one.
Adopting template-generated `convertRawProp` and `debugStringConvertibleItem` functions in `graphics` module.
Note, to do so we have to change signatures of some conversions functions to make them more overloading-friendly.

Reviewed By: fkgozali

Differential Revision: D7958252

fbshipit-source-id: 0f33a2e6aad60befacee31486acdb9b6114d3e07
2018-05-14 16:03:49 -07:00
Valentin Shergin 9d21e6661a Fabric: New props treatment in `attributedstring` module
Summary:
Adopting template-generated `convertRawProp` and `debugStringConvertibleItem` functions in `attributedstring` module.
Note, to do so we have to change signatures of some conversions functions to make them more overloading-friendly.

Reviewed By: fkgozali

Differential Revision: D7958245

fbshipit-source-id: 275a58bd3955a6ceb4881bffff86bf1d4501b3d2
2018-05-14 16:03:49 -07:00
Valentin Shergin 7048c9134a Fabric: Support for optionals in `convertRawProp` and `debugStringConvertibleItem` templates
Summary:
We have to have automatic treatment for `optional` types. So, if we can process type `T` we can also automatically process `optional<T>.`
Support for optional allows us to not introduce new types (with embedded special "undefined" value) or pollute existing pure types (with special "undefined" value). (A lot of examples of those types can be found in AttributedString module.)

Reviewed By: fkgozali

Differential Revision: D7958249

fbshipit-source-id: 21af526a17dd0329e1262020cab8ecb902316654
2018-05-14 16:03:49 -07:00
Valentin Shergin 03fb77cc95 Fabric: Using templates to generate convertRawProp and debugStringConvertibleItem functions
Summary:
This diff opens a diffstack where we migrate the generation of all prop conversions (convertRawProp) and pretty-printing (debugStringConvertibleItem) functions to C++ templates (instead of using `#define`s).
So, this diff implements base versions of those functions as templated functions.
For now we still need #define-based version, but eventually, we will get rid of it.

Reviewed By: fkgozali

Differential Revision: D7958247

fbshipit-source-id: 24346297c1bd17e8054758f0eb84698eebfa21e2
2018-05-14 16:03:49 -07:00
Valentin Shergin 2b827c9f13 Fabric: Modernizing debug printing in View module
Summary: This is continue of the work started in D7797561.

Reviewed By: fkgozali

Differential Revision: D7901244

fbshipit-source-id: 2f7a5cd9fa8c0079787e26e19c7c6c4255e54b42
2018-05-14 16:03:49 -07:00
Valentin Shergin f3f378ad3d Fabric: Using modern props-conversion appraoch for YogaStylableProps
Summary:
This a natiral continue of previous/ongoing work towards modernizing props pipeline.
Less defines, less code, more obvious code.

Reviewed By: fkgozali

Differential Revision: D7901246

fbshipit-source-id: 3387b6d13e21e6ec48a38c9e3708762dfe536105
2018-05-14 16:03:49 -07:00
Valentin Shergin dd3a6eda70 Fabric: Devirtualizing of props parsing infra
Summary:
This diff contains several tight to each other changes (which can/should not be split into several diffs):
 * The props parsing/conversion process was de-virtualized: we don't use virtual `apply` method to parse props anymore. Instead, we use old-fashioned constructors.
 * All fields of Props classes which represent props values were marked as `const` which make impossible to modify them after the objects were created (even if we have non-const value-of/pointer-to the whole Props object). Those fields are also `public` now.
 * All custom handwritten getters were removed (because we don't need them anymore).

So, now we don't need all those custom getters which makes code much more compact, performant and codegen-friendly.

Reviewed By: fkgozali

Differential Revision: D7901245

fbshipit-source-id: 9f4b1fd2da64bf963b63215ed3bd74b9d3c58dd5
2018-05-14 16:03:49 -07:00
Valentin Shergin 582e1bded3 Fabric: Text types conversions & better debug printing
Summary: Trivial.

Reviewed By: fkgozali

Differential Revision: D7863489

fbshipit-source-id: c7b9852e104ca12eea144473ed8e1f2973a36df7
2018-05-14 16:03:48 -07:00
Kevin Gozali 266016c521 iOS: Mark Scheduler class as final
Summary:
This fixes some build flavor:

```
error: destructor called on non-final 'facebook::react::Scheduler' that has virtual functions but non-virtual destructor [-Werror,-Wdelete-non-virtual-dtor]
```

Reviewed By: shergin

Differential Revision: D7958022

fbshipit-source-id: 6ff64bdaa221b5c6430a98244d40d6d3789ba937
2018-05-10 15:17:53 -07:00
Marc Horowitz 9d0b7d8f31 Fix BUCK bugs which were breaking tests after refactoring
Reviewed By: johnislarry

Differential Revision: D7874275

fbshipit-source-id: 7f9c8648571bc7f41649ec4ef547e7c34b479221
2018-05-09 22:12:03 -07:00
Marc Horowitz a363a7b501 Refactor ReactMarker out of Platform
Reviewed By: fromcelticpark

Differential Revision: D7803908

fbshipit-source-id: 957e80519c209732b163ece2bccb7c8c36ff8107
2018-05-09 22:12:03 -07:00
Marc Horowitz 042449f24a simplify handleMemoryPressure conditionalization, delete some dead code
Reviewed By: javache

Differential Revision: D7803912

fbshipit-source-id: 0bab4be07fc006a208caa75f94b5716c99b5d265
2018-05-09 22:12:03 -07:00
Marc Horowitz 09f3d7ab49 reformat JSCExecutor.cpp
Reviewed By: fromcelticpark

Differential Revision: D7803913

fbshipit-source-id: fc4637d0f9ab8c01f2f257e34e435c9573ecf948
2018-05-09 22:12:03 -07:00
Marc Horowitz ef258b0106 Remove unnecessary #includes to reduce dependencies
Reviewed By: davidaurelio

Differential Revision: D7803909

fbshipit-source-id: 2ccafdbfcb786c4c5f703714fb0c92cda1026cef
2018-05-09 22:12:02 -07:00
Valentin Shergin e052685ffc Fabric: Resonable default values for LayoutConstraints members
Summary: Trivial.

Reviewed By: mdvacca

Differential Revision: D7857046

fbshipit-source-id: 88400f1831bf66ccd3d880ddf1de3df27287b5be
2018-05-08 23:03:36 -07:00
Valentin Shergin a879842033 Fabric: Introducing `ShadowTree`
Summary: ShadowTree is an abstraction around (commited) root shadow node and managing its lifecycle.

Reviewed By: mdvacca

Differential Revision: D7857049

fbshipit-source-id: 8d530e0366fc703e4aef4ec88dd8ea990dafaaf1
2018-05-08 23:03:36 -07:00
Valentin Shergin 2bb41031ba Fabric: Introducing `RootShadowNode`
Summary: `RootShadowNode` is a dedicated class for managing the root node.

Reviewed By: mdvacca

Differential Revision: D7857050

fbshipit-source-id: f15f4b177f03cea4c0fd5a60d761ee2745319d77
2018-05-08 23:03:36 -07:00
Valentin Shergin cb48fa4d49 Fabric: `LayoutContext::affectedShadowNodes` was removed
Summary:
Apparently, we don't need this functionality in Fabric because we compute mutation instactions during diffing anyways.
But we still need (will need) `LayoutContext` for sure.

Reviewed By: mdvacca

Differential Revision: D7857045

fbshipit-source-id: 4be2744d9abea473ead847f35f698104f94af33d
2018-05-08 23:03:35 -07:00
Valentin Shergin e028631513 Fabric: Implementation of `yogaStyleValueFromFloat`
Summary: Quite obvious.

Reviewed By: mdvacca

Differential Revision: D7857047

fbshipit-source-id: 876664b3ab5c19b7c66a38579664f18a38a1a371
2018-05-08 23:03:35 -07:00
Valentin Shergin 6e537b000b Fabric: New nice way to deal with DebugStringConvertible items
Summary:
No macros in product code.
(Not all callsites are converted yet.)

Reviewed By: mdvacca

Differential Revision: D7797561

fbshipit-source-id: da899421bf99669a0e0a2b83df6004daf14355c2
2018-05-08 23:03:35 -07:00
Valentin Shergin d9ff1769aa Fabric/Text: <Paragraph> is now supporting text attributes
Summary:
I was shamed by Sebastian's sebmarkbage concerns (totally unrelated to this topic) about introducing another level of indirection into the system and decided to change my original plan not to support text attributes for the <Paragraph> component.

So, now <Paragraph> shares <View>, <Text> and <Paragraph> itself capabilities. That reduces the minimum amount of required components for trivial text fragment from three (Paragraph, Text, RawText) to two (Paragraph and RawText).

Special thanks for C++ for supporting multiple inheritance.

Reviewed By: mdvacca

Differential Revision: D7785889

fbshipit-source-id: dd9f2e2650bfbfd76d7d4b538adaf409f9429df3
2018-05-08 19:24:10 -07:00
Valentin Shergin f3893aab3b Fabric/Text: Connecting the dots
Summary: This change registers the Text module.

Reviewed By: mdvacca

Differential Revision: D7784509

fbshipit-source-id: 0de3e432b8f975927547ba990586f99655e8322d
2018-05-08 19:24:10 -07:00
Valentin Shergin 81bdd36204 Fabric/Text: RCTParagraphComponentView
Summary: RCTParagraphComponentView is a UIView which can render text using TextLayoutManager.

Reviewed By: mdvacca

Differential Revision: D7751853

fbshipit-source-id: e6ee9a0f989cdf6e878390d37dbcf8a11ef90bf4
2018-05-08 19:24:10 -07:00
Valentin Shergin b5a780608e Fabric/Text: text module, paragraph part
Summary: <Paragraph> component represents <View>-like component containing and displaying text.

Reviewed By: mdvacca

Differential Revision: D7751854

fbshipit-source-id: 1acdfebf6f96a5da068ce985e15288e958266855
2018-05-07 22:08:54 -07:00
Valentin Shergin dc7a87e737 Fabric/Text: text module, text part
Summary: <Text> component is used to describe text attributes in React.

Reviewed By: mdvacca

Differential Revision: D7751851

fbshipit-source-id: f90a4367cad64283ee64828b0d5e24470ee3d9f7
2018-05-07 22:08:53 -07:00
Valentin Shergin 02c3cd4c4e Fabric/Text: text module, rawtext part
Summary: <RawText> component represents a purely regular string object in React.

Reviewed By: mdvacca

Differential Revision: D7751850

fbshipit-source-id: 54afe43e0c1ac063862f109ea07f0e7de3593573
2018-05-07 22:08:53 -07:00
Valentin Shergin 05890a5942 Fabric/Text: textlayoutmanager
Summary:
TextLayoutManager measures and renders text using iOS specific APIs (CoreText & TextKit).
By desing, only this module should contain platfrom-specific text functionality.

Reviewed By: mdvacca

Differential Revision: D7751852

fbshipit-source-id: fd6e1907df617fe5a4479ea08f207946765b3a45
2018-05-07 19:05:53 -07:00
Valentin Shergin 62576bcb78 Fabric/Text: attributedstring module, the second part
Reviewed By: mdvacca

Differential Revision: D7748711

fbshipit-source-id: 57b37cb2eaa20b85c6f6719b38eac2a2c0479485
2018-05-07 18:09:06 -07:00
Valentin Shergin e2287976f3 Fabric/Text: attributedstring module, the first part
Summary:
`fabric/attributedstring` is a simple, cross-platfrom, react-specific implementation of attributed string (aka spanned string).
This diff is the first part of this which contains text primitives (types) and conversions.

Reviewed By: fkgozali

Differential Revision: D7748704

fbshipit-source-id: d76e31807e5ac7ab1a16fd6ee6445c59de5b89a2
2018-05-07 18:09:06 -07:00
Jonathan Kim 255b97ddd1 Load and use fb_xplat_cxx_test
Reviewed By: mzlee

Differential Revision: D7854278

fbshipit-source-id: 2a4c4fc27fc665a192fc04a8c8fae19f7f221566
2018-05-03 16:04:29 -07:00
David Aurelio 4d931d529e Add native delta client for Metro
Summary:
Adds C++ delta client that keeps modules in memory, and can be used as a RAM bundle.

For now, this client expects a `folly::dynamic` object as payload for patches, i.e. the JSON response retrieved from Metro needs to be parsed with `folly::parseJson` by the caller.

In the future, we will replace JSON with a streaming friendly binary format.

Reviewed By: fromcelticpark

Differential Revision: D7845136

fbshipit-source-id: f003f98a2607c8354c427a7e60e01e19e20295b1
2018-05-03 08:47:47 -07:00
Jonathan Kim be379efc9b Minimize included defs by adding a level of indirection
Reviewed By: zertosh

Differential Revision: D7851714

fbshipit-source-id: aa14e003a612173c6f316cb76a26f7e78e7f15d4
2018-05-02 22:24:42 -07:00
Jonathan Kim 62784f35d8 load in platform macros
Reviewed By: ttsugriy

Differential Revision: D7809673

fbshipit-source-id: aacff1a99ba50393ed8f74842afa59384b846e63
2018-04-29 16:01:17 -07:00
Valentin Shergin 6ce2823afe Fabric: Proper types and default arguments in ConcreteViewShadowNode
Summary: Trivial. Those are artefacts from copy-pasting from `ViewShadowNode`.

Reviewed By: mdvacca

Differential Revision: D7738576

fbshipit-source-id: 2d362cd0ff56420d54cdd0e339458ebe57049ddc
2018-04-26 18:03:07 -07:00
Valentin Shergin edc6cb5711 Fabric: New, much fancier, approach to parse dynamic props
Summary:
The new approach uses C++ overloading feature instead of specifying exact types in macros manually.
*Almost* macro-free!

Reviewed By: mdvacca

Differential Revision: D7738584

fbshipit-source-id: 85f8e4c1037b452df5e73b093dced9392cb2f73e
2018-04-26 18:03:07 -07:00
Valentin Shergin f8ab0e0b08 Fabric: YogaLayoutableShadowNode::enableMeasurement() enables custom measuring for Yoga based shadow nodes
Summary:
YogaLayoutableShadowNode::enableMeasurement() connects Yoga's measuring API and Fabric measuring API.
`enableMeasurement` should be called for leaf Yoga nodes with custom content which should be measured manually during layout.

Reviewed By: mdvacca

Differential Revision: D7738574

fbshipit-source-id: ffe883905c4809290d4d973ad29dc5f0e1ec7573
2018-04-26 18:03:07 -07:00
Valentin Shergin 6bbc2ec921 Fabric: Introcucing `ConcreteComponentDescriptor::adopt()`
Summary: Overriding `adopt` method allows subclasses to configure just created or cloned shadow nodes without overriding `create` and `clone` methods.

Reviewed By: mdvacca

Differential Revision: D7738581

fbshipit-source-id: bfe4e4e2d3d448591a3267b5ea7ca4e0800f5ba0
2018-04-26 18:03:07 -07:00
Valentin Shergin 368388bfc8 Fabric: Introducing `LocalData` concept
Summary:
LocalData might be used to communicate some infomation between `ShadowNode`s
and native component views.

We will use it soon to store (and transmit to mounting layer) prepared for rendering attributed text in Text component.

Reviewed By: mdvacca

Differential Revision: D7738582

fbshipit-source-id: 1ead23ffd105cce0b3d9aeb9fc1d0df47673be50
2018-04-26 18:03:07 -07:00
Valentin Shergin 9d08e2afae Fabric: Using `ColorComponents` in `colorFromComponents` function
Summary: Trivial. We have a special data structure for it, why do not use it here?

Reviewed By: mdvacca

Differential Revision: D7738577

fbshipit-source-id: 750aa649b06f17d27906d44df07172a907cde2e5
2018-04-26 18:03:07 -07:00
Valentin Shergin 139db66a3e Fabric: More graphic values conversions from dynamic type
Summary: Trivial.

Reviewed By: mdvacca

Differential Revision: D7738578

fbshipit-source-id: 3112e523dd1cdceff90a8596033f9516aa2c8156
2018-04-26 18:03:07 -07:00
Valentin Shergin 6aa52f2684 Fabric: Using a proper Component Descriptor for node cloning
Summary: To clone a ShadowNode we must use node's ComponentDescriptot, not parent node's one.

Reviewed By: mdvacca

Differential Revision: D7738583

fbshipit-source-id: 83656f9a761530cdaedf65663ae28b3119af75f5
2018-04-26 18:03:07 -07:00
Valentin Shergin 3428808b97 Fabric: Using view name argument in `FabricUIManager.createNode()`
Summary: We are going to have not only <View> component soon!

Reviewed By: mdvacca

Differential Revision: D7738579

fbshipit-source-id: 5165762b98d94f74d40d016722be36a04d45f264
2018-04-26 18:03:07 -07:00
Valentin Shergin 98b4747041 Fabric/View: Debug printing logic in YogaLayoutableShadowNode was moved to superclass
Summary:
It's more useful and consistent now because:
 - We print compound layout metrics from the correct storage (not from Yoga nodes);
 - It works fro any kind of layout now (but we still have just one);
 - It's much clear and straight-forward.

Reviewed By: fkgozali

Differential Revision: D7607422

fbshipit-source-id: 4c3cd2848e785a7f77c7f591e376d00c7c09ade9
2018-04-26 18:03:07 -07:00
Valentin Shergin 88c368b488 Fabric/Graphics: New graphic values conversion functions and type refinments
Summary: Quite trivial. We need this to debug print LayoutMetrics.

Reviewed By: fkgozali

Differential Revision: D7607417

fbshipit-source-id: f4fa52ad04be9757545a8ac627db184f171288e5
2018-04-26 18:03:06 -07:00
Valentin Shergin f72df7a6e7 Fabric/Text: ConcreteViewShadowNode - base class for all `View`-like shadow nodes
Summary: Quite trivial split ViewShadowNode into concrete class and templace class.

Reviewed By: fkgozali

Differential Revision: D7595017

fbshipit-source-id: b1ac1dfa187e5cfd0a34fbf84b3e1ae308bb0c99
2018-04-26 18:03:06 -07:00
Valentin Shergin bd91eaf664 Fabric/Text: ShadowNode::clone() - dynamic self-cloning mechanism
Summary:
The previous approach simply didn't work. :(
As you might notice, in previous implementation of ViewShadowNode::cloneAndReplaceChild we used `ViewShadowNode` class for cloning `childNode`, and this is incorrect becasue `childNode` might be instance of any class.

Reviewed By: fkgozali

Differential Revision: D7595016

fbshipit-source-id: 2215414926f2f7a2e2fd05ca2d065f10d6d32b74
2018-04-26 18:03:06 -07:00
Naris Siamwalla e512a4ae30 Fix dtor declaration for clang-6
Reviewed By: smeenai

Differential Revision: D7690428

fbshipit-source-id: 4b02a6f6cbccda3446f0a19b1b35c266a33560bd
2018-04-20 10:04:39 -07:00
Jean Lauliac 5fd92f90af cxxreact: executors: insert ID of segment reliably into the bundle path
Reviewed By: fromcelticpark

Differential Revision: D7623232

fbshipit-source-id: df833d18f0445d52e3098b58aac347a2e9aa0040
2018-04-20 07:03:23 -07:00
Jean Lauliac 281ed9f4ce cxxreact/RAMBundleRegistry: nit fixes
Reviewed By: mhorowitz

Differential Revision: D7587411

fbshipit-source-id: 516753247af585914381308248de9652f18a6cf5
2018-04-17 12:02:35 -07:00
Jean Lauliac c9094e952b cxxreact/RAMBundleRegistry: prepend segment ID
Reviewed By: fromcelticpark

Differential Revision: D7594348

fbshipit-source-id: 0b433de8722f8a952fd056139a350dc481f0af38
2018-04-17 12:02:35 -07:00
Taras Tsugrii 1433d15557 Avoid top-level read_config invocations.
Reviewed By: danzimm

Differential Revision: D7651745

fbshipit-source-id: 5cbc82b3c9da3ab514278d438f97f98e19946dc7
2018-04-17 09:41:20 -07:00
Valentin Shergin 82bd4337c9 Fabric: Fixed ComponentDescriptorTest
Summary: Trivial.

Reviewed By: mdvacca

Differential Revision: D7591712

fbshipit-source-id: fbcaaa30004f096749a6bcd47dcc56c060d7524a
2018-04-16 08:15:09 -07:00
Valentin Shergin c399d69716 Fabric: More restrictive types (const &) for ShadowNode constuctors' arguments
Summary: Should be more performant theoretically.

Reviewed By: mdvacca

Differential Revision: D7591713

fbshipit-source-id: 74141053f2b91cb621cc0d573f89f3454512c585
2018-04-16 08:15:09 -07:00
Valentin Shergin 3fd2e2da4f Fabric/Text/Prep: Refined ComponentDescriptor interface
Summary:
The new interface of ComponentDescriptor makes ShadowNode creation/cloning process a bit more explicit:
Now customers (UIManager) must prepare Props object explicitly before creation or cloning.
Besides general clarity, we need this to prepare for a new virtual `ShadowNode::clone()` method which will serve "virtual constructor" role,
redirecting execution to concrete ComponentDescriptor instance.

Actually, the whole purpose of concrete ComponentDescriptor instance is serve "virtual constructor" role (and all this code should be "templated").

Reviewed By: mdvacca

Differential Revision: D7591714

fbshipit-source-id: 8793b3ef70ed7ae113efb36ad1eee20573360dc8
2018-04-16 08:15:09 -07:00
Jonathan Kim 2fd7fda05d Delete fb_xplat_cxx.bzl
Reviewed By: mzlee, ttsugriy

Differential Revision: D7625836

fbshipit-source-id: 3169d43f028b895e1075268495de66816c778b35
2018-04-14 19:17:47 -07:00
Jakub Grzmiel c866ef243e Clean up BUCK files for missing dependencies and tests
Differential Revision: D7625433

fbshipit-source-id: 332b7ff7eaed82cb52f459921f1ae67b702a1636
2018-04-14 15:32:22 -07:00
Jakub Grzmiel a42b2988ae Clean up BUCK files for missing dependencies and tests
Differential Revision: D7618360

fbshipit-source-id: 421834892519998ad088a138b3fc3d96afe34d79
2018-04-14 13:18:08 -07:00
Kevin Gozali 2299d4cd7c iOS OSS: updated Podfile to have fabric related targets
Summary: Initial attempt to make fabric stuffs built properly with CocoaPods + RNTesterPods project. This simply includes fabric libs to the build, it doesn't change any behavior or enable fabric runtime.

Reviewed By: shergin

Differential Revision: D7626038

fbshipit-source-id: 4a80e0066cffa4478bb442fa8aefeaee6ff56ddd
2018-04-13 17:33:23 -07:00
Valentin Shergin 6924d44b20 Fabric: Fixed ConcreteShadowNode::getProps()
Summary:
Apparently, there is no point to return a reference from this method because the struct (std::shared_ptr) is allocated on stack.
The test is also updated.

allow-large-files

Reviewed By: fkgozali

Differential Revision: D7557749

fbshipit-source-id: aa74146322c6d340256752586f05fc672024038e
2018-04-10 17:15:08 -07:00
Valentin Shergin b13d5beb11 Fabric: `LayoutableShadowNodeList::getChildren` renamed to `getLayoutableChildNodes`
Summary:
The previous name conflicts with the method with same (but with different semantic) name in `ShadowNode` class.
That was bad idea to use same name especially because the different semantic.

Reviewed By: fkgozali

Differential Revision: D7554549

fbshipit-source-id: 0bccbaacd0812f8a26592b2008f15ddb5bc34ebc
2018-04-10 17:15:08 -07:00
Valentin Shergin 711abeda79 Fabric: Using `enum class` for some graphics types
Summary:
`enum class` types do not provide default conversion to integers and reguire use typename before value names.
This must prevent bugs like the previous one where we used `Undefined` as a number value.

Reviewed By: fkgozali

Differential Revision: D7554548

fbshipit-source-id: b19379aae48c9aebe03043e08cf3acc712da3cb8
2018-04-10 17:15:08 -07:00
Valentin Shergin dd49f9e0bc Fabric: Fixed incorrect usage of `Undefined` (instead of `kFloatUndefined`) in `yogaValuesConversions`
Summary: `Undefined` is actually equal `0` (becasuse it is `LayoutDirection::Undefined`), whereas `kFloatUndefined` is a magic huge number.

Reviewed By: fkgozali

Differential Revision: D7554550

fbshipit-source-id: 3ea37f0b8b6a59b4b0e00d205b75cd7252247d03
2018-04-10 17:15:08 -07:00
Valentin Shergin db92b16e04 Fabric: Proper invocation of `ensureunsealed` in `LayoutableShadowNode::layout`
Summary: Quite obvious. We have to check `sealable` flag of the child (not a parent) before mutating it.

Reviewed By: mdvacca

Differential Revision: D7526407

fbshipit-source-id: ce8e0d6446ff7eb23baee9c92f246d5e198fe377
2018-04-10 17:15:08 -07:00