Skip to content

Commit

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

X-link: facebook/yoga#1540

tsia

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D52608259

fbshipit-source-id: 647ec4e2fe180ace8d6b641e17cd610fa53fe845
  • Loading branch information
joevilches authored and facebook-github-bot committed Jan 9, 2024
1 parent 8714e41 commit f5b824a
Show file tree
Hide file tree
Showing 5 changed files with 22 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
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ class FakeYogaNode : YogaNode() {

override fun setBaselineFunction(baselineFunction: YogaBaselineFunction?) {}

override fun setAlwaysFormsContainingBlock(alwaysFormsContainingBlock: Boolean) {}

override fun getWidth(): YogaValue = YogaValue(YogaConstants.UNDEFINED, YogaUnit.UNDEFINED)

override fun getMinWidth(): YogaValue = YogaValue(YogaConstants.UNDEFINED, YogaUnit.UNDEFINED)
Expand Down

0 comments on commit f5b824a

Please sign in to comment.