Summary: This change registers the Text module.
Reviewed By: mdvacca
Differential Revision: D7784509
fbshipit-source-id: 0de3e432b8f975927547ba990586f99655e8322d
Summary: RCTParagraphComponentView is a UIView which can render text using TextLayoutManager.
Reviewed By: mdvacca
Differential Revision: D7751853
fbshipit-source-id: e6ee9a0f989cdf6e878390d37dbcf8a11ef90bf4
Summary: <Text> component is used to describe text attributes in React.
Reviewed By: mdvacca
Differential Revision: D7751851
fbshipit-source-id: f90a4367cad64283ee64828b0d5e24470ee3d9f7
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
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
Summary: Trivial. Those are artefacts from copy-pasting from `ViewShadowNode`.
Reviewed By: mdvacca
Differential Revision: D7738576
fbshipit-source-id: 2d362cd0ff56420d54cdd0e339458ebe57049ddc
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
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
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
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
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
Summary: We are going to have not only <View> component soon!
Reviewed By: mdvacca
Differential Revision: D7738579
fbshipit-source-id: 5165762b98d94f74d40d016722be36a04d45f264
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
Summary: Quite trivial. We need this to debug print LayoutMetrics.
Reviewed By: fkgozali
Differential Revision: D7607417
fbshipit-source-id: f4fa52ad04be9757545a8ac627db184f171288e5
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
Summary: Should be more performant theoretically.
Reviewed By: mdvacca
Differential Revision: D7591713
fbshipit-source-id: 74141053f2b91cb621cc0d573f89f3454512c585
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
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
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
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
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
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
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
Summary:
YogaLayoutableShadowNode::yogaNodeCloneCallbackConnector recently was disabled because of change in Yoga (D7339832).
This diff brings is back.
Reviewed By: mdvacca
Differential Revision: D7526417
fbshipit-source-id: 5369d641bf1e118132cf742d2d243bf426c0ffdb
Summary: UIManager uses UIManagerDelegate to communicate about shadow tree changes to another parts of the system.
Reviewed By: fkgozali
Differential Revision: D7503484
fbshipit-source-id: 0afe0f0d6cad31fe2ee9d61235d02b379cfe8217
Summary:
We have to call shallowSourceNode() in all cases of cloning which were not caused by UIManager instructions,
otherwise the diffing alogorith might produce incorrect mutation instructions.
Reviewed By: mdvacca
Differential Revision: D7503383
fbshipit-source-id: b33e5c39b7ba8cbd0f925fd29b3af379441a40a4
Summary: We have to call `ensureunSealed()` only if the node was changed.
Reviewed By: mdvacca
Differential Revision: D7503388
fbshipit-source-id: a3d07d50fa983ef93c14fa771711fa783fdf4c12
Summary:
Previously we generated `removed` *or* `delete` instruction, but sometimes we have to generate both.
So, basically we did it wrong. :(
Reviewed By: mdvacca
Differential Revision: D7503386
fbshipit-source-id: 8ee476abd29f088f31dc776f6e6a68d5293fbb35
Summary:
The method replaces the current source node with its source node.
It's useful when we have to clone some node but don't want to change a source node pointer.
Reviewed By: fkgozali
Differential Revision: D7503384
fbshipit-source-id: 81ec64079c7e99cb9abdda2af10d85281a94e1b1
Summary:
Quite trivial.
Note that std::unordered_map's `operator[]` is not `const`, so we have to use `at` instead.
Reviewed By: mdvacca
Differential Revision: D7467799
fbshipit-source-id: df38b21dccee4b347f7c070600af0d52f38d6570
Summary:
The first and quite naive implementation of The Diffing algorithm.
The exact set of instructions, their semantic, order, amount, and excessiveness are still unclear.
The concept should be verified by comprehensive testing with working native views rendering layer.
Reviewed By: mdvacca
Differential Revision: D7467790
fbshipit-source-id: 08f2f646e058cac8a4b73bf7b148e2748633348d
Summary:
Motivation:
* We never should call `markDirtyAndPropogate()` during tree construction/mutation because it might affect trees in different thread/dimentions;
* In Fabric we basically always have to dirty nodes ourselves manually duting tree construction;
* In Fabric we don't have "scoped/limited" tree mutations which require recursive dirtying; any mutation is creation of the new tree instance;
* Default value of the `isDirty` flag is "false", so we have to change this right after creation of Yoga node (and after cloning).
Reviewed By: mdvacca
Differential Revision: D7467797
fbshipit-source-id: 2c9144271dceea6ba2b95173209b99b5d86fbd87
Summary:
The modern Concurent Yoga's concept is:
We have to set parent/owner reference as part of `appendChild` process only if the current reference to parent/owner is `null`.
The motivation:
* Null-parent indicates that this node was not attached to anything yet;
* So, in this case there is no any concurrent memory access because we always create and (first time) attach the node on same thread;
* Simmetrical parent-child relationship indicates that we don't need to (re)clone assosiated ShadowNode (nor Yoga node).
Reviewed By: mdvacca
Differential Revision: D7467791
fbshipit-source-id: 9a7f517380fde3bb00272de18fd5dc13edb52071
Summary: Previously we recreate a vector with pointers to child nodes every single time we modify the collection. That was okay but recently I realized that the we can simply make a copy of the vector one time during object construction and then mutate it freely.
Reviewed By: mdvacca
Differential Revision: D7467796
fbshipit-source-id: 660f1706a19ae5f07c34c509f411ce9d67b93b35
Summary:
Computed `layoutMetrics` are also considered as part of ViewShadowNode's value.
In the future we probably have to add something like `localData` and `imperativeCommands`.
We need all this for diffing algorithm and mointing phase.
Reviewed By: mdvacca
Differential Revision: D7467800
fbshipit-source-id: 8a0dcf1fd2f97dc501d6969cb0b0f6a2c6a648b4
Summary: Using methods of the base class instead of custom implementation.
Reviewed By: fkgozali
Differential Revision: D7467795
fbshipit-source-id: 4d168b72880f6900bf8b747e1d655c10140e0c79
Summary: We have to have getters for all props/fields.
Reviewed By: mdvacca
Differential Revision: D7467792
fbshipit-source-id: 1492aad2d3398e6c14e0e354047730cf91201175
Summary: Two additional types of instructions were added and now all of them have explicitly clear semantic.
Reviewed By: fkgozali
Differential Revision: D7467798
fbshipit-source-id: 83c0e774d56975be504aa3fe892035f5f724f809
Summary: Slightly new approach: Some non-const methods might not always mutate objects, so sometimes we should call `ensureUnsealed()` only inside conditional branches where we actually mutate an instance.
Reviewed By: fkgozali
Differential Revision: D7467793
fbshipit-source-id: 1b9f229cf6816e54e0df36699a571fdb612d3c3c
Summary: Trivial. Those nits prevent cause compilation errors in some configurations.
Reviewed By: fkgozali
Differential Revision: D7467794
fbshipit-source-id: cbda285748374fd941a0b1ca6718d702ca2d6d82
Summary: Test for equality will be used in ShadowNode Tree Diffing algorithm.
Reviewed By: fkgozali
Differential Revision: D7467802
fbshipit-source-id: 5383add9fc7d7e4a772ca16e70a54f7e0c36823a
Summary: Any change must be propagate upwards.
Reviewed By: mdvacca
Differential Revision: D7389058
fbshipit-source-id: 09c74640d0e9607d2e17bdd31d7ce69df8565f72
Summary: Trivial. We don't need this because we already have another virtual method.
Reviewed By: fkgozali
Differential Revision: D7388964
fbshipit-source-id: 5ea6eb33ece72796d8cde2cc4b12c1240447d22a
Summary: The Great Diffing algorithm is coming.
Reviewed By: fkgozali
Differential Revision: D7376528
fbshipit-source-id: bdfef69551980136cfd1717a11ae376d5eef126b
Summary:
First, LayoutableShadowNode::cloneAndReplaceChild() is now pure virtual. The default implementation was useless and confusing.
Second, cloneAndReplaceChild() is now fully implemented for ViewShadowNode, so fancy Yoga Concurrent layout *should* work now.
Reviewed By: mdvacca
Differential Revision: D7376352
fbshipit-source-id: 1199a37e64535c8592a2a5480e60139f61d02006
Summary: We replace yogaNode with newly creaded (by Yoga) one. So, we have to set up context.
Reviewed By: mdvacca
Differential Revision: D7376345
fbshipit-source-id: 7926a10e3f057fc385e7731c354827aeb8245760
Summary: Trivial. We don't use it, and it shouldn't be exist by desing.
Reviewed By: mdvacca
Differential Revision: D7376351
fbshipit-source-id: 22f03af2b3596c274a22bab1fab6d8af854a7374
Summary:
We use shource nodes only in the diffing alogorithm. It implies that we have strong pointers to those nodes in trees we compare against.
Using weak_ptr's allows to avoid memory leaks.
Reviewed By: mdvacca
Differential Revision: D7376348
fbshipit-source-id: 34e5f58f18a00475f6bcdfbea3996b41c84dff62
Summary:
Fixed minor issue:
* use double spaces instead of a tab character for indentation
* depth should increase by 1, not 2
Reviewed By: shergin
Differential Revision: D7332803
fbshipit-source-id: 74fda2c7a4be4f509270d3074a7d71a3d4d32fe4
Summary: We will need this later in the diffing alogrithm.
Reviewed By: fkgozali
Differential Revision: D7330337
fbshipit-source-id: 3da44a62e4d5f30deed28b18a5779544153244f3
Summary: `LTR` is actually a default value for `direction` here, because an `inherit` value makes no sense for YGLayout (because it's *computed* value by definition).
Reviewed By: fkgozali
Differential Revision: D7330335
fbshipit-source-id: b3c7736c104689f2296e150f0cf57d622483d537
Summary: LayoutableShadowNode defines a unified interface (and set of primitives) essential for laying out shadow nodes.
Reviewed By: fkgozali
Differential Revision: D7230668
fbshipit-source-id: d8c1772d4c3bd1f87c41f7240a39aecebf3696ae
Summary: Foundation clases for Fabric designed to be "const-first".
Reviewed By: fkgozali
Differential Revision: D7230672
fbshipit-source-id: 433acd35a7958d5d577358b0a306923f970e573f
Summary:
* Fixed semantic: all kinds of derivative instances lose `sealed` flag (which is expected);
* Using atomic<bool> for `sealed_` ivar.
Reviewed By: fkgozali
Differential Revision: D7230674
fbshipit-source-id: abe786610c20a45a0fabb9068120e24adeeeac7f
Summary:
`Sealable` class represents something which can be *sealed* (imperatively marked as immutable).
Authored by shergin
Reviewed By: shergin
Differential Revision: D7174883
fbshipit-source-id: 8b26ca5b1a5154953a099895778eab86228acc46
Summary:
This is a very first diff in a series of undefined length implementing React Native Shadow Tree infra in C++.
All Shadow Nodes, Props and etc. implements `DebugStringConvertible`.
Authored by shergin
Reviewed By: shergin
Differential Revision: D7163868
fbshipit-source-id: 9c001aa5bd0723f709a07b1833f512c51e3bec11