Skip to content
Closed
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
5 changes: 5 additions & 0 deletions lib/yoga/src/main/cpp/yoga/YGNodeStyle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,11 @@ void YGNodeStyleSetGap(
node, scopedEnum(gutter), value::points(gapLength));
}

void YGNodeStyleSetGapAuto(YGNodeRef node, YGGutter gutter) {
updateStyle<&Style::gap, &Style::setGap>(
node, scopedEnum(gutter), value::ofAuto());
}

void YGNodeStyleSetGapPercent(YGNodeRef node, YGGutter gutter, float percent) {
updateStyle<&Style::gap, &Style::setGap>(
node, scopedEnum(gutter), value::percent(percent));
Expand Down
1 change: 1 addition & 0 deletions lib/yoga/src/main/cpp/yoga/YGNodeStyle.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ YG_EXPORT float YGNodeStyleGetBorder(YGNodeConstRef node, YGEdge edge);

YG_EXPORT void
YGNodeStyleSetGap(YGNodeRef node, YGGutter gutter, float gapLength);
YG_EXPORT void YGNodeStyleSetGapAuto(YGNodeRef node, YGGutter gutter);
YG_EXPORT void
YGNodeStyleSetGapPercent(YGNodeRef node, YGGutter gutter, float gapLength);
YG_EXPORT float YGNodeStyleGetGap(YGNodeConstRef node, YGGutter gutter);
Expand Down
1 change: 1 addition & 0 deletions lib/yoga/src/main/java/com/facebook/yoga/YogaNative.java
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ public class YogaNative {
static native float jni_YGNodeStyleGetGapJNI(long nativePointer, int gutter);
static native void jni_YGNodeStyleSetGapJNI(long nativePointer, int gutter, float gapLength);
static native void jni_YGNodeStyleSetGapPercentJNI(long nativePointer, int gutter, float gapLength);
static native void jni_YGNodeStyleSetGapAutoJNI(long nativePointer, int gutter);
static native void jni_YGNodeSetHasMeasureFuncJNI(long nativePointer, boolean hasMeasureFunc);
static native void jni_YGNodeSetHasBaselineFuncJNI(long nativePointer, boolean hasMeasureFunc);
static native void jni_YGNodeSetStyleInputsJNI(long nativePointer, float[] styleInputsArray, int size);
Expand Down
2 changes: 2 additions & 0 deletions lib/yoga/src/main/java/com/facebook/yoga/YogaNode.java
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,8 @@ public interface Inputs {

public abstract void setGapPercent(YogaGutter gutter, float gapLength);

public abstract void setGapAuto(YogaGutter gutter);

public abstract float getLayoutX();

public abstract float getLayoutY();
Expand Down
5 changes: 5 additions & 0 deletions lib/yoga/src/main/java/com/facebook/yoga/YogaNodeJNIBase.java
Original file line number Diff line number Diff line change
Expand Up @@ -726,4 +726,9 @@ public void setGap(YogaGutter gutter, float gapLength) {
public void setGapPercent(YogaGutter gutter, float gapLength) {
YogaNative.jni_YGNodeStyleSetGapPercentJNI(mNativePointer, gutter.intValue(), gapLength);
}

@Override
public void setGapAuto(YogaGutter gutter) {
YogaNative.jni_YGNodeStyleSetGapAutoJNI(mNativePointer, gutter.intValue());
}
}
12 changes: 12 additions & 0 deletions lib/yogajni/src/main/cpp/jni/YGJNIVanilla.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -727,6 +727,15 @@ static void jni_YGNodeStyleSetGapPercentJNI(
static_cast<float>(gapLength));
}

static void jni_YGNodeStyleSetGapAutoJNI(
JNIEnv* /*env*/,
jobject /*obj*/,
jlong nativePointer,
jint gutter) {
YGNodeStyleSetGapAuto(
_jlong2YGNodeRef(nativePointer), static_cast<YGGutter>(gutter));
}

// Yoga specific properties, not compatible with flexbox specification
YG_NODE_JNI_STYLE_PROP(jfloat, float, AspectRatio);

Expand Down Expand Up @@ -959,6 +968,9 @@ static JNINativeMethod methods[] = {
{"jni_YGNodeStyleSetGapPercentJNI",
"(JIF)V",
(void*)jni_YGNodeStyleSetGapPercentJNI},
{"jni_YGNodeStyleSetGapAutoJNI",
"(JI)V",
(void*)jni_YGNodeStyleSetGapAutoJNI},
{"jni_YGNodeSetHasBaselineFuncJNI",
"(JZ)V",
(void*)jni_YGNodeSetHasBaselineFuncJNI},
Expand Down