From 369b3d2983c85d91aa7a8269b0d0bb9ecf90c573 Mon Sep 17 00:00:00 2001 From: Samuel Susla Date: Wed, 23 Dec 2020 04:43:55 -0800 Subject: [PATCH] Remove unused methods from LayoutableShadowNode Summary: Changelog: [internal] These methods were not used, removing them. Reviewed By: shergin Differential Revision: D25680765 fbshipit-source-id: 7e44aa5b9c4ffa9d0264b573dcb7edc2ad2a74c3 --- .../renderer/core/LayoutableShadowNode.cpp | 7 ---- .../renderer/core/LayoutableShadowNode.h | 15 --------- .../core/tests/LayoutableShadowNodeTest.cpp | 33 ++++++++++++------- 3 files changed, 21 insertions(+), 34 deletions(-) diff --git a/ReactCommon/react/renderer/core/LayoutableShadowNode.cpp b/ReactCommon/react/renderer/core/LayoutableShadowNode.cpp index 3809740c83e..1b49fd9eb36 100644 --- a/ReactCommon/react/renderer/core/LayoutableShadowNode.cpp +++ b/ReactCommon/react/renderer/core/LayoutableShadowNode.cpp @@ -159,13 +159,6 @@ Point LayoutableShadowNode::getContentOriginOffset() const { return {0, 0}; } -LayoutMetrics LayoutableShadowNode::getRelativeLayoutMetrics( - LayoutableShadowNode const &ancestorLayoutableShadowNode, - LayoutInspectingPolicy policy) const { - return computeRelativeLayoutMetrics( - getFamily(), ancestorLayoutableShadowNode, policy); -} - LayoutableShadowNode::UnsharedList LayoutableShadowNode::getLayoutableChildNodes() const { LayoutableShadowNode::UnsharedList layoutableChildren; diff --git a/ReactCommon/react/renderer/core/LayoutableShadowNode.h b/ReactCommon/react/renderer/core/LayoutableShadowNode.h index 83ad3273a13..b30f1d21242 100644 --- a/ReactCommon/react/renderer/core/LayoutableShadowNode.h +++ b/ReactCommon/react/renderer/core/LayoutableShadowNode.h @@ -122,21 +122,6 @@ class LayoutableShadowNode : public ShadowNode { */ virtual Point getContentOriginOffset() const; - /* - * Returns layout metrics relatively to the given ancestor node. - * Uses `computeRelativeLayoutMetrics()` under the hood. - */ - LayoutMetrics getRelativeLayoutMetrics( - ShadowNodeFamily const &descendantNodeFamily, - LayoutInspectingPolicy policy) const; - - /* - * Returns layout metrics relatively to the given ancestor node. - */ - LayoutMetrics getRelativeLayoutMetrics( - LayoutableShadowNode const &ancestorLayoutableShadowNode, - LayoutInspectingPolicy policy) const; - /* * Sets layout metrics for the shadow node. */ diff --git a/ReactCommon/react/renderer/core/tests/LayoutableShadowNodeTest.cpp b/ReactCommon/react/renderer/core/tests/LayoutableShadowNodeTest.cpp index 8e02861ae79..c6dc5f68b5b 100644 --- a/ReactCommon/react/renderer/core/tests/LayoutableShadowNodeTest.cpp +++ b/ReactCommon/react/renderer/core/tests/LayoutableShadowNodeTest.cpp @@ -52,7 +52,8 @@ TEST(LayoutableShadowNodeTest, relativeLayoutMetrics) { auto parentShadowNode = builder.build(element); auto relativeLayoutMetrics = - childShadowNode->getRelativeLayoutMetrics(*parentShadowNode, {}); + LayoutableShadowNode::computeRelativeLayoutMetrics( + childShadowNode->getFamily(), *parentShadowNode, {}); // A is a parent to B, A has origin {10, 10}, B has origin {10, 10}. // B's relative origin to A should be {10, 10}. @@ -104,13 +105,14 @@ TEST(LayoutableShadowNodeTest, contentOriginOffset) { auto parentShadowNode = builder.build(element); auto relativeLayoutMetrics = - childShadowNode->getRelativeLayoutMetrics(*parentShadowNode, {}); + LayoutableShadowNode::computeRelativeLayoutMetrics( + childShadowNode->getFamily(), *parentShadowNode, {}); EXPECT_EQ(relativeLayoutMetrics.frame.origin.x, 0); EXPECT_EQ(relativeLayoutMetrics.frame.origin.y, 10); - relativeLayoutMetrics = - childShadowNode->getRelativeLayoutMetrics(*parentShadowNode, {false}); + relativeLayoutMetrics = LayoutableShadowNode::computeRelativeLayoutMetrics( + childShadowNode->getFamily(), *parentShadowNode, {false}); EXPECT_EQ(relativeLayoutMetrics.frame.origin.x, 10); EXPECT_EQ(relativeLayoutMetrics.frame.origin.y, 20); @@ -157,7 +159,8 @@ TEST(LayoutableShadowNodeTest, relativeLayoutMetricsOnTransformedNode) { auto parentShadowNode = builder.build(element); auto relativeLayoutMetrics = - childShadowNode->getRelativeLayoutMetrics(*parentShadowNode, {}); + LayoutableShadowNode::computeRelativeLayoutMetrics( + childShadowNode->getFamily(), *parentShadowNode, {}); EXPECT_EQ(relativeLayoutMetrics.frame.origin.x, 35); EXPECT_EQ(relativeLayoutMetrics.frame.origin.y, 70); @@ -222,7 +225,8 @@ TEST(LayoutableShadowNodeTest, relativeLayoutMetricsOnTransformedParent) { auto parentShadowNode = builder.build(element); auto relativeLayoutMetrics = - childShadowNode->getRelativeLayoutMetrics(*parentShadowNode, {}); + LayoutableShadowNode::computeRelativeLayoutMetrics( + childShadowNode->getFamily(), *parentShadowNode, {}); EXPECT_EQ(relativeLayoutMetrics.frame.origin.x, 45); EXPECT_EQ(relativeLayoutMetrics.frame.origin.y, 45); @@ -254,7 +258,8 @@ TEST(LayoutableShadowNodeTest, relativeLayoutMetricsOnSameNode) { auto shadowNode = builder.build(element); auto relativeLayoutMetrics = - shadowNode->getRelativeLayoutMetrics(*shadowNode, {}); + LayoutableShadowNode::computeRelativeLayoutMetrics( + shadowNode->getFamily(), *shadowNode, {}); EXPECT_EQ(relativeLayoutMetrics.frame.origin.x, 0); EXPECT_EQ(relativeLayoutMetrics.frame.origin.y, 0); @@ -290,7 +295,8 @@ TEST(LayoutableShadowNodeTest, relativeLayoutMetricsOnSameTransformedNode) { auto shadowNode = builder.build(element); auto relativeLayoutMetrics = - shadowNode->getRelativeLayoutMetrics(*shadowNode, {}); + LayoutableShadowNode::computeRelativeLayoutMetrics( + shadowNode->getFamily(), *shadowNode, {}); EXPECT_EQ(relativeLayoutMetrics.frame.origin.x, 0); EXPECT_EQ(relativeLayoutMetrics.frame.origin.y, 0); @@ -332,7 +338,8 @@ TEST(LayoutableShadowNodeTest, relativeLayourMetricsOnClonedNode) { parentShadowNode->replaceChild(*childShadowNode, clonedChildShadowNode); auto newRelativeLayoutMetrics = - childShadowNode->getRelativeLayoutMetrics(*parentShadowNode, {}); + LayoutableShadowNode::computeRelativeLayoutMetrics( + childShadowNode->getFamily(), *parentShadowNode, {}); EXPECT_EQ(newRelativeLayoutMetrics.frame.size.width, 50); EXPECT_EQ(newRelativeLayoutMetrics.frame.size.height, 60); } @@ -379,7 +386,7 @@ TEST( auto parentShadowNode = builder.build(element); - auto relativeLayoutMetrics = childShadowNode->getRelativeLayoutMetrics(*parentShadowNode, {}); + auto relativeLayoutMetrics = LayoutableShadowNode::computeRelativeLayoutMetrics(childShadowNode->getFamily(), *parentShadowNode, {}); // relativeLayoutMetrics do not include offsset of nodeAA_ because it is a // RootKindNode. @@ -410,13 +417,15 @@ TEST(LayoutableShadowNodeTest, includeViewportOffset) { // `includeViewportOffset` has to work with `includeTransform` enabled and // disabled. - auto layoutMetrics = viewShadowNode->getRelativeLayoutMetrics( + auto layoutMetrics = LayoutableShadowNode::computeRelativeLayoutMetrics( + viewShadowNode->getFamily(), *rootShadowNode, {/* includeTransform = */ false, /* includeViewportOffset = */ true}); EXPECT_EQ(layoutMetrics.frame.origin.x, 10); EXPECT_EQ(layoutMetrics.frame.origin.y, 20); - layoutMetrics = viewShadowNode->getRelativeLayoutMetrics( + layoutMetrics = LayoutableShadowNode::computeRelativeLayoutMetrics( + viewShadowNode->getFamily(), *rootShadowNode, {/* includeTransform = */ true, /* includeViewportOffset = */ true}); EXPECT_EQ(layoutMetrics.frame.origin.x, 10);