Remove the usage of YGUndefined for kYGValueAuto and fix setter and getter of dimensions
Summary: Removes the use of YGUndefined from kYGValueAuto. Also fixed the setter and getter of dimensions. This diff also fixes a typo Reviewed By: emilsjolander Differential Revision: D7302453 fbshipit-source-id: e002a1ddd75bfc6fe142a7275e7913c064972e16
This commit is contained in:
committed by
Facebook Github Bot
parent
5e3ffb39a2
commit
fe433b012f
@@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
const YGValue kYGValueUndefined = {0, YGUnitUndefined};
|
const YGValue kYGValueUndefined = {0, YGUnitUndefined};
|
||||||
|
|
||||||
const YGValue kYGValueAuto = {YGUndefined, YGUnitAuto};
|
const YGValue kYGValueAuto = {0, YGUnitAuto};
|
||||||
|
|
||||||
const std::array<YGValue, YGEdgeCount> kYGDefaultEdgeValuesUnit = {
|
const std::array<YGValue, YGEdgeCount> kYGDefaultEdgeValuesUnit = {
|
||||||
{kYGValueUndefined,
|
{kYGValueUndefined,
|
||||||
@@ -42,7 +42,7 @@ YGStyle::YGStyle()
|
|||||||
flex(YGFloatOptional()),
|
flex(YGFloatOptional()),
|
||||||
flexGrow(YGFloatOptional()),
|
flexGrow(YGFloatOptional()),
|
||||||
flexShrink(YGFloatOptional()),
|
flexShrink(YGFloatOptional()),
|
||||||
flexBasis({0, YGUnitAuto}),
|
flexBasis(kYGValueAuto),
|
||||||
margin(kYGDefaultEdgeValuesUnit),
|
margin(kYGDefaultEdgeValuesUnit),
|
||||||
position(kYGDefaultEdgeValuesUnit),
|
position(kYGDefaultEdgeValuesUnit),
|
||||||
padding(kYGDefaultEdgeValuesUnit),
|
padding(kYGDefaultEdgeValuesUnit),
|
||||||
|
@@ -629,7 +629,7 @@ float YGNodeStyleGetFlexShrink(const YGNodeRef node) {
|
|||||||
type, name, paramName, instanceName) \
|
type, name, paramName, instanceName) \
|
||||||
void YGNodeStyleSet##name(const YGNodeRef node, const type paramName) { \
|
void YGNodeStyleSet##name(const YGNodeRef node, const type paramName) { \
|
||||||
YGValue value = { \
|
YGValue value = { \
|
||||||
.value = paramName, \
|
.value = YGFloatSanitize(paramName), \
|
||||||
.unit = YGFloatIsUndefined(paramName) ? YGUnitUndefined : YGUnitPoint, \
|
.unit = YGFloatIsUndefined(paramName) ? YGUnitUndefined : YGUnitPoint, \
|
||||||
}; \
|
}; \
|
||||||
if ((node->getStyle().instanceName.value != value.value && \
|
if ((node->getStyle().instanceName.value != value.value && \
|
||||||
@@ -644,10 +644,10 @@ float YGNodeStyleGetFlexShrink(const YGNodeRef node) {
|
|||||||
\
|
\
|
||||||
void YGNodeStyleSet##name##Percent( \
|
void YGNodeStyleSet##name##Percent( \
|
||||||
const YGNodeRef node, const type paramName) { \
|
const YGNodeRef node, const type paramName) { \
|
||||||
if (node->getStyle().instanceName.value != paramName || \
|
if (node->getStyle().instanceName.value != YGFloatSanitize(paramName) || \
|
||||||
node->getStyle().instanceName.unit != YGUnitPercent) { \
|
node->getStyle().instanceName.unit != YGUnitPercent) { \
|
||||||
YGStyle style = node->getStyle(); \
|
YGStyle style = node->getStyle(); \
|
||||||
style.instanceName.value = paramName; \
|
style.instanceName.value = YGFloatSanitize(paramName); \
|
||||||
style.instanceName.unit = \
|
style.instanceName.unit = \
|
||||||
YGFloatIsUndefined(paramName) ? YGUnitAuto : YGUnitPercent; \
|
YGFloatIsUndefined(paramName) ? YGUnitAuto : YGUnitPercent; \
|
||||||
node->setStyle(style); \
|
node->setStyle(style); \
|
||||||
@@ -658,7 +658,7 @@ float YGNodeStyleGetFlexShrink(const YGNodeRef node) {
|
|||||||
void YGNodeStyleSet##name##Auto(const YGNodeRef node) { \
|
void YGNodeStyleSet##name##Auto(const YGNodeRef node) { \
|
||||||
if (node->getStyle().instanceName.unit != YGUnitAuto) { \
|
if (node->getStyle().instanceName.unit != YGUnitAuto) { \
|
||||||
YGStyle style = node->getStyle(); \
|
YGStyle style = node->getStyle(); \
|
||||||
style.instanceName.value = YGUndefined; \
|
style.instanceName.value = 0; \
|
||||||
style.instanceName.unit = YGUnitAuto; \
|
style.instanceName.unit = YGUnitAuto; \
|
||||||
node->setStyle(style); \
|
node->setStyle(style); \
|
||||||
node->markDirtyAndPropogate(); \
|
node->markDirtyAndPropogate(); \
|
||||||
@@ -678,7 +678,7 @@ float YGNodeStyleGetFlexShrink(const YGNodeRef node) {
|
|||||||
\
|
\
|
||||||
type YGNodeStyleGet##name(const YGNodeRef node) { \
|
type YGNodeStyleGet##name(const YGNodeRef node) { \
|
||||||
YGValue value = node->getStyle().instanceName; \
|
YGValue value = node->getStyle().instanceName; \
|
||||||
if (value.unit == YGUndefined || value.unit == YGUnitAuto) { \
|
if (value.unit == YGUnitUndefined || value.unit == YGUnitAuto) { \
|
||||||
value.value = YGUndefined; \
|
value.value = YGUndefined; \
|
||||||
} \
|
} \
|
||||||
return value; \
|
return value; \
|
||||||
@@ -690,7 +690,11 @@ float YGNodeStyleGetFlexShrink(const YGNodeRef node) {
|
|||||||
float, name, paramName, instanceName) \
|
float, name, paramName, instanceName) \
|
||||||
\
|
\
|
||||||
type YGNodeStyleGet##name(const YGNodeRef node) { \
|
type YGNodeStyleGet##name(const YGNodeRef node) { \
|
||||||
return node->getStyle().instanceName; \
|
YGValue value = node->getStyle().instanceName; \
|
||||||
|
if (value.unit == YGUnitUndefined || value.unit == YGUnitAuto) { \
|
||||||
|
value.value = YGUndefined; \
|
||||||
|
} \
|
||||||
|
return value; \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define YG_NODE_STYLE_EDGE_PROPERTY_UNIT_AUTO_IMPL(type, name, instanceName) \
|
#define YG_NODE_STYLE_EDGE_PROPERTY_UNIT_AUTO_IMPL(type, name, instanceName) \
|
||||||
|
Reference in New Issue
Block a user