diff --git a/android/src/main/java/com/facebook/yoga/android/YogaLayout.java b/android/src/main/java/com/facebook/yoga/android/YogaLayout.java index 90d61af8..3c981b58 100644 --- a/android/src/main/java/com/facebook/yoga/android/YogaLayout.java +++ b/android/src/main/java/com/facebook/yoga/android/YogaLayout.java @@ -46,14 +46,14 @@ import java.util.Map; * * @@ -262,11 +262,11 @@ public class YogaLayout extends ViewGroup { return; } - final YogaNode parent = node.getParent(); + final YogaNode owner = node.getOwner(); - for (int i = 0; i < parent.getChildCount(); i++) { - if (parent.getChildAt(i).equals(node)) { - parent.removeChildAt(i); + for (int i = 0; i < owner.getChildCount(); i++) { + if (owner.getChildAt(i).equals(node)) { + owner.removeChildAt(i); break; } } @@ -315,7 +315,7 @@ public class YogaLayout extends ViewGroup { @Override protected void onLayout(boolean changed, int l, int t, int r, int b) { - // Either we are a root of a tree, or this function is called by our parent's onLayout, in which + // Either we are a root of a tree, or this function is called by our owner's onLayout, in which // case our r-l and b-t are the size of our node. if (!(getParent() instanceof YogaLayout)) { createLayout( @@ -699,7 +699,7 @@ public class YogaLayout extends ViewGroup { /** * Constructs a set of layout params, given width and height specs. In this case, we can set * the {@code yoga:width} and {@code yoga:height} if we are given them explicitly. If other - * options (such as {@code match_parent} or {@code wrap_content} are given, then the parent + * options (such as {@code match_owner} or {@code wrap_content} are given, then the owner * LayoutParams will store them, and we deal with them during layout. (see * {@link YogaLayout#createLayout}) * @@ -773,9 +773,9 @@ public class YogaLayout extends ViewGroup { * {@code View}'s measure function. * * @param node The yoga node to measure - * @param width The suggested width from the parent + * @param width The suggested width from the owner * @param widthMode The type of suggestion for the width - * @param height The suggested height from the parent + * @param height The suggested height from the owner * @param heightMode The type of suggestion for the height * @return A measurement output ({@code YogaMeasureOutput}) for the node */ diff --git a/java/com/facebook/yoga/YogaNode.java b/java/com/facebook/yoga/YogaNode.java index 577ee3fb..ae5165e6 100644 --- a/java/com/facebook/yoga/YogaNode.java +++ b/java/com/facebook/yoga/YogaNode.java @@ -29,7 +29,7 @@ public class YogaNode implements Cloneable { */ static native int jni_YGNodeGetInstanceCount(); - private YogaNode mParent; + private YogaNode mOwner; private List mChildren; private YogaMeasureFunction mMeasureFunction; private YogaBaselineFunction mBaselineFunction; @@ -152,7 +152,7 @@ public class YogaNode implements Cloneable { private native void jni_YGNodeInsertChild(long nativePointer, long childPointer, int index); public void addChildAt(YogaNode child, int i) { - if (child.mParent != null) { + if (child.mOwner != null) { throw new IllegalStateException("Child already has a parent, it must be removed first."); } @@ -160,7 +160,7 @@ public class YogaNode implements Cloneable { mChildren = new ArrayList<>(4); } mChildren.add(i, child); - child.mParent = this; + child.mOwner = this; jni_YGNodeInsertChild(mNativePointer, child.mNativePointer, i); } @@ -180,15 +180,23 @@ public class YogaNode implements Cloneable { public YogaNode removeChildAt(int i) { final YogaNode child = mChildren.remove(i); - child.mParent = null; + child.mOwner = null; jni_YGNodeRemoveChild(mNativePointer, child.mNativePointer); return child; } + /** + * @returns the {@link YogaNode} that owns this {@link YogaNode}. + * The owner is used to identify the YogaTree that a {@link YogaNode} belongs + * to. + * This method will return the parent of the {@link YogaNode} when the + * {@link YogaNode} only belongs to one YogaTree or null when the + * {@link YogaNode} is shared between two or more YogaTrees. + */ @Nullable public - YogaNode getParent() { - return mParent; + YogaNode getOwner() { + return mOwner; } public int indexOf(YogaNode child) { diff --git a/java/jni/YGJNI.cpp b/java/jni/YGJNI.cpp index 7f92ba8e..b303ce22 100644 --- a/java/jni/YGJNI.cpp +++ b/java/jni/YGJNI.cpp @@ -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); diff --git a/java/tests/com/facebook/yoga/YogaNodeTest.java b/java/tests/com/facebook/yoga/YogaNodeTest.java index 49c26d46..a502f43d 100644 --- a/java/tests/com/facebook/yoga/YogaNodeTest.java +++ b/java/tests/com/facebook/yoga/YogaNodeTest.java @@ -258,7 +258,7 @@ public class YogaNodeTest { config.setOnCloneNode( new YogaNodeCloneFunction() { @Override - public YogaNode cloneNode(YogaNode oldNode, YogaNode parent, int childIndex) { + public YogaNode cloneNode(YogaNode oldNode, YogaNode owner, int childIndex) { try { onNodeClonedExecuted.set(true); return oldNode.clone(); @@ -295,7 +295,7 @@ public class YogaNodeTest { config.setOnCloneNode( new YogaNodeCloneFunction() { @Override - public YogaNode cloneNode(YogaNode oldNode, YogaNode parent, int childIndex) { + public YogaNode cloneNode(YogaNode oldNode, YogaNode owner, int childIndex) { try { return oldNode.clone(); } catch (CloneNotSupportedException ex) { diff --git a/tests/YGTreeMutationTest.cpp b/tests/YGTreeMutationTest.cpp index 0f62b29f..273f22ac 100644 --- a/tests/YGTreeMutationTest.cpp +++ b/tests/YGTreeMutationTest.cpp @@ -23,17 +23,17 @@ TEST(YogaTest, set_children_adds_children_to_parent) { YGNodeRef const root = YGNodeNew(); YGNodeRef const root_child0 = YGNodeNew(); YGNodeRef const root_child1 = YGNodeNew(); - + YGNodeSetChildren(root, {root_child0, root_child1}); - + const std::vector children = getChildren(root); const std::vector expectedChildren = {root_child0, root_child1}; ASSERT_EQ(children, expectedChildren); - - const std::vector parents = {YGNodeGetParent(root_child0), YGNodeGetParent(root_child1)}; - const std::vector expectedParents = {root, root}; - ASSERT_EQ(parents, expectedParents); - + + const std::vector owners = {YGNodeGetOwner(root_child0), YGNodeGetOwner(root_child1)}; + const std::vector expectedOwners = {root, root}; + ASSERT_EQ(owners, expectedOwners); + YGNodeFreeRecursive(root); } @@ -41,18 +41,18 @@ TEST(YogaTest, set_children_to_empty_removes_old_children) { YGNodeRef const root = YGNodeNew(); YGNodeRef const root_child0 = YGNodeNew(); YGNodeRef const root_child1 = YGNodeNew(); - + YGNodeSetChildren(root, {root_child0, root_child1}); YGNodeSetChildren(root, {}); - + const std::vector children = getChildren(root); const std::vector expectedChildren = {}; ASSERT_EQ(children, expectedChildren); - - const std::vector parents = {YGNodeGetParent(root_child0), YGNodeGetParent(root_child1)}; - const std::vector expectedParents = {nullptr, nullptr}; - ASSERT_EQ(parents, expectedParents); - + + const std::vector owners = {YGNodeGetOwner(root_child0), YGNodeGetOwner(root_child1)}; + const std::vector expectedOwners = {nullptr, nullptr}; + ASSERT_EQ(owners, expectedOwners); + YGNodeFreeRecursive(root); } @@ -60,22 +60,22 @@ TEST(YogaTest, set_children_replaces_non_common_children) { YGNodeRef const root = YGNodeNew(); YGNodeRef const root_child0 = YGNodeNew(); YGNodeRef const root_child1 = YGNodeNew(); - + YGNodeSetChildren(root, {root_child0, root_child1}); - + YGNodeRef const root_child2 = YGNodeNew(); YGNodeRef const root_child3 = YGNodeNew(); - + YGNodeSetChildren(root, {root_child2, root_child3}); const std::vector children = getChildren(root); const std::vector expectedChildren = {root_child2, root_child3}; ASSERT_EQ(children, expectedChildren); - - const std::vector parents = {YGNodeGetParent(root_child0), YGNodeGetParent(root_child1)}; - const std::vector expectedParents = {nullptr, nullptr}; - ASSERT_EQ(parents, expectedParents); - + + const std::vector owners = {YGNodeGetOwner(root_child0), YGNodeGetOwner(root_child1)}; + const std::vector expectedOwners = {nullptr, nullptr}; + ASSERT_EQ(owners, expectedOwners); + YGNodeFreeRecursive(root); YGNodeFree(root_child0); YGNodeFree(root_child1); @@ -86,26 +86,26 @@ TEST(YogaTest, set_children_keeps_and_reorders_common_children) { YGNodeRef const root_child0 = YGNodeNew(); YGNodeRef const root_child1 = YGNodeNew(); YGNodeRef const root_child2 = YGNodeNew(); - + YGNodeSetChildren(root, {root_child0, root_child1, root_child2}); - + YGNodeRef const root_child3 = YGNodeNew(); - + YGNodeSetChildren(root, {root_child2, root_child1, root_child3}); - + const std::vector children = getChildren(root); const std::vector expectedChildren = {root_child2, root_child1, root_child3}; ASSERT_EQ(children, expectedChildren); - - const std::vector parents = { - YGNodeGetParent(root_child0), - YGNodeGetParent(root_child1), - YGNodeGetParent(root_child2), - YGNodeGetParent(root_child3) + + const std::vector owners = { + YGNodeGetOwner(root_child0), + YGNodeGetOwner(root_child1), + YGNodeGetOwner(root_child2), + YGNodeGetOwner(root_child3) }; - const std::vector expectedParents = {nullptr, root, root, root}; - ASSERT_EQ(parents, expectedParents); - + const std::vector expectedOwners = {nullptr, root, root, root}; + ASSERT_EQ(owners, expectedOwners); + YGNodeFreeRecursive(root); YGNodeFree(root_child0); } diff --git a/yoga/Utils.h b/yoga/Utils.h index 7190fd7f..34284d2c 100644 --- a/yoga/Utils.h +++ b/yoga/Utils.h @@ -45,7 +45,7 @@ struct YGCollectFlexItemsRowValues { float remainingFreeSpace; // The size of the mainDim for the row after considering size, padding, margin // and border of flex items. This is used to calculate maxLineDim after going - // through all the rows to decide on the main axis size of parent. + // through all the rows to decide on the main axis size of owner. float mainDim; // The size of the crossDim for the row after considering size, padding, // margin and border of flex items. Used for calculating containers crossSize. @@ -109,7 +109,7 @@ inline bool YGFlexDirectionIsRow(const YGFlexDirection flexDirection) { flexDirection == YGFlexDirectionRowReverse; } -inline YGFloatOptional YGResolveValue(const YGValue value, const float parentSize) { +inline YGFloatOptional YGResolveValue(const YGValue value, const float ownerSize) { switch (value.unit) { case YGUnitUndefined: case YGUnitAuto: @@ -118,7 +118,7 @@ inline YGFloatOptional YGResolveValue(const YGValue value, const float parentSiz return YGFloatOptional(value.value); case YGUnitPercent: return YGFloatOptional( - static_cast(value.value * parentSize * 0.01)); + static_cast(value.value * ownerSize * 0.01)); } return YGFloatOptional(); } @@ -144,6 +144,6 @@ inline YGFlexDirection YGResolveFlexDirection( static inline float YGResolveValueMargin( const YGValue value, - const float parentSize) { - return value.unit == YGUnitAuto ? 0 : YGUnwrapFloatOptional(YGResolveValue(value, parentSize)); + const float ownerSize) { + return value.unit == YGUnitAuto ? 0 : YGUnwrapFloatOptional(YGResolveValue(value, ownerSize)); } diff --git a/yoga/YGLayout.cpp b/yoga/YGLayout.cpp index 4d798476..117638d7 100644 --- a/yoga/YGLayout.cpp +++ b/yoga/YGLayout.cpp @@ -22,7 +22,7 @@ YGLayout::YGLayout() computedFlexBasis(YGUndefined), hadOverflow(false), generationCount(0), - lastParentDirection((YGDirection)-1), + lastOwnerDirection((YGDirection)-1), nextCachedMeasurementsIndex(0), cachedMeasurements(), measuredDimensions(kYGDefaultDimensionValues), @@ -37,7 +37,7 @@ bool YGLayout::operator==(YGLayout layout) const { YGFloatArrayEqual(border, layout.border) && YGFloatArrayEqual(padding, layout.padding) && direction == layout.direction && hadOverflow == layout.hadOverflow && - lastParentDirection == layout.lastParentDirection && + lastOwnerDirection == layout.lastOwnerDirection && nextCachedMeasurementsIndex == layout.nextCachedMeasurementsIndex && cachedLayout == layout.cachedLayout; diff --git a/yoga/YGLayout.h b/yoga/YGLayout.h index cfe559f6..81cc6631 100644 --- a/yoga/YGLayout.h +++ b/yoga/YGLayout.h @@ -23,7 +23,7 @@ struct YGLayout { // Instead of recomputing the entire layout every single time, we // cache some information to break early when nothing changed uint32_t generationCount; - YGDirection lastParentDirection; + YGDirection lastOwnerDirection; uint32_t nextCachedMeasurementsIndex; std::array diff --git a/yoga/YGNode.cpp b/yoga/YGNode.cpp index f15105f2..01be3a7c 100644 --- a/yoga/YGNode.cpp +++ b/yoga/YGNode.cpp @@ -49,8 +49,8 @@ uint32_t YGNode::getLineIndex() const { return lineIndex_; } -YGNodeRef YGNode::getParent() const { - return parent_; +YGNodeRef YGNode::getOwner() const { + return owner_; } YGVector YGNode::getChildren() const { @@ -237,8 +237,8 @@ void YGNode::setLineIndex(uint32_t lineIndex) { lineIndex_ = lineIndex; } -void YGNode::setParent(YGNodeRef parent) { - parent_ = parent; +void YGNode::setOwner(YGNodeRef owner) { + owner_ = owner; } void YGNode::setChildren(const YGVector& children) { @@ -305,8 +305,8 @@ void YGNode::setLayoutPadding(float padding, int index) { layout_.padding[index] = padding; } -void YGNode::setLayoutLastParentDirection(YGDirection direction) { - layout_.lastParentDirection = direction; +void YGNode::setLayoutLastOwnerDirection(YGDirection direction) { + layout_.lastOwnerDirection = direction; } void YGNode::setLayoutComputedFlexBasis(float computedFlexBasis) { @@ -347,11 +347,11 @@ void YGNode::setPosition( const YGDirection direction, const float mainSize, const float crossSize, - const float parentWidth) { + const float ownerWidth) { /* Root nodes should be always layouted as LTR, so we don't return negative * values. */ const YGDirection directionRespectingRoot = - parent_ != nullptr ? direction : YGDirectionLTR; + owner_ != nullptr ? direction : YGDirectionLTR; const YGFlexDirection mainAxis = YGResolveFlexDirection(style_.flexDirection, directionRespectingRoot); const YGFlexDirection crossAxis = @@ -361,16 +361,16 @@ void YGNode::setPosition( const float relativePositionCross = relativePosition(crossAxis, crossSize); setLayoutPosition( - getLeadingMargin(mainAxis, parentWidth) + relativePositionMain, + getLeadingMargin(mainAxis, ownerWidth) + relativePositionMain, leading[mainAxis]); setLayoutPosition( - getTrailingMargin(mainAxis, parentWidth) + relativePositionMain, + getTrailingMargin(mainAxis, ownerWidth) + relativePositionMain, trailing[mainAxis]); setLayoutPosition( - getLeadingMargin(crossAxis, parentWidth) + relativePositionCross, + getLeadingMargin(crossAxis, ownerWidth) + relativePositionCross, leading[crossAxis]); setLayoutPosition( - getTrailingMargin(crossAxis, parentWidth) + relativePositionCross, + getTrailingMargin(crossAxis, ownerWidth) + relativePositionCross, trailing[crossAxis]); } @@ -385,7 +385,7 @@ YGNode::YGNode() style_(YGStyle()), layout_(YGLayout()), lineIndex_(0), - parent_(nullptr), + owner_(nullptr), children_(YGVector()), nextChild_(nullptr), config_(nullptr), @@ -403,7 +403,7 @@ YGNode::YGNode(const YGNode& node) style_(node.style_), layout_(node.layout_), lineIndex_(node.lineIndex_), - parent_(node.parent_), + owner_(node.owner_), children_(node.children_), nextChild_(node.nextChild_), config_(node.config_), @@ -425,7 +425,7 @@ YGNode::YGNode( YGStyle style, const YGLayout& layout, uint32_t lineIndex, - YGNodeRef parent, + YGNodeRef owner, const YGVector& children, YGNodeRef nextChild, YGConfigRef config, @@ -441,7 +441,7 @@ YGNode::YGNode( style_(style), layout_(layout), lineIndex_(lineIndex), - parent_(parent), + owner_(owner), children_(children), nextChild_(nextChild), config_(config), @@ -467,7 +467,7 @@ YGNode& YGNode::operator=(const YGNode& node) { style_ = node.style_; layout_ = node.layout_; lineIndex_ = node.getLineIndex(); - parent_ = node.getParent(); + owner_ = node.getOwner(); children_ = node.getChildren(); nextChild_ = node.getNextChild(); config_ = node.getConfig(); @@ -518,9 +518,9 @@ void YGNode::resolveDimension() { } } -YGDirection YGNode::resolveDirection(const YGDirection parentDirection) { +YGDirection YGNode::resolveDirection(const YGDirection ownerDirection) { if (style_.direction == YGDirectionInherit) { - return parentDirection > YGDirectionInherit ? parentDirection + return ownerDirection > YGDirectionInherit ? ownerDirection : YGDirectionLTR; } else { return style_.direction; @@ -550,10 +550,10 @@ void YGNode::cloneChildrenIfNeeded() { } const YGNodeRef firstChild = children_.front(); - if (firstChild->getParent() == this) { - // If the first child has this node as its parent, we assume that it is + if (firstChild->getOwner() == this) { + // If the first child has this node as its owner, we assume that it is // already unique. We can do this because if we have it has a child, that - // means that its parent was at some point cloned which made that subtree + // means that its owner was at some point cloned which made that subtree // immutable. We also assume that all its sibling are cloned as well. return; } @@ -569,7 +569,7 @@ void YGNode::cloneChildrenIfNeeded() { newChild = YGNodeClone(oldChild); } replaceChild(newChild, i); - newChild->setParent(this); + newChild->setOwner(this); } } @@ -577,8 +577,8 @@ void YGNode::markDirtyAndPropogate() { if (!isDirty_) { setDirty(true); setLayoutComputedFlexBasis(YGUndefined); - if (parent_) { - parent_->markDirtyAndPropogate(); + if (owner_) { + owner_->markDirtyAndPropogate(); } } } @@ -592,7 +592,7 @@ void YGNode::markDirtyAndPropogateDownwards() { float YGNode::resolveFlexGrow() { // Root nodes flexGrow should always be 0 - if (parent_ == nullptr) { + if (owner_ == nullptr) { return 0.0; } if (!style_.flexGrow.isUndefined()) { @@ -605,7 +605,7 @@ float YGNode::resolveFlexGrow() { } float YGNode::resolveFlexShrink() { - if (parent_ == nullptr) { + if (owner_ == nullptr) { return 0.0; } if (!style_.flexShrink.isUndefined()) { diff --git a/yoga/YGNode.h b/yoga/YGNode.h index 0ed05d7e..02afb830 100644 --- a/yoga/YGNode.h +++ b/yoga/YGNode.h @@ -23,7 +23,7 @@ struct YGNode { YGStyle style_; YGLayout layout_; uint32_t lineIndex_; - YGNodeRef parent_; + YGNodeRef owner_; YGVector children_; YGNodeRef nextChild_; YGConfigRef config_; @@ -49,7 +49,7 @@ struct YGNode { YGStyle style, const YGLayout& layout, uint32_t lineIndex, - YGNodeRef parent, + YGNodeRef owner, const YGVector& children, YGNodeRef nextChild, YGConfigRef config, @@ -69,7 +69,12 @@ struct YGNode { // For Performance reasons passing as reference. YGLayout& getLayout(); uint32_t getLineIndex() const; - YGNodeRef getParent() const; + // returns the YGNodeRef that owns this YGNode. An owner is used to identify + // the YogaTree that a YGNode belongs to. + // This method will return the parent of the YGNode when a YGNode only belongs + // to one YogaTree or nullptr when the YGNode is shared between two or more + // YogaTrees. + YGNodeRef getOwner() const; YGVector getChildren() const; uint32_t getChildrenCount() const; YGNodeRef getChild(uint32_t index) const; @@ -111,12 +116,12 @@ struct YGNode { void setStyleAlignContent(YGAlign alignContent); void setLayout(const YGLayout& layout); void setLineIndex(uint32_t lineIndex); - void setParent(YGNodeRef parent); + void setOwner(YGNodeRef owner); void setChildren(const YGVector& children); void setNextChild(YGNodeRef nextChild); void setConfig(YGConfigRef config); void setDirty(bool isDirty); - void setLayoutLastParentDirection(YGDirection direction); + void setLayoutLastOwnerDirection(YGDirection direction); void setLayoutComputedFlexBasis(float computedFlexBasis); void setLayoutComputedFlexBasisGeneration( uint32_t computedFlexBasisGeneration); @@ -132,7 +137,7 @@ struct YGNode { const YGDirection direction, const float mainSize, const float crossSize, - const float parentWidth); + const float ownerWidth); void setAndPropogateUseLegacyFlag(bool useLegacyFlag); void setLayoutDoesLegacyFlagAffectsLayout(bool doesLegacyFlagAffectsLayout); void setLayoutDidUseLegacyFlag(bool didUseLegacyFlag); @@ -143,7 +148,7 @@ struct YGNode { YGValue marginTrailingValue(const YGFlexDirection axis) const; YGValue resolveFlexBasisPtr() const; void resolveDimension(); - YGDirection resolveDirection(const YGDirection parentDirection); + YGDirection resolveDirection(const YGDirection ownerDirection); void clearChildren(); /// Replaces the occurrences of oldChild with newChild void replaceChild(YGNodeRef oldChild, YGNodeRef newChild); diff --git a/yoga/Yoga.cpp b/yoga/Yoga.cpp index b597727b..2e5979a2 100644 --- a/yoga/Yoga.cpp +++ b/yoga/Yoga.cpp @@ -257,7 +257,7 @@ YGNodeRef YGNodeClone(YGNodeRef oldNode) { node != nullptr, "Could not allocate memory for node"); gNodeInstanceCount++; - node->setParent(nullptr); + node->setOwner(nullptr); return node; } @@ -278,7 +278,7 @@ static YGNodeRef YGNodeDeepClone(YGNodeRef oldNode) { YGNodeRef childNode = nullptr; for (auto& item : oldNode->getChildren()) { childNode = YGNodeDeepClone(item); - childNode->setParent(node); + childNode->setOwner(node); vec.push_back(childNode); } node->setChildren(vec); @@ -295,15 +295,15 @@ static YGNodeRef YGNodeDeepClone(YGNodeRef oldNode) { } void YGNodeFree(const YGNodeRef node) { - if (YGNodeRef parent = node->getParent()) { - parent->removeChild(node); - node->setParent(nullptr); + if (YGNodeRef owner = node->getOwner()) { + owner->removeChild(node); + node->setOwner(nullptr); } const uint32_t childCount = YGNodeGetChildCount(node); for (uint32_t i = 0; i < childCount; i++) { const YGNodeRef child = YGNodeGetChild(node, i); - child->setParent(nullptr); + child->setOwner(nullptr); } node->clearChildren(); @@ -325,7 +325,7 @@ static void YGConfigFreeRecursive(const YGNodeRef root) { void YGNodeFreeRecursive(const YGNodeRef root) { while (YGNodeGetChildCount(root) > 0) { const YGNodeRef child = YGNodeGetChild(root, 0); - if (child->getParent() != root) { + if (child->getOwner() != root) { // Don't free shared nodes that we don't own. break; } @@ -341,8 +341,8 @@ void YGNodeReset(const YGNodeRef node) { "Cannot reset a node which still has children attached"); YGAssertWithNode( node, - node->getParent() == nullptr, - "Cannot reset a node still attached to a parent"); + node->getOwner() == nullptr, + "Cannot reset a node still attached to a owner"); node->clearChildren(); @@ -391,8 +391,8 @@ void YGConfigCopy(const YGConfigRef dest, const YGConfigRef src) { void YGNodeInsertChild(const YGNodeRef node, const YGNodeRef child, const uint32_t index) { YGAssertWithNode( node, - child->getParent() == nullptr, - "Child already has a parent, it must be removed first."); + child->getOwner() == nullptr, + "Child already has a owner, it must be removed first."); YGAssertWithNode( node, node->getMeasure() == nullptr, @@ -400,28 +400,28 @@ void YGNodeInsertChild(const YGNodeRef node, const YGNodeRef child, const uint32 node->cloneChildrenIfNeeded(); node->insertChild(child, index); - child->setParent(node); + child->setOwner(node); node->markDirtyAndPropogate(); } -void YGNodeRemoveChild(const YGNodeRef parent, const YGNodeRef excludedChild) { +void YGNodeRemoveChild(const YGNodeRef owner, const YGNodeRef excludedChild) { // This algorithm is a forked variant from cloneChildrenIfNeeded in YGNode // that excludes a child. - const uint32_t childCount = YGNodeGetChildCount(parent); + const uint32_t childCount = YGNodeGetChildCount(owner); if (childCount == 0) { // This is an empty set. Nothing to remove. return; } - const YGNodeRef firstChild = YGNodeGetChild(parent, 0); - if (firstChild->getParent() == parent) { - // If the first child has this node as its parent, we assume that it is already unique. + const YGNodeRef firstChild = YGNodeGetChild(owner, 0); + if (firstChild->getOwner() == owner) { + // If the first child has this node as its owner, we assume that it is already unique. // We can now try to delete a child in this list. - if (parent->removeChild(excludedChild)) { + if (owner->removeChild(excludedChild)) { excludedChild->setLayout( YGNode().getLayout()); // layout is no longer valid - excludedChild->setParent(nullptr); - parent->markDirtyAndPropogate(); + excludedChild->setOwner(nullptr); + owner->markDirtyAndPropogate(); } return; } @@ -429,98 +429,98 @@ void YGNodeRemoveChild(const YGNodeRef parent, const YGNodeRef excludedChild) { // We don't want to simply clone all children, because then the host will need to free // the clone of the child that was just deleted. const YGCloneNodeFunc cloneNodeCallback = - parent->getConfig()->cloneNodeCallback; + owner->getConfig()->cloneNodeCallback; uint32_t nextInsertIndex = 0; for (uint32_t i = 0; i < childCount; i++) { - const YGNodeRef oldChild = parent->getChild(i); + const YGNodeRef oldChild = owner->getChild(i); if (excludedChild == oldChild) { - // Ignore the deleted child. Don't reset its layout or parent since it is still valid - // in the other parent. However, since this parent has now changed, we need to mark it + // Ignore the deleted child. Don't reset its layout or owner since it is still valid + // in the other owner. However, since this owner has now changed, we need to mark it // as dirty. - parent->markDirtyAndPropogate(); + owner->markDirtyAndPropogate(); continue; } YGNodeRef newChild = nullptr; if (cloneNodeCallback) { - newChild = cloneNodeCallback(oldChild, parent, nextInsertIndex); + newChild = cloneNodeCallback(oldChild, owner, nextInsertIndex); } if (newChild == nullptr) { newChild = YGNodeClone(oldChild); } - parent->replaceChild(newChild, nextInsertIndex); - newChild->setParent(parent); + owner->replaceChild(newChild, nextInsertIndex); + newChild->setOwner(owner); nextInsertIndex++; } while (nextInsertIndex < childCount) { - parent->removeChild(nextInsertIndex); + owner->removeChild(nextInsertIndex); nextInsertIndex++; } } -void YGNodeRemoveAllChildren(const YGNodeRef parent) { - const uint32_t childCount = YGNodeGetChildCount(parent); +void YGNodeRemoveAllChildren(const YGNodeRef owner) { + const uint32_t childCount = YGNodeGetChildCount(owner); if (childCount == 0) { // This is an empty set already. Nothing to do. return; } - const YGNodeRef firstChild = YGNodeGetChild(parent, 0); - if (firstChild->getParent() == parent) { - // If the first child has this node as its parent, we assume that this child set is unique. + const YGNodeRef firstChild = YGNodeGetChild(owner, 0); + if (firstChild->getOwner() == owner) { + // If the first child has this node as its owner, we assume that this child set is unique. for (uint32_t i = 0; i < childCount; i++) { - const YGNodeRef oldChild = YGNodeGetChild(parent, i); + const YGNodeRef oldChild = YGNodeGetChild(owner, i); oldChild->setLayout(YGNode().getLayout()); // layout is no longer valid - oldChild->setParent(nullptr); + oldChild->setOwner(nullptr); } - parent->clearChildren(); - parent->markDirtyAndPropogate(); + owner->clearChildren(); + owner->markDirtyAndPropogate(); return; } // Otherwise, we are not the owner of the child set. We don't have to do anything to clear it. - parent->setChildren(YGVector()); - parent->markDirtyAndPropogate(); + owner->setChildren(YGVector()); + owner->markDirtyAndPropogate(); } -static void YGNodeSetChildrenInternal(YGNodeRef const parent, const std::vector &children) +static void YGNodeSetChildrenInternal(YGNodeRef const owner, const std::vector &children) { - if (!parent) { + if (!owner) { return; } if (children.size() == 0) { - if (YGNodeGetChildCount(parent) > 0) { - for (YGNodeRef const child : parent->getChildren()) { + if (YGNodeGetChildCount(owner) > 0) { + for (YGNodeRef const child : owner->getChildren()) { child->setLayout(YGLayout()); - child->setParent(nullptr); + child->setOwner(nullptr); } - parent->setChildren(YGVector()); - parent->markDirtyAndPropogate(); + owner->setChildren(YGVector()); + owner->markDirtyAndPropogate(); } } else { - if (YGNodeGetChildCount(parent) > 0) { - for (YGNodeRef const oldChild : parent->getChildren()) { + if (YGNodeGetChildCount(owner) > 0) { + for (YGNodeRef const oldChild : owner->getChildren()) { // Our new children may have nodes in common with the old children. We don't reset these common nodes. if (std::find(children.begin(), children.end(), oldChild) == children.end()) { oldChild->setLayout(YGLayout()); - oldChild->setParent(nullptr); + oldChild->setOwner(nullptr); } } } - parent->setChildren(children); + owner->setChildren(children); for (YGNodeRef child : children) { - child->setParent(parent); + child->setOwner(owner); } - parent->markDirtyAndPropogate(); + owner->markDirtyAndPropogate(); } } -void YGNodeSetChildren(YGNodeRef const parent, const YGNodeRef c[], const uint32_t count) { +void YGNodeSetChildren(YGNodeRef const owner, const YGNodeRef c[], const uint32_t count) { const YGVector children = {c, c + count}; - YGNodeSetChildrenInternal(parent, children); + YGNodeSetChildrenInternal(owner, children); } -void YGNodeSetChildren(YGNodeRef const parent, const std::vector &children) +void YGNodeSetChildren(YGNodeRef const owner, const std::vector &children) { - YGNodeSetChildrenInternal(parent, children); + YGNodeSetChildrenInternal(owner, children); } YGNodeRef YGNodeGetChild(const YGNodeRef node, const uint32_t index) { @@ -534,8 +534,8 @@ uint32_t YGNodeGetChildCount(const YGNodeRef node) { return static_cast(node->getChildren().size()); } -YGNodeRef YGNodeGetParent(const YGNodeRef node) { - return node->getParent(); +YGNodeRef YGNodeGetOwner(const YGNodeRef node) { + return node->getOwner(); } void YGNodeMarkDirty(const YGNodeRef node) { @@ -947,11 +947,11 @@ uint32_t gCurrentGenerationCount = 0; bool YGLayoutNodeInternal(const YGNodeRef node, const float availableWidth, const float availableHeight, - const YGDirection parentDirection, + const YGDirection ownerDirection, const YGMeasureMode widthMeasureMode, const YGMeasureMode heightMeasureMode, - const float parentWidth, - const float parentHeight, + const float ownerWidth, + const float ownerHeight, const bool performLayout, const char *reason, const YGConfigRef config); @@ -1069,7 +1069,7 @@ static inline float YGNodeDimWithMargin(const YGNodeRef node, static inline bool YGNodeIsStyleDimDefined(const YGNodeRef node, const YGFlexDirection axis, - const float parentSize) { + const float ownerSize) { bool isUndefined = YGFloatIsUndefined(node->getResolvedDimension(dim[axis]).value); return !( @@ -1080,7 +1080,7 @@ static inline bool YGNodeIsStyleDimDefined(const YGNodeRef node, (node->getResolvedDimension(dim[axis]).unit == YGUnitPercent && !isUndefined && (node->getResolvedDimension(dim[axis]).value < 0.0f || - YGFloatIsUndefined(parentSize)))); + YGFloatIsUndefined(ownerSize)))); } static inline bool YGNodeIsLayoutDimDefined(const YGNodeRef node, const YGFlexDirection axis) { @@ -1145,14 +1145,14 @@ static void YGNodeSetChildTrailingPosition(const YGNodeRef node, static void YGConstrainMaxSizeForMode(const YGNodeRef node, const enum YGFlexDirection axis, - const float parentAxisSize, - const float parentWidth, + const float ownerAxisSize, + const float ownerWidth, YGMeasureMode *mode, float *size) { const float maxSize = YGUnwrapFloatOptional(YGResolveValue( - node->getStyle().maxDimensions[dim[axis]], parentAxisSize)) + - node->getMarginForAxis(axis, parentWidth); + node->getStyle().maxDimensions[dim[axis]], ownerAxisSize)) + + node->getMarginForAxis(axis, ownerWidth); switch (*mode) { case YGMeasureModeExactly: case YGMeasureModeAtMost: @@ -1172,8 +1172,8 @@ static void YGNodeComputeFlexBasisForChild(const YGNodeRef node, const float width, const YGMeasureMode widthMode, const float height, - const float parentWidth, - const float parentHeight, + const float ownerWidth, + const float ownerHeight, const YGMeasureMode heightMode, const YGDirection direction, const YGConfigRef config) { @@ -1181,7 +1181,7 @@ static void YGNodeComputeFlexBasisForChild(const YGNodeRef node, YGResolveFlexDirection(node->getStyle().flexDirection, direction); const bool isMainAxisRow = YGFlexDirectionIsRow(mainAxis); const float mainAxisSize = isMainAxisRow ? width : height; - const float mainAxisParentSize = isMainAxisRow ? parentWidth : parentHeight; + const float mainAxisownerSize = isMainAxisRow ? ownerWidth : ownerHeight; float childWidth; float childHeight; @@ -1189,10 +1189,10 @@ static void YGNodeComputeFlexBasisForChild(const YGNodeRef node, YGMeasureMode childHeightMeasureMode; const float resolvedFlexBasis = - YGUnwrapFloatOptional(YGResolveValue(child->resolveFlexBasisPtr(), mainAxisParentSize)); - const bool isRowStyleDimDefined = YGNodeIsStyleDimDefined(child, YGFlexDirectionRow, parentWidth); + YGUnwrapFloatOptional(YGResolveValue(child->resolveFlexBasisPtr(), mainAxisownerSize)); + const bool isRowStyleDimDefined = YGNodeIsStyleDimDefined(child, YGFlexDirectionRow, ownerWidth); const bool isColumnStyleDimDefined = - YGNodeIsStyleDimDefined(child, YGFlexDirectionColumn, parentHeight); + YGNodeIsStyleDimDefined(child, YGFlexDirectionColumn, ownerHeight); if (!YGFloatIsUndefined(resolvedFlexBasis) && !YGFloatIsUndefined(mainAxisSize)) { if (YGFloatIsUndefined(child->getLayout().computedFlexBasis) || @@ -1202,21 +1202,21 @@ static void YGNodeComputeFlexBasisForChild(const YGNodeRef node, gCurrentGenerationCount)) { child->setLayoutComputedFlexBasis(YGFloatMax( resolvedFlexBasis, - YGNodePaddingAndBorderForAxis(child, mainAxis, parentWidth))); + YGNodePaddingAndBorderForAxis(child, mainAxis, ownerWidth))); } } else if (isMainAxisRow && isRowStyleDimDefined) { // The width is definite, so use that as the flex basis. child->setLayoutComputedFlexBasis(YGFloatMax( YGUnwrapFloatOptional(YGResolveValue( - child->getResolvedDimension(YGDimensionWidth), parentWidth)), - YGNodePaddingAndBorderForAxis(child, YGFlexDirectionRow, parentWidth))); + child->getResolvedDimension(YGDimensionWidth), ownerWidth)), + YGNodePaddingAndBorderForAxis(child, YGFlexDirectionRow, ownerWidth))); } else if (!isMainAxisRow && isColumnStyleDimDefined) { // The height is definite, so use that as the flex basis. child->setLayoutComputedFlexBasis(YGFloatMax( YGUnwrapFloatOptional(YGResolveValue( - child->getResolvedDimension(YGDimensionHeight), parentHeight)), + child->getResolvedDimension(YGDimensionHeight), ownerHeight)), YGNodePaddingAndBorderForAxis( - child, YGFlexDirectionColumn, parentWidth))); + child, YGFlexDirectionColumn, ownerWidth))); } else { // Compute the flex basis and hypothetical main size (i.e. the clamped // flex basis). @@ -1226,21 +1226,21 @@ static void YGNodeComputeFlexBasisForChild(const YGNodeRef node, childHeightMeasureMode = YGMeasureModeUndefined; const float marginRow = - child->getMarginForAxis(YGFlexDirectionRow, parentWidth); + child->getMarginForAxis(YGFlexDirectionRow, ownerWidth); const float marginColumn = - child->getMarginForAxis(YGFlexDirectionColumn, parentWidth); + child->getMarginForAxis(YGFlexDirectionColumn, ownerWidth); if (isRowStyleDimDefined) { childWidth = YGUnwrapFloatOptional(YGResolveValue( - child->getResolvedDimension(YGDimensionWidth), parentWidth)) + + child->getResolvedDimension(YGDimensionWidth), ownerWidth)) + marginRow; childWidthMeasureMode = YGMeasureModeExactly; } if (isColumnStyleDimDefined) { childHeight = YGUnwrapFloatOptional(YGResolveValue( - child->getResolvedDimension(YGDimensionHeight), parentHeight)) + + child->getResolvedDimension(YGDimensionHeight), ownerHeight)) + marginColumn; childHeightMeasureMode = YGMeasureModeExactly; } @@ -1306,11 +1306,11 @@ static void YGNodeComputeFlexBasisForChild(const YGNodeRef node, } YGConstrainMaxSizeForMode( - child, YGFlexDirectionRow, parentWidth, parentWidth, &childWidthMeasureMode, &childWidth); + child, YGFlexDirectionRow, ownerWidth, ownerWidth, &childWidthMeasureMode, &childWidth); YGConstrainMaxSizeForMode(child, YGFlexDirectionColumn, - parentHeight, - parentWidth, + ownerHeight, + ownerWidth, &childHeightMeasureMode, &childHeight); @@ -1321,15 +1321,15 @@ static void YGNodeComputeFlexBasisForChild(const YGNodeRef node, direction, childWidthMeasureMode, childHeightMeasureMode, - parentWidth, - parentHeight, + ownerWidth, + ownerHeight, false, "measure", config); child->setLayoutComputedFlexBasis(YGFloatMax( child->getLayout().measuredDimensions[dim[mainAxis]], - YGNodePaddingAndBorderForAxis(child, mainAxis, parentWidth))); + YGNodePaddingAndBorderForAxis(child, mainAxis, ownerWidth))); } child->setLayoutComputedFlexBasisGeneration(gCurrentGenerationCount); } @@ -1414,8 +1414,8 @@ static void YGNodeAbsoluteLayoutChild(const YGNodeRef node, childHeightMeasureMode = YGFloatIsUndefined(childHeight) ? YGMeasureModeUndefined : YGMeasureModeExactly; - // If the size of the parent is defined then try to constrain the absolute child to that size - // as well. This allows text within the absolute child to wrap to the size of its parent. + // If the size of the owner is defined then try to constrain the absolute child to that size + // as well. This allows text within the absolute child to wrap to the size of its owner. // This is the same behavior as many browsers implement. if (!isMainAxisRow && YGFloatIsUndefined(childWidth) && widthMode != YGMeasureModeUndefined && !YGFloatIsUndefined(width) && @@ -1515,8 +1515,8 @@ static void YGNodeWithMeasureFuncSetMeasuredDimensions(const YGNodeRef node, const float availableHeight, const YGMeasureMode widthMeasureMode, const YGMeasureMode heightMeasureMode, - const float parentWidth, - const float parentHeight) { + const float ownerWidth, + const float ownerHeight) { YGAssertWithNode( node, node->getMeasure() != nullptr, @@ -1548,16 +1548,16 @@ static void YGNodeWithMeasureFuncSetMeasuredDimensions(const YGNodeRef node, node, YGFlexDirectionRow, availableWidth - marginAxisRow, - parentWidth, - parentWidth), + ownerWidth, + ownerWidth), YGDimensionWidth); node->setLayoutMeasuredDimension( YGNodeBoundAxis( node, YGFlexDirectionColumn, availableHeight - marginAxisColumn, - parentHeight, - parentWidth), + ownerHeight, + ownerWidth), YGDimensionHeight); } else { // Measure the text under the current constraints. @@ -1572,8 +1572,8 @@ static void YGNodeWithMeasureFuncSetMeasuredDimensions(const YGNodeRef node, widthMeasureMode == YGMeasureModeAtMost) ? measuredSize.width + paddingAndBorderAxisRow : availableWidth - marginAxisRow, - parentWidth, - parentWidth), + ownerWidth, + ownerWidth), YGDimensionWidth); node->setLayoutMeasuredDimension( @@ -1584,8 +1584,8 @@ static void YGNodeWithMeasureFuncSetMeasuredDimensions(const YGNodeRef node, heightMeasureMode == YGMeasureModeAtMost) ? measuredSize.height + paddingAndBorderAxisColumn : availableHeight - marginAxisColumn, - parentHeight, - parentWidth), + ownerHeight, + ownerWidth), YGDimensionHeight); } } @@ -1597,16 +1597,16 @@ static void YGNodeEmptyContainerSetMeasuredDimensions(const YGNodeRef node, const float availableHeight, const YGMeasureMode widthMeasureMode, const YGMeasureMode heightMeasureMode, - const float parentWidth, - const float parentHeight) { + const float ownerWidth, + const float ownerHeight) { const float paddingAndBorderAxisRow = - YGNodePaddingAndBorderForAxis(node, YGFlexDirectionRow, parentWidth); + YGNodePaddingAndBorderForAxis(node, YGFlexDirectionRow, ownerWidth); const float paddingAndBorderAxisColumn = - YGNodePaddingAndBorderForAxis(node, YGFlexDirectionColumn, parentWidth); + YGNodePaddingAndBorderForAxis(node, YGFlexDirectionColumn, ownerWidth); const float marginAxisRow = - node->getMarginForAxis(YGFlexDirectionRow, parentWidth); + node->getMarginForAxis(YGFlexDirectionRow, ownerWidth); const float marginAxisColumn = - node->getMarginForAxis(YGFlexDirectionColumn, parentWidth); + node->getMarginForAxis(YGFlexDirectionColumn, ownerWidth); node->setLayoutMeasuredDimension( YGNodeBoundAxis( @@ -1616,8 +1616,8 @@ static void YGNodeEmptyContainerSetMeasuredDimensions(const YGNodeRef node, widthMeasureMode == YGMeasureModeAtMost) ? paddingAndBorderAxisRow : availableWidth - marginAxisRow, - parentWidth, - parentWidth), + ownerWidth, + ownerWidth), YGDimensionWidth); node->setLayoutMeasuredDimension( @@ -1628,8 +1628,8 @@ static void YGNodeEmptyContainerSetMeasuredDimensions(const YGNodeRef node, heightMeasureMode == YGMeasureModeAtMost) ? paddingAndBorderAxisColumn : availableHeight - marginAxisColumn, - parentHeight, - parentWidth), + ownerHeight, + ownerWidth), YGDimensionHeight); } @@ -1638,8 +1638,8 @@ static bool YGNodeFixedSizeSetMeasuredDimensions(const YGNodeRef node, const float availableHeight, const YGMeasureMode widthMeasureMode, const YGMeasureMode heightMeasureMode, - const float parentWidth, - const float parentHeight) { + const float ownerWidth, + const float ownerHeight) { if ((!YGFloatIsUndefined(availableWidth) && widthMeasureMode == YGMeasureModeAtMost && availableWidth <= 0.0f) || (!YGFloatIsUndefined(availableHeight) && @@ -1647,9 +1647,9 @@ static bool YGNodeFixedSizeSetMeasuredDimensions(const YGNodeRef node, (widthMeasureMode == YGMeasureModeExactly && heightMeasureMode == YGMeasureModeExactly)) { const float marginAxisColumn = - node->getMarginForAxis(YGFlexDirectionColumn, parentWidth); + node->getMarginForAxis(YGFlexDirectionColumn, ownerWidth); const float marginAxisRow = - node->getMarginForAxis(YGFlexDirectionRow, parentWidth); + node->getMarginForAxis(YGFlexDirectionRow, ownerWidth); node->setLayoutMeasuredDimension( YGNodeBoundAxis( @@ -1660,8 +1660,8 @@ static bool YGNodeFixedSizeSetMeasuredDimensions(const YGNodeRef node, availableWidth < 0.0f) ? 0.0f : availableWidth - marginAxisRow, - parentWidth, - parentWidth), + ownerWidth, + ownerWidth), YGDimensionWidth); node->setLayoutMeasuredDimension( @@ -1673,8 +1673,8 @@ static bool YGNodeFixedSizeSetMeasuredDimensions(const YGNodeRef node, availableHeight < 0.0f) ? 0.0f : availableHeight - marginAxisColumn, - parentHeight, - parentWidth), + ownerHeight, + ownerWidth), YGDimensionHeight); return true; } @@ -1697,15 +1697,15 @@ static float YGNodeCalculateAvailableInnerDim( const YGNodeRef node, YGFlexDirection axis, float availableDim, - float parentDim) { + float ownerDim) { YGFlexDirection direction = YGFlexDirectionIsRow(axis) ? YGFlexDirectionRow : YGFlexDirectionColumn; YGDimension dimension = YGFlexDirectionIsRow(axis) ? YGDimensionWidth : YGDimensionHeight; - const float margin = node->getMarginForAxis(direction, parentDim); + const float margin = node->getMarginForAxis(direction, ownerDim); const float paddingAndBorder = - YGNodePaddingAndBorderForAxis(node, direction, parentDim); + YGNodePaddingAndBorderForAxis(node, direction, ownerDim); float availableInnerDim = availableDim - margin - paddingAndBorder; // Max dimension overrides predefined dimension value; Min dimension in turn @@ -1713,12 +1713,12 @@ static float YGNodeCalculateAvailableInnerDim( if (!YGFloatIsUndefined(availableInnerDim)) { // We want to make sure our available height does not violate min and max // constraints - const YGFloatOptional minDimensionOptional = YGResolveValue(node->getStyle().minDimensions[dimension], parentDim); + const YGFloatOptional minDimensionOptional = YGResolveValue(node->getStyle().minDimensions[dimension], ownerDim); const float minInnerDim = minDimensionOptional.isUndefined() ? 0.0f : minDimensionOptional.getValue() - paddingAndBorder; - const YGFloatOptional maxDimensionOptional = YGResolveValue(node->getStyle().maxDimensions[dimension], parentDim) ; + const YGFloatOptional maxDimensionOptional = YGResolveValue(node->getStyle().maxDimensions[dimension], ownerDim) ; const float maxInnerDim = maxDimensionOptional.isUndefined() ? FLT_MAX @@ -1773,7 +1773,7 @@ static void YGNodeComputeFlexBasisForChildren( continue; } if (performLayout) { - // Set the initial position (relative to the parent). + // Set the initial position (relative to the owner). const YGDirection childDirection = child->resolveDirection(direction); const float mainDim = YGFlexDirectionIsRow(mainAxis) ? availableInnerWidth @@ -1816,8 +1816,8 @@ static void YGNodeComputeFlexBasisForChildren( // This function calculates YGCollectFlexItemsRowMeasurement static YGCollectFlexItemsRowValues YGCalculateCollectFlexItemsRowValues( const YGNodeRef& node, - const YGDirection parentDirection, - const float mainAxisParentSize, + const YGDirection ownerDirection, + const float mainAxisownerSize, const float availableInnerWidth, const float availableInnerMainDim, const uint32_t startOfLineIndex, @@ -1827,7 +1827,7 @@ static YGCollectFlexItemsRowValues YGCalculateCollectFlexItemsRowValues( float sizeConsumedOnCurrentLineIncludingMinConstraint = 0; const YGFlexDirection mainAxis = YGResolveFlexDirection( - node->getStyle().flexDirection, node->resolveDirection(parentDirection)); + node->getStyle().flexDirection, node->resolveDirection(ownerDirection)); const bool isNodeFlexWrap = node->getStyle().flexWrap != YGWrapNoWrap; // Add items to the current line until it's full or we run out of items. @@ -1846,7 +1846,7 @@ static YGCollectFlexItemsRowValues YGCalculateCollectFlexItemsRowValues( child, mainAxis, child->getLayout().computedFlexBasis, - mainAxisParentSize); + mainAxisownerSize); // If this is a multi-line flow and this item pushes us over the // available size, we've @@ -1901,7 +1901,7 @@ static float YGDistributeFreeSpaceSecondPass( const YGNodeRef node, const YGFlexDirection mainAxis, const YGFlexDirection crossAxis, - const float mainAxisParentSize, + const float mainAxisownerSize, const float availableInnerMainDim, const float availableInnerCrossDim, const float availableInnerWidth, @@ -1922,7 +1922,7 @@ static float YGDistributeFreeSpaceSecondPass( currentRelativeChild, mainAxis, currentRelativeChild->getLayout().computedFlexBasis, - mainAxisParentSize); + mainAxisownerSize); float updatedMainSize = childFlexBasis; if (!YGFloatIsUndefined(collectedFlexItemsValues.remainingFreeSpace) && @@ -2083,7 +2083,7 @@ static float YGDistributeFreeSpaceSecondPass( static void YGDistributeFreeSpaceFirstPass( YGCollectFlexItemsRowValues& collectedFlexItemsValues, const YGFlexDirection mainAxis, - const float mainAxisParentSize, + const float mainAxisownerSize, const float availableInnerMainDim, const float availableInnerWidth) { float flexShrinkScaledFactor = 0; @@ -2097,7 +2097,7 @@ static void YGDistributeFreeSpaceFirstPass( currentRelativeChild, mainAxis, currentRelativeChild->getLayout().computedFlexBasis, - mainAxisParentSize); + mainAxisownerSize); if (collectedFlexItemsValues.remainingFreeSpace < 0) { flexShrinkScaledFactor = @@ -2195,7 +2195,7 @@ static void YGResolveFlexibleLength( YGCollectFlexItemsRowValues& collectedFlexItemsValues, const YGFlexDirection mainAxis, const YGFlexDirection crossAxis, - const float mainAxisParentSize, + const float mainAxisownerSize, const float availableInnerMainDim, const float availableInnerCrossDim, const float availableInnerWidth, @@ -2209,7 +2209,7 @@ static void YGResolveFlexibleLength( YGDistributeFreeSpaceFirstPass( collectedFlexItemsValues, mainAxis, - mainAxisParentSize, + mainAxisownerSize, availableInnerMainDim, availableInnerWidth); @@ -2219,7 +2219,7 @@ static void YGResolveFlexibleLength( node, mainAxis, crossAxis, - mainAxisParentSize, + mainAxisownerSize, availableInnerMainDim, availableInnerCrossDim, availableInnerWidth, @@ -2241,8 +2241,8 @@ static void YGJustifyMainAxis( const YGFlexDirection& crossAxis, const YGMeasureMode& measureModeMainDim, const YGMeasureMode& measureModeCrossDim, - const float& mainAxisParentSize, - const float& parentWidth, + const float& mainAxisownerSize, + const float& ownerWidth, const float& availableInnerMainDim, const float& availableInnerCrossDim, const float& availableInnerWidth, @@ -2254,12 +2254,12 @@ static void YGJustifyMainAxis( if (measureModeMainDim == YGMeasureModeAtMost && collectedFlexItemsValues.remainingFreeSpace > 0) { if (style.minDimensions[dim[mainAxis]].unit != YGUnitUndefined && - !YGResolveValue(style.minDimensions[dim[mainAxis]], mainAxisParentSize) + !YGResolveValue(style.minDimensions[dim[mainAxis]], mainAxisownerSize) .isUndefined()) { collectedFlexItemsValues.remainingFreeSpace = YGFloatMax( 0, YGUnwrapFloatOptional(YGResolveValue( - style.minDimensions[dim[mainAxis]], mainAxisParentSize)) - + style.minDimensions[dim[mainAxis]], mainAxisownerSize)) - (availableInnerMainDim - collectedFlexItemsValues.remainingFreeSpace)); } else { @@ -2324,7 +2324,7 @@ static void YGJustifyMainAxis( } const float leadingPaddingAndBorderMain = - node->getLeadingPaddingAndBorder(mainAxis, parentWidth); + node->getLeadingPaddingAndBorder(mainAxis, ownerWidth); collectedFlexItemsValues.mainDim = leadingPaddingAndBorderMain + leadingMainDim; collectedFlexItemsValues.crossDim = 0; @@ -2405,7 +2405,7 @@ static void YGJustifyMainAxis( } } collectedFlexItemsValues.mainDim += - node->getTrailingPaddingAndBorder(mainAxis, parentWidth); + node->getTrailingPaddingAndBorder(mainAxis, ownerWidth); } // @@ -2451,7 +2451,7 @@ static void YGJustifyMainAxis( // or YGUndefined if the size is not available; interpretation depends on // layout // flags -// - parentDirection: the inline (text) direction within the parent +// - ownerDirection: the inline (text) direction within the owner // (left-to-right or // right-to-left) // - widthMeasureMode: indicates the sizing rules for the width (see below @@ -2497,11 +2497,11 @@ static void YGJustifyMainAxis( static void YGNodelayoutImpl(const YGNodeRef node, const float availableWidth, const float availableHeight, - const YGDirection parentDirection, + const YGDirection ownerDirection, const YGMeasureMode widthMeasureMode, const YGMeasureMode heightMeasureMode, - const float parentWidth, - const float parentHeight, + const float ownerWidth, + const float ownerHeight, const bool performLayout, const YGConfigRef config) { YGAssertWithNode(node, @@ -2516,7 +2516,7 @@ static void YGNodelayoutImpl(const YGNodeRef node, "YGMeasureModeUndefined"); // Set the resolved resolution in the node's layout. - const YGDirection direction = node->resolveDirection(parentDirection); + const YGDirection direction = node->resolveDirection(ownerDirection); node->setLayoutDirection(direction); const YGFlexDirection flexRowDirection = YGResolveFlexDirection(YGFlexDirectionRow, direction); @@ -2524,13 +2524,13 @@ static void YGNodelayoutImpl(const YGNodeRef node, YGResolveFlexDirection(YGFlexDirectionColumn, direction); node->setLayoutMargin( - node->getLeadingMargin(flexRowDirection, parentWidth), YGEdgeStart); + node->getLeadingMargin(flexRowDirection, ownerWidth), YGEdgeStart); node->setLayoutMargin( - node->getTrailingMargin(flexRowDirection, parentWidth), YGEdgeEnd); + node->getTrailingMargin(flexRowDirection, ownerWidth), YGEdgeEnd); node->setLayoutMargin( - node->getLeadingMargin(flexColumnDirection, parentWidth), YGEdgeTop); + node->getLeadingMargin(flexColumnDirection, ownerWidth), YGEdgeTop); node->setLayoutMargin( - node->getTrailingMargin(flexColumnDirection, parentWidth), YGEdgeBottom); + node->getTrailingMargin(flexColumnDirection, ownerWidth), YGEdgeBottom); node->setLayoutBorder(node->getLeadingBorder(flexRowDirection), YGEdgeStart); node->setLayoutBorder(node->getTrailingBorder(flexRowDirection), YGEdgeEnd); @@ -2539,13 +2539,13 @@ static void YGNodelayoutImpl(const YGNodeRef node, node->getTrailingBorder(flexColumnDirection), YGEdgeBottom); node->setLayoutPadding( - node->getLeadingPadding(flexRowDirection, parentWidth), YGEdgeStart); + node->getLeadingPadding(flexRowDirection, ownerWidth), YGEdgeStart); node->setLayoutPadding( - node->getTrailingPadding(flexRowDirection, parentWidth), YGEdgeEnd); + node->getTrailingPadding(flexRowDirection, ownerWidth), YGEdgeEnd); node->setLayoutPadding( - node->getLeadingPadding(flexColumnDirection, parentWidth), YGEdgeTop); + node->getLeadingPadding(flexColumnDirection, ownerWidth), YGEdgeTop); node->setLayoutPadding( - node->getTrailingPadding(flexColumnDirection, parentWidth), YGEdgeBottom); + node->getTrailingPadding(flexColumnDirection, ownerWidth), YGEdgeBottom); if (node->getMeasure() != nullptr) { YGNodeWithMeasureFuncSetMeasuredDimensions(node, @@ -2553,8 +2553,8 @@ static void YGNodelayoutImpl(const YGNodeRef node, availableHeight, widthMeasureMode, heightMeasureMode, - parentWidth, - parentHeight); + ownerWidth, + ownerHeight); return; } @@ -2565,8 +2565,8 @@ static void YGNodelayoutImpl(const YGNodeRef node, availableHeight, widthMeasureMode, heightMeasureMode, - parentWidth, - parentHeight); + ownerWidth, + ownerHeight); return; } @@ -2577,8 +2577,8 @@ static void YGNodelayoutImpl(const YGNodeRef node, availableHeight, widthMeasureMode, heightMeasureMode, - parentWidth, - parentHeight)) { + ownerWidth, + ownerHeight)) { return; } @@ -2594,14 +2594,14 @@ static void YGNodelayoutImpl(const YGNodeRef node, const bool isMainAxisRow = YGFlexDirectionIsRow(mainAxis); const bool isNodeFlexWrap = node->getStyle().flexWrap != YGWrapNoWrap; - const float mainAxisParentSize = isMainAxisRow ? parentWidth : parentHeight; - const float crossAxisParentSize = isMainAxisRow ? parentHeight : parentWidth; + const float mainAxisownerSize = isMainAxisRow ? ownerWidth : ownerHeight; + const float crossAxisownerSize = isMainAxisRow ? ownerHeight : ownerWidth; const float leadingPaddingAndBorderCross = - node->getLeadingPaddingAndBorder(crossAxis, parentWidth); - const float paddingAndBorderAxisMain = YGNodePaddingAndBorderForAxis(node, mainAxis, parentWidth); + node->getLeadingPaddingAndBorder(crossAxis, ownerWidth); + const float paddingAndBorderAxisMain = YGNodePaddingAndBorderForAxis(node, mainAxis, ownerWidth); const float paddingAndBorderAxisCross = - YGNodePaddingAndBorderForAxis(node, crossAxis, parentWidth); + YGNodePaddingAndBorderForAxis(node, crossAxis, ownerWidth); YGMeasureMode measureModeMainDim = isMainAxisRow ? widthMeasureMode : heightMeasureMode; YGMeasureMode measureModeCrossDim = isMainAxisRow ? heightMeasureMode : widthMeasureMode; @@ -2612,22 +2612,22 @@ static void YGNodelayoutImpl(const YGNodeRef node, isMainAxisRow ? paddingAndBorderAxisCross : paddingAndBorderAxisMain; const float marginAxisRow = - node->getMarginForAxis(YGFlexDirectionRow, parentWidth); + node->getMarginForAxis(YGFlexDirectionRow, ownerWidth); const float marginAxisColumn = - node->getMarginForAxis(YGFlexDirectionColumn, parentWidth); + node->getMarginForAxis(YGFlexDirectionColumn, ownerWidth); const float minInnerWidth = - YGUnwrapFloatOptional(YGResolveValue(node->getStyle().minDimensions[YGDimensionWidth], parentWidth)) - + YGUnwrapFloatOptional(YGResolveValue(node->getStyle().minDimensions[YGDimensionWidth], ownerWidth)) - paddingAndBorderAxisRow; const float maxInnerWidth = - YGUnwrapFloatOptional(YGResolveValue(node->getStyle().maxDimensions[YGDimensionWidth], parentWidth)) - + YGUnwrapFloatOptional(YGResolveValue(node->getStyle().maxDimensions[YGDimensionWidth], ownerWidth)) - paddingAndBorderAxisRow; const float minInnerHeight = - YGUnwrapFloatOptional(YGResolveValue(node->getStyle().minDimensions[YGDimensionHeight], parentHeight)) - + YGUnwrapFloatOptional(YGResolveValue(node->getStyle().minDimensions[YGDimensionHeight], ownerHeight)) - paddingAndBorderAxisColumn; const float maxInnerHeight = YGUnwrapFloatOptional(YGResolveValue( - node->getStyle().maxDimensions[YGDimensionHeight], parentHeight)) - + node->getStyle().maxDimensions[YGDimensionHeight], ownerHeight)) - paddingAndBorderAxisColumn; const float minInnerMainDim = isMainAxisRow ? minInnerWidth : minInnerHeight; @@ -2636,9 +2636,9 @@ static void YGNodelayoutImpl(const YGNodeRef node, // STEP 2: DETERMINE AVAILABLE SIZE IN MAIN AND CROSS DIRECTIONS float availableInnerWidth = YGNodeCalculateAvailableInnerDim( - node, YGFlexDirectionRow, availableWidth, parentWidth); + node, YGFlexDirectionRow, availableWidth, ownerWidth); float availableInnerHeight = YGNodeCalculateAvailableInnerDim( - node, YGFlexDirectionColumn, availableHeight, parentHeight); + node, YGFlexDirectionColumn, availableHeight, ownerHeight); float availableInnerMainDim = isMainAxisRow ? availableInnerWidth : availableInnerHeight; @@ -2687,8 +2687,8 @@ static void YGNodelayoutImpl(const YGNodeRef node, lineCount++, startOfLineIndex = endOfLineIndex) { collectedFlexItemsValues = YGCalculateCollectFlexItemsRowValues( node, - parentDirection, - mainAxisParentSize, + ownerDirection, + mainAxisownerSize, availableInnerWidth, availableInnerMainDim, startOfLineIndex, @@ -2756,7 +2756,7 @@ static void YGNodelayoutImpl(const YGNodeRef node, collectedFlexItemsValues, mainAxis, crossAxis, - mainAxisParentSize, + mainAxisownerSize, availableInnerMainDim, availableInnerCrossDim, availableInnerWidth, @@ -2788,8 +2788,8 @@ static void YGNodelayoutImpl(const YGNodeRef node, crossAxis, measureModeMainDim, measureModeCrossDim, - mainAxisParentSize, - parentWidth, + mainAxisownerSize, + ownerWidth, availableInnerMainDim, availableInnerCrossDim, availableInnerWidth, @@ -2804,8 +2804,8 @@ static void YGNodelayoutImpl(const YGNodeRef node, node, crossAxis, collectedFlexItemsValues.crossDim + paddingAndBorderAxisCross, - crossAxisParentSize, - parentWidth) - + crossAxisownerSize, + ownerWidth) - paddingAndBorderAxisCross; } @@ -2820,8 +2820,8 @@ static void YGNodelayoutImpl(const YGNodeRef node, node, crossAxis, collectedFlexItemsValues.crossDim + paddingAndBorderAxisCross, - crossAxisParentSize, - parentWidth) - + crossAxisownerSize, + ownerWidth) - paddingAndBorderAxisCross; // STEP 7: CROSS-AXIS ALIGNMENT @@ -2856,7 +2856,7 @@ static void YGNodelayoutImpl(const YGNodeRef node, } else { float leadingCrossDim = leadingPaddingAndBorderCross; - // For a relative children, we're either using alignItems (parent) or + // For a relative children, we're either using alignItems (owner) or // alignSelf (child) in order to determine the position in the cross // axis const YGAlign alignItem = YGNodeAlignItem(node, child); @@ -3083,7 +3083,7 @@ static void YGNodelayoutImpl(const YGNodeRef node, pos[crossAxis]); // Remeasure child with the line height as it as been only measured with the - // parents height yet. + // owners height yet. if (!YGNodeIsStyleDimDefined(child, crossAxis, availableInnerCrossDim)) { const float childWidth = isMainAxisRow ? (child->getLayout() @@ -3150,8 +3150,8 @@ static void YGNodelayoutImpl(const YGNodeRef node, node, YGFlexDirectionRow, availableWidth - marginAxisRow, - parentWidth, - parentWidth), + ownerWidth, + ownerWidth), YGDimensionWidth); node->setLayoutMeasuredDimension( @@ -3159,8 +3159,8 @@ static void YGNodelayoutImpl(const YGNodeRef node, node, YGFlexDirectionColumn, availableHeight - marginAxisColumn, - parentHeight, - parentWidth), + ownerHeight, + ownerWidth), YGDimensionHeight); // If the user didn't specify a width or height for the node, set the @@ -3172,7 +3172,7 @@ static void YGNodelayoutImpl(const YGNodeRef node, // doesn't go below the padding and border amount. node->setLayoutMeasuredDimension( YGNodeBoundAxis( - node, mainAxis, maxLineMainDim, mainAxisParentSize, parentWidth), + node, mainAxis, maxLineMainDim, mainAxisownerSize, ownerWidth), dim[mainAxis]); } else if ( @@ -3183,7 +3183,7 @@ static void YGNodelayoutImpl(const YGNodeRef node, YGFloatMin( availableInnerMainDim + paddingAndBorderAxisMain, YGNodeBoundAxisWithinMinAndMax( - node, mainAxis, maxLineMainDim, mainAxisParentSize)), + node, mainAxis, maxLineMainDim, mainAxisownerSize)), paddingAndBorderAxisMain), dim[mainAxis]); } @@ -3199,8 +3199,8 @@ static void YGNodelayoutImpl(const YGNodeRef node, node, crossAxis, totalLineCrossDim + paddingAndBorderAxisCross, - crossAxisParentSize, - parentWidth), + crossAxisownerSize, + ownerWidth), dim[crossAxis]); } else if ( @@ -3214,7 +3214,7 @@ static void YGNodelayoutImpl(const YGNodeRef node, node, crossAxis, totalLineCrossDim + paddingAndBorderAxisCross, - crossAxisParentSize)), + crossAxisownerSize)), paddingAndBorderAxisCross), dim[crossAxis]); } @@ -3435,11 +3435,11 @@ bool YGNodeCanUseCachedMeasurement(const YGMeasureMode widthMode, bool YGLayoutNodeInternal(const YGNodeRef node, const float availableWidth, const float availableHeight, - const YGDirection parentDirection, + const YGDirection ownerDirection, const YGMeasureMode widthMeasureMode, const YGMeasureMode heightMeasureMode, - const float parentWidth, - const float parentHeight, + const float ownerWidth, + const float ownerHeight, const bool performLayout, const char *reason, const YGConfigRef config) { @@ -3449,7 +3449,7 @@ bool YGLayoutNodeInternal(const YGNodeRef node, const bool needToVisitNode = (node->isDirty() && layout->generationCount != gCurrentGenerationCount) || - layout->lastParentDirection != parentDirection; + layout->lastOwnerDirection != ownerDirection; if (needToVisitNode) { // Invalidate the cached results. @@ -3476,9 +3476,9 @@ bool YGLayoutNodeInternal(const YGNodeRef node, // all possible. if (node->getMeasure() != nullptr) { const float marginAxisRow = - node->getMarginForAxis(YGFlexDirectionRow, parentWidth); + node->getMarginForAxis(YGFlexDirectionRow, ownerWidth); const float marginAxisColumn = - node->getMarginForAxis(YGFlexDirectionColumn, parentWidth); + node->getMarginForAxis(YGFlexDirectionColumn, ownerWidth); // First, try to use the layout cache. if (YGNodeCanUseCachedMeasurement(widthMeasureMode, @@ -3582,11 +3582,11 @@ bool YGLayoutNodeInternal(const YGNodeRef node, YGNodelayoutImpl(node, availableWidth, availableHeight, - parentDirection, + ownerDirection, widthMeasureMode, heightMeasureMode, - parentWidth, - parentHeight, + ownerWidth, + ownerHeight, performLayout, config); @@ -3612,7 +3612,7 @@ bool YGLayoutNodeInternal(const YGNodeRef node, reason); } - layout->lastParentDirection = parentDirection; + layout->lastOwnerDirection = ownerDirection; if (cachedResults == nullptr) { if (layout->nextCachedMeasurementsIndex == YG_MAX_CACHED_RESULT_COUNT) { @@ -3742,9 +3742,9 @@ static void YGRoundToPixelGrid(const YGNodeRef node, void YGNodeCalculateLayout( const YGNodeRef node, - const float parentWidth, - const float parentHeight, - const YGDirection parentDirection) { + const float ownerWidth, + const float ownerHeight, + const YGDirection ownerDirection) { // Increment the generation count. This will force the recursive routine to // visit // all dirty nodes at least once. Subsequent visits will be skipped if the @@ -3754,40 +3754,40 @@ void YGNodeCalculateLayout( node->resolveDimension(); float width = YGUndefined; YGMeasureMode widthMeasureMode = YGMeasureModeUndefined; - if (YGNodeIsStyleDimDefined(node, YGFlexDirectionRow, parentWidth)) { + if (YGNodeIsStyleDimDefined(node, YGFlexDirectionRow, ownerWidth)) { width = YGUnwrapFloatOptional(YGResolveValue( - node->getResolvedDimension(dim[YGFlexDirectionRow]), parentWidth)) + - node->getMarginForAxis(YGFlexDirectionRow, parentWidth); + node->getResolvedDimension(dim[YGFlexDirectionRow]), ownerWidth)) + + node->getMarginForAxis(YGFlexDirectionRow, ownerWidth); widthMeasureMode = YGMeasureModeExactly; } else if (!YGResolveValue( - node->getStyle().maxDimensions[YGDimensionWidth], parentWidth) + node->getStyle().maxDimensions[YGDimensionWidth], ownerWidth) .isUndefined()) { width = YGUnwrapFloatOptional(YGResolveValue( - node->getStyle().maxDimensions[YGDimensionWidth], parentWidth)); + node->getStyle().maxDimensions[YGDimensionWidth], ownerWidth)); widthMeasureMode = YGMeasureModeAtMost; } else { - width = parentWidth; + width = ownerWidth; widthMeasureMode = YGFloatIsUndefined(width) ? YGMeasureModeUndefined : YGMeasureModeExactly; } float height = YGUndefined; YGMeasureMode heightMeasureMode = YGMeasureModeUndefined; - if (YGNodeIsStyleDimDefined(node, YGFlexDirectionColumn, parentHeight)) { + if (YGNodeIsStyleDimDefined(node, YGFlexDirectionColumn, ownerHeight)) { height = YGUnwrapFloatOptional(YGResolveValue( node->getResolvedDimension(dim[YGFlexDirectionColumn]), - parentHeight)) + - node->getMarginForAxis(YGFlexDirectionColumn, parentWidth); + ownerHeight)) + + node->getMarginForAxis(YGFlexDirectionColumn, ownerWidth); heightMeasureMode = YGMeasureModeExactly; } else if (!YGResolveValue( node->getStyle().maxDimensions[YGDimensionHeight], - parentHeight) + ownerHeight) .isUndefined()) { - height = YGUnwrapFloatOptional(YGResolveValue(node->getStyle().maxDimensions[YGDimensionHeight], parentHeight)); + height = YGUnwrapFloatOptional(YGResolveValue(node->getStyle().maxDimensions[YGDimensionHeight], ownerHeight)); heightMeasureMode = YGMeasureModeAtMost; } else { - height = parentHeight; + height = ownerHeight; heightMeasureMode = YGFloatIsUndefined(height) ? YGMeasureModeUndefined : YGMeasureModeExactly; } @@ -3795,16 +3795,16 @@ void YGNodeCalculateLayout( node, width, height, - parentDirection, + ownerDirection, widthMeasureMode, heightMeasureMode, - parentWidth, - parentHeight, + ownerWidth, + ownerHeight, true, "initial", node->getConfig())) { node->setPosition( - node->getLayout().direction, parentWidth, parentHeight, parentWidth); + node->getLayout().direction, ownerWidth, ownerHeight, ownerWidth); YGRoundToPixelGrid(node, node->getConfig()->pointScaleFactor, 0.0f, 0.0f); if (gPrintTree) { @@ -3836,19 +3836,19 @@ void YGNodeCalculateLayout( originalNode, width, height, - parentDirection, + ownerDirection, widthMeasureMode, heightMeasureMode, - parentWidth, - parentHeight, + ownerWidth, + ownerHeight, true, "initial", originalNode->getConfig())) { originalNode->setPosition( originalNode->getLayout().direction, - parentWidth, - parentHeight, - parentWidth); + ownerWidth, + ownerHeight, + ownerWidth); YGRoundToPixelGrid( originalNode, originalNode->getConfig()->pointScaleFactor, diff --git a/yoga/Yoga.h b/yoga/Yoga.h index 73e7c7fd..445c0b06 100644 --- a/yoga/Yoga.h +++ b/yoga/Yoga.h @@ -81,14 +81,14 @@ WIN_EXPORT void YGNodeInsertChild(const YGNodeRef node, 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); -WIN_EXPORT YGNodeRef YGNodeGetParent(const YGNodeRef node); +WIN_EXPORT YGNodeRef YGNodeGetOwner(const YGNodeRef node); WIN_EXPORT uint32_t YGNodeGetChildCount(const YGNodeRef node); WIN_EXPORT void YGNodeSetChildren(YGNodeRef const parent, const YGNodeRef children[], const uint32_t count); WIN_EXPORT void YGNodeCalculateLayout(const YGNodeRef node, const float availableWidth, const float availableHeight, - const YGDirection parentDirection); + const YGDirection ownerDirection); // Mark a node as dirty. Only valid for nodes with a custom measure function // set.