Fabric: Removing `ShadowNode::operator==`
Summary: @public We don't need this anymore. The same functionality is now implemented as `ShadowView::operator==` in much more reasonable way. Reviewed By: sahrens Differential Revision: D9649821 fbshipit-source-id: 8cd5f3cb4f583fd10d2d1e060aba914541341b5b
This commit is contained in:
parent
dd627479c2
commit
1183d82884
|
@ -113,17 +113,6 @@ public:
|
|||
return clonedChildShadowNode.get();
|
||||
}
|
||||
|
||||
#pragma mark - Equality
|
||||
|
||||
bool operator==(const ShadowNode& rhs) const override {
|
||||
if (!ShadowNode::operator==(rhs)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const auto &other = static_cast<const ConcreteViewShadowNode&>(rhs);
|
||||
return getLayoutMetrics() == other.getLayoutMetrics();
|
||||
}
|
||||
|
||||
#pragma mark - DebugStringConvertible
|
||||
|
||||
SharedDebugStringConvertibleList getDebugProps() const override {
|
||||
|
|
|
@ -143,23 +143,6 @@ void ShadowNode::cloneChildrenIfShared() {
|
|||
children_ = std::make_shared<SharedShadowNodeList>(*children_);
|
||||
}
|
||||
|
||||
#pragma mark - Equality
|
||||
|
||||
bool ShadowNode::operator==(const ShadowNode& rhs) const {
|
||||
// Note: Child nodes are not considered as part of instance's value
|
||||
// and/or identity.
|
||||
return
|
||||
tag_ == rhs.tag_ &&
|
||||
rootTag_ == rhs.rootTag_ &&
|
||||
props_ == rhs.props_ &&
|
||||
eventEmitter_ == rhs.eventEmitter_ &&
|
||||
localData_ == rhs.localData_;
|
||||
}
|
||||
|
||||
bool ShadowNode::operator!=(const ShadowNode& rhs) const {
|
||||
return !(*this == rhs);
|
||||
}
|
||||
|
||||
#pragma mark - DebugStringConvertible
|
||||
|
||||
std::string ShadowNode::getDebugName() const {
|
||||
|
|
|
@ -101,18 +101,6 @@ public:
|
|||
*/
|
||||
void setLocalData(const SharedLocalData &localData);
|
||||
|
||||
#pragma mark - Equality
|
||||
|
||||
/*
|
||||
* Equality operators.
|
||||
* Use this to compare `ShadowNode`s values for equality (and non-equality).
|
||||
* Same values indicates that nodes must not produce mutations
|
||||
* during tree diffing process.
|
||||
* Child nodes are not considered as part of the value.
|
||||
*/
|
||||
virtual bool operator==(const ShadowNode& rhs) const;
|
||||
virtual bool operator!=(const ShadowNode& rhs) const;
|
||||
|
||||
#pragma mark - DebugStringConvertible
|
||||
|
||||
std::string getDebugName() const override;
|
||||
|
|
|
@ -158,10 +158,10 @@ TEST(ShadowNodeTest, handleLocalData) {
|
|||
thirdNode->setLocalData(localDataOver9000);
|
||||
|
||||
// LocalData object are compared by pointer, not by value.
|
||||
ASSERT_EQ(*firstNode, *secondNode);
|
||||
ASSERT_NE(*firstNode, *thirdNode);
|
||||
ASSERT_EQ(firstNode->getLocalData(), secondNode->getLocalData());
|
||||
ASSERT_NE(firstNode->getLocalData(), thirdNode->getLocalData());
|
||||
secondNode->setLocalData(anotherLocalData42);
|
||||
ASSERT_NE(*firstNode, *secondNode);
|
||||
ASSERT_NE(firstNode->getLocalData(), secondNode->getLocalData());
|
||||
|
||||
// LocalData cannot be changed for sealed shadow node.
|
||||
secondNode->sealRecursive();
|
||||
|
|
|
@ -211,12 +211,15 @@ ShadowViewMutationList calculateShadowViewMutations(
|
|||
|
||||
ShadowViewMutationList mutations;
|
||||
|
||||
if (oldRootShadowNode != newRootShadowNode) {
|
||||
auto oldRootShadowView = ShadowView(oldRootShadowNode);
|
||||
auto newRootShadowView = ShadowView(newRootShadowNode);
|
||||
|
||||
if (oldRootShadowView != newRootShadowView) {
|
||||
mutations.push_back(
|
||||
ShadowViewMutation::UpdateMutation(
|
||||
ShadowView(),
|
||||
ShadowView(oldRootShadowNode),
|
||||
ShadowView(newRootShadowNode),
|
||||
oldRootShadowView,
|
||||
newRootShadowView,
|
||||
-1
|
||||
)
|
||||
);
|
||||
|
|
Loading…
Reference in New Issue