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
This commit is contained in:
Samuel Susla
2020-12-23 04:45:54 -08:00
committed by Facebook GitHub Bot
parent 1c895678cf
commit 369b3d2983
3 changed files with 21 additions and 34 deletions
@@ -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;
@@ -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.
*/
@@ -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);