Commit Graph

299 Commits

Author SHA1 Message Date
Valentin Shergin fec0a51e85 Fabric: Simplified `ViewShadowNode::cloneAndReplaceChild`
Summary: Using methods of the base class instead of custom implementation.

Reviewed By: fkgozali

Differential Revision: D7467795

fbshipit-source-id: 4d168b72880f6900bf8b747e1d655c10140e0c79
2018-04-10 12:59:51 -07:00
Valentin Shergin a38f32a5a6 Fabric: Couple of ViewProps fields were exposed as getters
Summary: We have to have getters for all props/fields.

Reviewed By: mdvacca

Differential Revision: D7467792

fbshipit-source-id: 1492aad2d3398e6c14e0e354047730cf91201175
2018-04-10 12:59:51 -07:00
Valentin Shergin dc1a9680de Fabric: Refined TreeMutationInstruction class
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
2018-04-10 12:59:50 -07:00
Valentin Shergin 7e84cadc9c Fabric: Refined conception and usage of Sealable
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
2018-04-10 12:59:50 -07:00
Valentin Shergin c83aeaaf82 Fabric: Forgotten compiler directive and include
Summary: Trivial. Those nits prevent cause compilation errors in some configurations.

Reviewed By: fkgozali

Differential Revision: D7467794

fbshipit-source-id: cbda285748374fd941a0b1ca6718d702ca2d6d82
2018-04-10 12:59:50 -07:00
Valentin Shergin 1f969d3440 Fabric: Equality operators for ShadowNode
Summary: Test for equality will be used in ShadowNode Tree Diffing algorithm.

Reviewed By: fkgozali

Differential Revision: D7467802

fbshipit-source-id: 5383add9fc7d7e4a772ca16e70a54f7e0c36823a
2018-04-10 12:59:50 -07:00
Valentin Shergin 4ebb57b0ba Fabric: `ShadowNode.revision_` field is now private
Summary: It prevents accidental access to the variable.

Reviewed By: fkgozali

Differential Revision: D7467789

fbshipit-source-id: fa026734f58f0039e9b6d401751e022a9ae2431d
2018-04-10 12:59:50 -07:00
Pritesh Nandgaonkar bcd12f1e87 Change the type of aspect Ratio to YGFloatOptional
Reviewed By: emilsjolander

Differential Revision: D7302651

fbshipit-source-id: 53e3b4c9627207a379f927b1f3485e36a9c70601
2018-04-03 15:02:57 -07:00
David Vacca 29ff30c539 Rename YogaNode.parent -> YogaNode.owner
Reviewed By: priteshrnandgaonkar

Differential Revision: D7352778

fbshipit-source-id: dcf1af5e72bfc3063b5c4bda197d7952a9194768
2018-04-01 18:32:12 -07:00
David Vacca aff5a75d8e Refactor cloning of YogaNode
Reviewed By: priteshrnandgaonkar

Differential Revision: D7339832

fbshipit-source-id: 2de6f47ae7601ac083d3b9fbe10ffaf6307ae760
2018-04-01 18:32:12 -07:00
Valentin Shergin 1f27098a1a Fabric: Proper Yoga node dirting in YogaLayoutableShadowNode
Summary: Any change must be propagate upwards.

Reviewed By: mdvacca

Differential Revision: D7389058

fbshipit-source-id: 09c74640d0e9607d2e17bdd31d7ce69df8565f72
2018-03-30 12:25:51 -07:00
Valentin Shergin 99e9c6e798 Fabric: Collecting and printing ShadowNode's revision/generation
Summary: It drastically simplifies reading logs.

Reviewed By: fkgozali

Differential Revision: D7388963

fbshipit-source-id: 7849c803f295719918c20ddf8c082e5a5780116f
2018-03-25 22:48:19 -07:00
Valentin Shergin cb7a7f3b93 Fabric: Deleted virtual default destructor from Props
Summary: Trivial. We don't need this because we already have another virtual method.

Reviewed By: fkgozali

Differential Revision: D7388964

fbshipit-source-id: 5ea6eb33ece72796d8cde2cc4b12c1240447d22a
2018-03-25 22:48:18 -07:00
Valentin Shergin 6f17e3b328 Fabric: Introducing `TreeMutationInstruction`
Summary: The Great Diffing algorithm is coming.

Reviewed By: fkgozali

Differential Revision: D7376528

fbshipit-source-id: bdfef69551980136cfd1717a11ae376d5eef126b
2018-03-25 22:48:18 -07:00
Valentin Shergin 53dfbcc81c Fabric: Fixed bug in node management in FabricUIManager
Summary: Suddenly, `{}` means `{nullptr}`, not `empty list`.

Reviewed By: mdvacca

Differential Revision: D7376347

fbshipit-source-id: 76f81eebe046ae592f0a42be7bcaa0587732c2a9
2018-03-25 22:48:18 -07:00
Valentin Shergin 5642514aa5 Fabric: Detailed looging in FabricUIManager
Summary: Apparently, we need this.

Reviewed By: mdvacca

Differential Revision: D7376350

fbshipit-source-id: 11d8ad54c7439e6c19a739ae1ac31af90d37166a
2018-03-25 22:48:18 -07:00
Valentin Shergin ee0cc6bbe7 Fabric: Implementing cloneAndReplaceChild() for ViewShadowNode
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
2018-03-25 22:48:18 -07:00
Valentin Shergin 8f9212b839 Fabric: Fixed lost YogaNode's context in YogaLayoutableShadowNode
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
2018-03-25 22:48:18 -07:00
Valentin Shergin 1bb6db36be Fabric: Removed unused copy constructor YogaLayoutableShadowNode()
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
2018-03-25 22:48:18 -07:00
Valentin Shergin 53782eafc9 Fabric: Source shadow node is now stored as a weak pointer
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
2018-03-25 22:48:18 -07:00
Kevin Gozali 1acef45977 iOS: added placeholder test setup for fabric graphics/uimanager/view targets
Reviewed By: shergin

Differential Revision: D7390366

fbshipit-source-id: d49fcc335fc03d52402676341f1da24177c6084b
2018-03-23 22:22:20 -07:00
Kevin Gozali 408a5f264b iOS: added fabric/core ComponentDescriptor tests
Summary: Basic test for ComponentDescriptor mechanism.

Reviewed By: shergin

Differential Revision: D7388297

fbshipit-source-id: 3b0c625656e31df03d71a2e036388621a5e2e21d
2018-03-23 17:32:52 -07:00
Kevin Gozali e254474d4c iOS: added fabric/core ShadowNode tests
Summary: basic tests for shadow nodes and props for fabric

Reviewed By: shergin

Differential Revision: D7377867

fbshipit-source-id: dc8e5bb369aeb32b4790fd8b56f333376bc1578c
2018-03-23 17:32:52 -07:00
Kevin Gozali 8c0070c706 iOS: added fabric/core primitives tests
Summary: basic tests for fabric core primitives

Reviewed By: shergin

Differential Revision: D7373952

fbshipit-source-id: e2d9b3c15716c16b1aab698883817e670dcb7a57
2018-03-23 17:32:52 -07:00
Kevin Gozali 10c95a25cc fixed contacts for the test target
Reviewed By: mdvacca

Differential Revision: D7366977

fbshipit-source-id: 93341f8964da71a7e23049fc5d2324a0da376746
2018-03-22 10:49:44 -07:00
Kevin Gozali 6ae38feb65 Added sample iOS unit test setup for fabric/debug target
Summary: basic setup for unit testing Fabric impl

Reviewed By: hramos

Differential Revision: D7359239

fbshipit-source-id: ccaf36e775036f2fad4d8c882bce86bbbe06dd28
2018-03-21 16:40:06 -07:00
Kevin Gozali f015900d30 fixed debug string formatting for structure
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
2018-03-21 16:40:06 -07:00
Valentin Shergin b808bfdce2 Fabric: Introducting `ShadowNode.sourceNode`, the node used in copy-constructor
Summary: We will need this later in the diffing alogrithm.

Reviewed By: fkgozali

Differential Revision: D7330337

fbshipit-source-id: 3da44a62e4d5f30deed28b18a5779544153244f3
2018-03-19 17:08:31 -07:00
Valentin Shergin 39383d1189 Fabric: Improved YogaLayoutableShadowNode printing
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
2018-03-19 17:08:31 -07:00
Valentin Shergin ff288b7416 Fabric: Complete implementation of `layoutMetricsFromYogaNode`
Summary: That was simply incomplete.

Reviewed By: fkgozali

Differential Revision: D7330336

fbshipit-source-id: c495c7f61d8e551fa963bfa6cc0408343eb8439b
2018-03-19 17:08:31 -07:00
Valentin Shergin a5a34565e0 Fabric: Proper return value of `LayoutableShadowNode::setLayoutMetrics()`
Summary: `LayoutableShadowNode::setLayoutMetrics()` must return `false` is nothing was changes.

Reviewed By: fkgozali

Differential Revision: D7330334

fbshipit-source-id: 700d50b0047919fa2b919acfa72825f100cd496f
2018-03-19 17:08:31 -07:00
Valentin Shergin aaaa946e6d Fabric: Equality operators for geometry types
Summary: We will need this soon.

Reviewed By: fkgozali

Differential Revision: D7330338

fbshipit-source-id: 30aeadc182893e86c6a039c74d245f9b56624151
2018-03-19 17:08:31 -07:00
Naris Siamwalla 12535ae69d Fix clang-6 strictness surrounding virtual destructors
Reviewed By: smeenai

Differential Revision: D7326765

fbshipit-source-id: 9df477dfa89812e05e79b5e6d510bcbbc793381c
2018-03-19 15:00:09 -07:00
Valentin Shergin 378da73201 DebugStringConvertibleOptions: Formating
Summary:
DebugStringConvertibleOptions allows pretty-format debug strings.
https://pxl.cl/ch0m

Reviewed By: fkgozali

Differential Revision: D7312622

fbshipit-source-id: 0ed62520bbc521790bedf5a6d18c796b42f85658
2018-03-18 19:17:39 -07:00
Valentin Shergin 4cda0df2e5 Switching to the new FabricUIManager and all new shadow tree infra
Reviewed By: fkgozali

Differential Revision: D7230670

fbshipit-source-id: bca7d2859b87931c0d15406782b7d689de1d8c36
2018-03-18 19:17:39 -07:00
Valentin Shergin c2ad59a277 `fabric/uimanager` module
Summary: `fabric/uimanager` implements FabricUIModule.

Reviewed By: fkgozali

Differential Revision: D7230669

fbshipit-source-id: db6228021352598feac7854b5871d9d6c5c85119
2018-03-18 19:17:39 -07:00
Valentin Shergin 965e60b05a `fabric/view` module
Summary: Defines `<View>`: Yoga-powered, Accessible and styleable component.

Reviewed By: fkgozali

Differential Revision: D7230673

fbshipit-source-id: 08a1d8626c0b41260fafdca938d4fe9489b1b793
2018-03-18 19:17:39 -07:00
Valentin Shergin 6b0960cbdb Introducing `ConcreteShadowNode`
Summary: ConcreteShadowNode defines a template which connects typed Props and typed ShadowNode.

Reviewed By: fkgozali

Differential Revision: D7230667

fbshipit-source-id: be28314d6846d69960e921da852f01232951f965
2018-03-18 19:17:39 -07:00
Valentin Shergin 811d5bfc73 Introducing LayoutableShadowNode
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
2018-03-18 19:17:39 -07:00
Valentin Shergin 840638c441 Introducing `ComponentDescriptor`
Summary:
Abstract class and default template implementation.
`ComponentDescriptor`s define basic logic of managing (creation, cloning, applying props) ShadowNode of particular type.

Reviewed By: fkgozali

Differential Revision: D7230671

fbshipit-source-id: c32636f4db0716b55a1637f61c4f1872fc52cea7
2018-03-18 19:17:39 -07:00
Valentin Shergin 608d1fb590 `fabric/graphics` module: all about graphics
Summary: `fabric/graphics` provides graphics primitives; the implementation should be platform-specific eventually.

Reviewed By: fkgozali

Differential Revision: D7230675

fbshipit-source-id: ff05d2673072fad5ee6f331f0155561969e1a8b6
2018-03-18 19:17:39 -07:00
Valentin Shergin c623455845 Abstract classes for ShadowNode and Props
Summary: Foundation clases for Fabric designed to be "const-first".

Reviewed By: fkgozali

Differential Revision: D7230672

fbshipit-source-id: 433acd35a7958d5d577358b0a306923f970e573f
2018-03-18 19:17:39 -07:00
Valentin Shergin d16772a31e Sealable: fixed semantic; atomic type for the flag variable
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
2018-03-18 19:17:39 -07:00
Kevin Gozali 3c86701ea7 `fabric/core` module and `Sealable` class
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
2018-03-08 18:04:28 -08:00
Kevin Gozali 34f8e7f848 `fabric/debug` module and `DebugStringConvertible` class
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
2018-03-08 18:04:28 -08:00
Jakub Grzmiel 5f497ca302 Convert constant with build flags to function
Reviewed By: ttsugriy

Differential Revision: D7184372

fbshipit-source-id: c66f473ad15898532f24c6276898ab250e749744
2018-03-08 00:17:53 -08:00
Kevin Gozali 7bf3b20837 iOS: create C++ <-> ObjC++ connector for FabricUIManager to do UI operations
Reviewed By: shergin

Differential Revision: D7162911

fbshipit-source-id: 3e303020dafdccc51f52c3359a7054dc8a787978
2018-03-07 16:54:16 -08:00
Kevin Gozali 52acbbdd62 iOS: adjusted JSI binding for C++ FabricUIManager
Reviewed By: sebmarkbage, shergin

Differential Revision: D7078631

fbshipit-source-id: 6df21e52d3941372a9845fdcf2aed777de7cb359
2018-02-27 08:42:14 -08:00
Kevin Gozali 0ee03178a0 added C++ setup for FabricUIManager
Reviewed By: shergin

Differential Revision: D7077312

fbshipit-source-id: e284c151438eb4d1f67a8386580ab54e3dce7c17
2018-02-23 19:49:03 -08:00