Fabric: `ShadowNodeFragment::rootTag` was renamed to `surfaceId`
Summary: Trivial. We are replacing rootTag with surfaceId according to the plan describing here: https://fb.workplace.com/groups/rn.fabric/permalink/1374002366064519/ Reviewed By: JoshuaGross, mdvacca Differential Revision: D15039134 fbshipit-source-id: ec8c3044f9f3f23939488bc01c66e9b653e651dd
This commit is contained in:
Родитель
81d0f9a690
Коммит
035e0403bb
|
@ -37,7 +37,7 @@ UnsharedRootShadowNode RootShadowNode::clone(
|
|||
*this,
|
||||
ShadowNodeFragment{
|
||||
/* .tag = */ ShadowNodeFragment::tagPlaceholder(),
|
||||
/* .rootTag = */ ShadowNodeFragment::surfaceIdPlaceholder(),
|
||||
/* .surfaceId = */ ShadowNodeFragment::surfaceIdPlaceholder(),
|
||||
/* .props = */ props,
|
||||
});
|
||||
return newRootShadowNode;
|
||||
|
|
|
@ -42,7 +42,7 @@ ShadowNode::ShadowNode(
|
|||
state_(fragment.state),
|
||||
family_(std::make_shared<ShadowNodeFamily const>(
|
||||
fragment.tag,
|
||||
fragment.rootTag,
|
||||
fragment.surfaceId,
|
||||
fragment.eventEmitter,
|
||||
componentDescriptor)),
|
||||
childrenAreShared_(true),
|
||||
|
@ -72,7 +72,7 @@ ShadowNode::ShadowNode(
|
|||
revision_(sourceShadowNode.revision_ + 1) {
|
||||
// `tag`, `surfaceId`, and `eventEmitter` cannot be changed with cloning.
|
||||
assert(fragment.tag == ShadowNodeFragment::tagPlaceholder());
|
||||
assert(fragment.rootTag == ShadowNodeFragment::surfaceIdPlaceholder());
|
||||
assert(fragment.surfaceId == ShadowNodeFragment::surfaceIdPlaceholder());
|
||||
assert(
|
||||
fragment.eventEmitter == ShadowNodeFragment::eventEmitterPlaceholder());
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ namespace react {
|
|||
*/
|
||||
struct ShadowNodeFragment {
|
||||
Tag const tag = tagPlaceholder();
|
||||
SurfaceId const rootTag = surfaceIdPlaceholder();
|
||||
SurfaceId const surfaceId = surfaceIdPlaceholder();
|
||||
Props::Shared const &props = propsPlaceholder();
|
||||
EventEmitter::Shared const &eventEmitter = eventEmitterPlaceholder();
|
||||
ShadowNode::SharedListOfShared const &children = childrenPlaceholder();
|
||||
|
|
|
@ -24,7 +24,7 @@ TEST(ComponentDescriptorTest, createShadowNode) {
|
|||
SharedProps props = descriptor->cloneProps(nullptr, raw);
|
||||
SharedShadowNode node = descriptor->createShadowNode(ShadowNodeFragment{
|
||||
/* .tag = */ 9,
|
||||
/* .rootTag = */ 1,
|
||||
/* .surfaceId = */ 1,
|
||||
/* .props = */ props,
|
||||
/* .eventEmitter = */ descriptor->createEventEmitter(0, 9),
|
||||
});
|
||||
|
@ -46,7 +46,7 @@ TEST(ComponentDescriptorTest, cloneShadowNode) {
|
|||
SharedProps props = descriptor->cloneProps(nullptr, raw);
|
||||
SharedShadowNode node = descriptor->createShadowNode(ShadowNodeFragment{
|
||||
/* .tag = */ 9,
|
||||
/* .rootTag = */ 1,
|
||||
/* .surfaceId = */ 1,
|
||||
/* .props = */ props,
|
||||
/* .eventEmitter = */ descriptor->createEventEmitter(0, 9),
|
||||
});
|
||||
|
@ -66,19 +66,19 @@ TEST(ComponentDescriptorTest, appendChild) {
|
|||
SharedProps props = descriptor->cloneProps(nullptr, raw);
|
||||
SharedShadowNode node1 = descriptor->createShadowNode(ShadowNodeFragment{
|
||||
/* .tag = */ 1,
|
||||
/* .rootTag = */ 1,
|
||||
/* .surfaceId = */ 1,
|
||||
/* .props = */ props,
|
||||
/* .eventEmitter = */ descriptor->createEventEmitter(0, 1),
|
||||
});
|
||||
SharedShadowNode node2 = descriptor->createShadowNode(ShadowNodeFragment{
|
||||
/* .tag = */ 2,
|
||||
/* .rootTag = */ 1,
|
||||
/* .surfaceId = */ 1,
|
||||
/* .props = */ props,
|
||||
/* .eventEmitter = */ descriptor->createEventEmitter(0, 2),
|
||||
});
|
||||
SharedShadowNode node3 = descriptor->createShadowNode(ShadowNodeFragment{
|
||||
/* .tag = */ 3,
|
||||
/* .rootTag = */ 1,
|
||||
/* .surfaceId = */ 1,
|
||||
/* .props = */ props,
|
||||
/* .eventEmitter = */ descriptor->createEventEmitter(0, 3),
|
||||
});
|
||||
|
|
|
@ -31,7 +31,7 @@ TEST(ShadowNodeTest, handleShadowNodeCreation) {
|
|||
auto node = std::make_shared<TestShadowNode>(
|
||||
ShadowNodeFragment{
|
||||
/* .tag = */ 9,
|
||||
/* .rootTag = */ 1,
|
||||
/* .surfaceId = */ 1,
|
||||
/* .props = */ std::make_shared<const TestProps>(),
|
||||
/* .eventEmitter = */ ShadowNodeFragment::eventEmitterPlaceholder(),
|
||||
/* .children = */ ShadowNode::emptySharedShadowNodeSharedList(),
|
||||
|
@ -57,7 +57,7 @@ TEST(ShadowNodeTest, handleShadowNodeSimpleCloning) {
|
|||
auto node = std::make_shared<TestShadowNode>(
|
||||
ShadowNodeFragment{
|
||||
/* .tag = */ 9,
|
||||
/* .rootTag = */ 1,
|
||||
/* .surfaceId = */ 1,
|
||||
/* .props = */ std::make_shared<const TestProps>(),
|
||||
/* .eventEmitter = */ ShadowNodeFragment::eventEmitterPlaceholder(),
|
||||
/* .children = */ ShadowNode::emptySharedShadowNodeSharedList(),
|
||||
|
@ -77,7 +77,7 @@ TEST(ShadowNodeTest, handleShadowNodeMutation) {
|
|||
auto node1 = std::make_shared<TestShadowNode>(
|
||||
ShadowNodeFragment{
|
||||
/* .tag = */ 1,
|
||||
/* .rootTag = */ 1,
|
||||
/* .surfaceId = */ 1,
|
||||
/* .props = */ std::make_shared<const TestProps>(),
|
||||
/* .eventEmitter = */ ShadowNodeFragment::eventEmitterPlaceholder(),
|
||||
/* .children = */ ShadowNode::emptySharedShadowNodeSharedList(),
|
||||
|
@ -86,7 +86,7 @@ TEST(ShadowNodeTest, handleShadowNodeMutation) {
|
|||
auto node2 = std::make_shared<TestShadowNode>(
|
||||
ShadowNodeFragment{
|
||||
/* .tag = */ 2,
|
||||
/* .rootTag = */ 1,
|
||||
/* .surfaceId = */ 1,
|
||||
/* .props = */ std::make_shared<const TestProps>(),
|
||||
/* .eventEmitter = */ ShadowNodeFragment::eventEmitterPlaceholder(),
|
||||
/* .children = */ ShadowNode::emptySharedShadowNodeSharedList(),
|
||||
|
@ -95,7 +95,7 @@ TEST(ShadowNodeTest, handleShadowNodeMutation) {
|
|||
auto node3 = std::make_shared<TestShadowNode>(
|
||||
ShadowNodeFragment{
|
||||
/* .tag = */ 3,
|
||||
/* .rootTag = */ 1,
|
||||
/* .surfaceId = */ 1,
|
||||
/* .props = */ std::make_shared<const TestProps>(),
|
||||
/* .eventEmitter = */ ShadowNodeFragment::eventEmitterPlaceholder(),
|
||||
/* .children = */ ShadowNode::emptySharedShadowNodeSharedList(),
|
||||
|
@ -136,7 +136,7 @@ TEST(ShadowNodeTest, handleCloneFunction) {
|
|||
auto firstNode = std::make_shared<TestShadowNode>(
|
||||
ShadowNodeFragment{
|
||||
/* .tag = */ 9,
|
||||
/* .rootTag = */ 1,
|
||||
/* .surfaceId = */ 1,
|
||||
/* .props = */ std::make_shared<const TestProps>(),
|
||||
/* .eventEmitter = */ ShadowNodeFragment::eventEmitterPlaceholder(),
|
||||
/* .children = */ ShadowNode::emptySharedShadowNodeSharedList(),
|
||||
|
@ -172,7 +172,7 @@ TEST(ShadowNodeTest, handleLocalData) {
|
|||
auto firstNode = std::make_shared<TestShadowNode>(
|
||||
ShadowNodeFragment{
|
||||
/* .tag = */ 9,
|
||||
/* .rootTag = */ 1,
|
||||
/* .surfaceId = */ 1,
|
||||
/* .props = */ props,
|
||||
/* .eventEmitter = */ ShadowNodeFragment::eventEmitterPlaceholder(),
|
||||
/* .children = */ ShadowNode::emptySharedShadowNodeSharedList(),
|
||||
|
@ -181,7 +181,7 @@ TEST(ShadowNodeTest, handleLocalData) {
|
|||
auto secondNode = std::make_shared<TestShadowNode>(
|
||||
ShadowNodeFragment{
|
||||
/* .tag = */ 9,
|
||||
/* .rootTag = */ 1,
|
||||
/* .surfaceId = */ 1,
|
||||
/* .props = */ props,
|
||||
/* .eventEmitter = */ ShadowNodeFragment::eventEmitterPlaceholder(),
|
||||
/* .children = */ ShadowNode::emptySharedShadowNodeSharedList(),
|
||||
|
@ -190,7 +190,7 @@ TEST(ShadowNodeTest, handleLocalData) {
|
|||
auto thirdNode = std::make_shared<TestShadowNode>(
|
||||
ShadowNodeFragment{
|
||||
/* .tag = */ 9,
|
||||
/* .rootTag = */ 1,
|
||||
/* .surfaceId = */ 1,
|
||||
/* .props = */ props,
|
||||
/* .eventEmitter = */ ShadowNodeFragment::eventEmitterPlaceholder(),
|
||||
/* .children = */ ShadowNode::emptySharedShadowNodeSharedList(),
|
||||
|
@ -232,7 +232,7 @@ TEST(ShadowNodeTest, handleBacktracking) {
|
|||
auto nodeAA = std::make_shared<TestShadowNode>(
|
||||
ShadowNodeFragment{
|
||||
/* .tag = */ ShadowNodeFragment::tagPlaceholder(),
|
||||
/* .rootTag = */ ShadowNodeFragment::surfaceIdPlaceholder(),
|
||||
/* .surfaceId = */ ShadowNodeFragment::surfaceIdPlaceholder(),
|
||||
/* .props = */ props,
|
||||
/* .eventEmitter = */ ShadowNodeFragment::eventEmitterPlaceholder(),
|
||||
/* .children = */ ShadowNode::emptySharedShadowNodeSharedList(),
|
||||
|
@ -242,7 +242,7 @@ TEST(ShadowNodeTest, handleBacktracking) {
|
|||
auto nodeABA = std::make_shared<TestShadowNode>(
|
||||
ShadowNodeFragment{
|
||||
/* .tag = */ ShadowNodeFragment::tagPlaceholder(),
|
||||
/* .rootTag = */ ShadowNodeFragment::surfaceIdPlaceholder(),
|
||||
/* .surfaceId = */ ShadowNodeFragment::surfaceIdPlaceholder(),
|
||||
/* .props = */ props,
|
||||
/* .eventEmitter = */ ShadowNodeFragment::eventEmitterPlaceholder(),
|
||||
/* .children = */ ShadowNode::emptySharedShadowNodeSharedList(),
|
||||
|
@ -251,7 +251,7 @@ TEST(ShadowNodeTest, handleBacktracking) {
|
|||
auto nodeABB = std::make_shared<TestShadowNode>(
|
||||
ShadowNodeFragment{
|
||||
/* .tag = */ ShadowNodeFragment::tagPlaceholder(),
|
||||
/* .rootTag = */ ShadowNodeFragment::surfaceIdPlaceholder(),
|
||||
/* .surfaceId = */ ShadowNodeFragment::surfaceIdPlaceholder(),
|
||||
/* .props = */ props,
|
||||
/* .eventEmitter = */ ShadowNodeFragment::eventEmitterPlaceholder(),
|
||||
/* .children = */ ShadowNode::emptySharedShadowNodeSharedList(),
|
||||
|
@ -260,7 +260,7 @@ TEST(ShadowNodeTest, handleBacktracking) {
|
|||
auto nodeABC = std::make_shared<TestShadowNode>(
|
||||
ShadowNodeFragment{
|
||||
/* .tag = */ ShadowNodeFragment::tagPlaceholder(),
|
||||
/* .rootTag = */ ShadowNodeFragment::surfaceIdPlaceholder(),
|
||||
/* .surfaceId = */ ShadowNodeFragment::surfaceIdPlaceholder(),
|
||||
/* .props = */ props,
|
||||
/* .eventEmitter = */ ShadowNodeFragment::eventEmitterPlaceholder(),
|
||||
/* .children = */ ShadowNode::emptySharedShadowNodeSharedList(),
|
||||
|
@ -272,7 +272,7 @@ TEST(ShadowNodeTest, handleBacktracking) {
|
|||
auto nodeAB = std::make_shared<TestShadowNode>(
|
||||
ShadowNodeFragment{
|
||||
/* .tag = */ ShadowNodeFragment::tagPlaceholder(),
|
||||
/* .rootTag = */ ShadowNodeFragment::surfaceIdPlaceholder(),
|
||||
/* .surfaceId = */ ShadowNodeFragment::surfaceIdPlaceholder(),
|
||||
/* .props = */ props,
|
||||
/* .eventEmitter = */ ShadowNodeFragment::eventEmitterPlaceholder(),
|
||||
/* .children = */ nodeABChildren,
|
||||
|
@ -282,7 +282,7 @@ TEST(ShadowNodeTest, handleBacktracking) {
|
|||
auto nodeAC = std::make_shared<TestShadowNode>(
|
||||
ShadowNodeFragment{
|
||||
/* .tag = */ ShadowNodeFragment::tagPlaceholder(),
|
||||
/* .rootTag = */ ShadowNodeFragment::surfaceIdPlaceholder(),
|
||||
/* .surfaceId = */ ShadowNodeFragment::surfaceIdPlaceholder(),
|
||||
/* .props = */ props,
|
||||
/* .eventEmitter = */ ShadowNodeFragment::eventEmitterPlaceholder(),
|
||||
/* .children = */ ShadowNode::emptySharedShadowNodeSharedList(),
|
||||
|
@ -294,7 +294,7 @@ TEST(ShadowNodeTest, handleBacktracking) {
|
|||
auto nodeA = std::make_shared<TestShadowNode>(
|
||||
ShadowNodeFragment{
|
||||
/* .tag = */ ShadowNodeFragment::tagPlaceholder(),
|
||||
/* .rootTag = */ ShadowNodeFragment::surfaceIdPlaceholder(),
|
||||
/* .surfaceId = */ ShadowNodeFragment::surfaceIdPlaceholder(),
|
||||
/* .props = */ props,
|
||||
/* .eventEmitter = */ ShadowNodeFragment::eventEmitterPlaceholder(),
|
||||
/* .children = */ nodeAChildren,
|
||||
|
@ -304,7 +304,7 @@ TEST(ShadowNodeTest, handleBacktracking) {
|
|||
auto nodeZ = std::make_shared<TestShadowNode>(
|
||||
ShadowNodeFragment{
|
||||
/* .tag = */ ShadowNodeFragment::tagPlaceholder(),
|
||||
/* .rootTag = */ ShadowNodeFragment::surfaceIdPlaceholder(),
|
||||
/* .surfaceId = */ ShadowNodeFragment::surfaceIdPlaceholder(),
|
||||
/* .props = */ props,
|
||||
/* .eventEmitter = */ ShadowNodeFragment::eventEmitterPlaceholder(),
|
||||
/* .children = */ ShadowNode::emptySharedShadowNodeSharedList(),
|
||||
|
|
|
@ -94,7 +94,7 @@ ShadowTree::ShadowTree(
|
|||
rootShadowNode_ = std::static_pointer_cast<const RootShadowNode>(
|
||||
rootComponentDescriptor.createShadowNode(ShadowNodeFragment{
|
||||
/* .tag = */ surfaceId,
|
||||
/* .rootTag = */ surfaceId,
|
||||
/* .surfaceId = */ surfaceId,
|
||||
/* .props = */ props,
|
||||
/* .eventEmitter = */ noopEventEmitter,
|
||||
}));
|
||||
|
@ -111,7 +111,7 @@ ShadowTree::~ShadowTree() {
|
|||
*oldRootShadowNode,
|
||||
ShadowNodeFragment{
|
||||
/* .tag = */ ShadowNodeFragment::tagPlaceholder(),
|
||||
/* .rootTag = */ ShadowNodeFragment::surfaceIdPlaceholder(),
|
||||
/* .surfaceId = */ ShadowNodeFragment::surfaceIdPlaceholder(),
|
||||
/* .props = */ ShadowNodeFragment::propsPlaceholder(),
|
||||
/* .eventEmitter = */
|
||||
ShadowNodeFragment::eventEmitterPlaceholder(),
|
||||
|
|
|
@ -142,14 +142,14 @@ ComponentDescriptor const &ComponentDescriptorRegistry::at(
|
|||
SharedShadowNode ComponentDescriptorRegistry::createNode(
|
||||
Tag tag,
|
||||
ComponentName const &viewName,
|
||||
Tag rootTag,
|
||||
SurfaceId surfaceId,
|
||||
folly::dynamic const &props,
|
||||
SharedEventTarget const &eventTarget) const {
|
||||
auto unifiedComponentName = componentNameByReactViewName(viewName);
|
||||
auto const &componentDescriptor = this->at(unifiedComponentName);
|
||||
return componentDescriptor.createShadowNode({
|
||||
/* .tag = */ tag,
|
||||
/* .rootTag = */ rootTag,
|
||||
/* .surfaceId = */ surfaceId,
|
||||
/* .props = */ componentDescriptor.cloneProps(nullptr, RawProps(props)),
|
||||
/* .eventEmitter = */
|
||||
componentDescriptor.createEventEmitter(std::move(eventTarget), tag),
|
||||
|
|
|
@ -51,7 +51,7 @@ class ComponentDescriptorRegistry {
|
|||
SharedShadowNode createNode(
|
||||
Tag tag,
|
||||
ComponentName const &viewName,
|
||||
Tag rootTag,
|
||||
SurfaceId surfaceId,
|
||||
folly::dynamic const &props,
|
||||
SharedEventTarget const &eventTarget) const;
|
||||
|
||||
|
|
|
@ -131,7 +131,8 @@ void Scheduler::renderTemplateToSurface(
|
|||
*oldRootShadowNode,
|
||||
ShadowNodeFragment{
|
||||
/* .tag = */ ShadowNodeFragment::tagPlaceholder(),
|
||||
/* .rootTag = */ ShadowNodeFragment::surfaceIdPlaceholder(),
|
||||
/* .surfaceId = */
|
||||
ShadowNodeFragment::surfaceIdPlaceholder(),
|
||||
/* .props = */ ShadowNodeFragment::propsPlaceholder(),
|
||||
/* .eventEmitter = */
|
||||
ShadowNodeFragment::eventEmitterPlaceholder(),
|
||||
|
@ -161,7 +162,7 @@ void Scheduler::stopSurface(SurfaceId surfaceId) const {
|
|||
*oldRootShadowNode,
|
||||
ShadowNodeFragment{
|
||||
/* .tag = */ ShadowNodeFragment::tagPlaceholder(),
|
||||
/* .rootTag = */
|
||||
/* .surfaceId = */
|
||||
ShadowNodeFragment::surfaceIdPlaceholder(),
|
||||
/* .props = */ ShadowNodeFragment::propsPlaceholder(),
|
||||
/* .eventEmitter = */
|
||||
|
@ -265,7 +266,7 @@ void Scheduler::uiManagerDidFinishTransaction(
|
|||
*oldRootShadowNode,
|
||||
ShadowNodeFragment{
|
||||
/* .tag = */ ShadowNodeFragment::tagPlaceholder(),
|
||||
/* .rootTag = */ ShadowNodeFragment::surfaceIdPlaceholder(),
|
||||
/* .surfaceId = */ ShadowNodeFragment::surfaceIdPlaceholder(),
|
||||
/* .props = */ ShadowNodeFragment::propsPlaceholder(),
|
||||
/* .eventEmitter = */
|
||||
ShadowNodeFragment::eventEmitterPlaceholder(),
|
||||
|
|
|
@ -26,7 +26,7 @@ SharedShadowNode UIManager::createNode(
|
|||
|
||||
auto shadowNode = componentDescriptor.createShadowNode({
|
||||
/* .tag = */ tag,
|
||||
/* .rootTag = */ surfaceId,
|
||||
/* .surfaceId = */ surfaceId,
|
||||
/* .props = */
|
||||
fallbackDescriptor != nullptr &&
|
||||
fallbackDescriptor->getComponentHandle() ==
|
||||
|
@ -59,7 +59,7 @@ SharedShadowNode UIManager::cloneNode(
|
|||
*shadowNode,
|
||||
{
|
||||
/* .tag = */ ShadowNodeFragment::tagPlaceholder(),
|
||||
/* .rootTag = */ ShadowNodeFragment::surfaceIdPlaceholder(),
|
||||
/* .surfaceId = */ ShadowNodeFragment::surfaceIdPlaceholder(),
|
||||
/* .props = */
|
||||
rawProps ? componentDescriptor.cloneProps(
|
||||
shadowNode->getProps(), *rawProps)
|
||||
|
@ -102,7 +102,7 @@ void UIManager::setNativeProps(
|
|||
auto props = componentDescriptor.cloneProps(shadowNode->getProps(), rawProps);
|
||||
auto newShadowNode = shadowNode->clone({
|
||||
/* .tag = */ ShadowNodeFragment::tagPlaceholder(),
|
||||
/* .rootTag = */ ShadowNodeFragment::surfaceIdPlaceholder(),
|
||||
/* .surfaceId = */ ShadowNodeFragment::surfaceIdPlaceholder(),
|
||||
/* .props = */ props,
|
||||
});
|
||||
|
||||
|
@ -158,7 +158,7 @@ void UIManager::updateState(
|
|||
componentDescriptor.createState(shadowNode->getState(), rawStateData);
|
||||
auto newShadowNode = shadowNode->clone({
|
||||
/* .tag = */ ShadowNodeFragment::tagPlaceholder(),
|
||||
/* .rootTag = */ ShadowNodeFragment::surfaceIdPlaceholder(),
|
||||
/* .surfaceId = */ ShadowNodeFragment::surfaceIdPlaceholder(),
|
||||
/* .props = */ ShadowNodeFragment::propsPlaceholder(),
|
||||
/* .eventEmitter = */ ShadowNodeFragment::eventEmitterPlaceholder(),
|
||||
/* .children = */ ShadowNodeFragment::childrenPlaceholder(),
|
||||
|
|
Загрузка…
Ссылка в новой задаче