Move native methods to a single class

Summary:
@public

Moving all native methods in a single class provides the benefit of not having to load native bindings eagerly when just creating config objects in the startup paths, or setting Java-only values on them.
Loading native bindings triggers additional class loads (`YogaConfig` / `YogaNode`), and can lead to problems in multi-dex scenarions.

Reviewed By: pasqualeanatriello

Differential Revision: D14560658

fbshipit-source-id: 14e31e3c3b560675b5a752a38ae75ab80a565ea1
This commit is contained in:
David Aurelio
2019-03-22 09:30:25 -07:00
committed by Facebook Github Bot
parent ab3bf40c7d
commit 5bb2265083
6 changed files with 308 additions and 321 deletions

View File

@@ -6,76 +6,57 @@
*/ */
package com.facebook.yoga; package com.facebook.yoga;
import com.facebook.proguard.annotations.DoNotStrip;
import com.facebook.soloader.SoLoader; import com.facebook.soloader.SoLoader;
@DoNotStrip
public class YogaConfig { public class YogaConfig {
public static int SPACING_TYPE = 1; public static int SPACING_TYPE = 1;
static {
SoLoader.loadLibrary("yoga");
}
long mNativePointer; long mNativePointer;
private YogaLogger mLogger; private YogaLogger mLogger;
private YogaNodeCloneFunction mYogaNodeCloneFunction; private YogaNodeCloneFunction mYogaNodeCloneFunction;
private native long jni_YGConfigNew();
public YogaConfig() { public YogaConfig() {
mNativePointer = jni_YGConfigNew(); mNativePointer = YogaNative.jni_YGConfigNew();
if (mNativePointer == 0) { if (mNativePointer == 0) {
throw new IllegalStateException("Failed to allocate native memory"); throw new IllegalStateException("Failed to allocate native memory");
} }
} }
private native void jni_YGConfigFree(long nativePointer);
@Override @Override
protected void finalize() throws Throwable { protected void finalize() throws Throwable {
try { try {
jni_YGConfigFree(mNativePointer); YogaNative.jni_YGConfigFree(mNativePointer);
} finally { } finally {
super.finalize(); super.finalize();
} }
} }
private native void jni_YGConfigSetExperimentalFeatureEnabled(
long nativePointer,
int feature,
boolean enabled);
public void setExperimentalFeatureEnabled(YogaExperimentalFeature feature, boolean enabled) { public void setExperimentalFeatureEnabled(YogaExperimentalFeature feature, boolean enabled) {
jni_YGConfigSetExperimentalFeatureEnabled(mNativePointer, feature.intValue(), enabled); YogaNative.jni_YGConfigSetExperimentalFeatureEnabled(mNativePointer, feature.intValue(), enabled);
} }
private native void jni_YGConfigSetUseWebDefaults(long nativePointer, boolean useWebDefaults);
public void setUseWebDefaults(boolean useWebDefaults) { public void setUseWebDefaults(boolean useWebDefaults) {
jni_YGConfigSetUseWebDefaults(mNativePointer, useWebDefaults); YogaNative.jni_YGConfigSetUseWebDefaults(mNativePointer, useWebDefaults);
} }
private native void jni_YGConfigSetPrintTreeFlag(long nativePointer, boolean enable);
public void setPrintTreeFlag(boolean enable) { public void setPrintTreeFlag(boolean enable) {
jni_YGConfigSetPrintTreeFlag(mNativePointer, enable); YogaNative.jni_YGConfigSetPrintTreeFlag(mNativePointer, enable);
} }
private native void jni_YGConfigSetPointScaleFactor(long nativePointer, float pixelsInPoint);
public void setPointScaleFactor(float pixelsInPoint) { public void setPointScaleFactor(float pixelsInPoint) {
jni_YGConfigSetPointScaleFactor(mNativePointer, pixelsInPoint); YogaNative.jni_YGConfigSetPointScaleFactor(mNativePointer, pixelsInPoint);
} }
private native void jni_YGConfigSetUseLegacyStretchBehaviour(long nativePointer, boolean useLegacyStretchBehaviour);
/** /**
* Yoga previously had an error where containers would take the maximum space possible instead of the minimum * Yoga previously had an error where containers would take the maximum space possible instead of the minimum
* like they are supposed to. In practice this resulted in implicit behaviour similar to align-self: stretch; * like they are supposed to. In practice this resulted in implicit behaviour similar to align-self: stretch;
* Because this was such a long-standing bug we must allow legacy users to switch back to this behaviour. * Because this was such a long-standing bug we must allow legacy users to switch back to this behaviour.
*/ */
public void setUseLegacyStretchBehaviour(boolean useLegacyStretchBehaviour) { public void setUseLegacyStretchBehaviour(boolean useLegacyStretchBehaviour) {
jni_YGConfigSetUseLegacyStretchBehaviour(mNativePointer, useLegacyStretchBehaviour); YogaNative.jni_YGConfigSetUseLegacyStretchBehaviour(mNativePointer, useLegacyStretchBehaviour);
} }
private native void jni_YGConfigSetShouldDiffLayoutWithoutLegacyStretchBehaviour(
long nativePointer, boolean shouldDiffLayoutWithoutLegacyStretchBehaviour);
/** /**
* If this flag is set then yoga would diff the layout without legacy flag and would set a bool in * If this flag is set then yoga would diff the layout without legacy flag and would set a bool in
* YogaNode(mDoesLegacyStretchFlagAffectsLayout) with true if the layouts were different and false * YogaNode(mDoesLegacyStretchFlagAffectsLayout) with true if the layouts were different and false
@@ -83,14 +64,13 @@ public class YogaConfig {
*/ */
public void setShouldDiffLayoutWithoutLegacyStretchBehaviour( public void setShouldDiffLayoutWithoutLegacyStretchBehaviour(
boolean shouldDiffLayoutWithoutLegacyStretchBehaviour) { boolean shouldDiffLayoutWithoutLegacyStretchBehaviour) {
jni_YGConfigSetShouldDiffLayoutWithoutLegacyStretchBehaviour( YogaNative.jni_YGConfigSetShouldDiffLayoutWithoutLegacyStretchBehaviour(
mNativePointer, shouldDiffLayoutWithoutLegacyStretchBehaviour); mNativePointer, shouldDiffLayoutWithoutLegacyStretchBehaviour);
} }
private native void jni_YGConfigSetLogger(long nativePointer, Object logger);
public void setLogger(YogaLogger logger) { public void setLogger(YogaLogger logger) {
mLogger = logger; mLogger = logger;
jni_YGConfigSetLogger(mNativePointer, logger); YogaNative.jni_YGConfigSetLogger(mNativePointer, logger);
} }
public YogaLogger getLogger() { public YogaLogger getLogger() {

View File

@@ -0,0 +1,114 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the LICENSE
* file in the root directory of this source tree.
*/
package com.facebook.yoga;
import com.facebook.proguard.annotations.DoNotStrip;
import com.facebook.soloader.SoLoader;
@DoNotStrip
public class YogaNative {
static {
SoLoader.loadLibrary("yoga");
}
// YGConfig related
static native long jni_YGConfigNew();
static native void jni_YGConfigFree(long nativePointer);
static native void jni_YGConfigSetExperimentalFeatureEnabled(long nativePointer, int feature, boolean enabled);
static native void jni_YGConfigSetUseWebDefaults(long nativePointer, boolean useWebDefaults);
static native void jni_YGConfigSetPrintTreeFlag(long nativePointer, boolean enable);
static native void jni_YGConfigSetPointScaleFactor(long nativePointer, float pixelsInPoint);
static native void jni_YGConfigSetUseLegacyStretchBehaviour(long nativePointer, boolean useLegacyStretchBehaviour);
static native void jni_YGConfigSetShouldDiffLayoutWithoutLegacyStretchBehaviour(long nativePointer, boolean shouldDiffLayoutWithoutLegacyStretchBehaviour);
static native void jni_YGConfigSetLogger(long nativePointer, Object logger);
// YGNode related
static native int jni_YGNodeGetInstanceCount();
static native long jni_YGNodeNew();
static native long jni_YGNodeNewWithConfig(long configPointer);
static native void jni_YGNodeFree(long nativePointer);
static native void jni_YGNodeReset(long nativePointer);
static native void jni_YGNodeInsertChild(long nativePointer, long childPointer, int index);
static native void jni_YGNodeSetIsReferenceBaseline(long nativePointer, boolean isReferenceBaseline);
static native boolean jni_YGNodeIsReferenceBaseline(long nativePointer);
static native void jni_YGNodeClearChildren(long nativePointer);
static native void jni_YGNodeRemoveChild(long nativePointer, long childPointer);
static native void jni_YGNodeCalculateLayout(long nativePointer, float width, float height, long[] nativePointers, YogaNodeJNIBase[] nodes);
static native void jni_YGNodeMarkDirty(long nativePointer);
static native void jni_YGNodeMarkDirtyAndPropogateToDescendants(long nativePointer);
static native boolean jni_YGNodeIsDirty(long nativePointer);
static native void jni_YGNodeCopyStyle(long dstNativePointer, long srcNativePointer);
static native int jni_YGNodeStyleGetDirection(long nativePointer);
static native void jni_YGNodeStyleSetDirection(long nativePointer, int direction);
static native int jni_YGNodeStyleGetFlexDirection(long nativePointer);
static native void jni_YGNodeStyleSetFlexDirection(long nativePointer, int flexDirection);
static native int jni_YGNodeStyleGetJustifyContent(long nativePointer);
static native void jni_YGNodeStyleSetJustifyContent(long nativePointer, int justifyContent);
static native int jni_YGNodeStyleGetAlignItems(long nativePointer);
static native void jni_YGNodeStyleSetAlignItems(long nativePointer, int alignItems);
static native int jni_YGNodeStyleGetAlignSelf(long nativePointer);
static native void jni_YGNodeStyleSetAlignSelf(long nativePointer, int alignSelf);
static native int jni_YGNodeStyleGetAlignContent(long nativePointer);
static native void jni_YGNodeStyleSetAlignContent(long nativePointer, int alignContent);
static native int jni_YGNodeStyleGetPositionType(long nativePointer);
static native void jni_YGNodeStyleSetPositionType(long nativePointer, int positionType);
static native int jni_YGNodeStyleGetFlexWrap(long nativePointer);
static native void jni_YGNodeStyleSetFlexWrap(long nativePointer, int wrapType);
static native int jni_YGNodeStyleGetOverflow(long nativePointer);
static native void jni_YGNodeStyleSetOverflow(long nativePointer, int overflow);
static native int jni_YGNodeStyleGetDisplay(long nativePointer);
static native void jni_YGNodeStyleSetDisplay(long nativePointer, int display);
static native float jni_YGNodeStyleGetFlex(long nativePointer);
static native void jni_YGNodeStyleSetFlex(long nativePointer, float flex);
static native float jni_YGNodeStyleGetFlexGrow(long nativePointer);
static native void jni_YGNodeStyleSetFlexGrow(long nativePointer, float flexGrow);
static native float jni_YGNodeStyleGetFlexShrink(long nativePointer);
static native void jni_YGNodeStyleSetFlexShrink(long nativePointer, float flexShrink);
static native Object jni_YGNodeStyleGetFlexBasis(long nativePointer);
static native void jni_YGNodeStyleSetFlexBasis(long nativePointer, float flexBasis);
static native void jni_YGNodeStyleSetFlexBasisPercent(long nativePointer, float percent);
static native void jni_YGNodeStyleSetFlexBasisAuto(long nativePointer);
static native Object jni_YGNodeStyleGetMargin(long nativePointer, int edge);
static native void jni_YGNodeStyleSetMargin(long nativePointer, int edge, float margin);
static native void jni_YGNodeStyleSetMarginPercent(long nativePointer, int edge, float percent);
static native void jni_YGNodeStyleSetMarginAuto(long nativePointer, int edge);
static native Object jni_YGNodeStyleGetPadding(long nativePointer, int edge);
static native void jni_YGNodeStyleSetPadding(long nativePointer, int edge, float padding);
static native void jni_YGNodeStyleSetPaddingPercent(long nativePointer, int edge, float percent);
static native float jni_YGNodeStyleGetBorder(long nativePointer, int edge);
static native void jni_YGNodeStyleSetBorder(long nativePointer, int edge, float border);
static native Object jni_YGNodeStyleGetPosition(long nativePointer, int edge);
static native void jni_YGNodeStyleSetPosition(long nativePointer, int edge, float position);
static native void jni_YGNodeStyleSetPositionPercent(long nativePointer, int edge, float percent);
static native Object jni_YGNodeStyleGetWidth(long nativePointer);
static native void jni_YGNodeStyleSetWidth(long nativePointer, float width);
static native void jni_YGNodeStyleSetWidthPercent(long nativePointer, float percent);
static native void jni_YGNodeStyleSetWidthAuto(long nativePointer);
static native Object jni_YGNodeStyleGetHeight(long nativePointer);
static native void jni_YGNodeStyleSetHeight(long nativePointer, float height);
static native void jni_YGNodeStyleSetHeightPercent(long nativePointer, float percent);
static native void jni_YGNodeStyleSetHeightAuto(long nativePointer);
static native Object jni_YGNodeStyleGetMinWidth(long nativePointer);
static native void jni_YGNodeStyleSetMinWidth(long nativePointer, float minWidth);
static native void jni_YGNodeStyleSetMinWidthPercent(long nativePointer, float percent);
static native Object jni_YGNodeStyleGetMinHeight(long nativePointer);
static native void jni_YGNodeStyleSetMinHeight(long nativePointer, float minHeight);
static native void jni_YGNodeStyleSetMinHeightPercent(long nativePointer, float percent);
static native Object jni_YGNodeStyleGetMaxWidth(long nativePointer);
static native void jni_YGNodeStyleSetMaxWidth(long nativePointer, float maxWidth);
static native void jni_YGNodeStyleSetMaxWidthPercent(long nativePointer, float percent);
static native Object jni_YGNodeStyleGetMaxHeight(long nativePointer);
static native void jni_YGNodeStyleSetMaxHeight(long nativePointer, float maxheight);
static native void jni_YGNodeStyleSetMaxHeightPercent(long nativePointer, float percent);
static native float jni_YGNodeStyleGetAspectRatio(long nativePointer);
static native void jni_YGNodeStyleSetAspectRatio(long nativePointer, float aspectRatio);
static native void jni_YGNodeSetHasMeasureFunc(long nativePointer, boolean hasMeasureFunc);
static native void jni_YGNodeSetHasBaselineFunc(long nativePointer, boolean hasMeasureFunc);
static native void jni_YGNodePrint(long nativePointer);
static native void jni_YGNodeSetStyleInputs(long nativePointer, float[] styleInputsArray, int size);
}

View File

@@ -7,7 +7,6 @@
package com.facebook.yoga; package com.facebook.yoga;
import com.facebook.proguard.annotations.DoNotStrip; import com.facebook.proguard.annotations.DoNotStrip;
import com.facebook.soloader.SoLoader;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import javax.annotation.Nullable; import javax.annotation.Nullable;
@@ -15,15 +14,6 @@ import javax.annotation.Nullable;
@DoNotStrip @DoNotStrip
public abstract class YogaNodeJNIBase extends YogaNode { public abstract class YogaNodeJNIBase extends YogaNode {
static {
SoLoader.loadLibrary("yoga");
}
/**
* Get native instance count. Useful for testing only.
*/
static native int jni_YGNodeGetInstanceCount();
private YogaNodeJNIBase mOwner; private YogaNodeJNIBase mOwner;
@Nullable private List<YogaNodeJNIBase> mChildren; @Nullable private List<YogaNodeJNIBase> mChildren;
private YogaMeasureFunction mMeasureFunction; private YogaMeasureFunction mMeasureFunction;
@@ -74,17 +64,15 @@ public abstract class YogaNodeJNIBase extends YogaNode {
private boolean mHasNewLayout = true; private boolean mHasNewLayout = true;
@DoNotStrip private boolean mDoesLegacyStretchFlagAffectsLayout = false; @DoNotStrip private boolean mDoesLegacyStretchFlagAffectsLayout = false;
private native long jni_YGNodeNew();
public YogaNodeJNIBase() { public YogaNodeJNIBase() {
mNativePointer = jni_YGNodeNew(); mNativePointer = YogaNative.jni_YGNodeNew();
if (mNativePointer == 0) { if (mNativePointer == 0) {
throw new IllegalStateException("Failed to allocate native memory"); throw new IllegalStateException("Failed to allocate native memory");
} }
} }
private native long jni_YGNodeNewWithConfig(long configPointer);
public YogaNodeJNIBase(YogaConfig config) { public YogaNodeJNIBase(YogaConfig config) {
mNativePointer = jni_YGNodeNewWithConfig(config.mNativePointer); mNativePointer = YogaNative.jni_YGNodeNewWithConfig(config.mNativePointer);
if (mNativePointer == 0) { if (mNativePointer == 0) {
throw new IllegalStateException("Failed to allocate native memory"); throw new IllegalStateException("Failed to allocate native memory");
} }
@@ -99,18 +87,14 @@ public abstract class YogaNodeJNIBase extends YogaNode {
} }
} }
private static native void jni_YGNodeFree(long nativePointer);
/* frees the native underlying YGNode. Useful for testing. */ /* frees the native underlying YGNode. Useful for testing. */
public void freeNatives() { public void freeNatives() {
if (mNativePointer > 0) { if (mNativePointer > 0) {
long nativePointer = mNativePointer; long nativePointer = mNativePointer;
mNativePointer = 0; mNativePointer = 0;
jni_YGNodeFree(nativePointer); YogaNative.jni_YGNodeFree(nativePointer);
} }
} }
private static native void jni_YGNodeReset(long nativePointer);
public void reset() { public void reset() {
mHasNewLayout = true; mHasNewLayout = true;
@@ -137,7 +121,7 @@ public abstract class YogaNodeJNIBase extends YogaNode {
mData = null; mData = null;
mDoesLegacyStretchFlagAffectsLayout = false; mDoesLegacyStretchFlagAffectsLayout = false;
jni_YGNodeReset(mNativePointer); YogaNative.jni_YGNodeReset(mNativePointer);
} }
public int getChildCount() { public int getChildCount() {
@@ -151,8 +135,6 @@ public abstract class YogaNodeJNIBase extends YogaNode {
return mChildren.get(i); return mChildren.get(i);
} }
private static native void jni_YGNodeInsertChild(long nativePointer, long childPointer, int index);
public void addChildAt(YogaNode c, int i) { public void addChildAt(YogaNode c, int i) {
YogaNodeJNIBase child = (YogaNodeJNIBase) c; YogaNodeJNIBase child = (YogaNodeJNIBase) c;
if (child.mOwner != null) { if (child.mOwner != null) {
@@ -164,29 +146,22 @@ public abstract class YogaNodeJNIBase extends YogaNode {
} }
mChildren.add(i, child); mChildren.add(i, child);
child.mOwner = this; child.mOwner = this;
jni_YGNodeInsertChild(mNativePointer, child.mNativePointer, i); YogaNative.jni_YGNodeInsertChild(mNativePointer, child.mNativePointer, i);
} }
private static native void jni_YGNodeSetIsReferenceBaseline(long nativePointer, boolean isReferenceBaseline);
public void setIsReferenceBaseline(boolean isReferenceBaseline) { public void setIsReferenceBaseline(boolean isReferenceBaseline) {
jni_YGNodeSetIsReferenceBaseline(mNativePointer, isReferenceBaseline); YogaNative.jni_YGNodeSetIsReferenceBaseline(mNativePointer, isReferenceBaseline);
} }
private static native boolean jni_YGNodeIsReferenceBaseline(long nativePointer);
public boolean isReferenceBaseline() { public boolean isReferenceBaseline() {
return jni_YGNodeIsReferenceBaseline(mNativePointer); return YogaNative.jni_YGNodeIsReferenceBaseline(mNativePointer);
} }
private static native void jni_YGNodeClearChildren(long nativePointer);
private void clearChildren() { private void clearChildren() {
mChildren = null; mChildren = null;
jni_YGNodeClearChildren(mNativePointer); YogaNative.jni_YGNodeClearChildren(mNativePointer);
} }
private static native void jni_YGNodeRemoveChild(long nativePointer, long childPointer);
public YogaNodeJNIBase removeChildAt(int i) { public YogaNodeJNIBase removeChildAt(int i) {
if (mChildren == null) { if (mChildren == null) {
throw new IllegalStateException( throw new IllegalStateException(
@@ -194,7 +169,7 @@ public abstract class YogaNodeJNIBase extends YogaNode {
} }
final YogaNodeJNIBase child = mChildren.remove(i); final YogaNodeJNIBase child = mChildren.remove(i);
child.mOwner = null; child.mOwner = null;
jni_YGNodeRemoveChild(mNativePointer, child.mNativePointer); YogaNative.jni_YGNodeRemoveChild(mNativePointer, child.mNativePointer);
return child; return child;
} }
@@ -222,7 +197,6 @@ public abstract class YogaNodeJNIBase extends YogaNode {
return mChildren == null ? -1 : mChildren.indexOf(child); return mChildren == null ? -1 : mChildren.indexOf(child);
} }
private static native void jni_YGNodeCalculateLayout(long nativePointer, float width, float height, long[] nativePointers, YogaNodeJNIBase[] nodes);
public void calculateLayout(float width, float height) { public void calculateLayout(float width, float height) {
long[] nativePointers = null; long[] nativePointers = null;
YogaNodeJNIBase[] nodes = null; YogaNodeJNIBase[] nodes = null;
@@ -242,357 +216,288 @@ public abstract class YogaNodeJNIBase extends YogaNode {
nativePointers[i] = nodes[i].mNativePointer; nativePointers[i] = nodes[i].mNativePointer;
} }
jni_YGNodeCalculateLayout(mNativePointer, width, height, nativePointers, nodes); YogaNative.jni_YGNodeCalculateLayout(mNativePointer, width, height, nativePointers, nodes);
} }
public boolean hasNewLayout() { public boolean hasNewLayout() {
return mHasNewLayout; return mHasNewLayout;
} }
private static native void jni_YGNodeMarkDirty(long nativePointer);
public void dirty() { public void dirty() {
jni_YGNodeMarkDirty(mNativePointer); YogaNative.jni_YGNodeMarkDirty(mNativePointer);
} }
private static native void jni_YGNodeMarkDirtyAndPropogateToDescendants(long nativePointer);
public void dirtyAllDescendants() { public void dirtyAllDescendants() {
jni_YGNodeMarkDirtyAndPropogateToDescendants(mNativePointer); YogaNative.jni_YGNodeMarkDirtyAndPropogateToDescendants(mNativePointer);
} }
private static native boolean jni_YGNodeIsDirty(long nativePointer);
public boolean isDirty() { public boolean isDirty() {
return jni_YGNodeIsDirty(mNativePointer); return YogaNative.jni_YGNodeIsDirty(mNativePointer);
} }
private static native void jni_YGNodeCopyStyle(long dstNativePointer, long srcNativePointer);
@Override @Override
public void copyStyle(YogaNode srcNode) { public void copyStyle(YogaNode srcNode) {
jni_YGNodeCopyStyle(mNativePointer, ((YogaNodeJNIBase) srcNode).mNativePointer); YogaNative.jni_YGNodeCopyStyle(mNativePointer, ((YogaNodeJNIBase) srcNode).mNativePointer);
} }
public void markLayoutSeen() { public void markLayoutSeen() {
mHasNewLayout = false; mHasNewLayout = false;
} }
private static native int jni_YGNodeStyleGetDirection(long nativePointer);
public YogaDirection getStyleDirection() { public YogaDirection getStyleDirection() {
return YogaDirection.fromInt(jni_YGNodeStyleGetDirection(mNativePointer)); return YogaDirection.fromInt(YogaNative.jni_YGNodeStyleGetDirection(mNativePointer));
} }
private static native void jni_YGNodeStyleSetDirection(long nativePointer, int direction);
public void setDirection(YogaDirection direction) { public void setDirection(YogaDirection direction) {
jni_YGNodeStyleSetDirection(mNativePointer, direction.intValue()); YogaNative.jni_YGNodeStyleSetDirection(mNativePointer, direction.intValue());
} }
private static native int jni_YGNodeStyleGetFlexDirection(long nativePointer);
public YogaFlexDirection getFlexDirection() { public YogaFlexDirection getFlexDirection() {
return YogaFlexDirection.fromInt(jni_YGNodeStyleGetFlexDirection(mNativePointer)); return YogaFlexDirection.fromInt(YogaNative.jni_YGNodeStyleGetFlexDirection(mNativePointer));
} }
private static native void jni_YGNodeStyleSetFlexDirection(long nativePointer, int flexDirection);
public void setFlexDirection(YogaFlexDirection flexDirection) { public void setFlexDirection(YogaFlexDirection flexDirection) {
jni_YGNodeStyleSetFlexDirection(mNativePointer, flexDirection.intValue()); YogaNative.jni_YGNodeStyleSetFlexDirection(mNativePointer, flexDirection.intValue());
} }
private static native int jni_YGNodeStyleGetJustifyContent(long nativePointer);
public YogaJustify getJustifyContent() { public YogaJustify getJustifyContent() {
return YogaJustify.fromInt(jni_YGNodeStyleGetJustifyContent(mNativePointer)); return YogaJustify.fromInt(YogaNative.jni_YGNodeStyleGetJustifyContent(mNativePointer));
} }
private static native void jni_YGNodeStyleSetJustifyContent(long nativePointer, int justifyContent);
public void setJustifyContent(YogaJustify justifyContent) { public void setJustifyContent(YogaJustify justifyContent) {
jni_YGNodeStyleSetJustifyContent(mNativePointer, justifyContent.intValue()); YogaNative.jni_YGNodeStyleSetJustifyContent(mNativePointer, justifyContent.intValue());
} }
private static native int jni_YGNodeStyleGetAlignItems(long nativePointer);
public YogaAlign getAlignItems() { public YogaAlign getAlignItems() {
return YogaAlign.fromInt(jni_YGNodeStyleGetAlignItems(mNativePointer)); return YogaAlign.fromInt(YogaNative.jni_YGNodeStyleGetAlignItems(mNativePointer));
} }
private static native void jni_YGNodeStyleSetAlignItems(long nativePointer, int alignItems);
public void setAlignItems(YogaAlign alignItems) { public void setAlignItems(YogaAlign alignItems) {
jni_YGNodeStyleSetAlignItems(mNativePointer, alignItems.intValue()); YogaNative.jni_YGNodeStyleSetAlignItems(mNativePointer, alignItems.intValue());
} }
private static native int jni_YGNodeStyleGetAlignSelf(long nativePointer);
public YogaAlign getAlignSelf() { public YogaAlign getAlignSelf() {
return YogaAlign.fromInt(jni_YGNodeStyleGetAlignSelf(mNativePointer)); return YogaAlign.fromInt(YogaNative.jni_YGNodeStyleGetAlignSelf(mNativePointer));
} }
private static native void jni_YGNodeStyleSetAlignSelf(long nativePointer, int alignSelf);
public void setAlignSelf(YogaAlign alignSelf) { public void setAlignSelf(YogaAlign alignSelf) {
jni_YGNodeStyleSetAlignSelf(mNativePointer, alignSelf.intValue()); YogaNative.jni_YGNodeStyleSetAlignSelf(mNativePointer, alignSelf.intValue());
} }
private static native int jni_YGNodeStyleGetAlignContent(long nativePointer);
public YogaAlign getAlignContent() { public YogaAlign getAlignContent() {
return YogaAlign.fromInt(jni_YGNodeStyleGetAlignContent(mNativePointer)); return YogaAlign.fromInt(YogaNative.jni_YGNodeStyleGetAlignContent(mNativePointer));
} }
private static native void jni_YGNodeStyleSetAlignContent(long nativePointer, int alignContent);
public void setAlignContent(YogaAlign alignContent) { public void setAlignContent(YogaAlign alignContent) {
jni_YGNodeStyleSetAlignContent(mNativePointer, alignContent.intValue()); YogaNative.jni_YGNodeStyleSetAlignContent(mNativePointer, alignContent.intValue());
} }
private static native int jni_YGNodeStyleGetPositionType(long nativePointer);
public YogaPositionType getPositionType() { public YogaPositionType getPositionType() {
return YogaPositionType.fromInt(jni_YGNodeStyleGetPositionType(mNativePointer)); return YogaPositionType.fromInt(YogaNative.jni_YGNodeStyleGetPositionType(mNativePointer));
} }
private static native void jni_YGNodeStyleSetPositionType(long nativePointer, int positionType);
public void setPositionType(YogaPositionType positionType) { public void setPositionType(YogaPositionType positionType) {
jni_YGNodeStyleSetPositionType(mNativePointer, positionType.intValue()); YogaNative.jni_YGNodeStyleSetPositionType(mNativePointer, positionType.intValue());
} }
private static native int jni_YGNodeStyleGetFlexWrap(long nativePointer);
public YogaWrap getWrap() { public YogaWrap getWrap() {
return YogaWrap.fromInt(jni_YGNodeStyleGetFlexWrap(mNativePointer)); return YogaWrap.fromInt(YogaNative.jni_YGNodeStyleGetFlexWrap(mNativePointer));
} }
private static native void jni_YGNodeStyleSetFlexWrap(long nativePointer, int wrapType);
public void setWrap(YogaWrap flexWrap) { public void setWrap(YogaWrap flexWrap) {
jni_YGNodeStyleSetFlexWrap(mNativePointer, flexWrap.intValue()); YogaNative.jni_YGNodeStyleSetFlexWrap(mNativePointer, flexWrap.intValue());
} }
private static native int jni_YGNodeStyleGetOverflow(long nativePointer);
public YogaOverflow getOverflow() { public YogaOverflow getOverflow() {
return YogaOverflow.fromInt(jni_YGNodeStyleGetOverflow(mNativePointer)); return YogaOverflow.fromInt(YogaNative.jni_YGNodeStyleGetOverflow(mNativePointer));
} }
private static native void jni_YGNodeStyleSetOverflow(long nativePointer, int overflow);
public void setOverflow(YogaOverflow overflow) { public void setOverflow(YogaOverflow overflow) {
jni_YGNodeStyleSetOverflow(mNativePointer, overflow.intValue()); YogaNative.jni_YGNodeStyleSetOverflow(mNativePointer, overflow.intValue());
} }
private static native int jni_YGNodeStyleGetDisplay(long nativePointer);
public YogaDisplay getDisplay() { public YogaDisplay getDisplay() {
return YogaDisplay.fromInt(jni_YGNodeStyleGetDisplay(mNativePointer)); return YogaDisplay.fromInt(YogaNative.jni_YGNodeStyleGetDisplay(mNativePointer));
} }
private static native void jni_YGNodeStyleSetDisplay(long nativePointer, int display);
public void setDisplay(YogaDisplay display) { public void setDisplay(YogaDisplay display) {
jni_YGNodeStyleSetDisplay(mNativePointer, display.intValue()); YogaNative.jni_YGNodeStyleSetDisplay(mNativePointer, display.intValue());
} }
private static native float jni_YGNodeStyleGetFlex(long nativePointer);
public float getFlex() { public float getFlex() {
return jni_YGNodeStyleGetFlex(mNativePointer); return YogaNative.jni_YGNodeStyleGetFlex(mNativePointer);
} }
private static native void jni_YGNodeStyleSetFlex(long nativePointer, float flex);
public void setFlex(float flex) { public void setFlex(float flex) {
jni_YGNodeStyleSetFlex(mNativePointer, flex); YogaNative.jni_YGNodeStyleSetFlex(mNativePointer, flex);
} }
private static native float jni_YGNodeStyleGetFlexGrow(long nativePointer);
public float getFlexGrow() { public float getFlexGrow() {
return jni_YGNodeStyleGetFlexGrow(mNativePointer); return YogaNative.jni_YGNodeStyleGetFlexGrow(mNativePointer);
} }
private static native void jni_YGNodeStyleSetFlexGrow(long nativePointer, float flexGrow);
public void setFlexGrow(float flexGrow) { public void setFlexGrow(float flexGrow) {
jni_YGNodeStyleSetFlexGrow(mNativePointer, flexGrow); YogaNative.jni_YGNodeStyleSetFlexGrow(mNativePointer, flexGrow);
} }
private static native float jni_YGNodeStyleGetFlexShrink(long nativePointer);
public float getFlexShrink() { public float getFlexShrink() {
return jni_YGNodeStyleGetFlexShrink(mNativePointer); return YogaNative.jni_YGNodeStyleGetFlexShrink(mNativePointer);
} }
private static native void jni_YGNodeStyleSetFlexShrink(long nativePointer, float flexShrink);
public void setFlexShrink(float flexShrink) { public void setFlexShrink(float flexShrink) {
jni_YGNodeStyleSetFlexShrink(mNativePointer, flexShrink); YogaNative.jni_YGNodeStyleSetFlexShrink(mNativePointer, flexShrink);
} }
private static native Object jni_YGNodeStyleGetFlexBasis(long nativePointer);
public YogaValue getFlexBasis() { public YogaValue getFlexBasis() {
return (YogaValue) jni_YGNodeStyleGetFlexBasis(mNativePointer); return (YogaValue) YogaNative.jni_YGNodeStyleGetFlexBasis(mNativePointer);
} }
private static native void jni_YGNodeStyleSetFlexBasis(long nativePointer, float flexBasis);
public void setFlexBasis(float flexBasis) { public void setFlexBasis(float flexBasis) {
jni_YGNodeStyleSetFlexBasis(mNativePointer, flexBasis); YogaNative.jni_YGNodeStyleSetFlexBasis(mNativePointer, flexBasis);
} }
private static native void jni_YGNodeStyleSetFlexBasisPercent(long nativePointer, float percent);
public void setFlexBasisPercent(float percent) { public void setFlexBasisPercent(float percent) {
jni_YGNodeStyleSetFlexBasisPercent(mNativePointer, percent); YogaNative.jni_YGNodeStyleSetFlexBasisPercent(mNativePointer, percent);
} }
private static native void jni_YGNodeStyleSetFlexBasisAuto(long nativePointer);
public void setFlexBasisAuto() { public void setFlexBasisAuto() {
jni_YGNodeStyleSetFlexBasisAuto(mNativePointer); YogaNative.jni_YGNodeStyleSetFlexBasisAuto(mNativePointer);
} }
private static native Object jni_YGNodeStyleGetMargin(long nativePointer, int edge);
public YogaValue getMargin(YogaEdge edge) { public YogaValue getMargin(YogaEdge edge) {
return (YogaValue) jni_YGNodeStyleGetMargin(mNativePointer, edge.intValue()); return (YogaValue) YogaNative.jni_YGNodeStyleGetMargin(mNativePointer, edge.intValue());
} }
private static native void jni_YGNodeStyleSetMargin(long nativePointer, int edge, float margin);
public void setMargin(YogaEdge edge, float margin) { public void setMargin(YogaEdge edge, float margin) {
jni_YGNodeStyleSetMargin(mNativePointer, edge.intValue(), margin); YogaNative.jni_YGNodeStyleSetMargin(mNativePointer, edge.intValue(), margin);
} }
private static native void jni_YGNodeStyleSetMarginPercent(long nativePointer, int edge, float percent);
public void setMarginPercent(YogaEdge edge, float percent) { public void setMarginPercent(YogaEdge edge, float percent) {
jni_YGNodeStyleSetMarginPercent(mNativePointer, edge.intValue(), percent); YogaNative.jni_YGNodeStyleSetMarginPercent(mNativePointer, edge.intValue(), percent);
} }
private static native void jni_YGNodeStyleSetMarginAuto(long nativePointer, int edge);
public void setMarginAuto(YogaEdge edge) { public void setMarginAuto(YogaEdge edge) {
jni_YGNodeStyleSetMarginAuto(mNativePointer, edge.intValue()); YogaNative.jni_YGNodeStyleSetMarginAuto(mNativePointer, edge.intValue());
} }
private static native Object jni_YGNodeStyleGetPadding(long nativePointer, int edge);
public YogaValue getPadding(YogaEdge edge) { public YogaValue getPadding(YogaEdge edge) {
return (YogaValue) jni_YGNodeStyleGetPadding(mNativePointer, edge.intValue()); return (YogaValue) YogaNative.jni_YGNodeStyleGetPadding(mNativePointer, edge.intValue());
} }
private static native void jni_YGNodeStyleSetPadding(long nativePointer, int edge, float padding);
public void setPadding(YogaEdge edge, float padding) { public void setPadding(YogaEdge edge, float padding) {
jni_YGNodeStyleSetPadding(mNativePointer, edge.intValue(), padding); YogaNative.jni_YGNodeStyleSetPadding(mNativePointer, edge.intValue(), padding);
} }
private static native void jni_YGNodeStyleSetPaddingPercent(long nativePointer, int edge, float percent);
public void setPaddingPercent(YogaEdge edge, float percent) { public void setPaddingPercent(YogaEdge edge, float percent) {
jni_YGNodeStyleSetPaddingPercent(mNativePointer, edge.intValue(), percent); YogaNative.jni_YGNodeStyleSetPaddingPercent(mNativePointer, edge.intValue(), percent);
} }
private static native float jni_YGNodeStyleGetBorder(long nativePointer, int edge);
public float getBorder(YogaEdge edge) { public float getBorder(YogaEdge edge) {
return jni_YGNodeStyleGetBorder(mNativePointer, edge.intValue()); return YogaNative.jni_YGNodeStyleGetBorder(mNativePointer, edge.intValue());
} }
private static native void jni_YGNodeStyleSetBorder(long nativePointer, int edge, float border);
public void setBorder(YogaEdge edge, float border) { public void setBorder(YogaEdge edge, float border) {
jni_YGNodeStyleSetBorder(mNativePointer, edge.intValue(), border); YogaNative.jni_YGNodeStyleSetBorder(mNativePointer, edge.intValue(), border);
} }
private static native Object jni_YGNodeStyleGetPosition(long nativePointer, int edge);
public YogaValue getPosition(YogaEdge edge) { public YogaValue getPosition(YogaEdge edge) {
return (YogaValue) jni_YGNodeStyleGetPosition(mNativePointer, edge.intValue()); return (YogaValue) YogaNative.jni_YGNodeStyleGetPosition(mNativePointer, edge.intValue());
} }
private static native void jni_YGNodeStyleSetPosition(long nativePointer, int edge, float position);
public void setPosition(YogaEdge edge, float position) { public void setPosition(YogaEdge edge, float position) {
jni_YGNodeStyleSetPosition(mNativePointer, edge.intValue(), position); YogaNative.jni_YGNodeStyleSetPosition(mNativePointer, edge.intValue(), position);
} }
private static native void jni_YGNodeStyleSetPositionPercent(long nativePointer, int edge, float percent);
public void setPositionPercent(YogaEdge edge, float percent) { public void setPositionPercent(YogaEdge edge, float percent) {
jni_YGNodeStyleSetPositionPercent(mNativePointer, edge.intValue(), percent); YogaNative.jni_YGNodeStyleSetPositionPercent(mNativePointer, edge.intValue(), percent);
} }
private static native Object jni_YGNodeStyleGetWidth(long nativePointer);
public YogaValue getWidth() { public YogaValue getWidth() {
return (YogaValue) jni_YGNodeStyleGetWidth(mNativePointer); return (YogaValue) YogaNative.jni_YGNodeStyleGetWidth(mNativePointer);
} }
private static native void jni_YGNodeStyleSetWidth(long nativePointer, float width);
public void setWidth(float width) { public void setWidth(float width) {
jni_YGNodeStyleSetWidth(mNativePointer, width); YogaNative.jni_YGNodeStyleSetWidth(mNativePointer, width);
} }
private static native void jni_YGNodeStyleSetWidthPercent(long nativePointer, float percent);
public void setWidthPercent(float percent) { public void setWidthPercent(float percent) {
jni_YGNodeStyleSetWidthPercent(mNativePointer, percent); YogaNative.jni_YGNodeStyleSetWidthPercent(mNativePointer, percent);
} }
private static native void jni_YGNodeStyleSetWidthAuto(long nativePointer);
public void setWidthAuto() { public void setWidthAuto() {
jni_YGNodeStyleSetWidthAuto(mNativePointer); YogaNative.jni_YGNodeStyleSetWidthAuto(mNativePointer);
} }
private static native Object jni_YGNodeStyleGetHeight(long nativePointer);
public YogaValue getHeight() { public YogaValue getHeight() {
return (YogaValue) jni_YGNodeStyleGetHeight(mNativePointer); return (YogaValue) YogaNative.jni_YGNodeStyleGetHeight(mNativePointer);
} }
private static native void jni_YGNodeStyleSetHeight(long nativePointer, float height);
public void setHeight(float height) { public void setHeight(float height) {
jni_YGNodeStyleSetHeight(mNativePointer, height); YogaNative.jni_YGNodeStyleSetHeight(mNativePointer, height);
} }
private static native void jni_YGNodeStyleSetHeightPercent(long nativePointer, float percent);
public void setHeightPercent(float percent) { public void setHeightPercent(float percent) {
jni_YGNodeStyleSetHeightPercent(mNativePointer, percent); YogaNative.jni_YGNodeStyleSetHeightPercent(mNativePointer, percent);
} }
private static native void jni_YGNodeStyleSetHeightAuto(long nativePointer);
public void setHeightAuto() { public void setHeightAuto() {
jni_YGNodeStyleSetHeightAuto(mNativePointer); YogaNative.jni_YGNodeStyleSetHeightAuto(mNativePointer);
} }
private static native Object jni_YGNodeStyleGetMinWidth(long nativePointer);
public YogaValue getMinWidth() { public YogaValue getMinWidth() {
return (YogaValue) jni_YGNodeStyleGetMinWidth(mNativePointer); return (YogaValue) YogaNative.jni_YGNodeStyleGetMinWidth(mNativePointer);
} }
private static native void jni_YGNodeStyleSetMinWidth(long nativePointer, float minWidth);
public void setMinWidth(float minWidth) { public void setMinWidth(float minWidth) {
jni_YGNodeStyleSetMinWidth(mNativePointer, minWidth); YogaNative.jni_YGNodeStyleSetMinWidth(mNativePointer, minWidth);
} }
private static native void jni_YGNodeStyleSetMinWidthPercent(long nativePointer, float percent);
public void setMinWidthPercent(float percent) { public void setMinWidthPercent(float percent) {
jni_YGNodeStyleSetMinWidthPercent(mNativePointer, percent); YogaNative.jni_YGNodeStyleSetMinWidthPercent(mNativePointer, percent);
} }
private static native Object jni_YGNodeStyleGetMinHeight(long nativePointer);
public YogaValue getMinHeight() { public YogaValue getMinHeight() {
return (YogaValue) jni_YGNodeStyleGetMinHeight(mNativePointer); return (YogaValue) YogaNative.jni_YGNodeStyleGetMinHeight(mNativePointer);
} }
private static native void jni_YGNodeStyleSetMinHeight(long nativePointer, float minHeight);
public void setMinHeight(float minHeight) { public void setMinHeight(float minHeight) {
jni_YGNodeStyleSetMinHeight(mNativePointer, minHeight); YogaNative.jni_YGNodeStyleSetMinHeight(mNativePointer, minHeight);
} }
private static native void jni_YGNodeStyleSetMinHeightPercent(long nativePointer, float percent);
public void setMinHeightPercent(float percent) { public void setMinHeightPercent(float percent) {
jni_YGNodeStyleSetMinHeightPercent(mNativePointer, percent); YogaNative.jni_YGNodeStyleSetMinHeightPercent(mNativePointer, percent);
} }
private static native Object jni_YGNodeStyleGetMaxWidth(long nativePointer);
public YogaValue getMaxWidth() { public YogaValue getMaxWidth() {
return (YogaValue) jni_YGNodeStyleGetMaxWidth(mNativePointer); return (YogaValue) YogaNative.jni_YGNodeStyleGetMaxWidth(mNativePointer);
} }
private static native void jni_YGNodeStyleSetMaxWidth(long nativePointer, float maxWidth);
public void setMaxWidth(float maxWidth) { public void setMaxWidth(float maxWidth) {
jni_YGNodeStyleSetMaxWidth(mNativePointer, maxWidth); YogaNative.jni_YGNodeStyleSetMaxWidth(mNativePointer, maxWidth);
} }
private static native void jni_YGNodeStyleSetMaxWidthPercent(long nativePointer, float percent);
public void setMaxWidthPercent(float percent) { public void setMaxWidthPercent(float percent) {
jni_YGNodeStyleSetMaxWidthPercent(mNativePointer, percent); YogaNative.jni_YGNodeStyleSetMaxWidthPercent(mNativePointer, percent);
} }
private static native Object jni_YGNodeStyleGetMaxHeight(long nativePointer);
public YogaValue getMaxHeight() { public YogaValue getMaxHeight() {
return (YogaValue) jni_YGNodeStyleGetMaxHeight(mNativePointer); return (YogaValue) YogaNative.jni_YGNodeStyleGetMaxHeight(mNativePointer);
} }
private static native void jni_YGNodeStyleSetMaxHeight(long nativePointer, float maxheight);
public void setMaxHeight(float maxheight) { public void setMaxHeight(float maxheight) {
jni_YGNodeStyleSetMaxHeight(mNativePointer, maxheight); YogaNative.jni_YGNodeStyleSetMaxHeight(mNativePointer, maxheight);
} }
private static native void jni_YGNodeStyleSetMaxHeightPercent(long nativePointer, float percent);
public void setMaxHeightPercent(float percent) { public void setMaxHeightPercent(float percent) {
jni_YGNodeStyleSetMaxHeightPercent(mNativePointer, percent); YogaNative.jni_YGNodeStyleSetMaxHeightPercent(mNativePointer, percent);
} }
private static native float jni_YGNodeStyleGetAspectRatio(long nativePointer);
public float getAspectRatio() { public float getAspectRatio() {
return jni_YGNodeStyleGetAspectRatio(mNativePointer); return YogaNative.jni_YGNodeStyleGetAspectRatio(mNativePointer);
} }
private static native void jni_YGNodeStyleSetAspectRatio(long nativePointer, float aspectRatio);
public void setAspectRatio(float aspectRatio) { public void setAspectRatio(float aspectRatio) {
jni_YGNodeStyleSetAspectRatio(mNativePointer, aspectRatio); YogaNative.jni_YGNodeStyleSetAspectRatio(mNativePointer, aspectRatio);
} }
public float getLayoutX() { public float getLayoutX() {
@@ -676,10 +581,9 @@ public abstract class YogaNodeJNIBase extends YogaNode {
return YogaDirection.fromInt(mLayoutDirection); return YogaDirection.fromInt(mLayoutDirection);
} }
private static native void jni_YGNodeSetHasMeasureFunc(long nativePointer, boolean hasMeasureFunc);
public void setMeasureFunction(YogaMeasureFunction measureFunction) { public void setMeasureFunction(YogaMeasureFunction measureFunction) {
mMeasureFunction = measureFunction; mMeasureFunction = measureFunction;
jni_YGNodeSetHasMeasureFunc(mNativePointer, measureFunction != null); YogaNative.jni_YGNodeSetHasMeasureFunc(mNativePointer, measureFunction != null);
} }
// Implementation Note: Why this method needs to stay final // Implementation Note: Why this method needs to stay final
@@ -701,10 +605,9 @@ public abstract class YogaNodeJNIBase extends YogaNode {
YogaMeasureMode.fromInt(heightMode)); YogaMeasureMode.fromInt(heightMode));
} }
private static native void jni_YGNodeSetHasBaselineFunc(long nativePointer, boolean hasMeasureFunc);
public void setBaselineFunction(YogaBaselineFunction baselineFunction) { public void setBaselineFunction(YogaBaselineFunction baselineFunction) {
mBaselineFunction = baselineFunction; mBaselineFunction = baselineFunction;
jni_YGNodeSetHasBaselineFunc(mNativePointer, baselineFunction != null); YogaNative.jni_YGNodeSetHasBaselineFunc(mNativePointer, baselineFunction != null);
} }
@DoNotStrip @DoNotStrip
@@ -724,20 +627,16 @@ public abstract class YogaNodeJNIBase extends YogaNode {
return mData; return mData;
} }
private static native void jni_YGNodePrint(long nativePointer);
/** /**
* Use the set logger (defaults to adb log) to print out the styles, children, and computed * Use the set logger (defaults to adb log) to print out the styles, children, and computed
* layout of the tree rooted at this node. * layout of the tree rooted at this node.
*/ */
public void print() { public void print() {
jni_YGNodePrint(mNativePointer); YogaNative.jni_YGNodePrint(mNativePointer);
} }
private static native void jni_YGNodeSetStyleInputs(long nativePointer, float[] styleInputsArray, int size);
public void setStyleInputs(float[] styleInputsArray, int size) { public void setStyleInputs(float[] styleInputsArray, int size) {
jni_YGNodeSetStyleInputs(mNativePointer, styleInputsArray, size); YogaNative.jni_YGNodeSetStyleInputs(mNativePointer, styleInputsArray, size);
} }
/** /**

View File

@@ -340,14 +340,14 @@ static int YGJNILogFunc(
return result; return result;
} }
jlong jni_YGNodeNew(alias_ref<jobject>) { jlong jni_YGNodeNew(alias_ref<jclass>) {
const YGNodeRef node = YGNodeNew(); const YGNodeRef node = YGNodeNew();
node->setContext(YGNodeContext{}.asVoidPtr); node->setContext(YGNodeContext{}.asVoidPtr);
node->setPrintFunc(YGPrint); node->setPrintFunc(YGPrint);
return reinterpret_cast<jlong>(node); return reinterpret_cast<jlong>(node);
} }
jlong jni_YGNodeNewWithConfig(alias_ref<jobject>, jlong configPointer) { jlong jni_YGNodeNewWithConfig(alias_ref<jclass>, jlong configPointer) {
const YGNodeRef node = YGNodeNewWithConfig(_jlong2YGConfigRef(configPointer)); const YGNodeRef node = YGNodeNewWithConfig(_jlong2YGConfigRef(configPointer));
node->setContext(YGNodeContext{}.asVoidPtr); node->setContext(YGNodeContext{}.asVoidPtr);
return reinterpret_cast<jlong>(node); return reinterpret_cast<jlong>(node);
@@ -473,7 +473,7 @@ void jni_YGNodeCopyStyle(jlong dstNativePointer, jlong srcNativePointer) {
#define YG_NODE_JNI_STYLE_UNIT_PROP(name) \ #define YG_NODE_JNI_STYLE_UNIT_PROP(name) \
local_ref<jobject> jni_YGNodeStyleGet##name( \ local_ref<jobject> jni_YGNodeStyleGet##name( \
alias_ref<jobject>, jlong nativePointer) { \ alias_ref<jclass>, jlong nativePointer) { \
return JYogaValue::create( \ return JYogaValue::create( \
YGNodeStyleGet##name(_jlong2YGNodeRef(nativePointer))); \ YGNodeStyleGet##name(_jlong2YGNodeRef(nativePointer))); \
} \ } \
@@ -510,7 +510,7 @@ void jni_YGNodeCopyStyle(jlong dstNativePointer, jlong srcNativePointer) {
#define YG_NODE_JNI_STYLE_EDGE_UNIT_PROP(name) \ #define YG_NODE_JNI_STYLE_EDGE_UNIT_PROP(name) \
local_ref<jobject> jni_YGNodeStyleGet##name( \ local_ref<jobject> jni_YGNodeStyleGet##name( \
alias_ref<jobject>, jlong nativePointer, jint edge) { \ alias_ref<jclass>, jlong nativePointer, jint edge) { \
return JYogaValue::create(YGNodeStyleGet##name( \ return JYogaValue::create(YGNodeStyleGet##name( \
_jlong2YGNodeRef(nativePointer), static_cast<YGEdge>(edge))); \ _jlong2YGNodeRef(nativePointer), static_cast<YGEdge>(edge))); \
} \ } \
@@ -572,11 +572,11 @@ YG_NODE_JNI_STYLE_UNIT_PROP(MaxHeight);
// Yoga specific properties, not compatible with flexbox specification // Yoga specific properties, not compatible with flexbox specification
YG_NODE_JNI_STYLE_PROP(jfloat, float, AspectRatio); YG_NODE_JNI_STYLE_PROP(jfloat, float, AspectRatio);
jlong jni_YGConfigNew(alias_ref<jobject>) { jlong jni_YGConfigNew(alias_ref<jclass>) {
return reinterpret_cast<jlong>(YGConfigNew()); return reinterpret_cast<jlong>(YGConfigNew());
} }
void jni_YGConfigFree(alias_ref<jobject>, jlong nativePointer) { void jni_YGConfigFree(alias_ref<jclass>, jlong nativePointer) {
const YGConfigRef config = _jlong2YGConfigRef(nativePointer); const YGConfigRef config = _jlong2YGConfigRef(nativePointer);
// unique_ptr will destruct the underlying global_ref, if present. // unique_ptr will destruct the underlying global_ref, if present.
auto context = std::unique_ptr<global_ref<JYogaLogger>>{ auto context = std::unique_ptr<global_ref<JYogaLogger>>{
@@ -585,7 +585,7 @@ void jni_YGConfigFree(alias_ref<jobject>, jlong nativePointer) {
} }
void jni_YGConfigSetExperimentalFeatureEnabled( void jni_YGConfigSetExperimentalFeatureEnabled(
alias_ref<jobject>, alias_ref<jclass>,
jlong nativePointer, jlong nativePointer,
jint feature, jint feature,
jboolean enabled) { jboolean enabled) {
@@ -595,7 +595,7 @@ void jni_YGConfigSetExperimentalFeatureEnabled(
} }
void jni_YGConfigSetShouldDiffLayoutWithoutLegacyStretchBehaviour( void jni_YGConfigSetShouldDiffLayoutWithoutLegacyStretchBehaviour(
alias_ref<jobject>, alias_ref<jclass>,
jlong nativePointer, jlong nativePointer,
jboolean enabled) { jboolean enabled) {
const YGConfigRef config = _jlong2YGConfigRef(nativePointer); const YGConfigRef config = _jlong2YGConfigRef(nativePointer);
@@ -603,7 +603,7 @@ void jni_YGConfigSetShouldDiffLayoutWithoutLegacyStretchBehaviour(
} }
void jni_YGConfigSetUseWebDefaults( void jni_YGConfigSetUseWebDefaults(
alias_ref<jobject>, alias_ref<jclass>,
jlong nativePointer, jlong nativePointer,
jboolean useWebDefaults) { jboolean useWebDefaults) {
const YGConfigRef config = _jlong2YGConfigRef(nativePointer); const YGConfigRef config = _jlong2YGConfigRef(nativePointer);
@@ -611,7 +611,7 @@ void jni_YGConfigSetUseWebDefaults(
} }
void jni_YGConfigSetPrintTreeFlag( void jni_YGConfigSetPrintTreeFlag(
alias_ref<jobject>, alias_ref<jclass>,
jlong nativePointer, jlong nativePointer,
jboolean enable) { jboolean enable) {
const YGConfigRef config = _jlong2YGConfigRef(nativePointer); const YGConfigRef config = _jlong2YGConfigRef(nativePointer);
@@ -619,7 +619,7 @@ void jni_YGConfigSetPrintTreeFlag(
} }
void jni_YGConfigSetPointScaleFactor( void jni_YGConfigSetPointScaleFactor(
alias_ref<jobject>, alias_ref<jclass>,
jlong nativePointer, jlong nativePointer,
jfloat pixelsInPoint) { jfloat pixelsInPoint) {
const YGConfigRef config = _jlong2YGConfigRef(nativePointer); const YGConfigRef config = _jlong2YGConfigRef(nativePointer);
@@ -627,7 +627,7 @@ void jni_YGConfigSetPointScaleFactor(
} }
void jni_YGConfigSetUseLegacyStretchBehaviour( void jni_YGConfigSetUseLegacyStretchBehaviour(
alias_ref<jobject>, alias_ref<jclass>,
jlong nativePointer, jlong nativePointer,
jboolean useLegacyStretchBehaviour) { jboolean useLegacyStretchBehaviour) {
const YGConfigRef config = _jlong2YGConfigRef(nativePointer); const YGConfigRef config = _jlong2YGConfigRef(nativePointer);
@@ -635,7 +635,7 @@ void jni_YGConfigSetUseLegacyStretchBehaviour(
} }
void jni_YGConfigSetLogger( void jni_YGConfigSetLogger(
alias_ref<jobject>, alias_ref<jclass>,
jlong nativePointer, jlong nativePointer,
alias_ref<jobject> logger) { alias_ref<jobject> logger) {
const YGConfigRef config = _jlong2YGConfigRef(nativePointer); const YGConfigRef config = _jlong2YGConfigRef(nativePointer);
@@ -828,7 +828,7 @@ static void YGNodeSetStyleInputs(
} }
void jni_YGNodeSetStyleInputs( void jni_YGNodeSetStyleInputs(
alias_ref<jobject>, alias_ref<jclass>,
jlong nativePointer, jlong nativePointer,
alias_ref<JArrayFloat> styleInputs, alias_ref<JArrayFloat> styleInputs,
jint size) { jint size) {
@@ -842,7 +842,7 @@ jint jni_YGNodeGetInstanceCount() {
} }
local_ref<jobject> jni_YGNodeStyleGetMargin( local_ref<jobject> jni_YGNodeStyleGetMargin(
alias_ref<jobject>, alias_ref<jclass>,
jlong nativePointer, jlong nativePointer,
jint edge) { jint edge) {
YGNodeRef yogaNodeRef = _jlong2YGNodeRef(nativePointer); YGNodeRef yogaNodeRef = _jlong2YGNodeRef(nativePointer);
@@ -877,7 +877,7 @@ void jni_YGNodeStyleSetMarginAuto(jlong nativePointer, jint edge) {
} }
local_ref<jobject> jni_YGNodeStyleGetPadding( local_ref<jobject> jni_YGNodeStyleGetPadding(
alias_ref<jobject>, alias_ref<jclass>,
jlong nativePointer, jlong nativePointer,
jint edge) { jint edge) {
YGNodeRef yogaNodeRef = _jlong2YGNodeRef(nativePointer); YGNodeRef yogaNodeRef = _jlong2YGNodeRef(nativePointer);
@@ -926,95 +926,93 @@ void jni_YGNodeStyleSetBorder(jlong nativePointer, jint edge, jfloat border) {
jint JNI_OnLoad(JavaVM* vm, void*) { jint JNI_OnLoad(JavaVM* vm, void*) {
return initialize(vm, [] { return initialize(vm, [] {
JYogaNode::javaClassStatic()->registerNatives({
YGMakeNativeMethod(jni_YGNodeNew),
YGMakeNativeMethod(jni_YGNodeNewWithConfig),
YGMakeNativeMethod(jni_YGNodeFree),
YGMakeCriticalNativeMethod(jni_YGNodeReset),
YGMakeCriticalNativeMethod(jni_YGNodeClearChildren),
YGMakeCriticalNativeMethod(jni_YGNodeInsertChild),
YGMakeCriticalNativeMethod(jni_YGNodeRemoveChild),
YGMakeCriticalNativeMethod(jni_YGNodeSetIsReferenceBaseline),
YGMakeCriticalNativeMethod(jni_YGNodeIsReferenceBaseline),
YGMakeNativeMethod(jni_YGNodeCalculateLayout),
YGMakeCriticalNativeMethod(jni_YGNodeMarkDirty),
YGMakeCriticalNativeMethod(
jni_YGNodeMarkDirtyAndPropogateToDescendants),
YGMakeCriticalNativeMethod(jni_YGNodeIsDirty),
YGMakeCriticalNativeMethod(jni_YGNodeSetHasMeasureFunc),
YGMakeCriticalNativeMethod(jni_YGNodeSetHasBaselineFunc),
YGMakeCriticalNativeMethod(jni_YGNodeCopyStyle),
YGMakeCriticalNativeMethod(jni_YGNodeStyleGetDirection),
YGMakeCriticalNativeMethod(jni_YGNodeStyleSetDirection),
YGMakeCriticalNativeMethod(jni_YGNodeStyleGetFlexDirection),
YGMakeCriticalNativeMethod(jni_YGNodeStyleSetFlexDirection),
YGMakeCriticalNativeMethod(jni_YGNodeStyleGetJustifyContent),
YGMakeCriticalNativeMethod(jni_YGNodeStyleSetJustifyContent),
YGMakeCriticalNativeMethod(jni_YGNodeStyleGetAlignItems),
YGMakeCriticalNativeMethod(jni_YGNodeStyleSetAlignItems),
YGMakeCriticalNativeMethod(jni_YGNodeStyleGetAlignSelf),
YGMakeCriticalNativeMethod(jni_YGNodeStyleSetAlignSelf),
YGMakeCriticalNativeMethod(jni_YGNodeStyleGetAlignContent),
YGMakeCriticalNativeMethod(jni_YGNodeStyleSetAlignContent),
YGMakeCriticalNativeMethod(jni_YGNodeStyleGetPositionType),
YGMakeCriticalNativeMethod(jni_YGNodeStyleSetPositionType),
YGMakeCriticalNativeMethod(jni_YGNodeStyleGetFlexWrap),
YGMakeCriticalNativeMethod(jni_YGNodeStyleSetFlexWrap),
YGMakeCriticalNativeMethod(jni_YGNodeStyleGetOverflow),
YGMakeCriticalNativeMethod(jni_YGNodeStyleSetOverflow),
YGMakeCriticalNativeMethod(jni_YGNodeStyleGetDisplay),
YGMakeCriticalNativeMethod(jni_YGNodeStyleSetDisplay),
YGMakeCriticalNativeMethod(jni_YGNodeStyleGetFlex),
YGMakeCriticalNativeMethod(jni_YGNodeStyleSetFlex),
YGMakeCriticalNativeMethod(jni_YGNodeStyleGetFlexGrow),
YGMakeCriticalNativeMethod(jni_YGNodeStyleSetFlexGrow),
YGMakeCriticalNativeMethod(jni_YGNodeStyleGetFlexShrink),
YGMakeCriticalNativeMethod(jni_YGNodeStyleSetFlexShrink),
YGMakeNativeMethod(jni_YGNodeStyleGetFlexBasis),
YGMakeCriticalNativeMethod(jni_YGNodeStyleSetFlexBasis),
YGMakeCriticalNativeMethod(jni_YGNodeStyleSetFlexBasisPercent),
YGMakeCriticalNativeMethod(jni_YGNodeStyleSetFlexBasisAuto),
YGMakeNativeMethod(jni_YGNodeStyleGetMargin),
YGMakeCriticalNativeMethod(jni_YGNodeStyleSetMargin),
YGMakeCriticalNativeMethod(jni_YGNodeStyleSetMarginPercent),
YGMakeCriticalNativeMethod(jni_YGNodeStyleSetMarginAuto),
YGMakeNativeMethod(jni_YGNodeStyleGetPadding),
YGMakeCriticalNativeMethod(jni_YGNodeStyleSetPadding),
YGMakeCriticalNativeMethod(jni_YGNodeStyleSetPaddingPercent),
YGMakeCriticalNativeMethod(jni_YGNodeStyleGetBorder),
YGMakeCriticalNativeMethod(jni_YGNodeStyleSetBorder),
YGMakeNativeMethod(jni_YGNodeStyleGetPosition),
YGMakeCriticalNativeMethod(jni_YGNodeStyleSetPosition),
YGMakeCriticalNativeMethod(jni_YGNodeStyleSetPositionPercent),
YGMakeNativeMethod(jni_YGNodeStyleGetWidth),
YGMakeCriticalNativeMethod(jni_YGNodeStyleSetWidth),
YGMakeCriticalNativeMethod(jni_YGNodeStyleSetWidthPercent),
YGMakeCriticalNativeMethod(jni_YGNodeStyleSetWidthAuto),
YGMakeNativeMethod(jni_YGNodeStyleGetHeight),
YGMakeCriticalNativeMethod(jni_YGNodeStyleSetHeight),
YGMakeCriticalNativeMethod(jni_YGNodeStyleSetHeightPercent),
YGMakeCriticalNativeMethod(jni_YGNodeStyleSetHeightAuto),
YGMakeNativeMethod(jni_YGNodeStyleGetMinWidth),
YGMakeCriticalNativeMethod(jni_YGNodeStyleSetMinWidth),
YGMakeCriticalNativeMethod(jni_YGNodeStyleSetMinWidthPercent),
YGMakeNativeMethod(jni_YGNodeStyleGetMinHeight),
YGMakeCriticalNativeMethod(jni_YGNodeStyleSetMinHeight),
YGMakeCriticalNativeMethod(jni_YGNodeStyleSetMinHeightPercent),
YGMakeNativeMethod(jni_YGNodeStyleGetMaxWidth),
YGMakeCriticalNativeMethod(jni_YGNodeStyleSetMaxWidth),
YGMakeCriticalNativeMethod(jni_YGNodeStyleSetMaxWidthPercent),
YGMakeNativeMethod(jni_YGNodeStyleGetMaxHeight),
YGMakeCriticalNativeMethod(jni_YGNodeStyleSetMaxHeight),
YGMakeCriticalNativeMethod(jni_YGNodeStyleSetMaxHeightPercent),
YGMakeCriticalNativeMethod(jni_YGNodeStyleGetAspectRatio),
YGMakeCriticalNativeMethod(jni_YGNodeStyleSetAspectRatio),
YGMakeCriticalNativeMethod(jni_YGNodeGetInstanceCount),
YGMakeCriticalNativeMethod(jni_YGNodePrint),
YGMakeNativeMethod(jni_YGNodeSetStyleInputs),
});
registerNatives( registerNatives(
"com/facebook/yoga/YogaConfig", "com/facebook/yoga/YogaNative",
{ {
YGMakeNativeMethod(jni_YGNodeNew),
YGMakeNativeMethod(jni_YGNodeNewWithConfig),
YGMakeNativeMethod(jni_YGNodeFree),
YGMakeCriticalNativeMethod(jni_YGNodeReset),
YGMakeCriticalNativeMethod(jni_YGNodeClearChildren),
YGMakeCriticalNativeMethod(jni_YGNodeInsertChild),
YGMakeCriticalNativeMethod(jni_YGNodeRemoveChild),
YGMakeCriticalNativeMethod(jni_YGNodeSetIsReferenceBaseline),
YGMakeCriticalNativeMethod(jni_YGNodeIsReferenceBaseline),
YGMakeNativeMethod(jni_YGNodeCalculateLayout),
YGMakeCriticalNativeMethod(jni_YGNodeMarkDirty),
YGMakeCriticalNativeMethod(
jni_YGNodeMarkDirtyAndPropogateToDescendants),
YGMakeCriticalNativeMethod(jni_YGNodeIsDirty),
YGMakeCriticalNativeMethod(jni_YGNodeSetHasMeasureFunc),
YGMakeCriticalNativeMethod(jni_YGNodeSetHasBaselineFunc),
YGMakeCriticalNativeMethod(jni_YGNodeCopyStyle),
YGMakeCriticalNativeMethod(jni_YGNodeStyleGetDirection),
YGMakeCriticalNativeMethod(jni_YGNodeStyleSetDirection),
YGMakeCriticalNativeMethod(jni_YGNodeStyleGetFlexDirection),
YGMakeCriticalNativeMethod(jni_YGNodeStyleSetFlexDirection),
YGMakeCriticalNativeMethod(jni_YGNodeStyleGetJustifyContent),
YGMakeCriticalNativeMethod(jni_YGNodeStyleSetJustifyContent),
YGMakeCriticalNativeMethod(jni_YGNodeStyleGetAlignItems),
YGMakeCriticalNativeMethod(jni_YGNodeStyleSetAlignItems),
YGMakeCriticalNativeMethod(jni_YGNodeStyleGetAlignSelf),
YGMakeCriticalNativeMethod(jni_YGNodeStyleSetAlignSelf),
YGMakeCriticalNativeMethod(jni_YGNodeStyleGetAlignContent),
YGMakeCriticalNativeMethod(jni_YGNodeStyleSetAlignContent),
YGMakeCriticalNativeMethod(jni_YGNodeStyleGetPositionType),
YGMakeCriticalNativeMethod(jni_YGNodeStyleSetPositionType),
YGMakeCriticalNativeMethod(jni_YGNodeStyleGetFlexWrap),
YGMakeCriticalNativeMethod(jni_YGNodeStyleSetFlexWrap),
YGMakeCriticalNativeMethod(jni_YGNodeStyleGetOverflow),
YGMakeCriticalNativeMethod(jni_YGNodeStyleSetOverflow),
YGMakeCriticalNativeMethod(jni_YGNodeStyleGetDisplay),
YGMakeCriticalNativeMethod(jni_YGNodeStyleSetDisplay),
YGMakeCriticalNativeMethod(jni_YGNodeStyleGetFlex),
YGMakeCriticalNativeMethod(jni_YGNodeStyleSetFlex),
YGMakeCriticalNativeMethod(jni_YGNodeStyleGetFlexGrow),
YGMakeCriticalNativeMethod(jni_YGNodeStyleSetFlexGrow),
YGMakeCriticalNativeMethod(jni_YGNodeStyleGetFlexShrink),
YGMakeCriticalNativeMethod(jni_YGNodeStyleSetFlexShrink),
YGMakeNativeMethod(jni_YGNodeStyleGetFlexBasis),
YGMakeCriticalNativeMethod(jni_YGNodeStyleSetFlexBasis),
YGMakeCriticalNativeMethod(jni_YGNodeStyleSetFlexBasisPercent),
YGMakeCriticalNativeMethod(jni_YGNodeStyleSetFlexBasisAuto),
YGMakeNativeMethod(jni_YGNodeStyleGetMargin),
YGMakeCriticalNativeMethod(jni_YGNodeStyleSetMargin),
YGMakeCriticalNativeMethod(jni_YGNodeStyleSetMarginPercent),
YGMakeCriticalNativeMethod(jni_YGNodeStyleSetMarginAuto),
YGMakeNativeMethod(jni_YGNodeStyleGetPadding),
YGMakeCriticalNativeMethod(jni_YGNodeStyleSetPadding),
YGMakeCriticalNativeMethod(jni_YGNodeStyleSetPaddingPercent),
YGMakeCriticalNativeMethod(jni_YGNodeStyleGetBorder),
YGMakeCriticalNativeMethod(jni_YGNodeStyleSetBorder),
YGMakeNativeMethod(jni_YGNodeStyleGetPosition),
YGMakeCriticalNativeMethod(jni_YGNodeStyleSetPosition),
YGMakeCriticalNativeMethod(jni_YGNodeStyleSetPositionPercent),
YGMakeNativeMethod(jni_YGNodeStyleGetWidth),
YGMakeCriticalNativeMethod(jni_YGNodeStyleSetWidth),
YGMakeCriticalNativeMethod(jni_YGNodeStyleSetWidthPercent),
YGMakeCriticalNativeMethod(jni_YGNodeStyleSetWidthAuto),
YGMakeNativeMethod(jni_YGNodeStyleGetHeight),
YGMakeCriticalNativeMethod(jni_YGNodeStyleSetHeight),
YGMakeCriticalNativeMethod(jni_YGNodeStyleSetHeightPercent),
YGMakeCriticalNativeMethod(jni_YGNodeStyleSetHeightAuto),
YGMakeNativeMethod(jni_YGNodeStyleGetMinWidth),
YGMakeCriticalNativeMethod(jni_YGNodeStyleSetMinWidth),
YGMakeCriticalNativeMethod(jni_YGNodeStyleSetMinWidthPercent),
YGMakeNativeMethod(jni_YGNodeStyleGetMinHeight),
YGMakeCriticalNativeMethod(jni_YGNodeStyleSetMinHeight),
YGMakeCriticalNativeMethod(jni_YGNodeStyleSetMinHeightPercent),
YGMakeNativeMethod(jni_YGNodeStyleGetMaxWidth),
YGMakeCriticalNativeMethod(jni_YGNodeStyleSetMaxWidth),
YGMakeCriticalNativeMethod(jni_YGNodeStyleSetMaxWidthPercent),
YGMakeNativeMethod(jni_YGNodeStyleGetMaxHeight),
YGMakeCriticalNativeMethod(jni_YGNodeStyleSetMaxHeight),
YGMakeCriticalNativeMethod(jni_YGNodeStyleSetMaxHeightPercent),
YGMakeCriticalNativeMethod(jni_YGNodeStyleGetAspectRatio),
YGMakeCriticalNativeMethod(jni_YGNodeStyleSetAspectRatio),
YGMakeCriticalNativeMethod(jni_YGNodeGetInstanceCount),
YGMakeCriticalNativeMethod(jni_YGNodePrint),
YGMakeNativeMethod(jni_YGNodeSetStyleInputs),
YGMakeNativeMethod(jni_YGConfigNew), YGMakeNativeMethod(jni_YGConfigNew),
YGMakeNativeMethod(jni_YGConfigFree), YGMakeNativeMethod(jni_YGConfigFree),
YGMakeNativeMethod(jni_YGConfigSetExperimentalFeatureEnabled), YGMakeNativeMethod(jni_YGConfigSetExperimentalFeatureEnabled),

View File

@@ -14,10 +14,6 @@ struct JYogaNode : public facebook::jni::JavaClass<JYogaNode> {
jlong measure(jfloat width, jint widthMode, jfloat height, jint heightMode); jlong measure(jfloat width, jint widthMode, jfloat height, jint heightMode);
}; };
struct JYogaConfig : public facebook::jni::JavaClass<JYogaConfig> {
static constexpr auto kJavaDescriptor = "Lcom/facebook/yoga/YogaConfig;";
};
struct JYogaLogLevel : public facebook::jni::JavaClass<JYogaLogLevel> { struct JYogaLogLevel : public facebook::jni::JavaClass<JYogaLogLevel> {
static constexpr auto kJavaDescriptor = "Lcom/facebook/yoga/YogaLogLevel;"; static constexpr auto kJavaDescriptor = "Lcom/facebook/yoga/YogaLogLevel;";

View File

@@ -30,9 +30,9 @@ public class YogaNodeTest {
@Test @Test
public void testInit() { public void testInit() {
final int refCount = YogaNodeJNIBase.jni_YGNodeGetInstanceCount(); final int refCount = YogaNative.jni_YGNodeGetInstanceCount();
final YogaNode node = createNode(); final YogaNode node = createNode();
assertEquals(refCount + 1, YogaNodeJNIBase.jni_YGNodeGetInstanceCount()); assertEquals(refCount + 1, YogaNative.jni_YGNodeGetInstanceCount());
} }
@Test @Test