Feature auto margin
Summary: Even so I know there are some opinions against ```margin: 0 auto``` it's still part of the spec: https://www.w3.org/TR/css-flexbox-1/#auto-margins and pretty usefull if you have to position via ```justify-content```. This PR adds an implementation for that. It adds an additonal ```YGUnitAuto``` and margins got ```YGNodeStyleSetMarginAuto``` functions as well. Closes https://github.com/facebook/yoga/pull/357 Reviewed By: astreet Differential Revision: D4501142 Pulled By: emilsjolander fbshipit-source-id: 86519f8632496f46e78a7c9dbc5b21e212e3e0c7
This commit is contained in:
committed by
Facebook Github Bot
parent
8a91c0a0e5
commit
1146013e9e
@@ -27,7 +27,7 @@ TEST(YogaTest, assert_default_values) {
|
||||
ASSERT_EQ(YGOverflowVisible, YGNodeStyleGetOverflow(root));
|
||||
ASSERT_FLOAT_EQ(0, YGNodeStyleGetFlexGrow(root));
|
||||
ASSERT_FLOAT_EQ(0, YGNodeStyleGetFlexShrink(root));
|
||||
ASSERT_FALSE(YGNodeStyleGetFlexBasis(root).unit != YGUnitUndefined);
|
||||
ASSERT_FALSE(YGNodeStyleGetFlexBasis(root).unit != YGUnitAuto);
|
||||
|
||||
ASSERT_EQ(YGNodeStyleGetPosition(root, YGEdgeLeft).unit, YGUnitUndefined);
|
||||
ASSERT_EQ(YGNodeStyleGetPosition(root, YGEdgeTop).unit, YGUnitUndefined);
|
||||
@@ -57,8 +57,8 @@ TEST(YogaTest, assert_default_values) {
|
||||
ASSERT_TRUE(YGFloatIsUndefined(YGNodeStyleGetBorder(root, YGEdgeStart)));
|
||||
ASSERT_TRUE(YGFloatIsUndefined(YGNodeStyleGetBorder(root, YGEdgeEnd)));
|
||||
|
||||
ASSERT_EQ(YGNodeStyleGetWidth(root).unit, YGUnitUndefined);
|
||||
ASSERT_EQ(YGNodeStyleGetHeight(root).unit, YGUnitUndefined);
|
||||
ASSERT_EQ(YGNodeStyleGetWidth(root).unit, YGUnitAuto);
|
||||
ASSERT_EQ(YGNodeStyleGetHeight(root).unit, YGUnitAuto);
|
||||
ASSERT_EQ(YGNodeStyleGetMinWidth(root).unit, YGUnitUndefined);
|
||||
ASSERT_EQ(YGNodeStyleGetMinHeight(root).unit, YGUnitUndefined);
|
||||
ASSERT_EQ(YGNodeStyleGetMaxWidth(root).unit, YGUnitUndefined);
|
||||
|
Reference in New Issue
Block a user