Merge commit '89156ebbc750a2d28b8d4594ccad62ef4c73127e'

This commit is contained in:
Peter
2017-01-18 02:13:01 +03:00
68 changed files with 1460 additions and 603 deletions

View File

@@ -78,6 +78,8 @@ static NSString * const kCellReuseIdentifier = @"_ASCollectionViewCell";
ASDisplayNodeAssertMainThread();
node.layoutAttributes = _layoutAttributes;
_node = node;
self.backgroundColor = node.backgroundColor;
self.clipsToBounds = node.clipsToBounds;
[node __setSelectedFromUIKit:self.selected];
[node __setHighlightedFromUIKit:self.highlighted];
}
@@ -121,6 +123,15 @@ static NSString * const kCellReuseIdentifier = @"_ASCollectionViewCell";
self.layoutAttributes = layoutAttributes;
}
/**
* Keep our node filling our content view.
*/
- (void)layoutSubviews
{
[super layoutSubviews];
self.node.frame = self.contentView.bounds;
}
@end
#pragma mark -
@@ -282,7 +293,15 @@ static NSString * const kCellReuseIdentifier = @"_ASCollectionViewCell";
{
if (!(self = [super initWithFrame:frame collectionViewLayout:layout]))
return nil;
// Disable UICollectionView prefetching.
// Experiments done by Instagram show that this option being YES (default)
// when unused causes a significant hit to scroll performance.
// https://github.com/Instagram/IGListKit/issues/318
if (AS_AT_LEAST_IOS10) {
self.prefetchingEnabled = NO;
}
_layoutController = [[ASCollectionViewLayoutController alloc] initWithCollectionView:self];
_rangeController = [[ASRangeController alloc] init];
@@ -614,6 +633,10 @@ static NSString * const kCellReuseIdentifier = @"_ASCollectionViewCell";
- (NSIndexPath *)convertIndexPathFromCollectionNode:(NSIndexPath *)indexPath waitingIfNeeded:(BOOL)wait
{
if (indexPath == nil) {
return nil;
}
// If this is a section index path, we don't currently have a method
// to do a mapping.
if (indexPath.item == NSNotFound) {
@@ -751,7 +774,8 @@ static NSString * const kCellReuseIdentifier = @"_ASCollectionViewCell";
- (void)performBatchUpdates:(void (^)())updates completion:(void (^)(BOOL))completion
{
[self performBatchAnimated:YES updates:updates completion:completion];
// We capture the current state of whether animations are enabled if they don't provide us with one.
[self performBatchAnimated:[UIView areAnimationsEnabled] updates:updates completion:completion];
}
- (void)registerSupplementaryNodeOfKind:(NSString *)elementKind