diff --git a/ReactAndroid/src/main/java/com/facebook/yoga/YogaNode.java b/ReactAndroid/src/main/java/com/facebook/yoga/YogaNode.java index e266701d8..0022bad59 100644 --- a/ReactAndroid/src/main/java/com/facebook/yoga/YogaNode.java +++ b/ReactAndroid/src/main/java/com/facebook/yoga/YogaNode.java @@ -117,7 +117,7 @@ public class YogaNode implements Cloneable { } } - private native void jni_YGNodeReset(long nativePointer); + private static native void jni_YGNodeReset(long nativePointer); public void reset() { mEdgeSetFlag = 0; mHasSetPosition = false; @@ -160,7 +160,7 @@ public class YogaNode implements Cloneable { return mChildren.get(i); } - private native void jni_YGNodeInsertChild(long nativePointer, long childPointer, int index); + private static native void jni_YGNodeInsertChild(long nativePointer, long childPointer, int index); public void addChildAt(YogaNode child, int i) { if (child.mOwner != null) { throw new IllegalStateException("Child already has a parent, it must be removed first."); @@ -174,7 +174,7 @@ public class YogaNode implements Cloneable { jni_YGNodeInsertChild(mNativePointer, child.mNativePointer, i); } - private native void jni_YGNodeInsertSharedChild(long nativePointer, long childPointer, int index); + private static native void jni_YGNodeInsertSharedChild(long nativePointer, long childPointer, int index); public void addSharedChildAt(YogaNode child, int i) { if (mChildren == null) { @@ -185,7 +185,7 @@ public class YogaNode implements Cloneable { jni_YGNodeInsertSharedChild(mNativePointer, child.mNativePointer, i); } - private native void jni_YGNodeSetOwner(long nativePointer, long newOwnerNativePointer); + private static native void jni_YGNodeSetOwner(long nativePointer, long newOwnerNativePointer); private native long jni_YGNodeClone(long nativePointer, Object newNode); @@ -197,7 +197,7 @@ public class YogaNode implements Cloneable { if (mChildren != null) { for (YogaNode child : mChildren) { - child.jni_YGNodeSetOwner(child.mNativePointer, 0); + YogaNode.jni_YGNodeSetOwner(child.mNativePointer, 0); child.mOwner = null; } } @@ -232,14 +232,14 @@ public class YogaNode implements Cloneable { } } - private native void jni_YGNodeClearChildren(long nativePointer); + private static native void jni_YGNodeClearChildren(long nativePointer); private void clearChildren() { mChildren = null; jni_YGNodeClearChildren(mNativePointer); } - private native void jni_YGNodeRemoveChild(long nativePointer, long childPointer); + private static native void jni_YGNodeRemoveChild(long nativePointer, long childPointer); public YogaNode removeChildAt(int i) { if (mChildren == null) { throw new IllegalStateException( @@ -275,7 +275,7 @@ public class YogaNode implements Cloneable { return mChildren == null ? -1 : mChildren.indexOf(child); } - private native void jni_YGNodeCalculateLayout(long nativePointer, float width, float height); + private static native void jni_YGNodeCalculateLayout(long nativePointer, float width, float height); public void calculateLayout(float width, float height) { jni_YGNodeCalculateLayout(mNativePointer, width, height); } @@ -284,23 +284,23 @@ public class YogaNode implements Cloneable { return mHasNewLayout; } - private native void jni_YGNodeMarkDirty(long nativePointer); + private static native void jni_YGNodeMarkDirty(long nativePointer); public void dirty() { jni_YGNodeMarkDirty(mNativePointer); } - private native void jni_YGNodeMarkDirtyAndPropogateToDescendants(long nativePointer); + private static native void jni_YGNodeMarkDirtyAndPropogateToDescendants(long nativePointer); public void dirtyAllDescendants() { jni_YGNodeMarkDirtyAndPropogateToDescendants(mNativePointer); } - private native boolean jni_YGNodeIsDirty(long nativePointer); + private static native boolean jni_YGNodeIsDirty(long nativePointer); public boolean isDirty() { return jni_YGNodeIsDirty(mNativePointer); } - private native void jni_YGNodeCopyStyle(long dstNativePointer, long srcNativePointer); + private static native void jni_YGNodeCopyStyle(long dstNativePointer, long srcNativePointer); public void copyStyle(YogaNode srcNode) { jni_YGNodeCopyStyle(mNativePointer, srcNode.mNativePointer); } @@ -309,147 +309,147 @@ public class YogaNode implements Cloneable { mHasNewLayout = false; } - private native int jni_YGNodeStyleGetDirection(long nativePointer); + private static native int jni_YGNodeStyleGetDirection(long nativePointer); public YogaDirection getStyleDirection() { return YogaDirection.fromInt(jni_YGNodeStyleGetDirection(mNativePointer)); } - private native void jni_YGNodeStyleSetDirection(long nativePointer, int direction); + private static native void jni_YGNodeStyleSetDirection(long nativePointer, int direction); public void setDirection(YogaDirection direction) { jni_YGNodeStyleSetDirection(mNativePointer, direction.intValue()); } - private native int jni_YGNodeStyleGetFlexDirection(long nativePointer); + private static native int jni_YGNodeStyleGetFlexDirection(long nativePointer); public YogaFlexDirection getFlexDirection() { return YogaFlexDirection.fromInt(jni_YGNodeStyleGetFlexDirection(mNativePointer)); } - private native void jni_YGNodeStyleSetFlexDirection(long nativePointer, int flexDirection); + private static native void jni_YGNodeStyleSetFlexDirection(long nativePointer, int flexDirection); public void setFlexDirection(YogaFlexDirection flexDirection) { jni_YGNodeStyleSetFlexDirection(mNativePointer, flexDirection.intValue()); } - private native int jni_YGNodeStyleGetJustifyContent(long nativePointer); + private static native int jni_YGNodeStyleGetJustifyContent(long nativePointer); public YogaJustify getJustifyContent() { return YogaJustify.fromInt(jni_YGNodeStyleGetJustifyContent(mNativePointer)); } - private native void jni_YGNodeStyleSetJustifyContent(long nativePointer, int justifyContent); + private static native void jni_YGNodeStyleSetJustifyContent(long nativePointer, int justifyContent); public void setJustifyContent(YogaJustify justifyContent) { jni_YGNodeStyleSetJustifyContent(mNativePointer, justifyContent.intValue()); } - private native int jni_YGNodeStyleGetAlignItems(long nativePointer); + private static native int jni_YGNodeStyleGetAlignItems(long nativePointer); public YogaAlign getAlignItems() { return YogaAlign.fromInt(jni_YGNodeStyleGetAlignItems(mNativePointer)); } - private native void jni_YGNodeStyleSetAlignItems(long nativePointer, int alignItems); + private static native void jni_YGNodeStyleSetAlignItems(long nativePointer, int alignItems); public void setAlignItems(YogaAlign alignItems) { jni_YGNodeStyleSetAlignItems(mNativePointer, alignItems.intValue()); } - private native int jni_YGNodeStyleGetAlignSelf(long nativePointer); + private static native int jni_YGNodeStyleGetAlignSelf(long nativePointer); public YogaAlign getAlignSelf() { return YogaAlign.fromInt(jni_YGNodeStyleGetAlignSelf(mNativePointer)); } - private native void jni_YGNodeStyleSetAlignSelf(long nativePointer, int alignSelf); + private static native void jni_YGNodeStyleSetAlignSelf(long nativePointer, int alignSelf); public void setAlignSelf(YogaAlign alignSelf) { jni_YGNodeStyleSetAlignSelf(mNativePointer, alignSelf.intValue()); } - private native int jni_YGNodeStyleGetAlignContent(long nativePointer); + private static native int jni_YGNodeStyleGetAlignContent(long nativePointer); public YogaAlign getAlignContent() { return YogaAlign.fromInt(jni_YGNodeStyleGetAlignContent(mNativePointer)); } - private native void jni_YGNodeStyleSetAlignContent(long nativePointer, int alignContent); + private static native void jni_YGNodeStyleSetAlignContent(long nativePointer, int alignContent); public void setAlignContent(YogaAlign alignContent) { jni_YGNodeStyleSetAlignContent(mNativePointer, alignContent.intValue()); } - private native int jni_YGNodeStyleGetPositionType(long nativePointer); + private static native int jni_YGNodeStyleGetPositionType(long nativePointer); public YogaPositionType getPositionType() { return YogaPositionType.fromInt(jni_YGNodeStyleGetPositionType(mNativePointer)); } - private native void jni_YGNodeStyleSetPositionType(long nativePointer, int positionType); + private static native void jni_YGNodeStyleSetPositionType(long nativePointer, int positionType); public void setPositionType(YogaPositionType positionType) { jni_YGNodeStyleSetPositionType(mNativePointer, positionType.intValue()); } - private native void jni_YGNodeStyleSetFlexWrap(long nativePointer, int wrapType); + private static native void jni_YGNodeStyleSetFlexWrap(long nativePointer, int wrapType); public void setWrap(YogaWrap flexWrap) { jni_YGNodeStyleSetFlexWrap(mNativePointer, flexWrap.intValue()); } - private native int jni_YGNodeStyleGetOverflow(long nativePointer); + private static native int jni_YGNodeStyleGetOverflow(long nativePointer); public YogaOverflow getOverflow() { return YogaOverflow.fromInt(jni_YGNodeStyleGetOverflow(mNativePointer)); } - private native void jni_YGNodeStyleSetOverflow(long nativePointer, int overflow); + private static native void jni_YGNodeStyleSetOverflow(long nativePointer, int overflow); public void setOverflow(YogaOverflow overflow) { jni_YGNodeStyleSetOverflow(mNativePointer, overflow.intValue()); } - private native int jni_YGNodeStyleGetDisplay(long nativePointer); + private static native int jni_YGNodeStyleGetDisplay(long nativePointer); public YogaDisplay getDisplay() { return YogaDisplay.fromInt(jni_YGNodeStyleGetDisplay(mNativePointer)); } - private native void jni_YGNodeStyleSetDisplay(long nativePointer, int display); + private static native void jni_YGNodeStyleSetDisplay(long nativePointer, int display); public void setDisplay(YogaDisplay display) { jni_YGNodeStyleSetDisplay(mNativePointer, display.intValue()); } - private native void jni_YGNodeStyleSetFlex(long nativePointer, float flex); + private static native void jni_YGNodeStyleSetFlex(long nativePointer, float flex); public void setFlex(float flex) { jni_YGNodeStyleSetFlex(mNativePointer, flex); } - private native float jni_YGNodeStyleGetFlexGrow(long nativePointer); + private static native float jni_YGNodeStyleGetFlexGrow(long nativePointer); public float getFlexGrow() { return jni_YGNodeStyleGetFlexGrow(mNativePointer); } - private native void jni_YGNodeStyleSetFlexGrow(long nativePointer, float flexGrow); + private static native void jni_YGNodeStyleSetFlexGrow(long nativePointer, float flexGrow); public void setFlexGrow(float flexGrow) { jni_YGNodeStyleSetFlexGrow(mNativePointer, flexGrow); } - private native float jni_YGNodeStyleGetFlexShrink(long nativePointer); + private static native float jni_YGNodeStyleGetFlexShrink(long nativePointer); public float getFlexShrink() { return jni_YGNodeStyleGetFlexShrink(mNativePointer); } - private native void jni_YGNodeStyleSetFlexShrink(long nativePointer, float flexShrink); + private static native void jni_YGNodeStyleSetFlexShrink(long nativePointer, float flexShrink); public void setFlexShrink(float flexShrink) { jni_YGNodeStyleSetFlexShrink(mNativePointer, flexShrink); } - private native Object jni_YGNodeStyleGetFlexBasis(long nativePointer); + private static native Object jni_YGNodeStyleGetFlexBasis(long nativePointer); public YogaValue getFlexBasis() { return (YogaValue) jni_YGNodeStyleGetFlexBasis(mNativePointer); } - private native void jni_YGNodeStyleSetFlexBasis(long nativePointer, float flexBasis); + private static native void jni_YGNodeStyleSetFlexBasis(long nativePointer, float flexBasis); public void setFlexBasis(float flexBasis) { jni_YGNodeStyleSetFlexBasis(mNativePointer, flexBasis); } - private native void jni_YGNodeStyleSetFlexBasisPercent(long nativePointer, float percent); + private static native void jni_YGNodeStyleSetFlexBasisPercent(long nativePointer, float percent); public void setFlexBasisPercent(float percent) { jni_YGNodeStyleSetFlexBasisPercent(mNativePointer, percent); } - private native void jni_YGNodeStyleSetFlexBasisAuto(long nativePointer); + private static native void jni_YGNodeStyleSetFlexBasisAuto(long nativePointer); public void setFlexBasisAuto() { jni_YGNodeStyleSetFlexBasisAuto(mNativePointer); } - private native Object jni_YGNodeStyleGetMargin(long nativePointer, int edge); + private static native Object jni_YGNodeStyleGetMargin(long nativePointer, int edge); public YogaValue getMargin(YogaEdge edge) { if (!((mEdgeSetFlag & MARGIN) == MARGIN)) { return YogaValue.UNDEFINED; @@ -457,25 +457,25 @@ public class YogaNode implements Cloneable { return (YogaValue) jni_YGNodeStyleGetMargin(mNativePointer, edge.intValue()); } - private native void jni_YGNodeStyleSetMargin(long nativePointer, int edge, float margin); + private static native void jni_YGNodeStyleSetMargin(long nativePointer, int edge, float margin); public void setMargin(YogaEdge edge, float margin) { mEdgeSetFlag |= MARGIN; jni_YGNodeStyleSetMargin(mNativePointer, edge.intValue(), margin); } - private native void jni_YGNodeStyleSetMarginPercent(long nativePointer, int edge, float percent); + private static native void jni_YGNodeStyleSetMarginPercent(long nativePointer, int edge, float percent); public void setMarginPercent(YogaEdge edge, float percent) { mEdgeSetFlag |= MARGIN; jni_YGNodeStyleSetMarginPercent(mNativePointer, edge.intValue(), percent); } - private native void jni_YGNodeStyleSetMarginAuto(long nativePointer, int edge); + private static native void jni_YGNodeStyleSetMarginAuto(long nativePointer, int edge); public void setMarginAuto(YogaEdge edge) { mEdgeSetFlag |= MARGIN; jni_YGNodeStyleSetMarginAuto(mNativePointer, edge.intValue()); } - private native Object jni_YGNodeStyleGetPadding(long nativePointer, int edge); + private static native Object jni_YGNodeStyleGetPadding(long nativePointer, int edge); public YogaValue getPadding(YogaEdge edge) { if (!((mEdgeSetFlag & PADDING) == PADDING)) { return YogaValue.UNDEFINED; @@ -483,19 +483,19 @@ public class YogaNode implements Cloneable { return (YogaValue) jni_YGNodeStyleGetPadding(mNativePointer, edge.intValue()); } - private native void jni_YGNodeStyleSetPadding(long nativePointer, int edge, float padding); + private static native void jni_YGNodeStyleSetPadding(long nativePointer, int edge, float padding); public void setPadding(YogaEdge edge, float padding) { mEdgeSetFlag |= PADDING; jni_YGNodeStyleSetPadding(mNativePointer, edge.intValue(), padding); } - private native void jni_YGNodeStyleSetPaddingPercent(long nativePointer, int edge, float percent); + private static native void jni_YGNodeStyleSetPaddingPercent(long nativePointer, int edge, float percent); public void setPaddingPercent(YogaEdge edge, float percent) { mEdgeSetFlag |= PADDING; jni_YGNodeStyleSetPaddingPercent(mNativePointer, edge.intValue(), percent); } - private native float jni_YGNodeStyleGetBorder(long nativePointer, int edge); + private static native float jni_YGNodeStyleGetBorder(long nativePointer, int edge); public float getBorder(YogaEdge edge) { if (!((mEdgeSetFlag & BORDER) == BORDER)) { return YogaConstants.UNDEFINED; @@ -503,13 +503,13 @@ public class YogaNode implements Cloneable { return jni_YGNodeStyleGetBorder(mNativePointer, edge.intValue()); } - private native void jni_YGNodeStyleSetBorder(long nativePointer, int edge, float border); + private static native void jni_YGNodeStyleSetBorder(long nativePointer, int edge, float border); public void setBorder(YogaEdge edge, float border) { mEdgeSetFlag |= BORDER; jni_YGNodeStyleSetBorder(mNativePointer, edge.intValue(), border); } - private native Object jni_YGNodeStyleGetPosition(long nativePointer, int edge); + private static native Object jni_YGNodeStyleGetPosition(long nativePointer, int edge); public YogaValue getPosition(YogaEdge edge) { if (!mHasSetPosition) { return YogaValue.UNDEFINED; @@ -517,124 +517,124 @@ public class YogaNode implements Cloneable { return (YogaValue) jni_YGNodeStyleGetPosition(mNativePointer, edge.intValue()); } - private native void jni_YGNodeStyleSetPosition(long nativePointer, int edge, float position); + private static native void jni_YGNodeStyleSetPosition(long nativePointer, int edge, float position); public void setPosition(YogaEdge edge, float position) { mHasSetPosition = true; jni_YGNodeStyleSetPosition(mNativePointer, edge.intValue(), position); } - private native void jni_YGNodeStyleSetPositionPercent(long nativePointer, int edge, float percent); + private static native void jni_YGNodeStyleSetPositionPercent(long nativePointer, int edge, float percent); public void setPositionPercent(YogaEdge edge, float percent) { mHasSetPosition = true; jni_YGNodeStyleSetPositionPercent(mNativePointer, edge.intValue(), percent); } - private native Object jni_YGNodeStyleGetWidth(long nativePointer); + private static native Object jni_YGNodeStyleGetWidth(long nativePointer); public YogaValue getWidth() { return (YogaValue) jni_YGNodeStyleGetWidth(mNativePointer); } - private native void jni_YGNodeStyleSetWidth(long nativePointer, float width); + private static native void jni_YGNodeStyleSetWidth(long nativePointer, float width); public void setWidth(float width) { jni_YGNodeStyleSetWidth(mNativePointer, width); } - private native void jni_YGNodeStyleSetWidthPercent(long nativePointer, float percent); + private static native void jni_YGNodeStyleSetWidthPercent(long nativePointer, float percent); public void setWidthPercent(float percent) { jni_YGNodeStyleSetWidthPercent(mNativePointer, percent); } - private native void jni_YGNodeStyleSetWidthAuto(long nativePointer); + private static native void jni_YGNodeStyleSetWidthAuto(long nativePointer); public void setWidthAuto() { jni_YGNodeStyleSetWidthAuto(mNativePointer); } - private native Object jni_YGNodeStyleGetHeight(long nativePointer); + private static native Object jni_YGNodeStyleGetHeight(long nativePointer); public YogaValue getHeight() { return (YogaValue) jni_YGNodeStyleGetHeight(mNativePointer); } - private native void jni_YGNodeStyleSetHeight(long nativePointer, float height); + private static native void jni_YGNodeStyleSetHeight(long nativePointer, float height); public void setHeight(float height) { jni_YGNodeStyleSetHeight(mNativePointer, height); } - private native void jni_YGNodeStyleSetHeightPercent(long nativePointer, float percent); + private static native void jni_YGNodeStyleSetHeightPercent(long nativePointer, float percent); public void setHeightPercent(float percent) { jni_YGNodeStyleSetHeightPercent(mNativePointer, percent); } - private native void jni_YGNodeStyleSetHeightAuto(long nativePointer); + private static native void jni_YGNodeStyleSetHeightAuto(long nativePointer); public void setHeightAuto() { jni_YGNodeStyleSetHeightAuto(mNativePointer); } - private native Object jni_YGNodeStyleGetMinWidth(long nativePointer); + private static native Object jni_YGNodeStyleGetMinWidth(long nativePointer); public YogaValue getMinWidth() { return (YogaValue) jni_YGNodeStyleGetMinWidth(mNativePointer); } - private native void jni_YGNodeStyleSetMinWidth(long nativePointer, float minWidth); + private static native void jni_YGNodeStyleSetMinWidth(long nativePointer, float minWidth); public void setMinWidth(float minWidth) { jni_YGNodeStyleSetMinWidth(mNativePointer, minWidth); } - private native void jni_YGNodeStyleSetMinWidthPercent(long nativePointer, float percent); + private static native void jni_YGNodeStyleSetMinWidthPercent(long nativePointer, float percent); public void setMinWidthPercent(float percent) { jni_YGNodeStyleSetMinWidthPercent(mNativePointer, percent); } - private native Object jni_YGNodeStyleGetMinHeight(long nativePointer); + private static native Object jni_YGNodeStyleGetMinHeight(long nativePointer); public YogaValue getMinHeight() { return (YogaValue) jni_YGNodeStyleGetMinHeight(mNativePointer); } - private native void jni_YGNodeStyleSetMinHeight(long nativePointer, float minHeight); + private static native void jni_YGNodeStyleSetMinHeight(long nativePointer, float minHeight); public void setMinHeight(float minHeight) { jni_YGNodeStyleSetMinHeight(mNativePointer, minHeight); } - private native void jni_YGNodeStyleSetMinHeightPercent(long nativePointer, float percent); + private static native void jni_YGNodeStyleSetMinHeightPercent(long nativePointer, float percent); public void setMinHeightPercent(float percent) { jni_YGNodeStyleSetMinHeightPercent(mNativePointer, percent); } - private native Object jni_YGNodeStyleGetMaxWidth(long nativePointer); + private static native Object jni_YGNodeStyleGetMaxWidth(long nativePointer); public YogaValue getMaxWidth() { return (YogaValue) jni_YGNodeStyleGetMaxWidth(mNativePointer); } - private native void jni_YGNodeStyleSetMaxWidth(long nativePointer, float maxWidth); + private static native void jni_YGNodeStyleSetMaxWidth(long nativePointer, float maxWidth); public void setMaxWidth(float maxWidth) { jni_YGNodeStyleSetMaxWidth(mNativePointer, maxWidth); } - private native void jni_YGNodeStyleSetMaxWidthPercent(long nativePointer, float percent); + private static native void jni_YGNodeStyleSetMaxWidthPercent(long nativePointer, float percent); public void setMaxWidthPercent(float percent) { jni_YGNodeStyleSetMaxWidthPercent(mNativePointer, percent); } - private native Object jni_YGNodeStyleGetMaxHeight(long nativePointer); + private static native Object jni_YGNodeStyleGetMaxHeight(long nativePointer); public YogaValue getMaxHeight() { return (YogaValue) jni_YGNodeStyleGetMaxHeight(mNativePointer); } - private native void jni_YGNodeStyleSetMaxHeight(long nativePointer, float maxheight); + private static native void jni_YGNodeStyleSetMaxHeight(long nativePointer, float maxheight); public void setMaxHeight(float maxheight) { jni_YGNodeStyleSetMaxHeight(mNativePointer, maxheight); } - private native void jni_YGNodeStyleSetMaxHeightPercent(long nativePointer, float percent); + private static native void jni_YGNodeStyleSetMaxHeightPercent(long nativePointer, float percent); public void setMaxHeightPercent(float percent) { jni_YGNodeStyleSetMaxHeightPercent(mNativePointer, percent); } - private native float jni_YGNodeStyleGetAspectRatio(long nativePointer); + private static native float jni_YGNodeStyleGetAspectRatio(long nativePointer); public float getAspectRatio() { return jni_YGNodeStyleGetAspectRatio(mNativePointer); } - private native void jni_YGNodeStyleSetAspectRatio(long nativePointer, float aspectRatio); + private static native void jni_YGNodeStyleSetAspectRatio(long nativePointer, float aspectRatio); public void setAspectRatio(float aspectRatio) { jni_YGNodeStyleSetAspectRatio(mNativePointer, aspectRatio); } @@ -720,7 +720,7 @@ public class YogaNode implements Cloneable { return YogaDirection.fromInt(mLayoutDirection); } - private native void jni_YGNodeSetHasMeasureFunc(long nativePointer, boolean hasMeasureFunc); + private static native void jni_YGNodeSetHasMeasureFunc(long nativePointer, boolean hasMeasureFunc); public void setMeasureFunction(YogaMeasureFunction measureFunction) { mMeasureFunction = measureFunction; jni_YGNodeSetHasMeasureFunc(mNativePointer, measureFunction != null); @@ -745,7 +745,7 @@ public class YogaNode implements Cloneable { YogaMeasureMode.fromInt(heightMode)); } - private native void jni_YGNodeSetHasBaselineFunc(long nativePointer, boolean hasMeasureFunc); + private static native void jni_YGNodeSetHasBaselineFunc(long nativePointer, boolean hasMeasureFunc); public void setBaselineFunction(YogaBaselineFunction baselineFunction) { mBaselineFunction = baselineFunction; jni_YGNodeSetHasBaselineFunc(mNativePointer, baselineFunction != null); @@ -768,7 +768,7 @@ public class YogaNode implements Cloneable { return mData; } - private native void jni_YGNodePrint(long nativePointer); + private static native void jni_YGNodePrint(long nativePointer); /** * Use the set logger (defaults to adb log) to print out the styles, children, and computed diff --git a/ReactAndroid/src/main/jni/first-party/fb/include/fb/fbjni/Registration-inl.h b/ReactAndroid/src/main/jni/first-party/fb/include/fb/fbjni/Registration-inl.h index 5df1a12de..e08533c52 100644 --- a/ReactAndroid/src/main/jni/first-party/fb/include/fb/fbjni/Registration-inl.h +++ b/ReactAndroid/src/main/jni/first-party/fb/include/fb/fbjni/Registration-inl.h @@ -144,7 +144,7 @@ inline std::string makeDescriptor(R (C::*)(Args... args)) { template template -R CriticalMethod::call(alias_ref, Args... args) { +JNI_ENTRY_POINT R CriticalMethod::call(alias_ref, Args... args) { static_assert( IsJniPrimitive() || std::is_void(), "Critical Native Methods may only return primitive JNI types, or void."); diff --git a/ReactAndroid/src/main/jni/first-party/yogajni/jni/YGJNI.cpp b/ReactAndroid/src/main/jni/first-party/yogajni/jni/YGJNI.cpp index aea7d3681..d78546569 100644 --- a/ReactAndroid/src/main/jni/first-party/yogajni/jni/YGJNI.cpp +++ b/ReactAndroid/src/main/jni/first-party/yogajni/jni/YGJNI.cpp @@ -303,10 +303,7 @@ jlong jni_YGNodeNewWithConfig(alias_ref thiz, jlong configPointer) { return reinterpret_cast(node); } -void jni_YGNodeSetOwner( - alias_ref thiz, - jlong nativePointer, - jlong newOwnerNativePointer) { +void jni_YGNodeSetOwner(jlong nativePointer, jlong newOwnerNativePointer) { const YGNodeRef node = _jlong2YGNodeRef(nativePointer); const YGNodeRef newOwnerNode = _jlong2YGNodeRef(newOwnerNativePointer); @@ -323,7 +320,7 @@ jlong jni_YGNodeClone( return reinterpret_cast(clonedYogaNode); } -void jni_YGNodeFree(alias_ref, jlong nativePointer) { +void jni_YGNodeFree(jlong nativePointer) { if (nativePointer == 0) { return; } @@ -332,12 +329,12 @@ void jni_YGNodeFree(alias_ref, jlong nativePointer) { YGNodeFree(node); } -void jni_YGNodeClearChildren(alias_ref thiz, jlong nativePointer) { +void jni_YGNodeClearChildren(jlong nativePointer) { const YGNodeRef node = _jlong2YGNodeRef(nativePointer); node->clearChildren(); } -void jni_YGNodeReset(alias_ref thiz, jlong nativePointer) { +void jni_YGNodeReset(jlong nativePointer) { const YGNodeRef node = _jlong2YGNodeRef(nativePointer); void* context = node->getContext(); YGNodeReset(node); @@ -345,7 +342,7 @@ void jni_YGNodeReset(alias_ref thiz, jlong nativePointer) { node->setPrintFunc(YGPrint); } -void jni_YGNodePrint(alias_ref thiz, jlong nativePointer) { +void jni_YGNodePrint(jlong nativePointer) { const YGNodeRef node = _jlong2YGNodeRef(nativePointer); YGNodePrint( node, @@ -354,7 +351,6 @@ void jni_YGNodePrint(alias_ref thiz, jlong nativePointer) { } void jni_YGNodeInsertChild( - alias_ref, jlong nativePointer, jlong childPointer, jint index) { @@ -363,7 +359,6 @@ void jni_YGNodeInsertChild( } void jni_YGNodeInsertSharedChild( - alias_ref, jlong nativePointer, jlong childPointer, jint index) { @@ -371,16 +366,13 @@ void jni_YGNodeInsertSharedChild( _jlong2YGNodeRef(nativePointer), _jlong2YGNodeRef(childPointer), index); } -void jni_YGNodeRemoveChild( - alias_ref, - jlong nativePointer, - jlong childPointer) { +void jni_YGNodeRemoveChild(jlong nativePointer, jlong childPointer) { YGNodeRemoveChild( _jlong2YGNodeRef(nativePointer), _jlong2YGNodeRef(childPointer)); } void jni_YGNodeCalculateLayout( - alias_ref, + alias_ref, jlong nativePointer, jfloat width, jfloat height) { @@ -393,40 +385,31 @@ void jni_YGNodeCalculateLayout( YGTransferLayoutOutputsRecursive(root); } -void jni_YGNodeMarkDirty(alias_ref, jlong nativePointer) { +void jni_YGNodeMarkDirty(jlong nativePointer) { YGNodeMarkDirty(_jlong2YGNodeRef(nativePointer)); } -void jni_YGNodeMarkDirtyAndPropogateToDescendants( - alias_ref, - jlong nativePointer) { +void jni_YGNodeMarkDirtyAndPropogateToDescendants(jlong nativePointer) { YGNodeMarkDirtyAndPropogateToDescendants(_jlong2YGNodeRef(nativePointer)); } -jboolean jni_YGNodeIsDirty(alias_ref, jlong nativePointer) { +jboolean jni_YGNodeIsDirty(jlong nativePointer) { return (jboolean)_jlong2YGNodeRef(nativePointer)->isDirty(); } -void jni_YGNodeSetHasMeasureFunc( - alias_ref, - jlong nativePointer, - jboolean hasMeasureFunc) { +void jni_YGNodeSetHasMeasureFunc(jlong nativePointer, jboolean hasMeasureFunc) { _jlong2YGNodeRef(nativePointer) ->setMeasureFunc(hasMeasureFunc ? YGJNIMeasureFunc : nullptr); } void jni_YGNodeSetHasBaselineFunc( - alias_ref, jlong nativePointer, jboolean hasBaselineFunc) { _jlong2YGNodeRef(nativePointer) ->setBaseLineFunc(hasBaselineFunc ? YGJNIBaselineFunc : nullptr); } -void jni_YGNodeCopyStyle( - alias_ref, - jlong dstNativePointer, - jlong srcNativePointer) { +void jni_YGNodeCopyStyle(jlong dstNativePointer, jlong srcNativePointer) { YGNodeCopyStyle( _jlong2YGNodeRef(dstNativePointer), _jlong2YGNodeRef(srcNativePointer)); } @@ -439,87 +422,81 @@ struct JYogaValue : public JavaClass { } }; -#define YG_NODE_JNI_STYLE_PROP(javatype, type, name) \ - javatype jni_YGNodeStyleGet##name(alias_ref, jlong nativePointer) { \ - return (javatype)YGNodeStyleGet##name(_jlong2YGNodeRef(nativePointer)); \ - } \ - \ - void jni_YGNodeStyleSet##name( \ - alias_ref, jlong nativePointer, javatype value) { \ - YGNodeStyleSet##name( \ - _jlong2YGNodeRef(nativePointer), static_cast(value)); \ +#define YG_NODE_JNI_STYLE_PROP(javatype, type, name) \ + javatype jni_YGNodeStyleGet##name(jlong nativePointer) { \ + return (javatype)YGNodeStyleGet##name(_jlong2YGNodeRef(nativePointer)); \ + } \ + \ + void jni_YGNodeStyleSet##name(jlong nativePointer, javatype value) { \ + YGNodeStyleSet##name( \ + _jlong2YGNodeRef(nativePointer), static_cast(value)); \ } -#define YG_NODE_JNI_STYLE_UNIT_PROP(name) \ - local_ref jni_YGNodeStyleGet##name( \ - alias_ref, jlong nativePointer) { \ - return JYogaValue::create( \ - YGNodeStyleGet##name(_jlong2YGNodeRef(nativePointer))); \ - } \ - \ - void jni_YGNodeStyleSet##name( \ - alias_ref, jlong nativePointer, jfloat value) { \ - YGNodeStyleSet##name( \ - _jlong2YGNodeRef(nativePointer), static_cast(value)); \ - } \ - \ - void jni_YGNodeStyleSet##name##Percent( \ - alias_ref, jlong nativePointer, jfloat value) { \ - YGNodeStyleSet##name##Percent( \ - _jlong2YGNodeRef(nativePointer), static_cast(value)); \ +#define YG_NODE_JNI_STYLE_UNIT_PROP(name) \ + local_ref jni_YGNodeStyleGet##name( \ + alias_ref, jlong nativePointer) { \ + return JYogaValue::create( \ + YGNodeStyleGet##name(_jlong2YGNodeRef(nativePointer))); \ + } \ + \ + void jni_YGNodeStyleSet##name(jlong nativePointer, jfloat value) { \ + YGNodeStyleSet##name( \ + _jlong2YGNodeRef(nativePointer), static_cast(value)); \ + } \ + \ + void jni_YGNodeStyleSet##name##Percent(jlong nativePointer, jfloat value) { \ + YGNodeStyleSet##name##Percent( \ + _jlong2YGNodeRef(nativePointer), static_cast(value)); \ } #define YG_NODE_JNI_STYLE_UNIT_PROP_AUTO(name) \ YG_NODE_JNI_STYLE_UNIT_PROP(name) \ - void jni_YGNodeStyleSet##name##Auto( \ - alias_ref, jlong nativePointer) { \ + void jni_YGNodeStyleSet##name##Auto(jlong nativePointer) { \ YGNodeStyleSet##name##Auto(_jlong2YGNodeRef(nativePointer)); \ } -#define YG_NODE_JNI_STYLE_EDGE_PROP(javatype, type, name) \ - javatype jni_YGNodeStyleGet##name( \ - alias_ref, jlong nativePointer, jint edge) { \ - return (javatype)YGNodeStyleGet##name( \ - _jlong2YGNodeRef(nativePointer), static_cast(edge)); \ - } \ - \ - void jni_YGNodeStyleSet##name( \ - alias_ref, jlong nativePointer, jint edge, javatype value) { \ - YGNodeStyleSet##name( \ - _jlong2YGNodeRef(nativePointer), \ - static_cast(edge), \ - static_cast(value)); \ +#define YG_NODE_JNI_STYLE_EDGE_PROP(javatype, type, name) \ + javatype jni_YGNodeStyleGet##name(jlong nativePointer, jint edge) { \ + return (javatype)YGNodeStyleGet##name( \ + _jlong2YGNodeRef(nativePointer), static_cast(edge)); \ + } \ + \ + void jni_YGNodeStyleSet##name( \ + jlong nativePointer, jint edge, javatype value) { \ + YGNodeStyleSet##name( \ + _jlong2YGNodeRef(nativePointer), \ + static_cast(edge), \ + static_cast(value)); \ } -#define YG_NODE_JNI_STYLE_EDGE_UNIT_PROP(name) \ - local_ref jni_YGNodeStyleGet##name( \ - alias_ref, jlong nativePointer, jint edge) { \ - return JYogaValue::create(YGNodeStyleGet##name( \ - _jlong2YGNodeRef(nativePointer), static_cast(edge))); \ - } \ - \ - void jni_YGNodeStyleSet##name( \ - alias_ref, jlong nativePointer, jint edge, jfloat value) { \ - YGNodeStyleSet##name( \ - _jlong2YGNodeRef(nativePointer), \ - static_cast(edge), \ - static_cast(value)); \ - } \ - \ - void jni_YGNodeStyleSet##name##Percent( \ - alias_ref, jlong nativePointer, jint edge, jfloat value) { \ - YGNodeStyleSet##name##Percent( \ - _jlong2YGNodeRef(nativePointer), \ - static_cast(edge), \ - static_cast(value)); \ +#define YG_NODE_JNI_STYLE_EDGE_UNIT_PROP(name) \ + local_ref jni_YGNodeStyleGet##name( \ + alias_ref, jlong nativePointer, jint edge) { \ + return JYogaValue::create(YGNodeStyleGet##name( \ + _jlong2YGNodeRef(nativePointer), static_cast(edge))); \ + } \ + \ + void jni_YGNodeStyleSet##name( \ + jlong nativePointer, jint edge, jfloat value) { \ + YGNodeStyleSet##name( \ + _jlong2YGNodeRef(nativePointer), \ + static_cast(edge), \ + static_cast(value)); \ + } \ + \ + void jni_YGNodeStyleSet##name##Percent( \ + jlong nativePointer, jint edge, jfloat value) { \ + YGNodeStyleSet##name##Percent( \ + _jlong2YGNodeRef(nativePointer), \ + static_cast(edge), \ + static_cast(value)); \ } -#define YG_NODE_JNI_STYLE_EDGE_UNIT_PROP_AUTO(name) \ - YG_NODE_JNI_STYLE_EDGE_UNIT_PROP(name) \ - void jni_YGNodeStyleSet##name##Auto( \ - alias_ref, jlong nativePointer, jint edge) { \ - YGNodeStyleSet##name##Auto( \ - _jlong2YGNodeRef(nativePointer), static_cast(edge)); \ +#define YG_NODE_JNI_STYLE_EDGE_UNIT_PROP_AUTO(name) \ + YG_NODE_JNI_STYLE_EDGE_UNIT_PROP(name) \ + void jni_YGNodeStyleSet##name##Auto(jlong nativePointer, jint edge) { \ + YGNodeStyleSet##name##Auto( \ + _jlong2YGNodeRef(nativePointer), static_cast(edge)); \ } YG_NODE_JNI_STYLE_PROP(jint, YGDirection, Direction); @@ -533,10 +510,7 @@ YG_NODE_JNI_STYLE_PROP(jint, YGWrap, FlexWrap); YG_NODE_JNI_STYLE_PROP(jint, YGOverflow, Overflow); YG_NODE_JNI_STYLE_PROP(jint, YGDisplay, Display); -void jni_YGNodeStyleSetFlex( - alias_ref, - jlong nativePointer, - jfloat value) { +void jni_YGNodeStyleSetFlex(jlong nativePointer, jfloat value) { YGNodeStyleSetFlex( _jlong2YGNodeRef(nativePointer), static_cast(value)); } @@ -668,113 +642,127 @@ void jni_YGConfigSetLogger( } } -jint jni_YGNodeGetInstanceCount(alias_ref clazz) { +jint jni_YGNodeGetInstanceCount() { return YGNodeGetInstanceCount(); } #define YGMakeNativeMethod(name) makeNativeMethod(#name, name) +#define YGRealMakeCriticalNativeMethod(name) \ + makeCriticalNativeMethod(#name, name) +#define YGWrapCriticalNativeMethodForRegularCall(name) \ + makeNativeMethod( \ + #name, \ + ::facebook::jni::detail::CriticalMethod::call<&name>) -void jni_bindNativeMethods(alias_ref, jboolean) { - registerNatives( - "com/facebook/yoga/YogaNode", - { - YGMakeNativeMethod(jni_YGNodeNew), - YGMakeNativeMethod(jni_YGNodeNewWithConfig), - YGMakeNativeMethod(jni_YGNodeFree), - YGMakeNativeMethod(jni_YGNodeReset), - YGMakeNativeMethod(jni_YGNodeClearChildren), - YGMakeNativeMethod(jni_YGNodeInsertChild), - YGMakeNativeMethod(jni_YGNodeInsertSharedChild), - YGMakeNativeMethod(jni_YGNodeRemoveChild), - YGMakeNativeMethod(jni_YGNodeCalculateLayout), - YGMakeNativeMethod(jni_YGNodeMarkDirty), - YGMakeNativeMethod(jni_YGNodeMarkDirtyAndPropogateToDescendants), - YGMakeNativeMethod(jni_YGNodeIsDirty), - YGMakeNativeMethod(jni_YGNodeSetHasMeasureFunc), - YGMakeNativeMethod(jni_YGNodeSetHasBaselineFunc), - YGMakeNativeMethod(jni_YGNodeCopyStyle), - YGMakeNativeMethod(jni_YGNodeStyleGetDirection), - YGMakeNativeMethod(jni_YGNodeStyleSetDirection), - YGMakeNativeMethod(jni_YGNodeStyleGetFlexDirection), - YGMakeNativeMethod(jni_YGNodeStyleSetFlexDirection), - YGMakeNativeMethod(jni_YGNodeStyleGetJustifyContent), - YGMakeNativeMethod(jni_YGNodeStyleSetJustifyContent), - YGMakeNativeMethod(jni_YGNodeStyleGetAlignItems), - YGMakeNativeMethod(jni_YGNodeStyleSetAlignItems), - YGMakeNativeMethod(jni_YGNodeStyleGetAlignSelf), - YGMakeNativeMethod(jni_YGNodeStyleSetAlignSelf), - YGMakeNativeMethod(jni_YGNodeStyleGetAlignContent), - YGMakeNativeMethod(jni_YGNodeStyleSetAlignContent), - YGMakeNativeMethod(jni_YGNodeStyleGetPositionType), - YGMakeNativeMethod(jni_YGNodeStyleSetPositionType), - YGMakeNativeMethod(jni_YGNodeStyleSetFlexWrap), - YGMakeNativeMethod(jni_YGNodeStyleGetOverflow), - YGMakeNativeMethod(jni_YGNodeStyleSetOverflow), - YGMakeNativeMethod(jni_YGNodeStyleGetDisplay), - YGMakeNativeMethod(jni_YGNodeStyleSetDisplay), - YGMakeNativeMethod(jni_YGNodeStyleSetFlex), - YGMakeNativeMethod(jni_YGNodeStyleGetFlexGrow), - YGMakeNativeMethod(jni_YGNodeStyleSetFlexGrow), - YGMakeNativeMethod(jni_YGNodeStyleGetFlexShrink), - YGMakeNativeMethod(jni_YGNodeStyleSetFlexShrink), - YGMakeNativeMethod(jni_YGNodeStyleGetFlexBasis), - YGMakeNativeMethod(jni_YGNodeStyleSetFlexBasis), - YGMakeNativeMethod(jni_YGNodeStyleSetFlexBasisPercent), - YGMakeNativeMethod(jni_YGNodeStyleSetFlexBasisAuto), - YGMakeNativeMethod(jni_YGNodeStyleGetMargin), - YGMakeNativeMethod(jni_YGNodeStyleSetMargin), - YGMakeNativeMethod(jni_YGNodeStyleSetMarginPercent), - YGMakeNativeMethod(jni_YGNodeStyleSetMarginAuto), - YGMakeNativeMethod(jni_YGNodeStyleGetPadding), - YGMakeNativeMethod(jni_YGNodeStyleSetPadding), - YGMakeNativeMethod(jni_YGNodeStyleSetPaddingPercent), - YGMakeNativeMethod(jni_YGNodeStyleGetBorder), - YGMakeNativeMethod(jni_YGNodeStyleSetBorder), - YGMakeNativeMethod(jni_YGNodeStyleGetPosition), - YGMakeNativeMethod(jni_YGNodeStyleSetPosition), - YGMakeNativeMethod(jni_YGNodeStyleSetPositionPercent), - YGMakeNativeMethod(jni_YGNodeStyleGetWidth), - YGMakeNativeMethod(jni_YGNodeStyleSetWidth), - YGMakeNativeMethod(jni_YGNodeStyleSetWidthPercent), - YGMakeNativeMethod(jni_YGNodeStyleSetWidthAuto), - YGMakeNativeMethod(jni_YGNodeStyleGetHeight), - YGMakeNativeMethod(jni_YGNodeStyleSetHeight), - YGMakeNativeMethod(jni_YGNodeStyleSetHeightPercent), - YGMakeNativeMethod(jni_YGNodeStyleSetHeightAuto), - YGMakeNativeMethod(jni_YGNodeStyleGetMinWidth), - YGMakeNativeMethod(jni_YGNodeStyleSetMinWidth), - YGMakeNativeMethod(jni_YGNodeStyleSetMinWidthPercent), - YGMakeNativeMethod(jni_YGNodeStyleGetMinHeight), - YGMakeNativeMethod(jni_YGNodeStyleSetMinHeight), - YGMakeNativeMethod(jni_YGNodeStyleSetMinHeightPercent), - YGMakeNativeMethod(jni_YGNodeStyleGetMaxWidth), - YGMakeNativeMethod(jni_YGNodeStyleSetMaxWidth), - YGMakeNativeMethod(jni_YGNodeStyleSetMaxWidthPercent), - YGMakeNativeMethod(jni_YGNodeStyleGetMaxHeight), - YGMakeNativeMethod(jni_YGNodeStyleSetMaxHeight), - YGMakeNativeMethod(jni_YGNodeStyleSetMaxHeightPercent), - YGMakeNativeMethod(jni_YGNodeStyleGetAspectRatio), - YGMakeNativeMethod(jni_YGNodeStyleSetAspectRatio), - YGMakeNativeMethod(jni_YGNodeGetInstanceCount), - YGMakeNativeMethod(jni_YGNodePrint), - YGMakeNativeMethod(jni_YGNodeClone), - YGMakeNativeMethod(jni_YGNodeSetOwner), - }); - registerNatives( - "com/facebook/yoga/YogaConfig", - { - YGMakeNativeMethod(jni_YGConfigNew), - YGMakeNativeMethod(jni_YGConfigFree), - YGMakeNativeMethod(jni_YGConfigSetExperimentalFeatureEnabled), - YGMakeNativeMethod(jni_YGConfigSetUseWebDefaults), - YGMakeNativeMethod(jni_YGConfigSetPrintTreeFlag), - YGMakeNativeMethod(jni_YGConfigSetPointScaleFactor), - YGMakeNativeMethod(jni_YGConfigSetUseLegacyStretchBehaviour), - YGMakeNativeMethod(jni_YGConfigSetLogger), - YGMakeNativeMethod(jni_YGConfigSetHasCloneNodeFunc), - YGMakeNativeMethod( - jni_YGConfigSetShouldDiffLayoutWithoutLegacyStretchBehaviour), +#define YGRegisterNatives(YGMakeCriticalNativeMethod) \ + registerNatives( \ + "com/facebook/yoga/YogaNode", \ + { \ + YGMakeNativeMethod(jni_YGNodeNew), \ + YGMakeNativeMethod(jni_YGNodeNewWithConfig), \ + YGMakeCriticalNativeMethod(jni_YGNodeFree), \ + YGMakeCriticalNativeMethod(jni_YGNodeReset), \ + YGMakeCriticalNativeMethod(jni_YGNodeClearChildren), \ + YGMakeCriticalNativeMethod(jni_YGNodeInsertChild), \ + YGMakeCriticalNativeMethod(jni_YGNodeInsertSharedChild), \ + YGMakeCriticalNativeMethod(jni_YGNodeRemoveChild), \ + 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_YGNodeStyleSetFlexWrap), \ + YGMakeCriticalNativeMethod(jni_YGNodeStyleGetOverflow), \ + YGMakeCriticalNativeMethod(jni_YGNodeStyleSetOverflow), \ + YGMakeCriticalNativeMethod(jni_YGNodeStyleGetDisplay), \ + YGMakeCriticalNativeMethod(jni_YGNodeStyleSetDisplay), \ + 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_YGNodeClone), \ + YGMakeCriticalNativeMethod(jni_YGNodeSetOwner), \ + }); \ + registerNatives( \ + "com/facebook/yoga/YogaConfig", \ + { \ + YGMakeNativeMethod(jni_YGConfigNew), \ + YGMakeNativeMethod(jni_YGConfigFree), \ + YGMakeNativeMethod(jni_YGConfigSetExperimentalFeatureEnabled), \ + YGMakeNativeMethod(jni_YGConfigSetUseWebDefaults), \ + YGMakeNativeMethod(jni_YGConfigSetPrintTreeFlag), \ + YGMakeNativeMethod(jni_YGConfigSetPointScaleFactor), \ + YGMakeNativeMethod(jni_YGConfigSetUseLegacyStretchBehaviour), \ + YGMakeNativeMethod(jni_YGConfigSetLogger), \ + YGMakeNativeMethod(jni_YGConfigSetHasCloneNodeFunc), \ + YGMakeNativeMethod( \ + jni_YGConfigSetShouldDiffLayoutWithoutLegacyStretchBehaviour), \ }); + +void jni_bindNativeMethods(alias_ref, jboolean useFastCall) { + if (useFastCall) { + YGRegisterNatives(YGRealMakeCriticalNativeMethod); + } else { + YGRegisterNatives(YGWrapCriticalNativeMethodForRegularCall); + } } jint JNI_OnLoad(JavaVM* vm, void*) {