mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-08-30 17:31:58 +00:00
Revert "Add setNeedsLayout
to yoga tree changes. (#1361)"
This reverts commit babd81bd23f24ad1e16785e2ad550d724e98c0a3.
This commit is contained in:
parent
9d77ef944f
commit
ae2b3af967
@ -23,19 +23,6 @@
|
|||||||
|
|
||||||
using AS::MutexLocker;
|
using AS::MutexLocker;
|
||||||
|
|
||||||
@interface ASDisplayNode (ASLayoutElementStyleDelegate) <ASLayoutElementStyleDelegate>
|
|
||||||
@end
|
|
||||||
|
|
||||||
@implementation ASDisplayNode (ASLayoutElementStyleDelegate)
|
|
||||||
|
|
||||||
#pragma mark <ASLayoutElementStyleDelegate>
|
|
||||||
|
|
||||||
- (void)style:(ASLayoutElementStyle *)style propertyDidChange:(NSString *)propertyName {
|
|
||||||
[self setNeedsLayout];
|
|
||||||
}
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
||||||
#pragma mark - ASDisplayNode (ASLayoutElement)
|
#pragma mark - ASDisplayNode (ASLayoutElement)
|
||||||
|
|
||||||
@implementation ASDisplayNode (ASLayoutElement)
|
@implementation ASDisplayNode (ASLayoutElement)
|
||||||
@ -59,9 +46,8 @@ using AS::MutexLocker;
|
|||||||
|
|
||||||
- (ASLayoutElementStyle *)_locked_style
|
- (ASLayoutElementStyle *)_locked_style
|
||||||
{
|
{
|
||||||
ASAssertLocked(__instanceLock__);
|
|
||||||
if (_style == nil) {
|
if (_style == nil) {
|
||||||
_style = [[ASLayoutElementStyle alloc] initWithDelegate:self];
|
_style = [[ASLayoutElementStyle alloc] init];
|
||||||
}
|
}
|
||||||
return _style;
|
return _style;
|
||||||
}
|
}
|
||||||
|
@ -93,7 +93,6 @@
|
|||||||
|
|
||||||
// YGNodeRef removal is done in setParent:
|
// YGNodeRef removal is done in setParent:
|
||||||
child.yogaParent = nil;
|
child.yogaParent = nil;
|
||||||
[self setNeedsLayout];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)insertYogaChild:(ASDisplayNode *)child atIndex:(NSUInteger)index
|
- (void)insertYogaChild:(ASDisplayNode *)child atIndex:(NSUInteger)index
|
||||||
@ -118,7 +117,6 @@
|
|||||||
|
|
||||||
// YGNodeRef insertion is done in setParent:
|
// YGNodeRef insertion is done in setParent:
|
||||||
child.yogaParent = self;
|
child.yogaParent = self;
|
||||||
[self setNeedsLayout];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark - Subclass Hooks
|
#pragma mark - Subclass Hooks
|
||||||
|
@ -141,19 +141,12 @@ NSString * const ASYogaBorderProperty = @"ASYogaBorderProperty";
|
|||||||
NSString * const ASYogaAspectRatioProperty = @"ASYogaAspectRatioProperty";
|
NSString * const ASYogaAspectRatioProperty = @"ASYogaAspectRatioProperty";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define ASLayoutElementStyleSetSizeWithScope(x) \
|
#define ASLayoutElementStyleSetSizeWithScope(x) \
|
||||||
({ \
|
__instanceLock__.lock(); \
|
||||||
__instanceLock__.lock(); \
|
ASLayoutElementSize newSize = _size.load(); \
|
||||||
const ASLayoutElementSize oldSize = _size.load(); \
|
{ x } \
|
||||||
ASLayoutElementSize newSize = oldSize; \
|
_size.store(newSize); \
|
||||||
{x}; \
|
__instanceLock__.unlock();
|
||||||
BOOL changed = !ASLayoutElementSizeEqualToLayoutElementSize(oldSize, newSize); \
|
|
||||||
if (changed) { \
|
|
||||||
_size.store(newSize); \
|
|
||||||
} \
|
|
||||||
__instanceLock__.unlock(); \
|
|
||||||
changed; \
|
|
||||||
})
|
|
||||||
|
|
||||||
#define ASLayoutElementStyleCallDelegate(propertyName)\
|
#define ASLayoutElementStyleCallDelegate(propertyName)\
|
||||||
do {\
|
do {\
|
||||||
@ -211,13 +204,9 @@ do {\
|
|||||||
{
|
{
|
||||||
self = [super init];
|
self = [super init];
|
||||||
if (self) {
|
if (self) {
|
||||||
std::atomic_init(&_size, ASLayoutElementSizeMake());
|
_size = ASLayoutElementSizeMake();
|
||||||
std::atomic_init(&_flexBasis, ASDimensionAuto);
|
|
||||||
#if YOGA
|
#if YOGA
|
||||||
_parentAlignStyle = ASStackLayoutAlignItemsNotSet;
|
_parentAlignStyle = ASStackLayoutAlignItemsNotSet;
|
||||||
std::atomic_init(&_flexDirection, ASStackLayoutDirectionVertical);
|
|
||||||
std::atomic_init(&_alignItems, ASStackLayoutAlignItemsStretch);
|
|
||||||
std::atomic_init(&_aspectRatio, static_cast<CGFloat>(YGUndefined));
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
return self;
|
return self;
|
||||||
@ -249,10 +238,10 @@ ASSynthesizeLockingMethodsWithMutex(__instanceLock__)
|
|||||||
|
|
||||||
- (void)setWidth:(ASDimension)width
|
- (void)setWidth:(ASDimension)width
|
||||||
{
|
{
|
||||||
BOOL changed = ASLayoutElementStyleSetSizeWithScope({ newSize.width = width; });
|
ASLayoutElementStyleSetSizeWithScope({
|
||||||
if (changed) {
|
newSize.width = width;
|
||||||
ASLayoutElementStyleCallDelegate(ASLayoutElementStyleWidthProperty);
|
});
|
||||||
}
|
ASLayoutElementStyleCallDelegate(ASLayoutElementStyleWidthProperty);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (ASDimension)height
|
- (ASDimension)height
|
||||||
@ -262,10 +251,10 @@ ASSynthesizeLockingMethodsWithMutex(__instanceLock__)
|
|||||||
|
|
||||||
- (void)setHeight:(ASDimension)height
|
- (void)setHeight:(ASDimension)height
|
||||||
{
|
{
|
||||||
BOOL changed = ASLayoutElementStyleSetSizeWithScope({ newSize.height = height; });
|
ASLayoutElementStyleSetSizeWithScope({
|
||||||
if (changed) {
|
newSize.height = height;
|
||||||
ASLayoutElementStyleCallDelegate(ASLayoutElementStyleHeightProperty);
|
});
|
||||||
}
|
ASLayoutElementStyleCallDelegate(ASLayoutElementStyleHeightProperty);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (ASDimension)minWidth
|
- (ASDimension)minWidth
|
||||||
@ -275,10 +264,10 @@ ASSynthesizeLockingMethodsWithMutex(__instanceLock__)
|
|||||||
|
|
||||||
- (void)setMinWidth:(ASDimension)minWidth
|
- (void)setMinWidth:(ASDimension)minWidth
|
||||||
{
|
{
|
||||||
BOOL changed = ASLayoutElementStyleSetSizeWithScope({ newSize.minWidth = minWidth; });
|
ASLayoutElementStyleSetSizeWithScope({
|
||||||
if (changed) {
|
newSize.minWidth = minWidth;
|
||||||
ASLayoutElementStyleCallDelegate(ASLayoutElementStyleMinWidthProperty);
|
});
|
||||||
}
|
ASLayoutElementStyleCallDelegate(ASLayoutElementStyleMinWidthProperty);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (ASDimension)maxWidth
|
- (ASDimension)maxWidth
|
||||||
@ -288,10 +277,10 @@ ASSynthesizeLockingMethodsWithMutex(__instanceLock__)
|
|||||||
|
|
||||||
- (void)setMaxWidth:(ASDimension)maxWidth
|
- (void)setMaxWidth:(ASDimension)maxWidth
|
||||||
{
|
{
|
||||||
BOOL changed = ASLayoutElementStyleSetSizeWithScope({ newSize.maxWidth = maxWidth; });
|
ASLayoutElementStyleSetSizeWithScope({
|
||||||
if (changed) {
|
newSize.maxWidth = maxWidth;
|
||||||
ASLayoutElementStyleCallDelegate(ASLayoutElementStyleMaxWidthProperty);
|
});
|
||||||
}
|
ASLayoutElementStyleCallDelegate(ASLayoutElementStyleMaxWidthProperty);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (ASDimension)minHeight
|
- (ASDimension)minHeight
|
||||||
@ -301,10 +290,10 @@ ASSynthesizeLockingMethodsWithMutex(__instanceLock__)
|
|||||||
|
|
||||||
- (void)setMinHeight:(ASDimension)minHeight
|
- (void)setMinHeight:(ASDimension)minHeight
|
||||||
{
|
{
|
||||||
BOOL changed = ASLayoutElementStyleSetSizeWithScope({ newSize.minHeight = minHeight; });
|
ASLayoutElementStyleSetSizeWithScope({
|
||||||
if (changed) {
|
newSize.minHeight = minHeight;
|
||||||
ASLayoutElementStyleCallDelegate(ASLayoutElementStyleMinHeightProperty);
|
});
|
||||||
}
|
ASLayoutElementStyleCallDelegate(ASLayoutElementStyleMinHeightProperty);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (ASDimension)maxHeight
|
- (ASDimension)maxHeight
|
||||||
@ -314,10 +303,10 @@ ASSynthesizeLockingMethodsWithMutex(__instanceLock__)
|
|||||||
|
|
||||||
- (void)setMaxHeight:(ASDimension)maxHeight
|
- (void)setMaxHeight:(ASDimension)maxHeight
|
||||||
{
|
{
|
||||||
BOOL changed = ASLayoutElementStyleSetSizeWithScope({ newSize.maxHeight = maxHeight; });
|
ASLayoutElementStyleSetSizeWithScope({
|
||||||
if (changed) {
|
newSize.maxHeight = maxHeight;
|
||||||
ASLayoutElementStyleCallDelegate(ASLayoutElementStyleMaxHeightProperty);
|
});
|
||||||
}
|
ASLayoutElementStyleCallDelegate(ASLayoutElementStyleMaxHeightProperty);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -325,14 +314,12 @@ ASSynthesizeLockingMethodsWithMutex(__instanceLock__)
|
|||||||
|
|
||||||
- (void)setPreferredSize:(CGSize)preferredSize
|
- (void)setPreferredSize:(CGSize)preferredSize
|
||||||
{
|
{
|
||||||
BOOL changed = ASLayoutElementStyleSetSizeWithScope({
|
ASLayoutElementStyleSetSizeWithScope({
|
||||||
newSize.width = ASDimensionMakeWithPoints(preferredSize.width);
|
newSize.width = ASDimensionMakeWithPoints(preferredSize.width);
|
||||||
newSize.height = ASDimensionMakeWithPoints(preferredSize.height);
|
newSize.height = ASDimensionMakeWithPoints(preferredSize.height);
|
||||||
});
|
});
|
||||||
if (changed) {
|
ASLayoutElementStyleCallDelegate(ASLayoutElementStyleWidthProperty);
|
||||||
ASLayoutElementStyleCallDelegate(ASLayoutElementStyleWidthProperty);
|
ASLayoutElementStyleCallDelegate(ASLayoutElementStyleHeightProperty);
|
||||||
ASLayoutElementStyleCallDelegate(ASLayoutElementStyleHeightProperty);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (CGSize)preferredSize
|
- (CGSize)preferredSize
|
||||||
@ -353,26 +340,22 @@ ASSynthesizeLockingMethodsWithMutex(__instanceLock__)
|
|||||||
|
|
||||||
- (void)setMinSize:(CGSize)minSize
|
- (void)setMinSize:(CGSize)minSize
|
||||||
{
|
{
|
||||||
BOOL changed = ASLayoutElementStyleSetSizeWithScope({
|
ASLayoutElementStyleSetSizeWithScope({
|
||||||
newSize.minWidth = ASDimensionMakeWithPoints(minSize.width);
|
newSize.minWidth = ASDimensionMakeWithPoints(minSize.width);
|
||||||
newSize.minHeight = ASDimensionMakeWithPoints(minSize.height);
|
newSize.minHeight = ASDimensionMakeWithPoints(minSize.height);
|
||||||
});
|
});
|
||||||
if (changed) {
|
ASLayoutElementStyleCallDelegate(ASLayoutElementStyleMinWidthProperty);
|
||||||
ASLayoutElementStyleCallDelegate(ASLayoutElementStyleMinWidthProperty);
|
ASLayoutElementStyleCallDelegate(ASLayoutElementStyleMinHeightProperty);
|
||||||
ASLayoutElementStyleCallDelegate(ASLayoutElementStyleMinHeightProperty);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setMaxSize:(CGSize)maxSize
|
- (void)setMaxSize:(CGSize)maxSize
|
||||||
{
|
{
|
||||||
BOOL changed = ASLayoutElementStyleSetSizeWithScope({
|
ASLayoutElementStyleSetSizeWithScope({
|
||||||
newSize.maxWidth = ASDimensionMakeWithPoints(maxSize.width);
|
newSize.maxWidth = ASDimensionMakeWithPoints(maxSize.width);
|
||||||
newSize.maxHeight = ASDimensionMakeWithPoints(maxSize.height);
|
newSize.maxHeight = ASDimensionMakeWithPoints(maxSize.height);
|
||||||
});
|
});
|
||||||
if (changed) {
|
ASLayoutElementStyleCallDelegate(ASLayoutElementStyleMaxWidthProperty);
|
||||||
ASLayoutElementStyleCallDelegate(ASLayoutElementStyleMaxWidthProperty);
|
ASLayoutElementStyleCallDelegate(ASLayoutElementStyleMaxHeightProperty);
|
||||||
ASLayoutElementStyleCallDelegate(ASLayoutElementStyleMaxHeightProperty);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (ASLayoutSize)preferredLayoutSize
|
- (ASLayoutSize)preferredLayoutSize
|
||||||
@ -383,14 +366,12 @@ ASSynthesizeLockingMethodsWithMutex(__instanceLock__)
|
|||||||
|
|
||||||
- (void)setPreferredLayoutSize:(ASLayoutSize)preferredLayoutSize
|
- (void)setPreferredLayoutSize:(ASLayoutSize)preferredLayoutSize
|
||||||
{
|
{
|
||||||
BOOL changed = ASLayoutElementStyleSetSizeWithScope({
|
ASLayoutElementStyleSetSizeWithScope({
|
||||||
newSize.width = preferredLayoutSize.width;
|
newSize.width = preferredLayoutSize.width;
|
||||||
newSize.height = preferredLayoutSize.height;
|
newSize.height = preferredLayoutSize.height;
|
||||||
});
|
});
|
||||||
if (changed) {
|
ASLayoutElementStyleCallDelegate(ASLayoutElementStyleWidthProperty);
|
||||||
ASLayoutElementStyleCallDelegate(ASLayoutElementStyleWidthProperty);
|
ASLayoutElementStyleCallDelegate(ASLayoutElementStyleHeightProperty);
|
||||||
ASLayoutElementStyleCallDelegate(ASLayoutElementStyleHeightProperty);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (ASLayoutSize)minLayoutSize
|
- (ASLayoutSize)minLayoutSize
|
||||||
@ -401,14 +382,12 @@ ASSynthesizeLockingMethodsWithMutex(__instanceLock__)
|
|||||||
|
|
||||||
- (void)setMinLayoutSize:(ASLayoutSize)minLayoutSize
|
- (void)setMinLayoutSize:(ASLayoutSize)minLayoutSize
|
||||||
{
|
{
|
||||||
BOOL changed = ASLayoutElementStyleSetSizeWithScope({
|
ASLayoutElementStyleSetSizeWithScope({
|
||||||
newSize.minWidth = minLayoutSize.width;
|
newSize.minWidth = minLayoutSize.width;
|
||||||
newSize.minHeight = minLayoutSize.height;
|
newSize.minHeight = minLayoutSize.height;
|
||||||
});
|
});
|
||||||
if (changed) {
|
ASLayoutElementStyleCallDelegate(ASLayoutElementStyleMinWidthProperty);
|
||||||
ASLayoutElementStyleCallDelegate(ASLayoutElementStyleMinWidthProperty);
|
ASLayoutElementStyleCallDelegate(ASLayoutElementStyleMinHeightProperty);
|
||||||
ASLayoutElementStyleCallDelegate(ASLayoutElementStyleMinHeightProperty);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (ASLayoutSize)maxLayoutSize
|
- (ASLayoutSize)maxLayoutSize
|
||||||
@ -419,23 +398,20 @@ ASSynthesizeLockingMethodsWithMutex(__instanceLock__)
|
|||||||
|
|
||||||
- (void)setMaxLayoutSize:(ASLayoutSize)maxLayoutSize
|
- (void)setMaxLayoutSize:(ASLayoutSize)maxLayoutSize
|
||||||
{
|
{
|
||||||
BOOL changed = ASLayoutElementStyleSetSizeWithScope({
|
ASLayoutElementStyleSetSizeWithScope({
|
||||||
newSize.maxWidth = maxLayoutSize.width;
|
newSize.maxWidth = maxLayoutSize.width;
|
||||||
newSize.maxHeight = maxLayoutSize.height;
|
newSize.maxHeight = maxLayoutSize.height;
|
||||||
});
|
});
|
||||||
if (changed) {
|
ASLayoutElementStyleCallDelegate(ASLayoutElementStyleMaxWidthProperty);
|
||||||
ASLayoutElementStyleCallDelegate(ASLayoutElementStyleMaxWidthProperty);
|
ASLayoutElementStyleCallDelegate(ASLayoutElementStyleMaxHeightProperty);
|
||||||
ASLayoutElementStyleCallDelegate(ASLayoutElementStyleMaxHeightProperty);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark - ASStackLayoutElement
|
#pragma mark - ASStackLayoutElement
|
||||||
|
|
||||||
- (void)setSpacingBefore:(CGFloat)spacingBefore
|
- (void)setSpacingBefore:(CGFloat)spacingBefore
|
||||||
{
|
{
|
||||||
if (_spacingBefore.exchange(spacingBefore) != spacingBefore) {
|
_spacingBefore.store(spacingBefore);
|
||||||
ASLayoutElementStyleCallDelegate(ASLayoutElementStyleSpacingBeforeProperty);
|
ASLayoutElementStyleCallDelegate(ASLayoutElementStyleSpacingBeforeProperty);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (CGFloat)spacingBefore
|
- (CGFloat)spacingBefore
|
||||||
@ -445,9 +421,8 @@ ASSynthesizeLockingMethodsWithMutex(__instanceLock__)
|
|||||||
|
|
||||||
- (void)setSpacingAfter:(CGFloat)spacingAfter
|
- (void)setSpacingAfter:(CGFloat)spacingAfter
|
||||||
{
|
{
|
||||||
if (_spacingAfter.exchange(spacingAfter) != spacingAfter) {
|
_spacingAfter.store(spacingAfter);
|
||||||
ASLayoutElementStyleCallDelegate(ASLayoutElementStyleSpacingAfterProperty);
|
ASLayoutElementStyleCallDelegate(ASLayoutElementStyleSpacingAfterProperty);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (CGFloat)spacingAfter
|
- (CGFloat)spacingAfter
|
||||||
@ -457,9 +432,8 @@ ASSynthesizeLockingMethodsWithMutex(__instanceLock__)
|
|||||||
|
|
||||||
- (void)setFlexGrow:(CGFloat)flexGrow
|
- (void)setFlexGrow:(CGFloat)flexGrow
|
||||||
{
|
{
|
||||||
if (_flexGrow.exchange(flexGrow) != flexGrow) {
|
_flexGrow.store(flexGrow);
|
||||||
ASLayoutElementStyleCallDelegate(ASLayoutElementStyleFlexGrowProperty);
|
ASLayoutElementStyleCallDelegate(ASLayoutElementStyleFlexGrowProperty);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (CGFloat)flexGrow
|
- (CGFloat)flexGrow
|
||||||
@ -469,9 +443,8 @@ ASSynthesizeLockingMethodsWithMutex(__instanceLock__)
|
|||||||
|
|
||||||
- (void)setFlexShrink:(CGFloat)flexShrink
|
- (void)setFlexShrink:(CGFloat)flexShrink
|
||||||
{
|
{
|
||||||
if (_flexShrink.exchange(flexShrink) != flexShrink) {
|
_flexShrink.store(flexShrink);
|
||||||
ASLayoutElementStyleCallDelegate(ASLayoutElementStyleFlexShrinkProperty);
|
ASLayoutElementStyleCallDelegate(ASLayoutElementStyleFlexShrinkProperty);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (CGFloat)flexShrink
|
- (CGFloat)flexShrink
|
||||||
@ -481,9 +454,8 @@ ASSynthesizeLockingMethodsWithMutex(__instanceLock__)
|
|||||||
|
|
||||||
- (void)setFlexBasis:(ASDimension)flexBasis
|
- (void)setFlexBasis:(ASDimension)flexBasis
|
||||||
{
|
{
|
||||||
if (!ASDimensionEqualToDimension(_flexBasis.exchange(flexBasis), flexBasis)) {
|
_flexBasis.store(flexBasis);
|
||||||
ASLayoutElementStyleCallDelegate(ASLayoutElementStyleFlexBasisProperty);
|
ASLayoutElementStyleCallDelegate(ASLayoutElementStyleFlexBasisProperty);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (ASDimension)flexBasis
|
- (ASDimension)flexBasis
|
||||||
@ -493,9 +465,8 @@ ASSynthesizeLockingMethodsWithMutex(__instanceLock__)
|
|||||||
|
|
||||||
- (void)setAlignSelf:(ASStackLayoutAlignSelf)alignSelf
|
- (void)setAlignSelf:(ASStackLayoutAlignSelf)alignSelf
|
||||||
{
|
{
|
||||||
if (_alignSelf.exchange(alignSelf) != alignSelf) {
|
_alignSelf.store(alignSelf);
|
||||||
ASLayoutElementStyleCallDelegate(ASLayoutElementStyleAlignSelfProperty);
|
ASLayoutElementStyleCallDelegate(ASLayoutElementStyleAlignSelfProperty);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (ASStackLayoutAlignSelf)alignSelf
|
- (ASStackLayoutAlignSelf)alignSelf
|
||||||
@ -505,9 +476,8 @@ ASSynthesizeLockingMethodsWithMutex(__instanceLock__)
|
|||||||
|
|
||||||
- (void)setAscender:(CGFloat)ascender
|
- (void)setAscender:(CGFloat)ascender
|
||||||
{
|
{
|
||||||
if (_ascender.exchange(ascender) != ascender) {
|
_ascender.store(ascender);
|
||||||
ASLayoutElementStyleCallDelegate(ASLayoutElementStyleAscenderProperty);
|
ASLayoutElementStyleCallDelegate(ASLayoutElementStyleAscenderProperty);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (CGFloat)ascender
|
- (CGFloat)ascender
|
||||||
@ -517,9 +487,8 @@ ASSynthesizeLockingMethodsWithMutex(__instanceLock__)
|
|||||||
|
|
||||||
- (void)setDescender:(CGFloat)descender
|
- (void)setDescender:(CGFloat)descender
|
||||||
{
|
{
|
||||||
if (_descender.exchange(descender) != descender) {
|
_descender.store(descender);
|
||||||
ASLayoutElementStyleCallDelegate(ASLayoutElementStyleDescenderProperty);
|
ASLayoutElementStyleCallDelegate(ASLayoutElementStyleDescenderProperty);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (CGFloat)descender
|
- (CGFloat)descender
|
||||||
@ -531,9 +500,8 @@ ASSynthesizeLockingMethodsWithMutex(__instanceLock__)
|
|||||||
|
|
||||||
- (void)setLayoutPosition:(CGPoint)layoutPosition
|
- (void)setLayoutPosition:(CGPoint)layoutPosition
|
||||||
{
|
{
|
||||||
if (!CGPointEqualToPoint(_layoutPosition.exchange(layoutPosition), layoutPosition)) {
|
_layoutPosition.store(layoutPosition);
|
||||||
ASLayoutElementStyleCallDelegate(ASLayoutElementStyleLayoutPositionProperty);
|
ASLayoutElementStyleCallDelegate(ASLayoutElementStyleLayoutPositionProperty);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (CGPoint)layoutPosition
|
- (CGPoint)layoutPosition
|
||||||
@ -821,64 +789,48 @@ ASSynthesizeLockingMethodsWithMutex(__instanceLock__)
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (void)setFlexWrap:(YGWrap)flexWrap {
|
- (void)setFlexWrap:(YGWrap)flexWrap {
|
||||||
if (_flexWrap.exchange(flexWrap) != flexWrap) {
|
_flexWrap.store(flexWrap);
|
||||||
ASLayoutElementStyleCallDelegate(ASYogaFlexWrapProperty);
|
ASLayoutElementStyleCallDelegate(ASYogaFlexWrapProperty);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
- (void)setFlexDirection:(ASStackLayoutDirection)flexDirection {
|
- (void)setFlexDirection:(ASStackLayoutDirection)flexDirection {
|
||||||
if (_flexDirection.exchange(flexDirection) != flexDirection) {
|
_flexDirection.store(flexDirection);
|
||||||
ASLayoutElementStyleCallDelegate(ASYogaFlexDirectionProperty);
|
ASLayoutElementStyleCallDelegate(ASYogaFlexDirectionProperty);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
- (void)setDirection:(YGDirection)direction {
|
- (void)setDirection:(YGDirection)direction {
|
||||||
if (_direction.exchange(direction) != direction) {
|
_direction.store(direction);
|
||||||
ASLayoutElementStyleCallDelegate(ASYogaDirectionProperty);
|
ASLayoutElementStyleCallDelegate(ASYogaDirectionProperty);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
- (void)setJustifyContent:(ASStackLayoutJustifyContent)justify {
|
- (void)setJustifyContent:(ASStackLayoutJustifyContent)justify {
|
||||||
if (_justifyContent.exchange(justify) != justify) {
|
_justifyContent.store(justify);
|
||||||
ASLayoutElementStyleCallDelegate(ASYogaJustifyContentProperty);
|
ASLayoutElementStyleCallDelegate(ASYogaJustifyContentProperty);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
- (void)setAlignItems:(ASStackLayoutAlignItems)alignItems {
|
- (void)setAlignItems:(ASStackLayoutAlignItems)alignItems {
|
||||||
if (_alignItems.exchange(alignItems) != alignItems) {
|
_alignItems.store(alignItems);
|
||||||
ASLayoutElementStyleCallDelegate(ASYogaAlignItemsProperty);
|
ASLayoutElementStyleCallDelegate(ASYogaAlignItemsProperty);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
- (void)setPositionType:(YGPositionType)positionType {
|
- (void)setPositionType:(YGPositionType)positionType {
|
||||||
if (_positionType.exchange(positionType) != positionType) {
|
_positionType.store(positionType);
|
||||||
ASLayoutElementStyleCallDelegate(ASYogaPositionTypeProperty);
|
ASLayoutElementStyleCallDelegate(ASYogaPositionTypeProperty);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
/// TODO: smart compare ASEdgeInsets instead of memory compare.
|
|
||||||
- (void)setPosition:(ASEdgeInsets)position {
|
- (void)setPosition:(ASEdgeInsets)position {
|
||||||
ASEdgeInsets oldValue = _position.exchange(position);
|
_position.store(position);
|
||||||
if (0 != memcmp(&position, &oldValue, sizeof(ASEdgeInsets))) {
|
ASLayoutElementStyleCallDelegate(ASYogaPositionProperty);
|
||||||
ASLayoutElementStyleCallDelegate(ASYogaPositionProperty);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
- (void)setMargin:(ASEdgeInsets)margin {
|
- (void)setMargin:(ASEdgeInsets)margin {
|
||||||
ASEdgeInsets oldValue = _margin.exchange(margin);
|
_margin.store(margin);
|
||||||
if (0 != memcmp(&margin, &oldValue, sizeof(ASEdgeInsets))) {
|
ASLayoutElementStyleCallDelegate(ASYogaMarginProperty);
|
||||||
ASLayoutElementStyleCallDelegate(ASYogaMarginProperty);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
- (void)setPadding:(ASEdgeInsets)padding {
|
- (void)setPadding:(ASEdgeInsets)padding {
|
||||||
ASEdgeInsets oldValue = _padding.exchange(padding);
|
_padding.store(padding);
|
||||||
if (0 != memcmp(&padding, &oldValue, sizeof(ASEdgeInsets))) {
|
ASLayoutElementStyleCallDelegate(ASYogaPaddingProperty);
|
||||||
ASLayoutElementStyleCallDelegate(ASYogaPaddingProperty);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
- (void)setBorder:(ASEdgeInsets)border {
|
- (void)setBorder:(ASEdgeInsets)border {
|
||||||
ASEdgeInsets oldValue = _border.exchange(border);
|
_border.store(border);
|
||||||
if (0 != memcmp(&border, &oldValue, sizeof(ASEdgeInsets))) {
|
ASLayoutElementStyleCallDelegate(ASYogaBorderProperty);
|
||||||
ASLayoutElementStyleCallDelegate(ASYogaBorderProperty);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
- (void)setAspectRatio:(CGFloat)aspectRatio {
|
- (void)setAspectRatio:(CGFloat)aspectRatio {
|
||||||
if (_aspectRatio.exchange(aspectRatio) != aspectRatio) {
|
_aspectRatio.store(aspectRatio);
|
||||||
ASLayoutElementStyleCallDelegate(ASYogaAspectRatioProperty);
|
ASLayoutElementStyleCallDelegate(ASYogaAspectRatioProperty);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// private (ASLayoutElementStylePrivate.h)
|
// private (ASLayoutElementStylePrivate.h)
|
||||||
- (void)setParentAlignStyle:(ASStackLayoutAlignItems)style {
|
- (void)setParentAlignStyle:(ASStackLayoutAlignItems)style {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user