From b5aaa25b9e5d4ad13431e8fe184599a797af0001 Mon Sep 17 00:00:00 2001 From: Valentin Shergin Date: Mon, 9 Mar 2020 16:32:33 -0700 Subject: [PATCH] Fabric: De-virtualizing `LayoutableShadowNode::setLayoutMetrics()` Summary: Removing `virtual` qualifier for `LayoutableShadowNode::setLayoutMetrics()`. Original design implied that some subclass might override that method to provide additional functionality but we never used that and seems not it does not much the overall design: we store `layoutMetrics` *inside* `LayoutableShadowNode`. Changelog: [Internal] Fabric-specific internal change. Reviewed By: sammy-SC Differential Revision: D20268042 fbshipit-source-id: 2aa9b3da316b97f26493fb04d19ca8290bd5d2a6 --- .../fabric/core/layout/LayoutableShadowNode.h | 12 ++++++------ ReactCommon/fabric/core/tests/TestComponent.h | 4 ---- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/ReactCommon/fabric/core/layout/LayoutableShadowNode.h b/ReactCommon/fabric/core/layout/LayoutableShadowNode.h index 020a7165784..ea30b492950 100644 --- a/ReactCommon/fabric/core/layout/LayoutableShadowNode.h +++ b/ReactCommon/fabric/core/layout/LayoutableShadowNode.h @@ -98,6 +98,12 @@ class LayoutableShadowNode : public ShadowNode { LayoutableShadowNode const &ancestorLayoutableShadowNode, LayoutInspectingPolicy policy) const; + /* + * Sets layout metrics for the shadow node. + * Returns true if the metrics are different from previous ones. + */ + bool setLayoutMetrics(LayoutMetrics layoutMetrics); + /* * Returns the ShadowNode that is rendered at the Point received as a * parameter. @@ -140,12 +146,6 @@ class LayoutableShadowNode : public ShadowNode { */ LayoutableShadowNode::UnsharedList getLayoutableChildNodes() const; - /* - * Sets layout metrics for the shadow node. - * Returns true if the metrics are different from previous ones. - */ - virtual bool setLayoutMetrics(LayoutMetrics layoutMetrics); - #pragma mark - DebugStringConvertible #if RN_DEBUG_STRING_CONVERTIBLE diff --git a/ReactCommon/fabric/core/tests/TestComponent.h b/ReactCommon/fabric/core/tests/TestComponent.h index 2de9bdd4032..e71d46ffb1a 100644 --- a/ReactCommon/fabric/core/tests/TestComponent.h +++ b/ReactCommon/fabric/core/tests/TestComponent.h @@ -55,10 +55,6 @@ class TestShadowNode : public ConcreteViewShadowNode< Transform _transform{Transform::Identity()}; - bool setLayoutMetrics(LayoutMetrics layoutMetrics) override { - return YogaLayoutableShadowNode::setLayoutMetrics(layoutMetrics); - } - Transform getTransform() const override { return _transform; }