Moved YGFloatOptional from C struct to C++ struct
Summary: Earlier `YGfloatOptional` was plain struct with no privacy around the variables. This diff adds privacy and also enforces checks when one tries to access value of an undefined `YGFloatOptional` This diff also adds a behaviour in which when a value of an undefined YGFloatOptional is accessed, it will normally terminate(Several cleanup steps are performed). Reviewed By: emilsjolander Differential Revision: D7288555 fbshipit-source-id: f61cc92c8fd0d48d2fc1f4d0e6fcef155f19ff8a
This commit is contained in:
committed by
Facebook Github Bot
parent
ae86824636
commit
5d7b75a47a
@@ -113,13 +113,14 @@ inline YGFloatOptional YGResolveValue(const YGValue value, const float parentSiz
|
||||
switch (value.unit) {
|
||||
case YGUnitUndefined:
|
||||
case YGUnitAuto:
|
||||
return {true, 0};
|
||||
return YGFloatOptional();
|
||||
case YGUnitPoint:
|
||||
return {false, value.value};
|
||||
return YGFloatOptional(value.value);
|
||||
case YGUnitPercent:
|
||||
return {false, static_cast<float>(value.value * parentSize * 0.01)};
|
||||
return YGFloatOptional(
|
||||
static_cast<float>(value.value * parentSize * 0.01));
|
||||
}
|
||||
return {true, 0};
|
||||
return YGFloatOptional();
|
||||
}
|
||||
|
||||
inline bool YGFlexDirectionIsColumn(const YGFlexDirection flexDirection) {
|
||||
|
Reference in New Issue
Block a user