Граф коммитов

192 Коммитов

Автор SHA1 Сообщение Дата
Joshua Gross d269844cc1 LayoutAnimations: have each Props struct do its own interpolation
Summary:
Each ComponentDescriptor becomes capable of doing its own interpolation over props for animation purposes.

This new custom interpolator is called by default by the ConcreteComponentDescriptor, but `ComponentDescriptor::interpolateProps` is a virtual function and each ComponentDescriptor can provide custom interpolation if necessary.

For now, only View does any actual interpolation, to support LayoutAnimations.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D20965310

fbshipit-source-id: e1c1588107848e94c155efecb0da1cc1619ae544
2020-05-13 15:40:34 -07:00
Valentin Shergin b65b00ab6b Fabric: Fixed incorrect name of the prop value `justifyContent=space-between`
Summary:
The name of the value was incorrect.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: mdvacca

Differential Revision: D21496651

fbshipit-source-id: 464c98436bb8d5f2b6275b7eab1c32d187e2b23c
2020-05-10 18:27:41 -07:00
Kevin Gozali 164d47f30a label react-native-github targets
Summary:
For internal code attribution.

Changelog: [Internal]

Reviewed By: zlern2k

Differential Revision: D21468924

fbshipit-source-id: 59cd2a52e0ae46bedbf54816820a5f40b684da8b
2020-05-08 00:36:17 -07:00
Nikita Lutsenko f4815fbad3 third-party | Move glog from xplat/third-party to third-party and create temporary redirect.
Summary:
Move and create an empty rule that redirects as well, to handle //arvr rules
Need to do this way, since ovrsource sync rules are in different repo.

allow_many_files
allow-large-files

Steps:
- [X] Move glog from xplat/third-party to /third-party
- [ ] Update references in ovrsource to translate to //third-party instead of //xplat/third-party
- [ ] Get rid of temporary rule
- [ ] Update fbsource/third-party/glog to 0.3.5 (what we have in ovrsource)

Changelog: [Internal] Update reference for glog from xplat/third-party to /third-party.

Reviewed By: yfeldblum

Differential Revision: D21363584

fbshipit-source-id: c1ffe2dd615077170b03d98dcfb77121537793c9
2020-05-06 19:04:33 -07:00
Valentin Shergin 78b1c85747 Fabric: Simplifying Yoga and Fabric integration
Summary:
The integration with Yoga was pretty complex from day one. The first attempt to make it simpler was in D19963353 when we removed a bunch of layers of indirection. This is the second iteration that aimed to simplify the structure of methods and their responsibilities.

The only conceptual change (that I am aware of) in this diff is that now we don't support (imaginary) case where a non-leaf YogaLayoutableShadowNode can have a non-YogaLayoutableShadowNode child. In the previous version, it was a no-op, now it's not supported and an assert will fire.

Alongside with refactoring, this diff implements several helper functions that verify the invariants important for the Concurrent Layout in debug mode.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: JoshuaGross

Differential Revision: D21198222

fbshipit-source-id: cc085904948056f861562af5bd2571de45a743b9
2020-04-23 15:00:46 -07:00
David Vacca 8c4efc94e1 Enable Yoga logging in Fabric Debug
Summary:
This diff extends Fabric to support Yoga logging

changeLog: [Internal] Internal changes in Fabric to enable yoga logging

Reviewed By: JoshuaGross

Differential Revision: D21150195

fbshipit-source-id: a2e8308a79a7b422bf9ecc3a65f822b305f02c5d
2020-04-20 23:31:21 -07:00
Valentin Shergin d639063499 Fabric: More strict policies to dirty Yoga nodes in YogaLayoutableShadowNode
Summary:
Yoga uses a dirty flag to re-layout nodes. In normal, single-threaded approach the policy for dirtying is simple: if a node was changed, we need to dirty it. In the Concurrent Yoga approach, those rules are not so simple, and it seems we haven't formalized those rules yet.

Investigating some layout issues that we have in Fabric, I tend to believe that we don't dirty as much we should. Hense this change adds mode dirtying.

Reviewed By: JoshuaGross

Differential Revision: D21092815

fbshipit-source-id: 4603c97ccb79efcdf5e6a4cc450ebe61b63effb3
2020-04-20 19:21:08 -07:00
Valentin Shergin 4afb8362ec Fabric: Fixed `getDirtied` vs `isDirty` in `YogaLayoutableShadowNode`
Summary:
This is quite a fateful mistake. `getDirtied()` returns the pointer to a function which is obviously a mistake here; we should use `isDirty()` instead.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: mdvacca

Differential Revision: D21028569

fbshipit-source-id: 95212b31f4e32d51c594d5209f295397af3f1252
2020-04-20 19:21:08 -07:00
Samuel Susla e7ef35c133 Fix mistake in swapping left/right layout properties
Summary:
Changelog: [Internal]

We were assigned `undefined` value to incorrect edge, instead of `YGEdgeLeft` it should have been `YGEdgeRight`.
If node has `YGEdgeRight` value, it needs to be reassigned to `YGEdgeEnd` and its original value set to undefined.

Reviewed By: mdvacca

Differential Revision: D21095234

fbshipit-source-id: fbecd9b7e6670742ad4a4bb097760aa10eec8685
2020-04-20 11:44:15 -07:00
Valentin Shergin e56950dc65 Fabric: `componentregistry` module was decoupled from `uimanager`
Summary:
We need to break up the `uimanager` module in order to solve circular dependencies problem (which future diff would have otherwise).

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: JoshuaGross

Differential Revision: D20885163

fbshipit-source-id: 08eb1ba1d408fc0948e8d0da62380786a40973af
2020-04-18 15:00:21 -07:00
Valentin Shergin 62544c0830 Fabric: Proper traits for `ImageShadowNode` and `ViewShadowNode`
Summary:
* <Image> must be a leaf node; having a proper trait will fail earlier in case of misuse (mounting something inside).
* <View> must have a `View` trait because it's for what that trait is.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: sammy-SC

Differential Revision: D21028573

fbshipit-source-id: 457716d4661333eb2357f34316f3e495ab4fda24
2020-04-17 21:20:04 -07:00
Samuel Susla 3591b7a956 Promote shadowColor to formsStackingContext property
Summary:
Changelog: [Internal]

View with `ShadowColor` was getting flattened and therefore views didn't have shadow property set.
This is fixed by promoting ShadowColor so in case it is set, it forms stacking context.

Reviewed By: shergin

Differential Revision: D20792201

fbshipit-source-id: 1033ac00e32047ffbb14e61b7c26348c578d132d
2020-04-01 10:42:51 -07:00
Samuel Susla 46722dcfc2 Swap left and right yoga position with start and end in RTL context
Summary:
Changelog: [Internal]

Paper swaps right and left in RTL setting, this logic is in [RCTShadowView.m](https://our.intern.facebook.com/intern/diffusion/FBS/browse/master/xplat/js/react-native-github/React/Views/RCTShadowView.m?commit=cdd504cfbee66ae0659495604c4ff7b5764a1d9e&lines=529-549).

For Fabric instead of doing it during yoga props assignment, I swap the left/right with start/end just before we pass yoga nodes to layout calculation.

Reviewed By: shergin

Differential Revision: D20420040

fbshipit-source-id: b777f2658f56c173743b2034b8b5059e3e0c9840
2020-04-01 05:42:20 -07:00
Samuel Susla 367a573ccc Assign orderIndex_ in ConcreteViewShadowNode constructor instead of ViewShadowNode's constructor
Summary:
Changelog: [Internal]

`orderIndex_` was only being assigned for `ViewShadowNode`, not for other `ShadowNodes` that are later represented on the screen.

Reviewed By: shergin

Differential Revision: D20746477

fbshipit-source-id: c04c2cfea14b9141d22bc3d9e9bb4c0c59925754
2020-03-31 09:50:17 -07:00
Kevin Gozali 25f7aea86c Replace fbsource// with // in xplat/js/ files [1]
Summary:
`fbsource//xplat` and `//xplat` are equivalent for FB BUCK targets. Removing extra prefix for consistency.

Changelog: [Internal]

Reviewed By: scottrice

Differential Revision: D20495655

fbshipit-source-id: a57b72f694c533e2e16dffe74eccb8fdec1f55f5
2020-03-25 21:55:47 -07:00
Valentin Shergin 0952e4bb03 Fabric: View Test: Changing state should not dirty Yoga tree (in some most cases)
Summary: Changelog: [Internal] Fabric-specific internal change.

Reviewed By: mdvacca

Differential Revision: D20578789

fbshipit-source-id: 4336165217bd39fc8065cfaeb96ef7753433d48a
2020-03-23 13:33:23 -07:00
Valentin Shergin 3679929830 Fabric: Modernizing Yoga Dirty flag test.
Summary:
Now we using TEST_F thing that allows consilidating initialization.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: mdvacca

Differential Revision: D20578788

fbshipit-source-id: 103bcb8fdeb3dbf297385cfe56415bd646e16791
2020-03-23 13:33:20 -07:00
Samuel Susla 48fe460ed9 When resolving borders, respect leading/trailing semantics before left/right
Summary:
Changelog: [Internal]

When resolving borders, leading/trailing semantics should take priority over left/right.

Reviewed By: shergin

Differential Revision: D20422951

fbshipit-source-id: 7a464c88f881a77732929a155aaa9b2e150bba74
2020-03-17 14:09:28 -07:00
Valentin Shergin 14a174c237 Fabric: Implementation of `ViewProps::zIndex` feature in C++ core
Summary:
Now, having `orderIndex` feature in the core, we can use it for implementing `zIndex` feature. All we need to do is just to assign this `zIndex` value to `orderIndex`.
Then we will use this to remove some platform-specific code that implements `zIndex` on the mounting layer.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: sammy-SC

Differential Revision: D20432155

fbshipit-source-id: b4d62b63006f45899de38e1f40b1dfbe69550ada
2020-03-15 20:52:11 -07:00
Valentin Shergin ca35bfe597 Fabric: `traitCast` now return `nullptr` if the argument is `nullptr`
Summary:
This behavior matches the behavior of `dynamic_cast` (on which some callsites rely on).

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: sammy-SC

Differential Revision: D20456792

fbshipit-source-id: 9604da0f9f78cc7357e60ed11012756e753e4b45
2020-03-14 10:17:20 -07:00
Valentin Shergin ee88e72c02 Fabric: Removed unused leftovers from ViewShadowNode
Summary:
This method does not have implementation and we don't use it.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: sammy-SC

Differential Revision: D20423392

fbshipit-source-id: cfb5e4a60dbeca26a968c29d20e74dd6af0bf660
2020-03-13 22:06:04 -07:00
Adam Ernst 0c7bd388f0 Rename get_debug_preprocessor_flags
Summary:
The new name is get_preprocessor_flags_for_build_mode.

Changelog: [Internal]

Reviewed By: d16r

Differential Revision: D20351718

fbshipit-source-id: 67628ce81e7244f0f72af2d00d92842a649ff619
2020-03-09 18:28:27 -07:00
Valentin Shergin 02f2c81240 Fabric: Proper way to specity layout constraints for root Yoga node
Summary:
This diff changes how we apply layout constraints to a root node before layout. We previously used two arguments of `YGNodeCalculateLayout` but that's not expressive enough in cases we have min & max sizes.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: JoshuaGross, sammy-SC

Differential Revision: D20268051

fbshipit-source-id: 85aaae65326432993296c3cbc9f7fb8919b07386
2020-03-09 16:36:47 -07:00
Valentin Shergin 2508c46a75 Fabric: More `assert`s in YogaLayoutableShadowNode
Summary:
These `assert`s must be satisfied. Having them allows us to fail early in case of bugs.
I spent a log of time debugging an issue and finally found that after adding those `assert`s.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: mdvacca

Differential Revision: D20268046

fbshipit-source-id: 1d8ddd6de00069bd2a79e74af5e4278aa6c9131b
2020-03-09 16:36:45 -07:00
Valentin Shergin 22fdb8bb05 Fabric: Fixed UI jankiness caused by changes in flattening
Summary:
It's not clear why exactly but seems in some cases, for some views the hierarchical relationship between views is required (when it should not be conceptually). Turning this feature off for Android for now.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: JoshuaGross

Differential Revision: D20292833

fbshipit-source-id: 1aab8468cedeb5c1440a95944be7eca3216e0db0
2020-03-05 17:29:08 -08:00
generatedunixname89002005287564 d1018e0414 Daily `arc lint --take CLANGFORMAT`
Reviewed By: zertosh

Differential Revision: D20278397

fbshipit-source-id: 2188283cd01d0d9d9d5b3995bd8d3f1fd687ad55
2020-03-05 08:27:36 -08:00
Valentin Shergin 4f3e3f8cc1 Fabric: Tweaking view flattening algorithm to rely on new traits instead of `LayoutableShadowNode::isLayoutOnly()`
Summary: Now, following the previous diff, we remove `LayoutableShadowNode::isLayoutOnly()` and change the view flattening algorithm to rely on two new traits. See the previous diff to learn more about how it works.

Reviewed By: sammy-SC

Differential Revision: D20212252

fbshipit-source-id: 87a07e8bb17b2e66e5703f107dc35ca7a8e49634
2020-03-04 12:33:03 -08:00
Valentin Shergin b5117bf6ea Fabric: New two ShadowNode Traits: FormsStackingContext & FormsView
Summary:
This diff introduces two new `ShadowNodeTrait`s that we will use in the future in the new (slightly tweaked) view-flattening algorithm. (Note: this diff does not enable the new flattening, it's just preparation.)
The idea is that we split the notion of `isLayoutOnlyView` into two traits:
* `FormsView`: `ShadowNode`s with this trait must be represented as `ShadowView`s. Normal "visible" ShadowNodes will have this trait, but "layout only views" in old nomenclature will not.
* `FormsStackingContext`: `ShadowNode`s with this thread not only must be represented as `ShadowView`s but also have to form a "stacking context" which means that their children must be mounted as `ShadowView`'s children.

Our implementation does not exactly follow W3C spec in terms of sets of props that create the stacking context (because of historical reasons and mobile specifics) but ideologically it's the same. We start from the very conservative implementation where only views with background-color and borders do not form stacking context and then we probably extend that to more props.

Most importantly for us now, we will enforce the absence of ``FormsStackingContext` for `ParagraphShadowNode` and the presence of `FormsView` for `TextShadowNode` on Android where it's essential for mounting layer.

Read more about stacking context here: https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Positioning/Understanding_z_index/The_stacking_context

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: sammy-SC

Differential Revision: D20212253

fbshipit-source-id: 0fbaee214ce2c5886cb0232843a2a3c7bb20655d
2020-03-04 12:33:03 -08:00
generatedunixname89002005287564 6aa7030ce8 Daily `arc lint --take CLANGFORMAT`
Reviewed By: zertosh

Differential Revision: D20245569

fbshipit-source-id: 2fede4cfd7e0291aa6718d510bfe14ee175134df
2020-03-04 06:08:57 -08:00
Samuel Susla 899b314ca2 Back out "Pass layoutContext to Yoga's MeasureCallback"
Summary:
Passing `layoutContext` to yoga crashes fb4a-64. Until I have a solution let's back this out.

Original commit changeset: 9df7da4bef8c

Changelog: [Internal]

Reviewed By: makovkastar

Differential Revision: D20246917

fbshipit-source-id: 220744fde9f74e8157fc0714c63639b01152e4ab
2020-03-04 05:01:54 -08:00
Samuel Susla 3ee1e5312a Back out "Rename measure to measureContent and pass it LayoutContext"
Summary:
Original commit changeset: 8928b59d5194

Changelog: [Internal]

Reviewed By: makovkastar

Differential Revision: D20246918

fbshipit-source-id: 0b9142d9bc4774a07304769126411a34cc8c33c5
2020-03-04 05:01:53 -08:00
Valentin Shergin 903bf2de21 Fabric: Removing `const` qualifier from AccessibilityProps fields
Summary:
This is a part of migration staterted in D19390813.
There is no need to have those as const. The whole *Props object is usually const (and when it's not, props should not be too).
Changelog: [Internal] Fabric-specific internal change.

Reviewed By: sammy-SC

Differential Revision: D20212255

fbshipit-source-id: 87f3d8e7a94c6626bd9b0fc304f75e915dd73d4c
2020-03-03 23:35:25 -08:00
Samuel Susla b40f0562f5 Rename measure to measureContent and pass it LayoutContext
Summary:
In order to build dynamic text sizing, `LayoutableShadowNode::measure` needs to accept `LayoutContext`

Changelog: [Internal]

Reviewed By: shergin

Differential Revision: D20184598

fbshipit-source-id: 8928b59d51948caf3654f40049212a89a91dceb6
2020-03-03 04:14:04 -08:00
Samuel Susla d98a229202 Pass layoutContext to Yoga's MeasureCallback
Summary:
In order to build dynamic text sizing, we need to pass layoutContext to `yogaNodeMeasureCallbackConnector`

Changelog: [Internal]

Reviewed By: shergin

Differential Revision: D20184597

fbshipit-source-id: 9df7da4bef8cbad3bc87d63ed0c5aa5f420dbc11
2020-03-03 04:14:04 -08:00
David Vacca bf0019e433 Do not flatten views with PointerEvents props
Summary:
Some of the values of pointer events should be propagated across the hierarchy of views, e.g. the pointerEvent value NONE: https://reactnative.dev/docs/view#pointerevents
That mean that we can't flatten these views (or we should propagate these values across alll the hierarchy of a view that is being flatten)
For now I'm going to prevent these views to be flatten, this behavior is consistent with the Adroid view flattening algorithm:
https://our.intern.facebook.com/intern/diffusion/FBS/browse/master/xplat/js/react-native-github/ReactAndroid/src/main/java/com/facebook/react/uimanager/ViewProps.java?commit=1144adb5b45bf9a8c8cedf4ac86a2e9ccb429815&lines=249

changelog: [internal]

Reviewed By: shergin

Differential Revision: D20180804

fbshipit-source-id: 1fe7fc99c873a28c077b3859f8a7884d38b6d4d8
2020-03-01 14:11:56 -08:00
Kevin Gozali 30822e3923 make RN infra labels public
Summary:
Internal build target labeling.

Changelog: [Internal]

Reviewed By: zlern2k

Differential Revision: D20152676

fbshipit-source-id: 89615a0b3a6f3994b18f2c07b86d0ae93e052327
2020-02-28 12:46:49 -08:00
Samuel Susla 85696298bf Fix yoga node owner getting out of sync with children
Summary:
Changelog: [internal]

# Problem
We have node A with N children.

Calling cloning constructor on `YogaLayoutableShadowNode` causes new `yogaNode_` to be created.
However if `fragment.children` is nil in cloning constructor, which basically says children were not changed, then the existing children's `owner` becomes invalid.

# Solution
In the clone constructor, always call `updateYogaChildren`. This updates yoga children with the new `owner`.

Reviewed By: JoshuaGross

Differential Revision: D20139582

fbshipit-source-id: 3932694d4381b601df07dd8a57887ce7c09f1582
2020-02-28 06:17:55 -08:00
Valentin Shergin 6f4d362887 Fabric: Providing correct `pointScaleFactor` in `YogaLayoutableShadowNode::layoutTree`
Summary:
The previous implementation didn't do it, which was incorrect.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: mdvacca

Differential Revision: D20151493

fbshipit-source-id: ce4b916dbf8f6469b37dfa8ec3bab8cafcf87940
2020-02-27 21:47:49 -08:00
Valentin Shergin 1aab70d0e2 Fabric: `RootShadowNode::clone` was renamed/moved to `ShadowNode::cloneTree`
Summary:
Cloning subtrees is not something specific to a RootNode, so it makes sense to have it in ShadowNode. Soon we will use that to clone subtrees inside Paragraph component to implement Inline Views.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: mdvacca

Differential Revision: D20090666

fbshipit-source-id: 0a64ef9bda438cd55d5fd21d3ad83b36221fa89e
2020-02-26 22:08:22 -08:00
Valentin Shergin 011b470961 Fabric: Introducing `LayoutableShadowNode::layoutTree`
Summary:
All logic that is performed on the root node only was moved from `layout` to a separate methods `layoutTree`. That makes the code simpler and allows reusing `layoutTree` in InlineViews feature.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: mdvacca

Differential Revision: D20052025

fbshipit-source-id: 3070a1cca4e322c6d077ede751ea80359c96a600
2020-02-26 22:08:22 -08:00
Valentin Shergin 1801d63de2 Fabric: Deleting `YogaLayoutableShadowNode::getYogaLayoutableChildren`
Summary:
We don't use it anymore.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: mdvacca

Differential Revision: D20052019

fbshipit-source-id: b829e7bbf0768588c2f0f28c59bf8f85054408b7
2020-02-26 22:08:22 -08:00
Valentin Shergin 6a88e94326 Fabric: `YogaLayoutableShadowNode::updateYogaChildren`
Summary:
Similar to a previous diff but for `setChildren`.
`YogaLayoutableShadowNode::setChildren()` was renamed to `YogaLayoutableShadowNode::updateYogaChildren()`. Now we don't need to pass an argument to this function because the object is already initialized. The new name also disambiguates this method with `getChildren()` from `ShadowNode` (which does something completely different). The rest of the changes is just type adjustments.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: mdvacca

Differential Revision: D20052031

fbshipit-source-id: 6157cad9b55d4cdd97ce04e1278ac1369bfb96bc
2020-02-26 22:08:21 -08:00
Valentin Shergin 191d65ec4e Fabric: `YogaLayoutableShadowNode::setProps()` was replaced with `updateYogaProps()`
Summary:
`YogaLayoutableShadowNode::setProps()` was renamed to `YogaLayoutableShadowNode::updateYogaProps()`. Now we don't need to pass an argument to this function because the object is already initialized. The new name also disambiguates this method with `getProp()` from `ShadowNode` (which does something completely different).

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: sammy-SC

Differential Revision: D20052018

fbshipit-source-id: 4d9651bb4452408708fa1b36bb5c5c8639f7d1bb
2020-02-26 22:08:21 -08:00
Valentin Shergin 33bf310920 Fabric: YogaStylableProps now inherits Props
Summary:
How we can finally make `ViewProps` inherit `YogaStylableProps` and remove `dynamic_cast`. This overall change is aligned with D19963353.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: sammy-SC

Differential Revision: D20052026

fbshipit-source-id: 1066f9a259b50d4672111c9c03a71c2590d59aca
2020-02-26 22:08:20 -08:00
Valentin Shergin 6d10310733 Fabric: Removing a couple of (ViewProps and YogaStylableProps) constructors
Summary:
Here we delete several constructors that were needed only because `YogaLayoutableShadowNode::yogaStyle` was private (which is not true anymore).

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: sammy-SC, mdvacca

Differential Revision: D20052033

fbshipit-source-id: c2afcaf2fdebb65cdcde6c214c8b78aa35d45e91
2020-02-26 22:08:20 -08:00
Valentin Shergin cdbc21132b Fabric: Refinement of `BaseTraits` chain
Summary:
Here we refine the `ShadowNode::BaseTraits` static method. Before this change, ConcreteViewShadowNode<> enforces Layoutable and YogaLayoutable traits. This change moves that responsibility to LayoutableShadowNode and YogaLayoutableShadowNode which makes overall logic more coherent.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: sammy-SC

Differential Revision: D20052027

fbshipit-source-id: fd25264204b0232b1dbbff6f9dfefd9fbcb146c4
2020-02-26 22:08:20 -08:00
Valentin Shergin 0c50ba5376 Fabric: Moving logic from `ConcreteViewShadowNode` constructors to `YogaLayoutableShadowNode` constructors
Summary:
Now we can move custom to `YogaLayoutableShadowNode` code from `ConcreteViewShadowNode<>` template to `YogaLayoutableShadowNode` itself reducing the amount of templated code and reduce overall complexity.

Note, here we have to do `dynamic_cast` for now, we will address that in coming diffs.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: mdvacca

Differential Revision: D20052021

fbshipit-source-id: dac5969a97b75e54c7728a1ca8161922bd2245ca
2020-02-26 22:08:19 -08:00
Valentin Shergin 6f08c37633 Fabric: `getLayoutableChildNodes` was de-virtualized and moved to `LayoutableShadowNode`
Summary:
The fact that `LayoutableShadowNode` now inherits `ShadowNode` allows us to de-virtualize `getLayoutableChildNodes` and move that to `LayoutableShadowNode`. Less code, less virtual dispatch, less complexity.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: sammy-SC

Differential Revision: D20052032

fbshipit-source-id: 580e86b5a746028e470788e00027f247bf77126c
2020-02-26 22:08:19 -08:00
Valentin Shergin 5bf6726bae Fabric: Stop using `getChildrenSlice` in ConcreteViewShadowNode
Summary:
D19963353 mentioned the infrastructure that re-routes methods calls related to adding and cloning children between YogaLayoutableShadowNode and ShadowNode. `cloneAndReplaceChild` is exactly this. It was implemented as a virtual method that is called from `ConcreteViewShadowNode`. The whole process requires building a list of children of some class and passing that as a list of pointers. Now we don't need it all that because we can call directly and statically. That change will allow us to simplify that infra even more in the future diffs.

With all previous changes, now we can implement `getYogaLayoutableChildren` inside `YogaLayoutableShadowNode` and call that statically. Eventually, that will allow us to remove templated `getChildrenSlice`. Previously the call for that method must be in `ConcreteViewShadowNode`, now it's not true anymore which we will use later to even better goodness.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: mdvacca

Differential Revision: D20052020

fbshipit-source-id: e5c819a4d21b2dbcd08f3439e1783e3a9cba5ef4
2020-02-26 22:08:18 -08:00
Valentin Shergin 7953c3e854 Fabric: Devirtualizing `LayoutableShadowNode::cloneAndReplaceChild`
Summary:
D19963353 mentioned the infrastructure that re-routes methods calls related to adding and cloning children between YogaLayoutableShadowNode and ShadowNode. `cloneAndReplaceChild` is exactly this. It was implemented as a virtual method that is called from `ConcreteViewShadowNode`. The whole process requires building a list of children of some class and passing that as a list of pointers. Now we don't need it all that because we can call directly and statically. That change will allow us to simplify that infra even more in the future diffs.
 Changelog: [Internal] Fabric-specific internal change.

Reviewed By: sammy-SC

Differential Revision: D20052022

fbshipit-source-id: ddf341c112edd8a2f79eaf74465a9a360a168541
2020-02-26 22:08:18 -08:00