Don't transfer layout outputs to java for nodes which don't have a new layout
Summary: As suggested in facebook/yoga#484. This is the PR which only adds the part of using a local bool field for storing the hasLayoutFlag, to be able to pass the layout only if it has really changed. Closes https://github.com/facebook/yoga/pull/492 Reviewed By: astreet Differential Revision: D4786961 Pulled By: emilsjolander fbshipit-source-id: cf3d354b93f6dcc3ef817ef73a47bd29e37d1848
This commit is contained in:
committed by
Facebook Github Bot
parent
60db018ce4
commit
5884ab7b76
@@ -81,6 +81,8 @@ public class YogaNode implements YogaNodeAPI<YogaNode> {
|
||||
private float mBorderBottom = 0;
|
||||
@DoNotStrip
|
||||
private int mLayoutDirection = 0;
|
||||
@DoNotStrip
|
||||
private boolean mHasNewLayout = true;
|
||||
|
||||
private native long jni_YGNodeNew();
|
||||
public YogaNode() {
|
||||
@@ -115,6 +117,7 @@ public class YogaNode implements YogaNodeAPI<YogaNode> {
|
||||
mHasSetMargin = false;
|
||||
mHasSetBorder = false;
|
||||
mHasSetPosition = false;
|
||||
mHasNewLayout = true;
|
||||
|
||||
mWidth = YogaConstants.UNDEFINED;
|
||||
mHeight = YogaConstants.UNDEFINED;
|
||||
@@ -180,10 +183,9 @@ public class YogaNode implements YogaNodeAPI<YogaNode> {
|
||||
jni_YGNodeCalculateLayout(mNativePointer, width, height);
|
||||
}
|
||||
|
||||
private native boolean jni_YGNodeHasNewLayout(long nativePointer);
|
||||
@Override
|
||||
public boolean hasNewLayout() {
|
||||
return jni_YGNodeHasNewLayout(mNativePointer);
|
||||
return mHasNewLayout;
|
||||
}
|
||||
|
||||
private native void jni_YGNodeMarkDirty(long nativePointer);
|
||||
@@ -198,18 +200,17 @@ public class YogaNode implements YogaNodeAPI<YogaNode> {
|
||||
return jni_YGNodeIsDirty(mNativePointer);
|
||||
}
|
||||
|
||||
private native void jni_YGNodeMarkLayoutSeen(long nativePointer);
|
||||
@Override
|
||||
public void markLayoutSeen() {
|
||||
jni_YGNodeMarkLayoutSeen(mNativePointer);
|
||||
}
|
||||
|
||||
private native void jni_YGNodeCopyStyle(long dstNativePointer, long srcNativePointer);
|
||||
@Override
|
||||
public void copyStyle(YogaNode srcNode) {
|
||||
jni_YGNodeCopyStyle(mNativePointer, srcNode.mNativePointer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void markLayoutSeen() {
|
||||
mHasNewLayout = false;
|
||||
}
|
||||
|
||||
private native int jni_YGNodeStyleGetDirection(long nativePointer);
|
||||
@Override
|
||||
public YogaDirection getStyleDirection() {
|
||||
|
Reference in New Issue
Block a user