Add feature to use percentage as value unit #258

Closed
woehrl01 wants to merge 43 commits from percentage-feature into master
60 changed files with 4402 additions and 2509 deletions
Showing only changes of commit 9ea8e73dd5 - Show all commits

View File

@@ -188,10 +188,11 @@ static inline YGValue YGComputedEdgeValue(const YGValue edges[YGEdgeCount],
return YGValueUndefined;
}
YGValue result;
result.value = defaultValue;
result.defined = (defaultValue < 0 || defaultValue >= 0); /* is faster than a nan function call and enough at this point */
result.unit = YGUnitPixel;
YGValue result = {
.value = defaultValue,
.defined = (defaultValue < 0 || defaultValue >= 0), /* is faster than a nan function call and enough at this point */
.unit = YGUnitPixel,
};
return result;
}
@@ -260,18 +261,20 @@ static void YGNodeInit(const YGNodeRef node) {
int32_t gNodeInstanceCount = 0;
YGValue YGPx(const float value){
YGValue result;
result.value = value;
result.defined = !YGFloatIsUndefined(value);
result.unit = YGUnitPixel;
YGValue result = {
.value = value,
.defined = !YGFloatIsUndefined(value),
.unit = YGUnitPixel,
};
return result;
}
YGValue YGPercent(const float value){
YGValue result;
result.value = value;
result.defined = !YGFloatIsUndefined(value);
result.unit = YGUnitPercent;
YGValue result = {
.value = value,
.defined = !YGFloatIsUndefined(value),
.unit = YGUnitPercent,
};
return result;
}
emilsjolander commented 2016-12-18 22:22:23 -08:00 (Migrated from github.com)
Review

return YGValue { ... };

return YGValue { ... };
emilsjolander commented 2016-12-18 22:22:29 -08:00 (Migrated from github.com)
Review

return YGValue { ... };

return YGValue { ... };