Java bindings for setAlwaysFormsContainingBlock (#1540)

Summary:
X-link: https://github.com/facebook/react-native/pull/42192

Pull Request resolved: https://github.com/facebook/yoga/pull/1540

tsia

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D52608259

fbshipit-source-id: 647ec4e2fe180ace8d6b641e17cd610fa53fe845
This commit is contained in:
Joe Vilches
2024-01-08 20:28:49 -08:00
committed by Facebook GitHub Bot
parent 5425107246
commit 47e9f33eb4
4 changed files with 20 additions and 0 deletions

View File

@@ -114,4 +114,5 @@ public class YogaNative {
static native void jni_YGNodePrintJNI(long nativePointer); static native void jni_YGNodePrintJNI(long nativePointer);
static native void jni_YGNodeSetStyleInputsJNI(long nativePointer, float[] styleInputsArray, int size); static native void jni_YGNodeSetStyleInputsJNI(long nativePointer, float[] styleInputsArray, int size);
static native long jni_YGNodeCloneJNI(long nativePointer); static native long jni_YGNodeCloneJNI(long nativePointer);
static native void jni_YGNodeSetAlwaysFormsContainingBlockJNI(long nativePointer, boolean alwaysFormContainingBlock);
} }

View File

@@ -226,4 +226,6 @@ public abstract class YogaNode implements YogaProps {
public abstract YogaNode cloneWithoutChildren(); public abstract YogaNode cloneWithoutChildren();
public abstract YogaNode cloneWithChildren(); public abstract YogaNode cloneWithChildren();
public abstract void setAlwaysFormsContainingBlock(boolean alwaysFormsContainingBlock);
} }

View File

@@ -504,6 +504,11 @@ public abstract class YogaNodeJNIBase extends YogaNode implements Cloneable {
YogaNative.jni_YGNodeSetHasMeasureFuncJNI(mNativePointer, measureFunction != null); 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 // 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 // We cache the jmethodid for this method in Yoga code. This means that even if a subclass

View File

@@ -681,6 +681,15 @@ static void jni_YGNodeSetHasBaselineFuncJNI(
hasBaselineFunc ? YGJNIBaselineFunc : nullptr); hasBaselineFunc ? YGJNIBaselineFunc : nullptr);
} }
static void jni_YGNodeSetAlwaysFormsContainingBlockJNI(
JNIEnv* /*env*/,
jobject /*obj*/,
jlong nativePointer,
jboolean alwaysFormsContainingBlock) {
YGNodeSetAlwaysFormsContainingBlock(
_jlong2YGNodeRef(nativePointer), alwaysFormsContainingBlock);
}
static void static void
jni_YGNodePrintJNI(JNIEnv* /*env*/, jobject /*obj*/, jlong nativePointer) { jni_YGNodePrintJNI(JNIEnv* /*env*/, jobject /*obj*/, jlong nativePointer) {
#ifdef DEBUG #ifdef DEBUG
@@ -958,6 +967,9 @@ static JNINativeMethod methods[] = {
{"jni_YGNodeSetHasBaselineFuncJNI", {"jni_YGNodeSetHasBaselineFuncJNI",
"(JZ)V", "(JZ)V",
(void*)jni_YGNodeSetHasBaselineFuncJNI}, (void*)jni_YGNodeSetHasBaselineFuncJNI},
{"jni_YGNodeSetAlwaysFormsContainingBlockJNI",
"(JZ)V",
(void*)jni_YGNodeSetAlwaysFormsContainingBlockJNI},
{"jni_YGNodePrintJNI", "(J)V", (void*)jni_YGNodePrintJNI}, {"jni_YGNodePrintJNI", "(J)V", (void*)jni_YGNodePrintJNI},
{"jni_YGNodeCloneJNI", "(J)J", (void*)jni_YGNodeCloneJNI}, {"jni_YGNodeCloneJNI", "(J)J", (void*)jni_YGNodeCloneJNI},
}; };