From 1d09227374b9d081bb763d9ee052e39c7d5b5bc0 Mon Sep 17 00:00:00 2001 From: David Aurelio Date: Fri, 17 Aug 2018 03:56:48 -0700 Subject: [PATCH] Inline `YG_NODE_STYLE_PROPERTY_UNIT_IMPL` macro Reviewed By: astreet Differential Revision: D8874733 fbshipit-source-id: 75c24b508f287f405fad09605f64d2bfb3ffa0a5 --- yoga/Yoga.cpp | 99 +++++++++++++++++++++++++++------------------------ 1 file changed, 53 insertions(+), 46 deletions(-) diff --git a/yoga/Yoga.cpp b/yoga/Yoga.cpp index 7a115a90..f35b70b5 100644 --- a/yoga/Yoga.cpp +++ b/yoga/Yoga.cpp @@ -639,19 +639,6 @@ struct DimensionProp { } // namespace -#define YG_NODE_STYLE_PROPERTY_SETTER_UNIT_IMPL( \ - type, name, paramName, instanceName, dimension) \ - void YGNodeStyleSet##name(const YGNodeRef node, const type paramName) { \ - DimensionProp<&YGStyle::instanceName>::set( \ - node, paramName); \ - } \ - \ - void YGNodeStyleSet##name##Percent( \ - const YGNodeRef node, const type paramName) { \ - DimensionProp<&YGStyle::instanceName>::set( \ - node, paramName); \ - } - #define YG_NODE_STYLE_PROPERTY_SETTER_UNIT_AUTO_IMPL( \ type, name, paramName, instanceName) \ void YGNodeStyleSet##name(const YGNodeRef node, const type paramName) { \ @@ -685,15 +672,6 @@ struct DimensionProp { } \ } -#define YG_NODE_STYLE_PROPERTY_UNIT_IMPL( \ - type, name, paramName, instanceName, dimension) \ - YG_NODE_STYLE_PROPERTY_SETTER_UNIT_IMPL( \ - float, name, paramName, instanceName, dimension) \ - \ - type YGNodeStyleGet##name(const YGNodeRef node) { \ - return DimensionProp<&YGStyle::instanceName>::get(node); \ - } - #define YG_NODE_STYLE_PROPERTY_UNIT_AUTO_IMPL( \ type, name, paramName, instanceName) \ YG_NODE_STYLE_PROPERTY_SETTER_UNIT_AUTO_IMPL( \ @@ -1000,30 +978,59 @@ YG_NODE_STYLE_PROPERTY_UNIT_AUTO_IMPL( Height, height, dimensions[YGDimensionHeight]); -YG_NODE_STYLE_PROPERTY_UNIT_IMPL( - YGValue, - MinWidth, - minWidth, - minDimensions, - YGDimensionWidth); -YG_NODE_STYLE_PROPERTY_UNIT_IMPL( - YGValue, - MinHeight, - minHeight, - minDimensions, - YGDimensionHeight); -YG_NODE_STYLE_PROPERTY_UNIT_IMPL( - YGValue, - MaxWidth, - maxWidth, - maxDimensions, - YGDimensionWidth); -YG_NODE_STYLE_PROPERTY_UNIT_IMPL( - YGValue, - MaxHeight, - maxHeight, - maxDimensions, - YGDimensionHeight); + +void YGNodeStyleSetMinWidth(const YGNodeRef node, const float minWidth) { + DimensionProp<&YGStyle::minDimensions>::set( + node, minWidth); +} +void YGNodeStyleSetMinWidthPercent(const YGNodeRef node, const float minWidth) { + DimensionProp<&YGStyle::minDimensions>::set( + node, minWidth); +} +YGValue YGNodeStyleGetMinWidth(const YGNodeRef node) { + return DimensionProp<&YGStyle::minDimensions>::get(node); +}; + +void YGNodeStyleSetMinHeight(const YGNodeRef node, const float minHeight) { + DimensionProp<&YGStyle::minDimensions>::set( + node, minHeight); +} +void YGNodeStyleSetMinHeightPercent( + const YGNodeRef node, + const float minHeight) { + DimensionProp<&YGStyle::minDimensions>::set( + node, minHeight); +} +YGValue YGNodeStyleGetMinHeight(const YGNodeRef node) { + return DimensionProp<&YGStyle::minDimensions>::get(node); +}; + +void YGNodeStyleSetMaxWidth(const YGNodeRef node, const float maxWidth) { + DimensionProp<&YGStyle::maxDimensions>::set( + node, maxWidth); +} +void YGNodeStyleSetMaxWidthPercent(const YGNodeRef node, const float maxWidth) { + DimensionProp<&YGStyle::maxDimensions>::set( + node, maxWidth); +} +YGValue YGNodeStyleGetMaxWidth(const YGNodeRef node) { + return DimensionProp<&YGStyle::maxDimensions>::get(node); +}; + +void YGNodeStyleSetMaxHeight(const YGNodeRef node, const float maxHeight) { + DimensionProp<&YGStyle::maxDimensions>::set( + node, maxHeight); +} +void YGNodeStyleSetMaxHeightPercent( + const YGNodeRef node, + const float maxHeight) { + DimensionProp<&YGStyle::maxDimensions>::set( + node, maxHeight); +} +YGValue YGNodeStyleGetMaxHeight(const YGNodeRef node) { + return DimensionProp<&YGStyle::maxDimensions>::get(node); +}; + YG_NODE_LAYOUT_PROPERTY_IMPL(float, Left, position[YGEdgeLeft]); YG_NODE_LAYOUT_PROPERTY_IMPL(float, Top, position[YGEdgeTop]); YG_NODE_LAYOUT_PROPERTY_IMPL(float, Right, position[YGEdgeRight]);