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

1182 Коммитов

Автор SHA1 Сообщение Дата
Samuel Susla 1fa3a8e475 Form stacking context if display style is none
Summary:
Changelog: [Internal]

View gets flattened even though it has `display: none` and therefore it and its children do not get hidden.

Reviewed By: shergin, mdvacca

Differential Revision: D21929033

fbshipit-source-id: 994a79fb64fbe66273a70218ebe8056d92cd3cd4
2020-06-09 02:31:00 -07:00
Samuel Susla 6860cb0775 Fix KERN_INVALID_ADDRESS in configureNextLayoutAnimation
Summary:
Changelog: [Internal]

The crash is caused by dereferencing invalid pointer.
This can happen because `UIManager` can outlive `RCTScheduler` and `Scheduler`.

Here we make sure when `Scheduler` is being deconstructed, UIManager's pointer is invalidated.

I don't think this is ideal solution but it should fix the crash.
Ideally we want the owner of animation delegate to invalidate the pointer.

Reviewed By: JoshuaGross

Differential Revision: D21922910

fbshipit-source-id: b2a56c1104574cecebaffad1bcbcbff82c1fa0cf
2020-06-07 13:17:52 -07:00
Paige Sun 058eeb43b4 Prefetch images using a lower download priority
Reviewed By: fkgozali

Differential Revision: D21881729

fbshipit-source-id: 071a41aef2458df3d9a93a4ab0174af73e85b9fc
2020-06-05 20:55:36 -07:00
Samuel Susla 9ebd852334 Fix KERN_INVALID_ADDRESS in LayoutAnimation
Summary:
Changelog: [Internal]

# Problem

`MountingCoordinator` holds a pointer to instance of `MountingOverrideDelegate` which becomes invalid.

# Solution

Use `std::weak_ptr` instead of raw pointer so it is possible to tell whether the pointer is expired.

Reviewed By: JoshuaGross

Differential Revision: D21905351

fbshipit-source-id: c7bf9635742a6ec086a03ba83202e46e1f1f373f
2020-06-05 16:11:11 -07:00
David Vacca d676558a30 Add support for elevation prop in Fabric
Summary:
This diff adds support elevation prop in Fabric core, additionally it adds this prop as non collapsable on the view flattening algorithm

changelog: [Internal] internal change in fabric to support elevation prop

Reviewed By: JoshuaGross

Differential Revision: D21896465

fbshipit-source-id: e0854acc0b2ac30eaf3f82d615aab1cf378cc530
2020-06-05 02:36:26 -07:00
David Vacca 4b596fd5b3 Extend Text to support measurement of empty Texts
Summary:
This diff extends the measurement of Text components in order to support empty strings.
This is required for parity with Paper.
I created a follow up task to analyze support of empty string as part of the Text infrastructure of Fabric in the future.

changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D21761171

fbshipit-source-id: d2aa074052b09732af5d35723f19014090fcabbf
2020-05-28 15:10:47 -07:00
Joshua Gross 8b2eb3766b C++ LayoutAnimations: solve crash when "animating" virtual views
Summary:
Index adjustment doesn't work if virtual views are inserted, because those don't actually result in the view hierarchy being mutated, as such.

Add an Android-specific check to solve the crash.

I don't love adding platform-specific checks here, so I'm considering wrapping this logic in a platform-specific class, so that logic lives outside of the core of LayoutAnimations and entirely in platform code.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D21727805

fbshipit-source-id: 5af2cf479beaa4d0e9d94ea16ac989c4268920f8
2020-05-26 16:12:03 -07:00
Joshua Gross ae7df2df22 LayoutAnimations: fail silently instead of redboxing if there's a misconfigured LayoutAnimation
Summary:
property and type are optional params according to Flow, so we should treat as such.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D21725746

fbshipit-source-id: 3c48a8cef8fa5911c195f582556de6dad871c4f1
2020-05-26 13:15:50 -07:00
Samuel Susla 1b1ebaf2bd Delete copy constructor and copy assignment operator in ShadowNode
Summary:
Changelog: [Internal]

ShadowNode shouldn't be copyable.

Reviewed By: shergin

Differential Revision: D21692756

fbshipit-source-id: e70dcf82f4d4c7609283936a42c741467f8f13ca
2020-05-23 06:57:51 -07:00
David Vacca 95546d932f Add ART components into Catalyst app Android
Summary:
Simple diff to add ART components into Catalyst app Android

changelog: [Internal] Internal changes to add support of ART for Fabric

Reviewed By: JoshuaGross

Differential Revision: D21621479

fbshipit-source-id: d957c25f447d19d8f349c69aa20f5f19237d867a
2020-05-22 01:23:38 -07:00
David Vacca 19e0b133f8 Delete unused class
Summary:
ez diff to delete unused class

changelog: [internal]

Reviewed By: fkgozali

Differential Revision: D21699666

fbshipit-source-id: d0e725c7096906e2effd16f8fa2a57683192420f
2020-05-22 01:23:38 -07:00
David Vacca 58a7ddd55d Implement equality of ARTElements and use it in ARTState
Summary:
Here I'm implementing equality methods for ARTGroup, ARTShape and ARTText and I'm using these methods to update the state only when it is necessary.
This will improve perf in rendering of ART

changelog: [Internal]

Reviewed By: JoshuaGross

Differential Revision: D21695127

fbshipit-source-id: b438ddea4c34bd7a0bdf26a6aac4fd62a9f78b49
2020-05-22 01:23:37 -07:00
David Vacca 55c36661d9 Rename Element -> ARTElement
Summary:
Element, Shape, Group, Text are too generic, we are renaming these classes to ARTElement, ARTBGroup, ARTShape...

changelog: [Internal] internal changes to support ART in android

Reviewed By: JoshuaGross

Differential Revision: D21681878

fbshipit-source-id: f6b35443486a3db210f61dcaf91bd32df47fbc66
2020-05-22 01:23:37 -07:00
David Vacca cfd2e7d88d Add support for Text in ART Fabric Android
Summary:
This diff adds support for Text in ART Fabric Android

changelog: [Internal] internal changes to fully support ART in Fabric

Reviewed By: JoshuaGross

Differential Revision: D21681877

fbshipit-source-id: c92e642cff56b71f8ee8f4eb9af6eea6c490f6c7
2020-05-22 01:23:36 -07:00
David Vacca b8b683dc46 Serialize ART text components and send data to Android
Summary:
This diff implements the serialization of Text components to send data from C++ to java

changelog: [Internal] internal changes to support ART in fabric

Reviewed By: JoshuaGross

Differential Revision: D21681875

fbshipit-source-id: eba31f35c95e0a2d3226ec70421832719083d7fa
2020-05-22 01:23:36 -07:00
David Vacca 888866461b Refactor types of ART Text class
Summary:
This diff refactors the types of ART Text classes, this is necessary on the next diffs of the stack

closeoncommit

changelog: [internal]

Reviewed By: JoshuaGross

Differential Revision: D21681876

fbshipit-source-id: ea438e89df6d860b3ff8bbdae657ca123b417a1b
2020-05-22 01:23:36 -07:00
Kevin Gozali e85118cc43 update internal code attribution
Summary:
Internal code attribution labeling update.

Changelog: [Internal]

Reviewed By: zlern2k

Differential Revision: D21696075

fbshipit-source-id: ef689a6367e1dddfffbbefb52a6aead2c91bfefe
2020-05-21 19:59:29 -07:00
Samuel Susla b31149cf90 Introduce BatchedEventQueue::enqueueUniqueEvent
Summary:
Changelog: [Internal]

`BatchedEventQueue::enqueueUniqueEvent` goes over event queue and deletes previous event of the same type and same target.

This is useful for ScrollView for example where only the latest event is relevant.
This only affects ScrollView scroll event, other events take the original code path.

Reviewed By: mdvacca

Differential Revision: D21648906

fbshipit-source-id: a80ad652058fd50ebb55e24a87229cdc1764b591
2020-05-21 11:56:22 -07:00
Samuel Susla 43d65ed66c Separate event dispatchers to ivars instead of array
Summary:
Changelog: [Internal]

Separates EventQueues from an array into 4 ivars.
EventQueues are of different type, in the future we will want to call different methods on different kind of EventQueue.

Reviewed By: shergin

Differential Revision: D21648905

fbshipit-source-id: 90ae65edb8a9276eecfea9770f554d8c56804797
2020-05-21 11:56:22 -07:00
generatedunixname89002005287564 7e343c8d3a Daily `arc lint --take CLANGFORMAT`
Reviewed By: zertosh

Differential Revision: D21683227

fbshipit-source-id: a29bc66af62fe99d803ac386261269b5cd16c18f
2020-05-21 10:13:22 -07:00
Samuel Susla 745ff1086a Prevent ABA problem during YogaLayoutableShadowNode cloning
Summary:
Changelog: [Internal]

# Problem
Yoga internally uses address of owner to determine whether a node should be cloned or it shouldn't.
During layout, it traverses the tree and looks whether current parent is equal to child's owner. If it isn't it means the yoga node is shared between 2+ trees and need to be cloned before mutated. Parent in yoga is stored as reference to the parent.

We can run into an issue where yoga node is shared between 2+ trees, but its current parent is equal to child's owner. This is because we reallocate new parent at address where its previous parent lived. This happens over few iterations, the old parent is first deallocated.

This is known as ABA problem.

# Solution

When we are cloning node, we loop over all children to see whether any of the is not using address of new `yogaNode_` as its owner. At this point we know this is accidental and set its owner to `0xBADC0FFEE0DDF00D`.

We chose `0xBADC0FFEE0DDF00D` because when someone is debugging this in LLDB and prints this address, it will hint them that it was artificially set and can string search for it in the codebase.

Reviewed By: shergin

Differential Revision: D21641096

fbshipit-source-id: c8b1b4487ea02b367f5831c1cdac055bce79c856
2020-05-21 07:20:20 -07:00
David Vacca 21afa62517 Serialize ART state into folly::dynamic
Summary:
This diff serializes ART state into folly::dynamic. this is necessary to send this data to Android

changelog: [Internal]

Reviewed By: shergin

Differential Revision: D21657608

fbshipit-source-id: 6c1b69af7d1dbe7de15e509f83c508a38294d89e
2020-05-21 00:11:51 -07:00
David Vacca 0305ff8ee0 Integrate ElementType Enum into state
Summary:
This diff replaces the usage of int to represent the type of elements for an Enum
changelog: [Internal] Internal change to support ART in fabric

Reviewed By: shergin

Differential Revision: D21657706

fbshipit-source-id: 7bda0210d50136477f0524695d5406e35074f09c
2020-05-21 00:11:51 -07:00
David Vacca b7ab3aaf61 Integrate State into ARTSurfaceViewShadowNode
Summary:
This diff integrates ART state into ARTSurfaceViewShadowNode

changelog: [Internal]

Reviewed By: shergin

Differential Revision: D21657611

fbshipit-source-id: 06bd4d610e2c52e0ef3bca423b93c9ad2318e8df
2020-05-21 00:11:51 -07:00
David Vacca 493d616521 Create internal State of ART based on Shadow Nodes
Summary:
This diff creates the internal state of ART based on its shadow nodes

changelog: [Internal]

Reviewed By: JoshuaGross

Differential Revision: D21657607

fbshipit-source-id: 0a15e90ee7465bf3a2b1001ff9d3198eb22fd708
2020-05-21 00:11:50 -07:00
David Vacca 192bea1613 Create classes to represent C++ state of ART
Summary:
This diff introduces a set of classes that are going to be used to represent the internal State of ART nodes

changeLog: [Internal][Android] Internal change to support ART in Fabric

Reviewed By: JoshuaGross, shergin

Differential Revision: D21657612

fbshipit-source-id: ea6d94b06807ff02d222dfa129a1cae384dceeaa
2020-05-21 00:11:50 -07:00
Joshua Gross c75e8ae4ff LayoutAnimations: allow Paragraph props to be interpolated
Summary:
1. Split out the prop interpolation function out of the View ComponentDescriptor, into an inline'd function that can be used elsewhere.
2. Call it from View and from Paragraph component descriptors.

This causes animations including Text to look normal on iOS.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D21675804

fbshipit-source-id: c34a317749fd6c108aef072d47f3dcb14ce8aa5c
2020-05-20 19:45:51 -07:00
Joshua Gross 3f9fad1052 LayoutAnimations: Use Quaternions to interpolate rotation transforms
Summary:
Implement a real Transform interpolation. It uses quaternions/Slerp to interpolate rotations. This allows us to interpolate scale, rotation, and translation simultaneously.

See caveats in code. Because of the way transform matrices work, there isn't much (anything?) we can do about skew, and certain values will look nonsensical. This seems to be true for any variant of this algorithm.

This is a big step up from Classic RN which didn't support this in LayoutAnimations at all.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D21675805

fbshipit-source-id: a33494cc02c73102ca67c1d562efc4b2a7308a4a
2020-05-20 19:45:50 -07:00
Joshua Gross eb9b2cedb8 LayoutAnimations: implement LayoutAnimationStatusDelegate for platform-specific integrations
Summary:
The LayoutAnimationStatusDelegate exists so that platforms can get a signal when animations are starting or have all completed.

This signal is meant to be used ONLY for driving animations at 60fps, or stopping that process, on the platform side.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D21675807

fbshipit-source-id: e89ba524ea43c266556199c8854e8228869755e3
2020-05-20 19:45:49 -07:00
Joshua Gross 8d2c1f6e7e LayoutImplementations: implement all existing animation curves besides Keyboard
Summary:
Implement EaseIn, EaseOut, EaseInOut, and Spring with SpringDamping.

Note this does not yet implement Keyboard-type animation for iOS (coming soon), and the spring interpolator is VERY naive. We likely want to replace it with a "real" spring animation ASAP. The spring animation is identical to what Android does today, but would likely be a downgrade for iOS. I will do both in a followup.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D21675810

fbshipit-source-id: ac98554ebc81f0b81fdacefd6d848e3566e424c0
2020-05-20 19:45:49 -07:00
Joshua Gross 3331962279 C++ Fabric Core LayoutAnimations
Summary:
This is the V1 implementation of Fabric Core LayoutAnimations.

The intention is to structure this in such a way that it's easy for each platform to customize the "AnimationDriver" class (to do platform-specific optimizations) without changing the KeyFrameManager at all.

In the future, this structure and architecture should allow us to iterate faster on new animation APIs.

Changelog: [Internal] Support for LayoutAnimations in Fabric

Reviewed By: mdvacca

Differential Revision: D21675808

fbshipit-source-id: b3ef44729bb8b6217f90760aec9737276c9601d1
2020-05-20 19:45:49 -07:00
Ishan Khot eb504e613e Revert D17486030: C++ Fabric Core LayoutAnimations
Differential Revision:
D17486030

Original commit changeset: 95c72cf9fc2b

fbshipit-source-id: fa7ef058f5d0dea0154c62718a8a11d9330698d9
2020-05-20 16:34:29 -07:00
Ishan Khot 6a15d7487f Revert D21587648: LayoutImplementations: implement all existing animation curves besides Keyboard
Differential Revision:
D21587648

Original commit changeset: 246ab7fd4039

fbshipit-source-id: 427e13ff821776feb4952c3438c15ea815fce5f0
2020-05-20 16:34:29 -07:00
Ishan Khot 5ae7e4fee2 Revert D21583109: LayoutAnimations: implement LayoutAnimationStatusDelegate for platform-specific integrations
Differential Revision:
D21583109

Original commit changeset: 234496841bde

fbshipit-source-id: 2f74dcce23f4eebf987e2114ad1f23cf01e11a9d
2020-05-20 16:34:29 -07:00
Ishan Khot 953c39293e Revert D21615829: LayoutAnimations: Use Quaternions to interpolate rotation transforms
Differential Revision:
D21615829

Original commit changeset: da6cb931ce85

fbshipit-source-id: 4b5bc392a35aac627b89ccccb73e10a2b1c4aaa6
2020-05-20 16:34:27 -07:00
Ishan Khot adccef7f48 Revert D21635473: LayoutAnimations: allow Paragraph props to be interpolated
Differential Revision:
D21635473

Original commit changeset: 470f43fd24a6

fbshipit-source-id: 8507b0aaead2c0ebbdd09077db99e5e44da175ab
2020-05-20 16:34:27 -07:00
Joshua Gross a799367baf LayoutAnimations: allow Paragraph props to be interpolated
Summary:
1. Split out the prop interpolation function out of the View ComponentDescriptor, into an inline'd function that can be used elsewhere.
2. Call it from View and from Paragraph component descriptors.

This causes animations including Text to look normal on iOS.

Changelog: [Internal]

Reviewed By: shergin

Differential Revision: D21635473

fbshipit-source-id: 470f43fd24a6e80d8696ee2f2a09d9e693b7f280
2020-05-20 14:16:48 -07:00
Joshua Gross 3cbafcccba LayoutAnimations: Use Quaternions to interpolate rotation transforms
Summary:
Implement a real Transform interpolation. It uses quaternions/Slerp to interpolate rotations. This allows us to interpolate scale, rotation, and translation simultaneously.

See caveats in code. Because of the way transform matrices work, there isn't much (anything?) we can do about skew, and certain values will look nonsensical. This seems to be true for any variant of this algorithm.

This is a big step up from Classic RN which didn't support this in LayoutAnimations at all.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D21615829

fbshipit-source-id: da6cb931ce857107d4b3d20108fb9bbecbf4f898
2020-05-20 14:16:47 -07:00
Joshua Gross f0c595b57c LayoutAnimations: implement LayoutAnimationStatusDelegate for platform-specific integrations
Summary:
The LayoutAnimationStatusDelegate exists so that platforms can get a signal when animations are starting or have all completed.

This signal is meant to be used ONLY for driving animations at 60fps, or stopping that process, on the platform side.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D21583109

fbshipit-source-id: 234496841bde226fcd6623c74c1a500e5cd00d99
2020-05-20 14:16:46 -07:00
Joshua Gross 46310c1976 LayoutImplementations: implement all existing animation curves besides Keyboard
Summary:
Implement EaseIn, EaseOut, EaseInOut, and Spring with SpringDamping.

Note this does not yet implement Keyboard-type animation for iOS (coming soon), and the spring interpolator is VERY naive. We likely want to replace it with a "real" spring animation ASAP. The spring animation is identical to what Android does today, but would likely be a downgrade for iOS. I will do both in a followup.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D21587648

fbshipit-source-id: 246ab7fd40397a4231bb6b18d2f29602788a1bd2
2020-05-20 14:16:46 -07:00
Joshua Gross e9d6fb2ec6 C++ Fabric Core LayoutAnimations
Summary:
This is the V1 implementation of Fabric Core LayoutAnimations.

The intention is to structure this in such a way that it's easy for each platform to customize the "AnimationDriver" class (to do platform-specific optimizations) without changing the KeyFrameManager at all.

In the future, this structure and architecture should allow us to iterate faster on new animation APIs.

TODOs:

- Use std::chrono for timekeeping

Changelog: [Internal] Support for LayoutAnimations in Fabric

Reviewed By: shergin

Differential Revision: D17486030

fbshipit-source-id: 95c72cf9fc2b4bf3fe652fbd249cf2ad113033c7
2020-05-20 14:16:45 -07:00
Jimmy Zhang 6acccae980 Add FBRotatablePhotoPlayerView to LegacyInterop whitelist
Summary: Changelog: [internal]

Reviewed By: sammy-SC

Differential Revision: D21661427

fbshipit-source-id: de692015f3c6f029d2ea3f927e30d6758c0b1102
2020-05-20 09:28:08 -07:00
Samuel Susla 351a9f1047 Copy alreadyAppliedPadding when cloning SafeAreaViewShadowNode
Summary:
Changelog: [Internal]

`SafeAreaViewShadowNode.alreadyAppliedPadding` was always {0, 0, 0, 0} because value of previous shadow node was never copied over to new shadow node during clone.

Reviewed By: shergin

Differential Revision: D21617361

fbshipit-source-id: 6d6c91b19ff60271bf7c48145d85faaee0321680
2020-05-19 03:20:42 -07:00
David Vacca 7929f674cc Basic implementation of ARTText
Summary:
Basic implementation of ARTText (shadow node, props and component descriptor)
changelog: [Internal] Internal changes to support art in Fabric

Reviewed By: shergin

Differential Revision: D21621483

fbshipit-source-id: d0886dc149520af13faa1bb936dfcccab1798c37
2020-05-18 16:36:38 -07:00
David Vacca 54adda64ec Basic implementation of ARTGroupProps
Summary:
Basic implementation of ARTGroupProps (shadow node, props and component descriptor)
changelog: [Internal] Internal changes to support art in Fabric

Reviewed By: shergin

Differential Revision: D21621480

fbshipit-source-id: 367a479568b8c1a290f3e0f633cc4052a9c95b87
2020-05-18 16:36:38 -07:00
David Vacca 12fee9af62 Create basic implementation of Shape
Summary:
Create basic implementation of Shape (shadow node, props and component descriptor)
changelog: [Internal] Internal changes to support art in Fabric

Reviewed By: shergin

Differential Revision: D21621482

fbshipit-source-id: e5b9bb2812ee92bce625301b7521f0578eaca0ff
2020-05-18 16:36:37 -07:00
David Vacca a011eaf7e5 Basic implementation of ARTSurfaceView
Summary:
Basic implementation of ARTSurfaceView (shadow nodes, props and component descriptor)
changelog: [Internal]

Reviewed By: shergin

Differential Revision: D21621484

fbshipit-source-id: 5577989e966a8a97a043454bf9ae1e5602abc3b1
2020-05-18 16:36:37 -07:00
Valentin Shergin dafa975352 Fabric: Simplification of `UIManager::getRelativeLayoutMetrics`
Summary:
Using of the new API makes clear that we don't need to calculate the newest descendant node.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: mdvacca

Differential Revision: D21480202

fbshipit-source-id: c54998573baffe4a05726e3402da027f052b049a
2020-05-18 14:08:27 -07:00
Valentin Shergin caab26e0c3 Fabric: Refinement of `LayoutableShadowNode::getRelativeLayoutMetrics`
Summary:
This diff simplifies the implementation of `LayoutableShadowNode::getRelativeLayoutMetrics`.

It fixes a small bug but the most important change is the new interface.

Now the function that does measurements accepts a node and a family instead of two nodes. It prevents misuse and misinterpretation of what the function does. The function needs two things to perform measurement:
 * an ancestor node that defines the tree is being measured and the base node of measurement;
* a family of some descendant node being measured relative to the ancestor node.

An API that accepts two nodes is misleading because it implies that the given descendant node will be measured (which is not true).

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: sammy-SC

Differential Revision: D21480200

fbshipit-source-id: 9fddc361417fee47bbf66cc7ac2954eb088a3179
2020-05-18 14:08:27 -07:00
Valentin Shergin 656db7823c Fabric: Changes in LayoutableShadowNodeTest
Summary:
One small test was added.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: sammy-SC

Differential Revision: D21480201

fbshipit-source-id: fd6c050143fcdf27d345ee62e74c4368266e6ce0
2020-05-18 14:08:26 -07:00