mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-11-25 01:22:41 +00:00
Merge pull request #493 from facebook/LayerDrivenLayout
Remove -[_ASDisplayView layoutSubviews] and use only -[_ASDisplayLayer layoutSublayers]
This commit is contained in:
commit
c12cbdd21a
@ -7,6 +7,19 @@
|
||||
*/
|
||||
|
||||
#import "ASScrollNode.h"
|
||||
#import "_ASDisplayLayer.h"
|
||||
|
||||
@interface ASScrollView : UIScrollView
|
||||
@end
|
||||
|
||||
@implementation ASScrollView
|
||||
|
||||
+ (Class)layerClass
|
||||
{
|
||||
return [_ASDisplayLayer class];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation ASScrollNode
|
||||
@dynamic view;
|
||||
@ -14,7 +27,7 @@
|
||||
- (instancetype)init
|
||||
{
|
||||
return [super initWithViewBlock:^UIView *{
|
||||
return [[UIScrollView alloc] init];
|
||||
return [[ASScrollView alloc] init];
|
||||
}];
|
||||
}
|
||||
|
||||
|
||||
@ -93,10 +93,13 @@
|
||||
[super layoutSublayers];
|
||||
|
||||
ASDisplayNode *node = self.asyncdisplaykit_node;
|
||||
// If our associated node is layer-backed, we cannot rely on the view's -layoutSubviews calling the node's -layout implementation, so do it ourselves.
|
||||
if (node.isLayerBacked) {
|
||||
ASDisplayNodeAssertMainThread();
|
||||
if (ASDisplayNodeThreadIsMain()) {
|
||||
[node __layout];
|
||||
} else {
|
||||
ASDisplayNodeFailAssert(@"not reached assertion");
|
||||
dispatch_async(dispatch_get_main_queue(), ^ {
|
||||
[node __layout];
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -122,19 +122,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
- (void)layoutSubviews
|
||||
{
|
||||
if (ASDisplayNodeThreadIsMain()) {
|
||||
[_node __layout];
|
||||
} else {
|
||||
// FIXME: CRASH This should not be happening because of the way we gate -setNeedsLayout, but it has been seen.
|
||||
ASDisplayNodeFailAssert(@"not reached assertion");
|
||||
dispatch_async(dispatch_get_main_queue(), ^ {
|
||||
[_node __layout];
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
- (UIViewContentMode)contentMode
|
||||
{
|
||||
return ASDisplayNodeUIContentModeFromCAContentsGravity(self.layer.contentsGravity);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user