mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-22 22:25:57 +00:00
Follow up for ASCollectionNode and ASTableNode background color fix
This commit is contained in:
@@ -85,7 +85,7 @@ BOOL ASDisplayNodeSubclassOverridesSelector(Class subclass, SEL selector)
|
||||
|
||||
// For classes like ASTableNode, ASCollectionNode, ASScrollNode and similar - we have to be sure to set certain properties
|
||||
// like setFrame: and setBackgroundColor: directly to the UIView and not apply it to the layer only.
|
||||
BOOL ASDisplayNodeNeedsSpecialPropertiesSettingHandlingForFlags(ASDisplayNodeFlags flags)
|
||||
BOOL ASDisplayNodeNeedsSpecialPropertiesHandlingForFlags(ASDisplayNodeFlags flags)
|
||||
{
|
||||
return flags.synchronous && !flags.layerBacked;
|
||||
}
|
||||
@@ -961,7 +961,7 @@ static ASDisplayNodeMethodOverrides GetASDisplayNodeMethodOverrides(Class c)
|
||||
if (self.layerBacked) {
|
||||
[_pendingViewState applyToLayer:self.layer];
|
||||
} else {
|
||||
BOOL specialPropertiesHandling = ASDisplayNodeNeedsSpecialPropertiesSettingHandlingForFlags(_flags);
|
||||
BOOL specialPropertiesHandling = ASDisplayNodeNeedsSpecialPropertiesHandlingForFlags(_flags);
|
||||
[_pendingViewState applyToView:self.view withSpecialPropertiesHandling:specialPropertiesHandling];
|
||||
}
|
||||
|
||||
|
||||
@@ -9,17 +9,10 @@
|
||||
#import "_ASCoreAnimationExtras.h"
|
||||
#import "_ASPendingState.h"
|
||||
#import "ASInternalHelpers.h"
|
||||
#import "ASAssert.h"
|
||||
#import "ASDisplayNodeInternal.h"
|
||||
#import "ASDisplayNodeExtras.h"
|
||||
#import "ASDisplayNode+Subclasses.h"
|
||||
#import "ASDisplayNode+FrameworkPrivate.h"
|
||||
#import "ASDisplayNode+Beta.h"
|
||||
#import "ASEqualityHelpers.h"
|
||||
#import "ASPendingStateController.h"
|
||||
#import "ASThread.h"
|
||||
#import "ASTextNode.h"
|
||||
#import "ASTableNode.h"
|
||||
|
||||
/**
|
||||
* The following macros are conveniences to help in the common tasks related to the bridging that ASDisplayNode does to UIView and CALayer.
|
||||
@@ -240,7 +233,7 @@ if (shouldApply) { _layer.layerProperty = (layerValueExpr); } else { ASDisplayNo
|
||||
|
||||
// For classes like ASTableNode, ASCollectionNode, ASScrollNode and similar - make sure UIView gets setFrame:
|
||||
struct ASDisplayNodeFlags flags = _flags;
|
||||
BOOL specialPropertiesHandling = ASDisplayNodeNeedsSpecialPropertiesSettingHandlingForFlags(flags);
|
||||
BOOL specialPropertiesHandling = ASDisplayNodeNeedsSpecialPropertiesHandlingForFlags(flags);
|
||||
|
||||
BOOL nodeLoaded = __loaded(self);
|
||||
BOOL isMainThread = ASDisplayNodeThreadIsMain();
|
||||
@@ -583,11 +576,12 @@ if (shouldApply) { _layer.layerProperty = (layerValueExpr); } else { ASDisplayNo
|
||||
|
||||
if (shouldApply) {
|
||||
CGColorRef oldBackgroundCGColor = _layer.backgroundColor;
|
||||
_layer.backgroundColor = newBackgroundCGColor;
|
||||
|
||||
BOOL specialPropertiesHandling = ASDisplayNodeNeedsSpecialPropertiesSettingHandlingForFlags(_flags);
|
||||
BOOL specialPropertiesHandling = ASDisplayNodeNeedsSpecialPropertiesHandlingForFlags(_flags);
|
||||
if (specialPropertiesHandling) {
|
||||
_view.backgroundColor = newBackgroundColor;
|
||||
} else {
|
||||
_layer.backgroundColor = newBackgroundCGColor;
|
||||
}
|
||||
|
||||
if (!CGColorEqualToColor(oldBackgroundCGColor, newBackgroundCGColor)) {
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
struct ASDisplayNodeFlags;
|
||||
|
||||
BOOL ASDisplayNodeSubclassOverridesSelector(Class subclass, SEL selector);
|
||||
BOOL ASDisplayNodeNeedsSpecialPropertiesSettingHandlingForFlags(ASDisplayNodeFlags flags);
|
||||
BOOL ASDisplayNodeNeedsSpecialPropertiesHandlingForFlags(ASDisplayNodeFlags flags);
|
||||
|
||||
/// Get the pending view state for the node, creating one if needed.
|
||||
_ASPendingState *ASDisplayNodeGetPendingState(ASDisplayNode *node);
|
||||
|
||||
@@ -790,12 +790,12 @@ static UIColor *defaultTintColor = nil;
|
||||
view.clipsToBounds = clipsToBounds;
|
||||
|
||||
if (flags.setBackgroundColor) {
|
||||
// Set the background color to the layer as in the UIView bridge we use this value as background color
|
||||
layer.backgroundColor = backgroundColor;
|
||||
|
||||
// We have to make sure certain nodes get the background color call directly
|
||||
// We have to make sure certain nodes get the background color call directly set
|
||||
if (specialPropertiesHandling) {
|
||||
view.backgroundColor = [UIColor colorWithCGColor:backgroundColor];
|
||||
} else {
|
||||
// Set the background color to the layer as in the UIView bridge we use this value as background color
|
||||
layer.backgroundColor = backgroundColor;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user