From 0c78681cdc67eceee858cd52a71a229176069531 Mon Sep 17 00:00:00 2001 From: Michael Schneider Date: Mon, 12 Aug 2019 14:05:23 -0700 Subject: [PATCH] Cleanup for cgFloatForYogaFloat (#1571) - Return CGFloat - Proper check for YGUndefined - Add YGUndefined default return value --- Source/Layout/ASYogaUtilities.mm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Source/Layout/ASYogaUtilities.mm b/Source/Layout/ASYogaUtilities.mm index 2411c06bf..68beede1a 100644 --- a/Source/Layout/ASYogaUtilities.mm +++ b/Source/Layout/ASYogaUtilities.mm @@ -117,9 +117,9 @@ float yogaFloatForCGFloat(CGFloat value) } } -float cgFloatForYogaFloat(float yogaFloat) +CGFloat cgFloatForYogaFloat(float yogaFloat, CGFloat undefinedDefault) { - return (yogaFloat == YGUndefined) ? CGFLOAT_MAX : yogaFloat; + return YGFloatIsUndefined(yogaFloat) ? undefinedDefault : yogaFloat; } float yogaDimensionToPoints(ASDimension dimension) @@ -213,8 +213,8 @@ YGSize ASLayoutElementYogaMeasureFunc(YGNodeRef yogaNode, float width, YGMeasure id layoutElement = (__bridge id )YGNodeGetContext(yogaNode); ASDisplayNodeCAssert([layoutElement conformsToProtocol:@protocol(ASLayoutElement)], @"Yoga context must be "); - width = cgFloatForYogaFloat(width); - height = cgFloatForYogaFloat(height); + width = cgFloatForYogaFloat(width, CGFLOAT_MAX); + height = cgFloatForYogaFloat(height, CGFLOAT_MAX); ASSizeRange sizeRange; sizeRange.min = CGSizeZero;