Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Back out "Back out "[yoga][intrinsic sizing] Update public API for intrinsic sizing setters"" #1757

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,15 @@

ENUMS = {
"Direction": ["Inherit", "LTR", "RTL"],
"Unit": ["Undefined", "Point", "Percent", "Auto"],
"Unit": [
"Undefined",
"Point",
"Percent",
"Auto",
"MaxContent",
"FitContent",
"Stretch",
],
"FlexDirection": ["Column", "ColumnReverse", "Row", "RowReverse"],
"Justify": [
"FlexStart",
Expand Down
21 changes: 21 additions & 0 deletions java/com/facebook/yoga/YogaNative.java
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ public class YogaNative {
static native void jni_YGNodeStyleSetFlexBasisJNI(long nativePointer, float flexBasis);
static native void jni_YGNodeStyleSetFlexBasisPercentJNI(long nativePointer, float percent);
static native void jni_YGNodeStyleSetFlexBasisAutoJNI(long nativePointer);
static native void jni_YGNodeStyleSetFlexBasisMaxContentJNI(long nativePointer);
static native void jni_YGNodeStyleSetFlexBasisFitContentJNI(long nativePointer);
static native void jni_YGNodeStyleSetFlexBasisStretchJNI(long nativePointer);
static native long jni_YGNodeStyleGetMarginJNI(long nativePointer, int edge);
static native void jni_YGNodeStyleSetMarginJNI(long nativePointer, int edge, float margin);
static native void jni_YGNodeStyleSetMarginPercentJNI(long nativePointer, int edge, float percent);
Expand All @@ -91,22 +94,40 @@ public class YogaNative {
static native void jni_YGNodeStyleSetWidthJNI(long nativePointer, float width);
static native void jni_YGNodeStyleSetWidthPercentJNI(long nativePointer, float percent);
static native void jni_YGNodeStyleSetWidthAutoJNI(long nativePointer);
static native void jni_YGNodeStyleSetWidthMaxContentJNI(long nativePointer);
static native void jni_YGNodeStyleSetWidthFitContentJNI(long nativePointer);
static native void jni_YGNodeStyleSetWidthStretchJNI(long nativePointer);
static native long jni_YGNodeStyleGetHeightJNI(long nativePointer);
static native void jni_YGNodeStyleSetHeightJNI(long nativePointer, float height);
static native void jni_YGNodeStyleSetHeightPercentJNI(long nativePointer, float percent);
static native void jni_YGNodeStyleSetHeightAutoJNI(long nativePointer);
static native void jni_YGNodeStyleSetHeightMaxContentJNI(long nativePointer);
static native void jni_YGNodeStyleSetHeightFitContentJNI(long nativePointer);
static native void jni_YGNodeStyleSetHeightStretchJNI(long nativePointer);
static native long jni_YGNodeStyleGetMinWidthJNI(long nativePointer);
static native void jni_YGNodeStyleSetMinWidthJNI(long nativePointer, float minWidth);
static native void jni_YGNodeStyleSetMinWidthPercentJNI(long nativePointer, float percent);
static native void jni_YGNodeStyleSetMinWidthMaxContentJNI(long nativePointer);
static native void jni_YGNodeStyleSetMinWidthFitContentJNI(long nativePointer);
static native void jni_YGNodeStyleSetMinWidthStretchJNI(long nativePointer);
static native long jni_YGNodeStyleGetMinHeightJNI(long nativePointer);
static native void jni_YGNodeStyleSetMinHeightJNI(long nativePointer, float minHeight);
static native void jni_YGNodeStyleSetMinHeightPercentJNI(long nativePointer, float percent);
static native void jni_YGNodeStyleSetMinHeightMaxContentJNI(long nativePointer);
static native void jni_YGNodeStyleSetMinHeightFitContentJNI(long nativePointer);
static native void jni_YGNodeStyleSetMinHeightStretchJNI(long nativePointer);
static native long jni_YGNodeStyleGetMaxWidthJNI(long nativePointer);
static native void jni_YGNodeStyleSetMaxWidthJNI(long nativePointer, float maxWidth);
static native void jni_YGNodeStyleSetMaxWidthPercentJNI(long nativePointer, float percent);
static native void jni_YGNodeStyleSetMaxWidthMaxContentJNI(long nativePointer);
static native void jni_YGNodeStyleSetMaxWidthFitContentJNI(long nativePointer);
static native void jni_YGNodeStyleSetMaxWidthStretchJNI(long nativePointer);
static native long jni_YGNodeStyleGetMaxHeightJNI(long nativePointer);
static native void jni_YGNodeStyleSetMaxHeightJNI(long nativePointer, float maxheight);
static native void jni_YGNodeStyleSetMaxHeightPercentJNI(long nativePointer, float percent);
static native void jni_YGNodeStyleSetMaxHeightMaxContentJNI(long nativePointer);
static native void jni_YGNodeStyleSetMaxHeightFitContentJNI(long nativePointer);
static native void jni_YGNodeStyleSetMaxHeightStretchJNI(long nativePointer);
static native float jni_YGNodeStyleGetAspectRatioJNI(long nativePointer);
static native void jni_YGNodeStyleSetAspectRatioJNI(long nativePointer, float aspectRatio);
static native float jni_YGNodeStyleGetGapJNI(long nativePointer, int gutter);
Expand Down
42 changes: 42 additions & 0 deletions java/com/facebook/yoga/YogaNode.java
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,12 @@ public interface Inputs {

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);
Expand Down Expand Up @@ -158,6 +164,12 @@ public interface Inputs {

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);
Expand All @@ -166,30 +178,60 @@ public interface Inputs {

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);
Expand Down
84 changes: 84 additions & 0 deletions java/com/facebook/yoga/YogaNodeJNIBase.java
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,18 @@ public void setFlexBasisAuto() {
YogaNative.jni_YGNodeStyleSetFlexBasisAutoJNI(mNativePointer);
}

public void setFlexBasisMaxContent() {
YogaNative.jni_YGNodeStyleSetFlexBasisMaxContentJNI(mNativePointer);
}

public void setFlexBasisFitContent() {
YogaNative.jni_YGNodeStyleSetFlexBasisFitContentJNI(mNativePointer);
}

public void setFlexBasisStretch() {
YogaNative.jni_YGNodeStyleSetFlexBasisStretchJNI(mNativePointer);
}

public YogaValue getMargin(YogaEdge edge) {
return valueFromLong(YogaNative.jni_YGNodeStyleGetMarginJNI(mNativePointer, edge.intValue()));
}
Expand Down Expand Up @@ -441,6 +453,18 @@ public void setWidthAuto() {
YogaNative.jni_YGNodeStyleSetWidthAutoJNI(mNativePointer);
}

public void setWidthMaxContent() {
YogaNative.jni_YGNodeStyleSetWidthMaxContentJNI(mNativePointer);
}

public void setWidthFitContent() {
YogaNative.jni_YGNodeStyleSetWidthFitContentJNI(mNativePointer);
}

public void setWidthStretch() {
YogaNative.jni_YGNodeStyleSetWidthStretchJNI(mNativePointer);
}

public YogaValue getHeight() {
return valueFromLong(YogaNative.jni_YGNodeStyleGetHeightJNI(mNativePointer));
}
Expand All @@ -457,6 +481,18 @@ public void setHeightAuto() {
YogaNative.jni_YGNodeStyleSetHeightAutoJNI(mNativePointer);
}

public void setHeightMaxContent() {
YogaNative.jni_YGNodeStyleSetHeightMaxContentJNI(mNativePointer);
}

public void setHeightFitContent() {
YogaNative.jni_YGNodeStyleSetHeightFitContentJNI(mNativePointer);
}

public void setHeightStretch() {
YogaNative.jni_YGNodeStyleSetHeightStretchJNI(mNativePointer);
}

public YogaValue getMinWidth() {
return valueFromLong(YogaNative.jni_YGNodeStyleGetMinWidthJNI(mNativePointer));
}
Expand All @@ -469,6 +505,18 @@ public void setMinWidthPercent(float percent) {
YogaNative.jni_YGNodeStyleSetMinWidthPercentJNI(mNativePointer, percent);
}

public void setMinWidthMaxContent() {
YogaNative.jni_YGNodeStyleSetMinWidthMaxContentJNI(mNativePointer);
}

public void setMinWidthFitContent() {
YogaNative.jni_YGNodeStyleSetMinWidthFitContentJNI(mNativePointer);
}

public void setMinWidthStretch() {
YogaNative.jni_YGNodeStyleSetMinWidthStretchJNI(mNativePointer);
}

public YogaValue getMinHeight() {
return valueFromLong(YogaNative.jni_YGNodeStyleGetMinHeightJNI(mNativePointer));
}
Expand All @@ -481,6 +529,18 @@ public void setMinHeightPercent(float percent) {
YogaNative.jni_YGNodeStyleSetMinHeightPercentJNI(mNativePointer, percent);
}

public void setMinHeightMaxContent() {
YogaNative.jni_YGNodeStyleSetMinHeightMaxContentJNI(mNativePointer);
}

public void setMinHeightFitContent() {
YogaNative.jni_YGNodeStyleSetMinHeightFitContentJNI(mNativePointer);
}

public void setMinHeightStretch() {
YogaNative.jni_YGNodeStyleSetMinHeightStretchJNI(mNativePointer);
}

public YogaValue getMaxWidth() {
return valueFromLong(YogaNative.jni_YGNodeStyleGetMaxWidthJNI(mNativePointer));
}
Expand All @@ -493,6 +553,18 @@ public void setMaxWidthPercent(float percent) {
YogaNative.jni_YGNodeStyleSetMaxWidthPercentJNI(mNativePointer, percent);
}

public void setMaxWidthMaxContent() {
YogaNative.jni_YGNodeStyleSetMaxWidthMaxContentJNI(mNativePointer);
}

public void setMaxWidthFitContent() {
YogaNative.jni_YGNodeStyleSetMaxWidthFitContentJNI(mNativePointer);
}

public void setMaxWidthStretch() {
YogaNative.jni_YGNodeStyleSetMaxWidthStretchJNI(mNativePointer);
}

public YogaValue getMaxHeight() {
return valueFromLong(YogaNative.jni_YGNodeStyleGetMaxHeightJNI(mNativePointer));
}
Expand All @@ -505,6 +577,18 @@ public void setMaxHeightPercent(float percent) {
YogaNative.jni_YGNodeStyleSetMaxHeightPercentJNI(mNativePointer, percent);
}

public void setMaxHeightMaxContent() {
YogaNative.jni_YGNodeStyleSetMaxHeightMaxContentJNI(mNativePointer);
}

public void setMaxHeightFitContent() {
YogaNative.jni_YGNodeStyleSetMaxHeightFitContentJNI(mNativePointer);
}

public void setMaxHeightStretch() {
YogaNative.jni_YGNodeStyleSetMaxHeightStretchJNI(mNativePointer);
}

public float getAspectRatio() {
return YogaNative.jni_YGNodeStyleGetAspectRatioJNI(mNativePointer);
}
Expand Down
46 changes: 44 additions & 2 deletions java/com/facebook/yoga/YogaProps.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,31 +15,67 @@ public interface YogaProps {

void setWidthPercent(float percent);

void setWidthAuto();

void setWidthMaxContent();

void setWidthFitContent();

void setWidthStretch();

void setMinWidth(float minWidth);

void setMinWidthPercent(float percent);

void setMinWidthMaxContent();

void setMinWidthFitContent();

void setMinWidthStretch();

void setMaxWidth(float maxWidth);

void setMaxWidthPercent(float percent);

void setWidthAuto();
void setMaxWidthMaxContent();

void setMaxWidthFitContent();

void setMaxWidthStretch();

/* Height properties */

void setHeight(float height);

void setHeightPercent(float percent);

void setHeightAuto();

void setHeightMaxContent();

void setHeightFitContent();

void setHeightStretch();

void setMinHeight(float minHeight);

void setMinHeightPercent(float percent);

void setMinHeightMaxContent();

void setMinHeightFitContent();

void setMinHeightStretch();

void setMaxHeight(float maxHeight);

void setMaxHeightPercent(float percent);

void setHeightAuto();
void setMaxHeightMaxContent();

void setMaxHeightFitContent();

void setMaxHeightStretch();

/* Margin properties */

Expand Down Expand Up @@ -81,6 +117,12 @@ public interface YogaProps {

void setFlexBasis(float flexBasis);

void setFlexBasisMaxContent();

void setFlexBasisFitContent();

void setFlexBasisStretch();

void setFlexDirection(YogaFlexDirection direction);

void setFlexGrow(float flexGrow);
Expand Down
8 changes: 7 additions & 1 deletion java/com/facebook/yoga/YogaUnit.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ public enum YogaUnit {
UNDEFINED(0),
POINT(1),
PERCENT(2),
AUTO(3);
AUTO(3),
MAX_CONTENT(4),
FIT_CONTENT(5),
STRETCH(6);

private final int mIntValue;

Expand All @@ -31,6 +34,9 @@ public static YogaUnit fromInt(int value) {
case 1: return POINT;
case 2: return PERCENT;
case 3: return AUTO;
case 4: return MAX_CONTENT;
case 5: return FIT_CONTENT;
case 6: return STRETCH;
default: throw new IllegalArgumentException("Unknown enum value: " + value);
}
}
Expand Down
Loading
Loading