Summary: It was made dead by the previous revisions
Reviewed By: amnn
Differential Revision: D13313263
fbshipit-source-id: b8c8402b5427dc5d3efbbd2ee871aebf1e14ee0d
Summary:
In the version of JSC on iOS 11, creating a JSContext on one
thread and using it on another can trigger subtle and nearly
impossible to debug reentrancy-related crashes in the VM (see
https://bugs.webkit.org/show_bug.cgi?id=186827). In !NDEBUG builds,
check for this case and throw an exception, so it can be detected
early.
Reviewed By: amnn
Differential Revision: D13313264
fbshipit-source-id: ee85435c20e23c8520495ce743d2f91f2eeada5c
Summary:
`ShadowTree` class is already thread-safe, so we don't need to (we should not) guard concurent access to it.
We should guard concurrent write-access to the collection of them though.
Note that unordered_map is "thread-compatible" collection, so concurrent reading access is okay.
Reviewed By: mdvacca
Differential Revision: D13269745
fbshipit-source-id: 4779626018da0e42b81a835e538f6c1d1a8e25f7
Summary: Trivial diff that cleans up measure function in C++ and Android
Reviewed By: shergin
Differential Revision: D13200340
fbshipit-source-id: 6c0888439640241cdedf514898a1ba3dac231d6a
Summary:
`JSBigString` is using functions from `unistd.h`, like `getpagesize`, `dup`, `open`, etc. but was not directly including it.
It was being included from inside the glog `logging.h` header, which in turn was getting included by the Folly headers `JSBigString` was using.
This was discovered while building CxxReact with a custom shimmed Glog.
Pull Request resolved: https://github.com/facebook/react-native/pull/22330
Differential Revision: D13115346
Pulled By: shergin
fbshipit-source-id: 9fe4e3b28f74c0ca351ac6308484e375eace4db4
Summary:
The reasoning behind this change is that right now, having both added and modified modules inside of a single `modules` field doesn't allow for basic operations like combining two deltas.
For instance, say I have three different bundle revisions: A, B and C.
Module 42 was added in B, and then removed in C.
A->B = `{modules: [42, "..."], deleted: []}`
B->C = `{modules: [], deleted: [42]}`
A->C = `{modules: [], deleted: []}`
However, were we to compute A->C as the combination of A->B and B->C, it would result in `{modules: [], deleted: [42]}` because we have no way of knowing that module 42 was only just added in B.
This means that the `deleted` field of delta X->Y might eventually contain module ids that were never present in revision X, because they were added and then removed between revisions X and Y.
The last time I changed the delta format, we had a few bug reports pop out from people who had desync issues between their version of React Native and their version of Metro. As such, I've tried to make this change backwards compatible in at least one direction (new RN, old Metro). However, this will still break if someone is using a newer version of Metro and an older version of RN. I created T37123645 to follow up on this.
Reviewed By: rafeca, fromcelticpark
Differential Revision: D13156514
fbshipit-source-id: 4a4ee3b6cc0cdff5dca7368a46d7bf663769e281
Summary: Pretty straight-forward migration to using `JSI` instead of `folly::dynamic` in `TouchEventEmitter`.
Reviewed By: sahrens
Differential Revision: D13123042
fbshipit-source-id: 594b89b6e3986d6a04846194701e3a727b152cec
Summary: Pretty straight-forward migration to using `JSI` instead of `folly::dynamic` in `ScrollViewEventEmitter`.
Reviewed By: sahrens
Differential Revision: D13123049
fbshipit-source-id: 2839976d0119c48fa2538dbaa53afbc24982c598
Summary: Pretty straight-forward migration to using `JSI` instead of `folly::dynamic` in ViewEventEmitter.
Reviewed By: sahrens
Differential Revision: D13123048
fbshipit-source-id: 3c323912d3e65b684f99df6cda99c785876164af
Summary: Pretty straight-forward migration to using `JSI` instead of `folly::dynamic` in SwitchEventEmitter.
Reviewed By: sahrens
Differential Revision: D13123046
fbshipit-source-id: f2e4905a96191540ceec633bae1871c93be724db
Summary:
Now the event delive pipeline supports `JSI::Value`-based payload. Instead of passing `folly::dynamic`, now we are passing `std::function<jsi::Value(jsi::Runtime &runtime)>` as factory that can build a `JSI::Value` with given `jsi::Runtime` and any captured data.
The old (now legacy) way of calling `EventEmitter::dispatchEvent(..., const folly::dynamic &payload, ...)` is also supported.
Reviewed By: sahrens
Differential Revision: D13123043
fbshipit-source-id: d65348bb215013042abb2fcfe5083a8c697333d0
Summary: Now instead of passing `reactTag` through the whole event pipeline, we store it inside `EventTargetWrapper` (and it does not leave `UIManagerBinding`). It helps with reducing the complexity of `EventEmitter` and will help us in migrating to JSI.
Reviewed By: sahrens
Differential Revision: D13123045
fbshipit-source-id: aa9ee94d5660ff3090369c1e55cf748d2e72b987
Summary:
That's generally better because:
* Avoids exposing ShadowNode to mounting layer;
* Enables hashing and comparing the AttributedString based on actual meaningful data (not on just a pointer to ShadowNode).
Reviewed By: mdvacca
Differential Revision: D13205230
fbshipit-source-id: 7b79c1aad97b10d81e3faa10408be61b74f815cf
Summary: Trivial. We need this for future use as part of AttributedString's hash.
Reviewed By: mdvacca
Differential Revision: D13205231
fbshipit-source-id: 14a3decae72741030284a30abdb936616bafb3fe
Summary:
ShadowView, ShadowViewMutation, and Differentiator were decoupled to separate module.
That enables us to use ShadowView more widely without facing a circular dependency problem.
Reviewed By: mdvacca
Differential Revision: D13205229
fbshipit-source-id: 7373864bf153a7813c2f97edb263a41454ce0b88
Summary: Pretty straightforward wiring UIManager and the new feature in ShadowTree: we get the node, clone with the new props and then replace this.
Reviewed By: sahrens
Differential Revision: D13114788
fbshipit-source-id: 3a34fb879f3ec564c26278034a19b88518302de8
Summary: This method is the core of the future features: `setNativeProps` and `LocalState`.
Reviewed By: sahrens
Differential Revision: D13114789
fbshipit-source-id: 2138496c43c171fe27784b1959d86d6eec4638ee
Summary:
Previously, we stored a pointer to ShadowNode inside NSAttributedString's attributes to make possible retrieving an EventEmitter associated with some text fragment.
That worked fine besides only one caveat: the internal implementation of NSAttributedString is quite strange and that causes a memory leak. Because of some reason, NSAttributedString does not release stored attributes after own destruction (maybe OS uses some kind of caching).
So, now, instead of storing a strong pointer to ShadowNode inside NSAttributedString, we store a weak pointer to EventEmitter. Storing a weak pointer is okay because a desired lifetime of EventEmitter is guaranteed by LocalData stored inside a View. Storing a weak EventEmitter instead of weak ShadowNode will also help us with migration to ShadowView (we cannot store ShadowView weakly because it's a stack allocated object).
Reviewed By: sahrens
Differential Revision: D13196886
fbshipit-source-id: f8714e4b3709765629d6456edf0c635bf5f7c53b
Summary:
Consider this:
* ParagraphShadowNode retains LocalData,
* LocalData contains AttributedString,
* AttributedString contains Fragments,
* Fragment can contain a pointer to parent shadow node, so it can be the ParagraphShadowNode.
In this case it's a retain cycle.
We actually don't need to store pointers to not TextShadowNodes, so we don't now.
Later, after we fully migrate to ShadowView, we can remove this condition because it will become harmless.
Reviewed By: sahrens
Differential Revision: D13196885
fbshipit-source-id: d386ce0a067df0a72e6619d62d56038aaf80eccb
Summary:
@public
Marking the node as dirty when isReferenceBaseline property is changed
Reviewed By: davidaurelio
Differential Revision: D13147742
fbshipit-source-id: 3bbff1cfceeadfbf77380519e4638f2984fc2009
Summary:
Apparently, the previous behavior brings more problems than some *possible-in-the-future* features and flexibility.
The new model allows us to easily implement "nested text" feature.
(We temporary hope the old behavious for Android only for compatibility reasons.)
Reviewed By: mdvacca
Differential Revision: D13176277
fbshipit-source-id: 01f7bfb3c2e70cc89d76ecb78add016ee91cbd63
Summary:
This diff changes the method to calculate the hash of an AttributedString (removing shadowNode and parentShadowNode from it).
This is necessary becuase otherwise hashcode of clonned parent keep changing in every state change, when the text doesnt change
With this change we are able to cache spannables in android properly
Reviewed By: shergin
Differential Revision: D13189110
fbshipit-source-id: c1f7372809ce98a5b4d091485cc15281a4ab5e1e
Summary:
Removing two props that are not currently used
They are being set as quiet_NaN in C++ and this brings problems in the Android side
Reviewed By: shergin
Differential Revision: D13188600
fbshipit-source-id: e8412497a80300cfbc3770b829e9633206aaf427
Summary: In this diff we expose the text local data hash to android, this will be used in the future to cache metadata when rendering text in android
Reviewed By: shergin
Differential Revision: D13161873
fbshipit-source-id: cd13a4beba75a3fe62ac9ff3def26f88e874834b
Summary: Simple diff that adds a systrace to start measuring the calculation of Yoga layout() in Fabric
Reviewed By: shergin
Differential Revision: D13124641
fbshipit-source-id: 6bd03e9f56524221f5d91606ffde50253673c1bb
Summary: This diff refactors the types used when Yoga requires to measure the size of a View in C++
Reviewed By: shergin
Differential Revision: D13124086
fbshipit-source-id: 89dfe80bb41b4fb2eaba84af630d52ef2509b1e1
Summary:
@public
Adds types for a marker API in Yoga.
This will allow us to register callbacks that Yoga can use to log performance data without hard-coding the backend system for that.
Reviewed By: SidharthGuglani
Differential Revision: D13118830
fbshipit-source-id: b42a42c609f0cf66212186f7f20ee572522d59e3
Summary:
@public
`YGNodeComputeFlexBasisForChildren` was using an output parameter (`float&`) that is always initialised to `0.0f`.
Here, we move the initialisation inside `YGNodeComputeFlexBasisForChildren`, and simply return the result.
Reviewed By: astreet
Differential Revision: D13167509
fbshipit-source-id: cbea20e2deb82ec75a1c158b16c94f4a3e5e4c99
Summary:
@public
passes all enum values by value, not by reference.
Reviewed By: astreet
Differential Revision: D13156390
fbshipit-source-id: 56aea66c16ab3325594f67b9017afa18a678d281
Summary:
@public
Passes all `float`, `bool`, etc. by value, not by reference.
Reviewed By: astreet
Differential Revision: D13153500
fbshipit-source-id: 95529bc2efcff144044e2c25087915b2b7ede179
Summary: Now we don't update `LocalData` for `ParagraphShadowNode` if the attributed string hasn't changed.
Reviewed By: mdvacca
Differential Revision: D13160128
fbshipit-source-id: 6ffe76ad187452fa37ba36a132b885cbcedfd1d3
Summary: This method is underlying infra for all `measure`-like methods exposed to JavaScript.
Reviewed By: mdvacca
Differential Revision: D13036553
fbshipit-source-id: cb5135f1db97ec8144b31a24ee4fb9f5d61f0df1
Summary: The diff adds a pointer to ShadowTreeRegistry to UIManager which enables the possibility of implementing ShadowTree mutating and inspecting methods like `setNativeProps` and `getRelativeLayoutMetrics`.
Reviewed By: mdvacca
Differential Revision: D13036549
fbshipit-source-id: 5ed1252d84c8dd895fe0e6e8cc71afbaa9dab4b7
Summary:
Why do we need a dedicated registry class?
* We need to simplify registry-related logic in Scheduler.
* We need to couple threading aspect of the registry with the registry itself, otherwise it's not clear why exactly we acquire the mutex. We also should not acquire the mutex in a per-method way (as we did before), because it's incorrect and misleading (only lines that access the registry should by protected).
* We need to have a way to share the registry with other classes (e.g. UIManager) without passing a reference to the whole Scheduler.
Reviewed By: mdvacca
Differential Revision: D13036550
fbshipit-source-id: 644da910e823666c586834a3da2b4cdcb90eebb2
Summary: Trivial. Those are not used.
Reviewed By: fkgozali
Differential Revision: D13017883
fbshipit-source-id: cf285e537eb85c8fca6852f7c03a5ef661b85757
Summary:
The generic method that returns relative (to some specified node) layout metrics.
We need this as a building block to implement `UIManager.measure*()` methods family.
Reviewed By: mdvacca
Differential Revision: D12932549
fbshipit-source-id: 79064551d32b0cd40e72dc87d0ed194e3779ba29
Summary:
We have to have a way to backtrack a pointer to a parent node and this is generalized version of that.
This is the first naive implementations of the algorithm. We will invest in optimizing this later.
Reviewed By: mdvacca
Differential Revision: D12920856
fbshipit-source-id: 9facb4e16a0b5608feb6747df3804952025ef093
Summary: This diff adds support for layout constraint when measuring text
Reviewed By: shergin
Differential Revision: D13111434
fbshipit-source-id: 0c8689e9ac8ce2281b03386f275d2a8e034f88d8
Summary: trivial change of the default font size from 12 to 14 to make it backward compatible with current version of RN
Reviewed By: shergin
Differential Revision: D13108543
fbshipit-source-id: e5e384c4459f2c87ee9589c4e00a0ab5d0c8a06a
Summary:
This pull request silences build warnings like this in open-source:
```
{snip}/ReactCommon/cxxreact/CxxNativeModule.cpp:134:85: warning: lambda capture 'callId' is not used [-Wunused-lambda-capture]
messageQueueThread_->runOnQueue([method, params=std::move(params), first, second, callId] () {
```
These are variables used by "fbsystrace", which is not open-sourced.
An unused statement has been added to the affected files in the `#else` for the `#ifdef WITH_FBSYSTRACE` conditionals
Pull Request resolved: https://github.com/facebook/react-native/pull/22240
Differential Revision: D13031358
Pulled By: shergin
fbshipit-source-id: 8ccfc226b65e32abda6abb573f77a6589bd19dcd
Summary:
@public
Restores the yearless format of the MIT license.
Reviewed By: SidharthGuglani
Differential Revision: D13082510
fbshipit-source-id: f5a849b06652cedf68547d4a7963398b2627915f