From 589efefcf2dd64a94de8ae44f48d8a8781796eae Mon Sep 17 00:00:00 2001 From: Scott Goodson Date: Sat, 30 Jul 2016 23:44:46 -0700 Subject: [PATCH] [ASDimension] Disable assertions for Percent values being between 0.0 and 1.0. This triggers on existing code that needs to be updated, but also there is some investigation needed as to whether it is a valid use case to have a >1.0 value in order to position greater-than-bounds elements. --- AsyncDisplayKit/Layout/ASDimension.mm | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/AsyncDisplayKit/Layout/ASDimension.mm b/AsyncDisplayKit/Layout/ASDimension.mm index cf58e1c517..d7309d7370 100644 --- a/AsyncDisplayKit/Layout/ASDimension.mm +++ b/AsyncDisplayKit/Layout/ASDimension.mm @@ -17,9 +17,11 @@ ASRelativeDimension const ASRelativeDimensionUnconstrained = {}; ASRelativeDimension ASRelativeDimensionMake(ASRelativeDimensionType type, CGFloat value) { - if (type == ASRelativeDimensionTypePoints) { ASDisplayNodeCAssertPositiveReal(@"Points", value); } - if (type == ASRelativeDimensionTypePercent) { - ASDisplayNodeCAssert( 0 <= value && value <= 1.0, @"ASRelativeDimension percent value (%f) must be between 0 and 1.", value); + if (type == ASRelativeDimensionTypePoints) { + ASDisplayNodeCAssertPositiveReal(@"Points", value); + } else if (type == ASRelativeDimensionTypePercent) { + // TODO: Enable this assertion for 2.0. Check that there is no use case for using a larger value, e.g. to layout for a clipsToBounds = NO element. + // ASDisplayNodeCAssert( 0 <= value && value <= 1.0, @"ASRelativeDimension percent value (%f) must be between 0 and 1.", value); } ASRelativeDimension dimension; dimension.type = type; dimension.value = value; return dimension; } @@ -32,7 +34,7 @@ ASRelativeDimension ASRelativeDimensionMakeWithPoints(CGFloat points) ASRelativeDimension ASRelativeDimensionMakeWithPercent(CGFloat percent) { - ASDisplayNodeCAssert( 0 <= percent && percent <= 1.0, @"ASRelativeDimension percent value (%f) must be between 0 and 1.", percent); + // ASDisplayNodeCAssert( 0 <= percent && percent <= 1.0, @"ASRelativeDimension percent value (%f) must be between 0 and 1.", percent); return ASRelativeDimensionMake(ASRelativeDimensionTypePercent, percent); }