Skip to content

Commit

Permalink
CSSNodeCopyStyle API for Java and C#
Browse files Browse the repository at this point in the history
Reviewed By: emilsjolander

Differential Revision: D4189954

fbshipit-source-id: 10759fdb27bf67350d3151614f7815aa09bf7e04
  • Loading branch information
splhack authored and Facebook Github Bot committed Nov 17, 2016
1 parent 39a59ca commit 2af1de2
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,12 @@ public void markLayoutSeen() {
jni_CSSNodeMarkLayoutSeen(mNativePointer);
}

private native void jni_CSSNodeCopyStyle(long dstNativePointer, long srcNativePointer);
@Override
public void copyStyle(CSSNode srcNode) {
jni_CSSNodeCopyStyle(mNativePointer, srcNode.mNativePointer);
}

private native int jni_CSSNodeStyleGetDirection(long nativePointer);
@Override
public CSSDirection getStyleDirection() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ long measure(
void dirty();
void markLayoutSeen();
boolean valuesEqual(float f1, float f2);
void copyStyle(CSSNodeType srcNode);
CSSDirection getStyleDirection();
void setDirection(CSSDirection direction);
CSSFlexDirection getFlexDirection();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,11 @@ public boolean valuesEqual(float f1, float f2) {
return FloatUtil.floatsEqual(f1, f2);
}

@Override
public void copyStyle(CSSNodeDEPRECATED srcNode) {
throw new UnsupportedOperationException("copyStyle is not implemented");
}

/**
* Get this node's direction, as defined in the style.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,10 @@ void jni_CSSNodeMarkLayoutSeen(alias_ref<jobject>, jlong nativePointer) {
CSSNodeSetHasNewLayout(_jlong2CSSNodeRef(nativePointer), false);
}

void jni_CSSNodeCopyStyle(alias_ref<jobject>, jlong dstNativePointer, jlong srcNativePointer) {
CSSNodeCopyStyle(_jlong2CSSNodeRef(dstNativePointer), _jlong2CSSNodeRef(srcNativePointer));
}

#define CSS_NODE_JNI_STYLE_PROP(javatype, type, name) \
javatype jni_CSSNodeStyleGet##name(alias_ref<jobject>, jlong nativePointer) { \
return (javatype) CSSNodeStyleGet##name(_jlong2CSSNodeRef(nativePointer)); \
Expand Down Expand Up @@ -257,6 +261,7 @@ jint JNI_OnLoad(JavaVM *vm, void *) {
CSSMakeNativeMethod(jni_CSSNodeIsDirty),
CSSMakeNativeMethod(jni_CSSNodeMarkLayoutSeen),
CSSMakeNativeMethod(jni_CSSNodeSetHasMeasureFunc),
CSSMakeNativeMethod(jni_CSSNodeCopyStyle),

CSSMakeNativeMethod(jni_CSSNodeStyleGetDirection),
CSSMakeNativeMethod(jni_CSSNodeStyleSetDirection),
Expand Down

0 comments on commit 2af1de2

Please sign in to comment.