Skip to content

Commit

Permalink
LithoLayoutResult stops implementing ComponentLayout
Browse files Browse the repository at this point in the history
Summary: LithoLayoutResult stops implementing ComponentLayout

Reviewed By: pentiumao

Differential Revision: D52541115

fbshipit-source-id: 23b0aa2b0fd64f8b4a926c7c6c0f850313a9a5f7
  • Loading branch information
adityasharat authored and facebook-github-bot committed Jan 13, 2024
1 parent 3ceb27b commit 99fb022
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 15 deletions.
13 changes: 1 addition & 12 deletions litho-core/src/main/java/com/facebook/litho/LithoLayoutResult.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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<LithoLayoutResult> = ArrayList()
private val _layoutData: Any? by
Expand Down Expand Up @@ -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()
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down Expand Up @@ -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)
}
Expand Down

0 comments on commit 99fb022

Please sign in to comment.