Commit Graph

726 Commits

Author SHA1 Message Date
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