Compare commits

...

1 Commits

Author SHA1 Message Date
Mateo Guzmán
0ea3cc6d2e Migrate YogaNode to Kotlin 2025-08-08 00:37:23 +02:00
2 changed files with 273 additions and 279 deletions

View File

@@ -1,279 +0,0 @@
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
package com.facebook.yoga;
import javax.annotation.Nullable;
public abstract class YogaNode implements YogaProps {
/** The interface the {@link #getData()} object can optionally implement. */
public interface Inputs {
/** Requests the data object to disable mutations of its inputs. */
void freeze(final YogaNode node, final @Nullable YogaNode parent);
}
public abstract void reset();
public abstract int getChildCount();
public abstract YogaNode getChildAt(int i);
public abstract void addChildAt(YogaNode child, int i);
public abstract void setIsReferenceBaseline(boolean isReferenceBaseline);
public abstract boolean isReferenceBaseline();
public abstract YogaNode removeChildAt(int i);
/**
* @returns the {@link YogaNode} that owns this {@link YogaNode}. The owner is used to identify
* the YogaTree that a {@link YogaNode} belongs to. This method will return the parent of the
* {@link YogaNode} when the {@link YogaNode} only belongs to one YogaTree or null when the
* {@link YogaNode} is shared between two or more YogaTrees.
*/
@Nullable
public abstract YogaNode getOwner();
/** @deprecated Use #getOwner() instead. This will be removed in the next version. */
@Deprecated
@Nullable
public abstract YogaNode getParent();
public abstract int indexOf(YogaNode child);
public abstract void calculateLayout(float width, float height);
public abstract boolean hasNewLayout();
public abstract void dirty();
public abstract boolean isDirty();
public abstract void copyStyle(YogaNode srcNode);
public abstract void markLayoutSeen();
public abstract YogaDirection getStyleDirection();
public abstract void setDirection(YogaDirection direction);
public abstract YogaFlexDirection getFlexDirection();
public abstract void setFlexDirection(YogaFlexDirection flexDirection);
public abstract YogaJustify getJustifyContent();
public abstract void setJustifyContent(YogaJustify justifyContent);
public abstract YogaAlign getAlignItems();
public abstract void setAlignItems(YogaAlign alignItems);
public abstract YogaAlign getAlignSelf();
public abstract void setAlignSelf(YogaAlign alignSelf);
public abstract YogaAlign getAlignContent();
public abstract void setAlignContent(YogaAlign alignContent);
public abstract YogaPositionType getPositionType();
public abstract void setPositionType(YogaPositionType positionType);
public abstract YogaBoxSizing getBoxSizing();
public abstract void setBoxSizing(YogaBoxSizing boxSizing);
public abstract YogaWrap getWrap();
public abstract void setWrap(YogaWrap flexWrap);
public abstract YogaOverflow getOverflow();
public abstract void setOverflow(YogaOverflow overflow);
public abstract YogaDisplay getDisplay();
public abstract void setDisplay(YogaDisplay display);
public abstract float getFlex();
public abstract void setFlex(float flex);
public abstract float getFlexGrow();
public abstract void setFlexGrow(float flexGrow);
public abstract float getFlexShrink();
public abstract void setFlexShrink(float flexShrink);
public abstract YogaValue getFlexBasis();
public abstract void setFlexBasis(float flexBasis);
public abstract void setFlexBasisPercent(float percent);
public abstract void setFlexBasisAuto();
public abstract void setFlexBasisMaxContent();
public abstract void setFlexBasisFitContent();
public abstract void setFlexBasisStretch();
public abstract YogaValue getMargin(YogaEdge edge);
public abstract void setMargin(YogaEdge edge, float margin);
public abstract void setMarginPercent(YogaEdge edge, float percent);
public abstract void setMarginAuto(YogaEdge edge);
public abstract YogaValue getPadding(YogaEdge edge);
public abstract void setPadding(YogaEdge edge, float padding);
public abstract void setPaddingPercent(YogaEdge edge, float percent);
public abstract float getBorder(YogaEdge edge);
public abstract void setBorder(YogaEdge edge, float border);
public abstract YogaValue getPosition(YogaEdge edge);
public abstract void setPosition(YogaEdge edge, float position);
public abstract void setPositionPercent(YogaEdge edge, float percent);
public abstract void setPositionAuto(YogaEdge edge);
public abstract YogaValue getWidth();
public abstract void setWidth(float width);
public abstract void setWidthPercent(float percent);
public abstract void setWidthAuto();
public abstract void setWidthMaxContent();
public abstract void setWidthFitContent();
public abstract void setWidthStretch();
public abstract YogaValue getHeight();
public abstract void setHeight(float height);
public abstract void setHeightPercent(float percent);
public abstract void setHeightAuto();
public abstract void setHeightMaxContent();
public abstract void setHeightFitContent();
public abstract void setHeightStretch();
public abstract YogaValue getMinWidth();
public abstract void setMinWidth(float minWidth);
public abstract void setMinWidthPercent(float percent);
public abstract void setMinWidthMaxContent();
public abstract void setMinWidthFitContent();
public abstract void setMinWidthStretch();
public abstract YogaValue getMinHeight();
public abstract void setMinHeight(float minHeight);
public abstract void setMinHeightPercent(float percent);
public abstract void setMinHeightMaxContent();
public abstract void setMinHeightFitContent();
public abstract void setMinHeightStretch();
public abstract YogaValue getMaxWidth();
public abstract void setMaxWidth(float maxWidth);
public abstract void setMaxWidthPercent(float percent);
public abstract void setMaxWidthMaxContent();
public abstract void setMaxWidthFitContent();
public abstract void setMaxWidthStretch();
public abstract YogaValue getMaxHeight();
public abstract void setMaxHeight(float maxheight);
public abstract void setMaxHeightPercent(float percent);
public abstract void setMaxHeightMaxContent();
public abstract void setMaxHeightFitContent();
public abstract void setMaxHeightStretch();
public abstract float getAspectRatio();
public abstract void setAspectRatio(float aspectRatio);
public abstract YogaValue getGap(YogaGutter gutter);
public abstract void setGap(YogaGutter gutter, float gapLength);
public abstract void setGapPercent(YogaGutter gutter, float gapLength);
public abstract float getLayoutX();
public abstract float getLayoutY();
public abstract float getLayoutWidth();
public abstract float getLayoutHeight();
public abstract float getLayoutMargin(YogaEdge edge);
public abstract float getLayoutPadding(YogaEdge edge);
public abstract float getLayoutBorder(YogaEdge edge);
public abstract YogaDirection getLayoutDirection();
public abstract void setMeasureFunction(YogaMeasureFunction measureFunction);
public abstract void setBaselineFunction(YogaBaselineFunction baselineFunction);
public abstract boolean isMeasureDefined();
public abstract boolean isBaselineDefined();
public abstract void setData(Object data);
@Nullable
public abstract Object getData();
public abstract YogaNode cloneWithoutChildren();
public abstract YogaNode cloneWithChildren();
public abstract void setAlwaysFormsContainingBlock(boolean alwaysFormsContainingBlock);
}

View File

@@ -0,0 +1,273 @@
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
package com.facebook.yoga
public abstract class YogaNode : YogaProps {
/** The interface the [getData] object can optionally implement. */
public fun interface Inputs {
/** Requests the data object to disable mutations of its inputs. */
public fun freeze(node: YogaNode, parent: YogaNode?)
}
public abstract fun reset()
public abstract fun getChildCount(): Int
public abstract fun getChildAt(i: Int): YogaNode
public abstract fun addChildAt(child: YogaNode, i: Int)
abstract override fun setIsReferenceBaseline(isReferenceBaseline: Boolean)
public abstract fun isReferenceBaseline(): Boolean
public abstract fun removeChildAt(i: Int): YogaNode
/**
* @returns the [YogaNode] that owns this [YogaNode]. The owner is used to identify the YogaTree
* that a [YogaNode] belongs to. This method will return the parent of the [YogaNode] when the
* [YogaNode] only belongs to one YogaTree or null when the [YogaNode] is shared between two or
* more YogaTrees.
*/
public abstract fun getOwner(): YogaNode?
@Deprecated(
"Use getOwner() instead. This will be removed in the next version. ",
replaceWith = ReplaceWith("getOwner()"))
public abstract fun getParent(): YogaNode?
public abstract fun indexOf(child: YogaNode): Int
public abstract fun calculateLayout(width: Float, height: Float)
public abstract fun hasNewLayout(): Boolean
public abstract fun dirty()
public abstract fun isDirty(): Boolean
public abstract fun copyStyle(srcNode: YogaNode)
public abstract fun markLayoutSeen()
abstract override fun getStyleDirection(): YogaDirection
abstract override fun setDirection(direction: YogaDirection)
abstract override fun getFlexDirection(): YogaFlexDirection
abstract override fun setFlexDirection(flexDirection: YogaFlexDirection)
abstract override fun getJustifyContent(): YogaJustify
abstract override fun setJustifyContent(justifyContent: YogaJustify)
abstract override fun getAlignItems(): YogaAlign
abstract override fun setAlignItems(alignItems: YogaAlign)
abstract override fun getAlignSelf(): YogaAlign
abstract override fun setAlignSelf(alignSelf: YogaAlign)
abstract override fun getAlignContent(): YogaAlign
abstract override fun setAlignContent(alignContent: YogaAlign)
abstract override fun getPositionType(): YogaPositionType
abstract override fun setPositionType(positionType: YogaPositionType)
abstract override fun getBoxSizing(): YogaBoxSizing
abstract override fun setBoxSizing(boxSizing: YogaBoxSizing)
public abstract fun getWrap(): YogaWrap
abstract override fun setWrap(flexWrap: YogaWrap)
public abstract fun getOverflow(): YogaOverflow
public abstract fun setOverflow(overflow: YogaOverflow)
public abstract fun getDisplay(): YogaDisplay
public abstract fun setDisplay(display: YogaDisplay)
public abstract fun getFlex(): Float
abstract override fun setFlex(flex: Float)
abstract override fun getFlexGrow(): Float
abstract override fun setFlexGrow(flexGrow: Float)
abstract override fun getFlexShrink(): Float
abstract override fun setFlexShrink(flexShrink: Float)
abstract override fun getFlexBasis(): YogaValue
abstract override fun setFlexBasis(flexBasis: Float)
abstract override fun setFlexBasisPercent(percent: Float)
abstract override fun setFlexBasisAuto()
abstract override fun setFlexBasisMaxContent()
abstract override fun setFlexBasisFitContent()
abstract override fun setFlexBasisStretch()
abstract override fun getMargin(edge: YogaEdge): YogaValue
abstract override fun setMargin(edge: YogaEdge, margin: Float)
abstract override fun setMarginPercent(edge: YogaEdge, percent: Float)
abstract override fun setMarginAuto(edge: YogaEdge)
abstract override fun getPadding(edge: YogaEdge): YogaValue
abstract override fun setPadding(edge: YogaEdge, padding: Float)
abstract override fun setPaddingPercent(edge: YogaEdge, percent: Float)
abstract override fun getBorder(edge: YogaEdge): Float
abstract override fun setBorder(edge: YogaEdge, border: Float)
abstract override fun getPosition(edge: YogaEdge): YogaValue
abstract override fun setPosition(edge: YogaEdge, position: Float)
abstract override fun setPositionPercent(edge: YogaEdge, percent: Float)
public abstract fun setPositionAuto(edge: YogaEdge)
abstract override fun getWidth(): YogaValue
abstract override fun setWidth(width: Float)
abstract override fun setWidthPercent(percent: Float)
abstract override fun setWidthAuto()
abstract override fun setWidthMaxContent()
abstract override fun setWidthFitContent()
abstract override fun setWidthStretch()
abstract override fun getHeight(): YogaValue
abstract override fun setHeight(height: Float)
abstract override fun setHeightPercent(percent: Float)
abstract override fun setHeightAuto()
abstract override fun setHeightMaxContent()
abstract override fun setHeightFitContent()
abstract override fun setHeightStretch()
abstract override fun getMinWidth(): YogaValue
abstract override fun setMinWidth(minWidth: Float)
abstract override fun setMinWidthPercent(percent: Float)
abstract override fun setMinWidthMaxContent()
abstract override fun setMinWidthFitContent()
abstract override fun setMinWidthStretch()
abstract override fun getMinHeight(): YogaValue
abstract override fun setMinHeight(minHeight: Float)
abstract override fun setMinHeightPercent(percent: Float)
abstract override fun setMinHeightMaxContent()
abstract override fun setMinHeightFitContent()
abstract override fun setMinHeightStretch()
abstract override fun getMaxWidth(): YogaValue
abstract override fun setMaxWidth(maxWidth: Float)
abstract override fun setMaxWidthPercent(percent: Float)
abstract override fun setMaxWidthMaxContent()
abstract override fun setMaxWidthFitContent()
abstract override fun setMaxWidthStretch()
abstract override fun getMaxHeight(): YogaValue
abstract override fun setMaxHeight(maxheight: Float)
abstract override fun setMaxHeightPercent(percent: Float)
abstract override fun setMaxHeightMaxContent()
abstract override fun setMaxHeightFitContent()
abstract override fun setMaxHeightStretch()
abstract override fun getAspectRatio(): Float
abstract override fun setAspectRatio(aspectRatio: Float)
public abstract fun getGap(gutter: YogaGutter): YogaValue
public abstract fun setGap(gutter: YogaGutter, gapLength: Float)
public abstract fun setGapPercent(gutter: YogaGutter, gapLength: Float)
public abstract fun getLayoutX(): Float
public abstract fun getLayoutY(): Float
public abstract fun getLayoutWidth(): Float
public abstract fun getLayoutHeight(): Float
public abstract fun getLayoutMargin(edge: YogaEdge): Float
public abstract fun getLayoutPadding(edge: YogaEdge): Float
public abstract fun getLayoutBorder(edge: YogaEdge): Float
public abstract fun getLayoutDirection(): YogaDirection
abstract override fun setMeasureFunction(measureFunction: YogaMeasureFunction)
abstract override fun setBaselineFunction(baselineFunction: YogaBaselineFunction)
public abstract fun isMeasureDefined(): Boolean
public abstract fun isBaselineDefined(): Boolean
public abstract fun setData(data: Any)
public abstract fun getData(): Any?
public abstract fun cloneWithoutChildren(): YogaNode
public abstract fun cloneWithChildren(): YogaNode
public abstract fun setAlwaysFormsContainingBlock(alwaysFormsContainingBlock: Boolean)
}