Summary:
Prior to this diff, if parents height was not set then the height of parent was deduced as max of childrens height(considering line ht, padding, margin etc. ), but it didn't consider the baseline scenario where the previous logic will fail as then the parents height will be determined by the space taken by children above and below the reference baseline. I added a test case for the same.
Look at the diff D9088051 which shows the screenshot of the bug.
It is solved to https://pxl.cl/gvVk
Reviewed By: dsyang
Differential Revision: D9219678
fbshipit-source-id: f4a0b9f1452c33e78bd8c6cf39f6fcf538a04074
Summary: This diff implements the update of props in Fabric C++. The props values are passed to java in a ReadableMap and they are integrated into the current implementation of ViewManagers. In the fututre we will replace the ReadableMap for typed objects.
Reviewed By: shergin
Differential Revision: D9093560
fbshipit-source-id: da58326cfadb0665dac3349a8cf24cde2d401aaa
Summary: this diff exposes the rawProps folly::dynamic map received by JS as part of the Props class
Reviewed By: shergin
Differential Revision: D9093559
fbshipit-source-id: 5f5bc4924aebb6bcc24c7a82ce1a59593d44450e
Summary: This diff fixes the color conversions for Android
Reviewed By: shergin
Differential Revision: D9093561
fbshipit-source-id: a17e61c58be511bd463dc0b21b632dc24066b8b6
Summary: This diff improves the error message that is displayed when a component descriptor is not implemented in C++
Reviewed By: shergin
Differential Revision: D9093562
fbshipit-source-id: 930b381bc66c20af6fa160b09e7484bad4666e28
Summary:
Removed the faulty calculation of `remainingFreeSpace` from the code. `remainingFreeSpace` already had the correct value that special condition was not required.
Also added a test case for this issue
Reviewed By: IanChilds
Differential Revision: D9286928
fbshipit-source-id: 915269602cda2cc4515e6eab8184b2ea98d3e6d4
Summary:
@public
Replaces local references to `YGStyle` objects, and assignment to `YGValue` members with direct assignment from temporaries.
This should increase readability, and eliminate duplicated checks for *undefined* values.
Reviewed By: astreet
Differential Revision: D9083531
fbshipit-source-id: 11386be465352f5cb167b8195b7da432d0055d6f
Summary:
@public
`YGNode.getStyle()` returns a reference to the enclosed `YGStyle` member. Assigning to a local copies unnecessarily.
Having eliminated the copy, we can also safely remove calls to `YGNode.setStyle()`, eliminating another copy.
Reviewed By: astreet
Differential Revision: D9083336
fbshipit-source-id: df8b603b5cc0b974cf5dd434c71956be4548e583
Summary:
@public
Now it accepts `const ShadowNode &` instead of `std::shared_ptr<const ShadowNode>` which is more reasonable (and more performant) becasue the function must not retain ownershipt.
Reviewed By: mdvacca
Differential Revision: D9073921
fbshipit-source-id: c24c475615e0f81b3e004e118dea7565d8e757b4
Summary:
@public
We backported that into Yoga recently, so we don't need it here anymore.
Reviewed By: mdvacca
Differential Revision: D8988439
fbshipit-source-id: 01a538ff291e25d92eeb01b1fdee3a6868b2448b
Summary:
@public
To avoid unnecessary copying of `shared_ptr`s inside ShadowNodeFragment, now we store them as `const &` references.
Reviewed By: mdvacca
Differential Revision: D8988388
fbshipit-source-id: 0b3582e57ce7577b8fa819392bf33f34e1a60b59
Summary:
@public
Now we use same data structure to specify a shape of shadow node as we use in ShadowNode (sub)clases.
Reviewed By: mdvacca
Differential Revision: D8988387
fbshipit-source-id: 475298b2c71ee7ee2b197db009f7b8313b54f5df
Summary:
@public
When we copy-construct ShadowNode, we don't need to retain a source shadow node, so there is no need to pass it as a `shared_ptr`. Passing an argument to constructor as `const &` is also more idiomatic in C++.
Reviewed By: mdvacca
Differential Revision: D8988384
fbshipit-source-id: 1279d9185fa1b4b82fd26e3040bd62fa9495b4d3
Summary:
@public
ShadowNode class is designed to share `props` and `children` objects between instances. Given that all *Props classes are immutable, it's very easy to share them and we do this from the day one. The `children_` collection is more tricky though because ShadowNode class has a couple of mutation methods. Previously, we dealt with it very simply by copying the whole vector in constructors, and that was far from optimal. Now we store a special flag that indicates that the children list is shared among nodes, and we clone this before the first mutation.
Sharing a `shared_ptr` should be much more efficient (cost of atomic refcount increment) than instantiating whole new collection (an allocation).
Reviewed By: mdvacca
Differential Revision: D8988386
fbshipit-source-id: cb2f6b2fccac70a35e070a1aa108d135f77cd041
Summary:
@public
Just a type alias to make the code prettier, nothing more.
Reviewed By: mdvacca
Differential Revision: D8988383
fbshipit-source-id: 3f21de0ec0cb9a2270eccfc4a67a3d1108535e42
Summary:
@public
This diff changes a way how we specify a shape of newly created and/or cloned of ShadowNode. Previously we pass those values as a list of arguments, now those values are coupled into a new data structure called ShadowNodeFragment. All that makes suppose to make code much more easy to read and maintain, this is especially important because we want to add a couple of new entities in this set.
Reviewed By: mdvacca
Differential Revision: D8988389
fbshipit-source-id: 1835f646e1ecc6a1f413feaf1900f3d3ad0ebc05
Summary:
@public
Previously, all ConcreteShadowNode subclasses had to override `getComponentName()` function to specialize a name of the component. And often it was all that those subclasses do. Now, it's a template argument; and many ShadowNode classes can be created as oneliners via *just* specializing ConcreteShadowNode template.
Unfortunately, C++ does not allow to use `std::string`s or string literals as template arguments, but it allows to use pointers. Moreover, those pointers must point to some linked data, hence, those values must be declared in .cpp (not .h) files. For simplicity, we put those constants in Props classes, (but this is not a strong requirement).
Reviewed By: mdvacca
Differential Revision: D8942826
fbshipit-source-id: 4fd517e2485eb8f8c20a51df9b3496941856d8a5
Summary:
@public
Now, Sealable is already error-preventing-only mechanism, no business logic relies on that.
So, it makes sense to make it debug-only to illuminate possible performance impact.
Reviewed By: mdvacca
Differential Revision: D8923597
fbshipit-source-id: 80aa9097c4b719e91de73ac59f38d3a4751f0b06
Summary: We've mistakenly used `free()` to free the memory, where `delete` should have been used
Reviewed By: davidaurelio
Differential Revision: D9042347
fbshipit-source-id: e15cec0f498409066521a6de1e3fe4b7404ec46c
Summary:
Added module names to systraces for getConstants and getMethods.
Also added systrace for moduleNames.
We are starting to look at ways to optimize native modules, and having these traces helps
Reviewed By: javache
Differential Revision: D9012702
fbshipit-source-id: c79222f36988bef3a108ed91d1ea1318d3576b40
Summary: There are cases where JS bundle fails to be evaluated, which throws an exception already, but then there were pending calls into JS which would fail in a weird way. This prevents those calls (because it's mostly meaningless at that point). For now, those extra calls will still throw an exception, but with a specific message so that it doesn't confuse people.
Reviewed By: yungsters
Differential Revision: D8961622
fbshipit-source-id: 3f67fb63fdfa9fc5b249de0096e893b07956776a
Summary:
@public
It's very useful sometimes for product code to compare `YGValue`s (e.g. in Fabric).
Reviewed By: priteshrnandgaonkar
Differential Revision: D8937594
fbshipit-source-id: b93e1ab4a6419ada6746f233b587e8c9cb32c6d4
Summary:
@public
Replacing the `YG_NODE_STYLE_PROPERTY_IMPL` macro with template code, in order to make code easier to edit and grep.
Reviewed By: astreet
Differential Revision: D8868184
fbshipit-source-id: f52537376fa8d4dd53aa98bb43e93279699dbdd5
Summary:
@public
Inlines macros used for declarations of `YGNodeStyle*` and `YGNodeLayout*` functions.
Benefits easier grepping and code base navigation.
Reviewed By: astreet
Differential Revision: D8868168
fbshipit-source-id: d6b1b70981a59a2214dc7d166435a1d1a844e1b7
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
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
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
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
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
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
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
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
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
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
Summary:
@public
There is no reason to have it inside View; it deserves that.
Reviewed By: mdvacca
Differential Revision: D8757012
fbshipit-source-id: 881b54008b51614cd203ab97811494fa7c30e4ef