Merge pull request #1174 from levi/implicitHierarchyFix

Wrap implicit hierarchy management behind beta feature flag
This commit is contained in:
appleguy
2016-02-03 20:56:15 -08:00

View File

@@ -644,17 +644,19 @@ static ASDisplayNodeMethodOverrides GetASDisplayNodeMethodOverrides(Class c)
if (!_flags.isMeasured || !ASSizeRangeEqualToSizeRange(constrainedSize, _constrainedSize)) { if (!_flags.isMeasured || !ASSizeRangeEqualToSizeRange(constrainedSize, _constrainedSize)) {
ASLayout *newLayout = [self calculateLayoutThatFits:constrainedSize]; ASLayout *newLayout = [self calculateLayoutThatFits:constrainedSize];
if (_layout) { if ([[self class] usesImplicitHierarchyManagement]) {
NSIndexSet *insertions, *deletions; if (_layout) {
[_layout.sublayouts asdk_diffWithArray:newLayout.sublayouts insertions:&insertions deletions:&deletions compareBlock:^BOOL(ASLayout *lhs, ASLayout *rhs) { NSIndexSet *insertions, *deletions;
return ASObjectIsEqual(lhs.layoutableObject, rhs.layoutableObject); [_layout.sublayouts asdk_diffWithArray:newLayout.sublayouts insertions:&insertions deletions:&deletions compareBlock:^BOOL(ASLayout *lhs, ASLayout *rhs) {
}]; return ASObjectIsEqual(lhs.layoutableObject, rhs.layoutableObject);
_insertedSubnodes = [self _filterNodesInLayouts:newLayout.sublayouts withIndexes:insertions]; }];
_deletedSubnodes = [self _filterNodesInLayouts:_layout.sublayouts withIndexes:deletions]; _insertedSubnodes = [self _filterNodesInLayouts:newLayout.sublayouts withIndexes:insertions];
} else { _deletedSubnodes = [self _filterNodesInLayouts:_layout.sublayouts withIndexes:deletions];
NSIndexSet *indexes = [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, [newLayout.sublayouts count])]; } else {
_insertedSubnodes = [self _filterNodesInLayouts:newLayout.sublayouts withIndexes:indexes]; NSIndexSet *indexes = [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, [newLayout.sublayouts count])];
_deletedSubnodes = @[]; _insertedSubnodes = [self _filterNodesInLayouts:newLayout.sublayouts withIndexes:indexes];
_deletedSubnodes = @[];
}
} }
_layout = newLayout; _layout = newLayout;