Rename YogaNode.parent -> YogaNode.owner

Summary:
In the persistent version of Yoga, a YogaNode can be shared between two YogaTrees, that means that a YogaNode could have more than one Parent at one point in time. That's why the concept of Parent of a YogaNode is not a 1-1 relationship anymore.
This diff changes the semantic of Parent of a YogaNode to Owner of a Yoga Node. CC sebmarkbage and priteshrnandgaonkar for more context.

Technically this diff renames the field YogaNode.parent to YogaNode.owner (and every internal field, Getter and Setter that is related to parent)

Note that as part of this diff I also modified the CSSLayoutDEPRECATED version of Yoga in order to keep compatibility with the C++ implementation.

Reviewed By: priteshrnandgaonkar

Differential Revision: D7352778

fbshipit-source-id: dcf1af5e72bfc3063b5c4bda197d7952a9194768
This commit is contained in:
David Vacca
2018-04-01 18:27:06 -07:00
committed by Facebook Github Bot
parent 17901ea5c2
commit f0edefdbb7
12 changed files with 344 additions and 331 deletions

View File

@@ -152,7 +152,7 @@ static inline YGConfigRef _jlong2YGConfigRef(jlong addr) {
static YGNodeRef YGJNIOnNodeClonedFunc(
YGNodeRef oldNode,
YGNodeRef parent,
YGNodeRef owner,
int childIndex) {
auto config = oldNode->getConfig();
if (!config) {
@@ -171,7 +171,7 @@ static YGNodeRef YGJNIOnNodeClonedFunc(
auto newNode = onNodeClonedFunc(
javaConfig->get(),
YGNodeJobject(oldNode)->lockLocal(),
YGNodeJobject(parent)->lockLocal(),
YGNodeJobject(owner)->lockLocal(),
childIndex);
static auto replaceChild = findClassStatic("com/facebook/yoga/YogaNode")
@@ -180,7 +180,7 @@ static YGNodeRef YGJNIOnNodeClonedFunc(
jint)>("replaceChild");
jlong newNodeNativePointer = replaceChild(
YGNodeJobject(parent)->lockLocal(),
YGNodeJobject(owner)->lockLocal(),
newNode,
childIndex);