diff --git a/java/com/facebook/yoga/YogaNode.java b/java/com/facebook/yoga/YogaNode.java index 7dd26947..a8168cf1 100644 --- a/java/com/facebook/yoga/YogaNode.java +++ b/java/com/facebook/yoga/YogaNode.java @@ -1,9 +1,8 @@ -/* - * Copyright (c) Facebook, Inc. - * - * This source code is licensed under the MIT license found in the LICENSE - * file in the root directory of this source tree. +/** + * 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; @@ -174,17 +173,6 @@ public class YogaNode implements Cloneable { jni_YGNodeInsertChild(mNativePointer, child.mNativePointer, i); } - private static native void jni_YGNodeInsertSharedChild(long nativePointer, long childPointer, int index); - - public void addSharedChildAt(YogaNode child, int i) { - if (mChildren == null) { - mChildren = new ArrayList<>(4); - } - mChildren.add(i, child); - child.mOwner = null; - jni_YGNodeInsertSharedChild(mNativePointer, child.mNativePointer, i); - } - private static native void jni_YGNodeSetIsReferenceBaseline(long nativePointer, boolean isReferenceBaseline); public void setIsReferenceBaseline(boolean isReferenceBaseline) { diff --git a/java/jni/YGJNI.cpp b/java/jni/YGJNI.cpp index ea0d9d07..915876b5 100644 --- a/java/jni/YGJNI.cpp +++ b/java/jni/YGJNI.cpp @@ -359,14 +359,6 @@ void jni_YGNodeInsertChild( _jlong2YGNodeRef(nativePointer), _jlong2YGNodeRef(childPointer), index); } -void jni_YGNodeInsertSharedChild( - jlong nativePointer, - jlong childPointer, - jint index) { - YGNodeInsertSharedChild( - _jlong2YGNodeRef(nativePointer), _jlong2YGNodeRef(childPointer), index); -} - void jni_YGNodeRemoveChild(jlong nativePointer, jlong childPointer) { YGNodeRemoveChild( _jlong2YGNodeRef(nativePointer), _jlong2YGNodeRef(childPointer)); @@ -672,7 +664,6 @@ jint JNI_OnLoad(JavaVM* vm, void*) { YGMakeCriticalNativeMethod(jni_YGNodeReset), YGMakeCriticalNativeMethod(jni_YGNodeClearChildren), YGMakeCriticalNativeMethod(jni_YGNodeInsertChild), - YGMakeCriticalNativeMethod(jni_YGNodeInsertSharedChild), YGMakeCriticalNativeMethod(jni_YGNodeRemoveChild), YGMakeCriticalNativeMethod(jni_YGNodeSetIsReferenceBaseline), YGMakeCriticalNativeMethod(jni_YGNodeIsReferenceBaseline), diff --git a/java/tests/com/facebook/yoga/YogaNodeTest.java b/java/tests/com/facebook/yoga/YogaNodeTest.java index a792fe52..4b8a2ce5 100644 --- a/java/tests/com/facebook/yoga/YogaNodeTest.java +++ b/java/tests/com/facebook/yoga/YogaNodeTest.java @@ -1,9 +1,8 @@ -/* - * 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. +/** + * 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; @@ -280,29 +279,6 @@ public class YogaNodeTest { assertEquals(1, child.getChildCount()); } - @Test - public void testAddSharedChildCloneWithNewChildren() throws Exception { - YogaConfig config = new YogaConfig(); - YogaNode root = createNode(config); - YogaNode child = createNode(config); - YogaNode grandChild = createNode(config); - root.addChildAt(child, 0); - child.addChildAt(grandChild, 0); - child.setFlexDirection(YogaFlexDirection.ROW); - - YogaNode clonedChild = child.cloneWithNewChildren(); - - assertNotSame(clonedChild, child); - assertEquals(YogaFlexDirection.ROW, clonedChild.getFlexDirection()); - assertEquals(child.getFlexDirection(), clonedChild.getFlexDirection()); - assertEquals(0, clonedChild.getChildCount()); - assertEquals(1, child.getChildCount()); - - clonedChild.addSharedChildAt(grandChild, 0); - assertEquals(1, clonedChild.getChildCount()); - assertNull(grandChild.getOwner()); - } - @Test public void testCloneNodeListener() throws Exception { final AtomicBoolean onNodeClonedExecuted = new AtomicBoolean(false); diff --git a/yoga/Yoga.cpp b/yoga/Yoga.cpp index 38287e76..357e137b 100644 --- a/yoga/Yoga.cpp +++ b/yoga/Yoga.cpp @@ -402,20 +402,6 @@ void YGNodeInsertChild( node->markDirtyAndPropogate(); } -void YGNodeInsertSharedChild( - const YGNodeRef node, - const YGNodeRef child, - const uint32_t index) { - YGAssertWithNode( - node, - node->getMeasure() == nullptr, - "Cannot add child: Nodes with measure functions cannot have children."); - - node->insertChild(child, index); - child->setOwner(nullptr); - node->markDirtyAndPropogate(); -} - void YGNodeRemoveChild(const YGNodeRef owner, const YGNodeRef excludedChild) { // This algorithm is a forked variant from cloneChildrenIfNeeded in YGNode // that excludes a child. diff --git a/yoga/Yoga.h b/yoga/Yoga.h index afb4c9be..b15f8bb2 100644 --- a/yoga/Yoga.h +++ b/yoga/Yoga.h @@ -69,16 +69,6 @@ WIN_EXPORT void YGNodeInsertChild( const YGNodeRef child, const uint32_t index); -// This function inserts the child YGNodeRef as a children of the node received -// by parameter and set the Owner of the child object to null. This function is -// expected to be called when using Yoga in persistent mode in order to share a -// YGNodeRef object as a child of two different Yoga trees. The child YGNodeRef -// is expected to be referenced from its original owner and from a clone of its -// original owner. -WIN_EXPORT void YGNodeInsertSharedChild( - const YGNodeRef node, - const YGNodeRef child, - const uint32_t index); WIN_EXPORT void YGNodeRemoveChild(const YGNodeRef node, const YGNodeRef child); WIN_EXPORT void YGNodeRemoveAllChildren(const YGNodeRef node); WIN_EXPORT YGNodeRef YGNodeGetChild(const YGNodeRef node, const uint32_t index);