Skip to content

Commit 3664ca6

Browse files
authored
[ASDisplayNode] Short circuit measure calls that have a zero-area constrainedSize. (facebookarchive#1939)
* [ASDisplayNode] Short circuit measure calls that have a zero-area constrainedSize. // If the constrainedSize is completely zero-area, then there is no possibility for layout calculations to be successful. // This also avoids the issue of an inset being applied to 0, creating negative frame values. * [ASDisplayNode] Fix to shouldMeasure change. * One more fix.
1 parent 4baf9bd commit 3664ca6

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

AsyncDisplayKit/ASDisplayNode.mm

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -664,6 +664,12 @@ - (BOOL)shouldMeasureWithSizeRange:(ASSizeRange)constrainedSize
664664
return NO;
665665
}
666666

667+
// If the constrainedSize is completely zero-area, then there is no possibility for layout calculations to be successful.
668+
// This also avoids the issue of an inset being applied to 0, creating negative frame values.
669+
if (constrainedSize.min.width * constrainedSize.min.height == 0.0 && constrainedSize.max.width * constrainedSize.max.height == 0.0) {
670+
return NO;
671+
}
672+
667673
if (ASHierarchyStateIncludesLayoutPending(_hierarchyState)) {
668674
ASLayoutableContext context = ASLayoutableGetCurrentContext();
669675
if (ASLayoutableContextIsNull(context) || _pendingTransitionID != context.transitionID) {

0 commit comments

Comments
 (0)