Skip to content

Commit

Permalink
Java bindings for setAlwaysFormsContainingBlock (facebook#42192)
Browse files Browse the repository at this point in the history
Summary:

X-link: facebook/yoga#1540

tsia

Reviewed By: NickGerleman

Differential Revision: D52608259
  • Loading branch information
joevilches authored and facebook-github-bot committed Jan 9, 2024
1 parent 52f0f0c commit 8e0d6b1
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -114,4 +114,5 @@ public class YogaNative {
static native void jni_YGNodePrintJNI(long nativePointer);
static native void jni_YGNodeSetStyleInputsJNI(long nativePointer, float[] styleInputsArray, int size);
static native long jni_YGNodeCloneJNI(long nativePointer);
static native void jni_YGNodeSetAlwaysFormsContainingBlockJNI(long nativePointer, boolean alwaysFormContainingBlock);
}
Original file line number Diff line number Diff line change
Expand Up @@ -226,4 +226,6 @@ public interface Inputs {
public abstract YogaNode cloneWithoutChildren();

public abstract YogaNode cloneWithChildren();

public abstract void setAlwaysFormsContainingBlock(boolean alwaysFormsContainingBlock);
}
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,11 @@ public void setMeasureFunction(YogaMeasureFunction measureFunction) {
YogaNative.jni_YGNodeSetHasMeasureFuncJNI(mNativePointer, measureFunction != null);
}

@Override
public void setAlwaysFormsContainingBlock(boolean alwaysFormsContainingBlock) {
YogaNative.jni_YGNodeSetAlwaysFormsContainingBlockJNI(mNativePointer, alwaysFormsContainingBlock);
}

// Implementation Note: Why this method needs to stay final
//
// We cache the jmethodid for this method in Yoga code. This means that even if a subclass
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -681,6 +681,15 @@ static void jni_YGNodeSetHasBaselineFuncJNI(
hasBaselineFunc ? YGJNIBaselineFunc : nullptr);
}

static void jni_YGNodeSetAlwaysFormsContainingBlockJNI(
JNIEnv* /*env*/,
jobject /*obj*/,
jlong nativePointer,
jboolean alwaysFormsContainingBlock) {
YGNodeSetAlwaysFormsContainingBlock(
_jlong2YGNodeRef(nativePointer), alwaysFormsContainingBlock);
}

static void
jni_YGNodePrintJNI(JNIEnv* /*env*/, jobject /*obj*/, jlong nativePointer) {
#ifdef DEBUG
Expand Down Expand Up @@ -958,6 +967,9 @@ static JNINativeMethod methods[] = {
{"jni_YGNodeSetHasBaselineFuncJNI",
"(JZ)V",
(void*)jni_YGNodeSetHasBaselineFuncJNI},
{"jni_YGNodeSetAlwaysFormsContainingBlockJNI",
"(JZ)V",
(void*)jni_YGNodeSetAlwaysFormsContainingBlockJNI},
{"jni_YGNodePrintJNI", "(J)V", (void*)jni_YGNodePrintJNI},
{"jni_YGNodeCloneJNI", "(J)J", (void*)jni_YGNodeCloneJNI},
};
Expand Down

0 comments on commit 8e0d6b1

Please sign in to comment.