From be6fa25d162a58bdbf5be22c0d5a197e847e9b6d Mon Sep 17 00:00:00 2001 From: Valentin Shergin Date: Mon, 18 Mar 2019 19:16:40 -0700 Subject: [PATCH] Fabric: Removing default implementation of some methods of LayoutableShadowNode Summary: These default implementations are never being used. Removing them allowing to ensure that flags inside YGNode have same values as flags in YogaLayoutableShadowNode. That also saves a couple of bytes in size of ShadowNode. Reviewed By: JoshuaGross Differential Revision: D14496938 fbshipit-source-id: c43f9c8a2eec054f728ff54a6573668eccda55fb --- .../view/yoga/YogaLayoutableShadowNode.cpp | 3 +-- .../core/layout/LayoutableShadowNode.cpp | 20 ------------------- .../fabric/core/layout/LayoutableShadowNode.h | 12 +++++------ 3 files changed, 6 insertions(+), 29 deletions(-) diff --git a/ReactCommon/fabric/components/view/yoga/YogaLayoutableShadowNode.cpp b/ReactCommon/fabric/components/view/yoga/YogaLayoutableShadowNode.cpp index 1fce4667ef6..fdbc1310501 100644 --- a/ReactCommon/fabric/components/view/yoga/YogaLayoutableShadowNode.cpp +++ b/ReactCommon/fabric/components/view/yoga/YogaLayoutableShadowNode.cpp @@ -26,7 +26,6 @@ YogaLayoutableShadowNode::YogaLayoutableShadowNode() yogaNode_.setConfig(&yogaConfig_); yogaNode_.setContext(this); - yogaNode_.setDirty(true); } YogaLayoutableShadowNode::YogaLayoutableShadowNode( @@ -48,7 +47,7 @@ void YogaLayoutableShadowNode::cleanLayout() { } void YogaLayoutableShadowNode::dirtyLayout() { - yogaNode_.markDirtyAndPropogate(); + yogaNode_.setDirty(true); } bool YogaLayoutableShadowNode::getIsLayoutClean() const { diff --git a/ReactCommon/fabric/core/layout/LayoutableShadowNode.cpp b/ReactCommon/fabric/core/layout/LayoutableShadowNode.cpp index f502fd4d0ef..13296abc4b8 100644 --- a/ReactCommon/fabric/core/layout/LayoutableShadowNode.cpp +++ b/ReactCommon/fabric/core/layout/LayoutableShadowNode.cpp @@ -65,26 +65,6 @@ LayoutMetrics LayoutableShadowNode::getRelativeLayoutMetrics( return layoutMetrics; } -void LayoutableShadowNode::cleanLayout() { - isLayoutClean_ = true; -} - -void LayoutableShadowNode::dirtyLayout() { - isLayoutClean_ = false; -} - -bool LayoutableShadowNode::getIsLayoutClean() const { - return isLayoutClean_; -} - -bool LayoutableShadowNode::getHasNewLayout() const { - return hasNewLayout_; -}; - -void LayoutableShadowNode::setHasNewLayout(bool hasNewLayout) { - hasNewLayout_ = hasNewLayout; -} - Size LayoutableShadowNode::measure(LayoutConstraints layoutConstraints) const { return Size(); } diff --git a/ReactCommon/fabric/core/layout/LayoutableShadowNode.h b/ReactCommon/fabric/core/layout/LayoutableShadowNode.h index 9a4fc4f31cc..569bc677d25 100644 --- a/ReactCommon/fabric/core/layout/LayoutableShadowNode.h +++ b/ReactCommon/fabric/core/layout/LayoutableShadowNode.h @@ -76,16 +76,16 @@ class LayoutableShadowNode : public virtual Sealable { * Indicates whether all nodes (and possibly their subtrees) along the path * to the root node should be re-layouted. */ - virtual void cleanLayout(); - virtual void dirtyLayout(); - virtual bool getIsLayoutClean() const; + virtual void cleanLayout() = 0; + virtual void dirtyLayout() = 0; + virtual bool getIsLayoutClean() const = 0; /* * Indicates does the shadow node (or any descendand node of the node) * get a new layout metrics during a previous layout pass. */ - virtual void setHasNewLayout(bool hasNewLayout); - virtual bool getHasNewLayout() const; + virtual void setHasNewLayout(bool hasNewLayout) = 0; + virtual bool getHasNewLayout() const = 0; /* * Applies layout for all children; @@ -127,8 +127,6 @@ class LayoutableShadowNode : public virtual Sealable { private: LayoutMetrics layoutMetrics_{}; - bool hasNewLayout_{false}; - bool isLayoutClean_{false}; }; } // namespace react