From 99fb022468d068926d9ebd7bbf1025f8043f9abc Mon Sep 17 00:00:00 2001 From: Aditya Sharat Date: Sat, 13 Jan 2024 06:12:32 -0800 Subject: [PATCH] LithoLayoutResult stops implementing ComponentLayout Summary: LithoLayoutResult stops implementing ComponentLayout Reviewed By: pentiumao Differential Revision: D52541115 fbshipit-source-id: 23b0aa2b0fd64f8b4a926c7c6c0f850313a9a5f7 --- .../java/com/facebook/litho/LithoLayoutResult.kt | 13 +------------ .../java/com/facebook/litho/ResolveAttributeTest.kt | 6 +++--- 2 files changed, 4 insertions(+), 15 deletions(-) diff --git a/litho-core/src/main/java/com/facebook/litho/LithoLayoutResult.kt b/litho-core/src/main/java/com/facebook/litho/LithoLayoutResult.kt index 14c5faecd04..8f64220de68 100644 --- a/litho-core/src/main/java/com/facebook/litho/LithoLayoutResult.kt +++ b/litho-core/src/main/java/com/facebook/litho/LithoLayoutResult.kt @@ -17,7 +17,6 @@ package com.facebook.litho import android.graphics.Rect -import android.graphics.drawable.Drawable import android.util.Pair import android.view.View import androidx.annotation.Px @@ -44,7 +43,7 @@ open class LithoLayoutResult( val yogaNode: YogaNode, widthFromStyle: Float = YogaConstants.UNDEFINED, heightFromStyle: Float = YogaConstants.UNDEFINED, -) : ComponentLayout, LayoutResult { +) : LayoutResult { private val children: MutableList = ArrayList() private val _layoutData: Any? by @@ -182,10 +181,6 @@ open class LithoLayoutResult( var borderRenderUnit: LithoRenderUnit? = null private set - @Px override fun getX(): Int = yogaNode.layoutX.toInt() - - @Px override fun getY(): Int = yogaNode.layoutY.toInt() - @Px override fun getWidth(): Int = yogaNode.layoutWidth.toInt() @Px override fun getHeight(): Int = yogaNode.layoutHeight.toInt() @@ -200,12 +195,6 @@ open class LithoLayoutResult( @Px override fun getPaddingLeft(): Int = FastMath.round(yogaNode.getLayoutPadding(YogaEdge.LEFT)) - override fun isPaddingSet(): Boolean = node.isPaddingSet - - override fun getBackground(): Drawable? = node.background - - override fun getResolvedLayoutDirection(): YogaDirection = yogaNode.layoutDirection - override fun getRenderUnit(): LithoRenderUnit? = null // Unimplemented. override fun getChildrenCount(): Int = children.size diff --git a/litho-it/src/test/java/com/facebook/litho/ResolveAttributeTest.kt b/litho-it/src/test/java/com/facebook/litho/ResolveAttributeTest.kt index bbbd91e42c9..063fbf4bfeb 100644 --- a/litho-it/src/test/java/com/facebook/litho/ResolveAttributeTest.kt +++ b/litho-it/src/test/java/com/facebook/litho/ResolveAttributeTest.kt @@ -61,7 +61,7 @@ class ResolveAttributeTest { .measure() .layout() val d = c.resources.getDrawable(test_bg) - val drawable = legacyLithoViewRule.currentRootNode?.background + val drawable = legacyLithoViewRule.currentRootNode?.node?.background assertThat(Shadows.shadowOf(drawable).createdFromResId) .isEqualTo(Shadows.shadowOf(d).createdFromResId) } @@ -89,9 +89,9 @@ class ResolveAttributeTest { column, MeasureSpecUtils.unspecified(), MeasureSpecUtils.unspecified()) .measure() .layout() - val node = legacyLithoViewRule.currentRootNode + val result = legacyLithoViewRule.currentRootNode val d = c.resources.getDrawable(test_bg) - val drawable = node?.background + val drawable = result?.node?.background assertThat(Shadows.shadowOf(drawable).createdFromResId) .isEqualTo(Shadows.shadowOf(d).createdFromResId) }