Skip to content
This repository was archived by the owner on Feb 2, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions AsyncDisplayKit/ASButtonNode.mm
Original file line number Diff line number Diff line change
Expand Up @@ -271,8 +271,8 @@ - (void)setContentEdgeInsets:(UIEdgeInsets)contentEdgeInsets
- (void)setTitle:(NSString *)title withFont:(UIFont *)font withColor:(UIColor *)color forState:(ASControlState)state
{
NSDictionary *attributes = @{
NSFontAttributeName: font ?: [UIFont systemFontOfSize:[UIFont buttonFontSize]],
NSForegroundColorAttributeName : color ?: [UIColor blackColor]
NSFontAttributeName: font ? : [UIFont systemFontOfSize:[UIFont buttonFontSize]],
NSForegroundColorAttributeName : color ? : [UIColor blackColor]
};

NSAttributedString *string = [[NSAttributedString alloc] initWithString:title
Expand Down
18 changes: 7 additions & 11 deletions AsyncDisplayKit/ASDisplayNode.mm
Original file line number Diff line number Diff line change
Expand Up @@ -768,7 +768,7 @@ - (void)calculatedLayoutDidChange
- (BOOL)usesImplicitHierarchyManagement
{
ASDN::MutexLocker l(_propertyLock);
return _usesImplicitHierarchyManagement ?: [[self class] usesImplicitHierarchyManagement];
return _usesImplicitHierarchyManagement ? : [[self class] usesImplicitHierarchyManagement];
}

- (void)setUsesImplicitHierarchyManagement:(BOOL)value
Expand Down Expand Up @@ -813,11 +813,7 @@ - (BOOL)displaysAsynchronously
- (BOOL)_displaysAsynchronously
{
ASDisplayNodeAssertThreadAffinity(self);
if (self.isSynchronous) {
return NO;
} else {
return _flags.displaysAsynchronously;
}
return self.isSynchronous == NO && _flags.displaysAsynchronously;
}

- (void)setDisplaysAsynchronously:(BOOL)displaysAsynchronously
Expand Down Expand Up @@ -1062,7 +1058,7 @@ - (CGPoint)convertPoint:(CGPoint)point fromNode:(ASDisplayNode *)node
{
ASDisplayNodeAssertThreadAffinity(self);
// Get root node of the accessible node hierarchy, if node not specified
node = node ?: ASDisplayNodeUltimateParentOfNode(self);
node = node ? : ASDisplayNodeUltimateParentOfNode(self);

// Calculate transform to map points between coordinate spaces
CATransform3D nodeTransform = _calculateTransformFromReferenceToTarget(node, self);
Expand All @@ -1077,7 +1073,7 @@ - (CGPoint)convertPoint:(CGPoint)point toNode:(ASDisplayNode *)node
{
ASDisplayNodeAssertThreadAffinity(self);
// Get root node of the accessible node hierarchy, if node not specified
node = node ?: ASDisplayNodeUltimateParentOfNode(self);
node = node ? : ASDisplayNodeUltimateParentOfNode(self);

// Calculate transform to map points between coordinate spaces
CATransform3D nodeTransform = _calculateTransformFromReferenceToTarget(self, node);
Expand All @@ -1092,7 +1088,7 @@ - (CGRect)convertRect:(CGRect)rect fromNode:(ASDisplayNode *)node
{
ASDisplayNodeAssertThreadAffinity(self);
// Get root node of the accessible node hierarchy, if node not specified
node = node ?: ASDisplayNodeUltimateParentOfNode(self);
node = node ? : ASDisplayNodeUltimateParentOfNode(self);

// Calculate transform to map points between coordinate spaces
CATransform3D nodeTransform = _calculateTransformFromReferenceToTarget(node, self);
Expand All @@ -1107,7 +1103,7 @@ - (CGRect)convertRect:(CGRect)rect toNode:(ASDisplayNode *)node
{
ASDisplayNodeAssertThreadAffinity(self);
// Get root node of the accessible node hierarchy, if node not specified
node = node ?: ASDisplayNodeUltimateParentOfNode(self);
node = node ? : ASDisplayNodeUltimateParentOfNode(self);

// Calculate transform to map points between coordinate spaces
CATransform3D nodeTransform = _calculateTransformFromReferenceToTarget(self, node);
Expand Down Expand Up @@ -1703,7 +1699,7 @@ - (BOOL)_pendingDisplayNodesHaveFinished
// Helper method to summarize whether or not the node run through the display process
- (BOOL)__implementsDisplay
{
return _flags.implementsDrawRect == YES || _flags.implementsImageDisplay == YES || self.shouldRasterizeDescendants || _flags.implementsInstanceDrawRect || _flags.implementsInstanceImageDisplay;
return _flags.implementsDrawRect || _flags.implementsImageDisplay || self.shouldRasterizeDescendants || _flags.implementsInstanceDrawRect || _flags.implementsInstanceImageDisplay;
}

- (void)_setupPlaceholderLayer
Expand Down
4 changes: 2 additions & 2 deletions AsyncDisplayKit/ASEditableTextNode.mm
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ - (void)setAttributedPlaceholderText:(NSAttributedString *)attributedPlaceholder
if (ASObjectIsEqual(_placeholderTextKitComponents.textStorage, attributedPlaceholderText))
return;

[_placeholderTextKitComponents.textStorage setAttributedString:attributedPlaceholderText ?: [[NSAttributedString alloc] initWithString:@""]];
[_placeholderTextKitComponents.textStorage setAttributedString:attributedPlaceholderText ? : [[NSAttributedString alloc] initWithString:@""]];
_textKitComponents.textView.accessibilityHint = attributedPlaceholderText.string;
}

Expand All @@ -332,7 +332,7 @@ - (void)setAttributedText:(NSAttributedString *)attributedText

// If we (_cmd) are called while the text view itself is updating (-textViewDidUpdate:), you cannot update the text storage and expect perfect propagation to the text view.
// Thus, we always update the textview directly if it's been created already.
if (ASObjectIsEqual((_textKitComponents.textView.attributedText ?: _textKitComponents.textStorage), attributedText))
if (ASObjectIsEqual((_textKitComponents.textView.attributedText ? : _textKitComponents.textStorage), attributedText))
return;

// If the cursor isn't at the end of the text, we need to preserve the selected range to avoid moving the cursor.
Expand Down
2 changes: 1 addition & 1 deletion AsyncDisplayKit/ASMapNode.mm
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ - (NSArray *)annotations

- (void)setAnnotations:(NSArray *)annotations
{
annotations = [annotations copy] ?: @[];
annotations = [annotations copy] ? : @[];

ASDN::MutexLocker l(_propertyLock);
_annotations = annotations;
Expand Down
2 changes: 1 addition & 1 deletion AsyncDisplayKit/ASMultiplexImageNode.mm
Original file line number Diff line number Diff line change
Expand Up @@ -700,7 +700,7 @@ - (void)_loadPHAssetWithRequest:(ASPhotosFrameworkImageRequest *)request identif
options.synchronous = YES;
}

PHImageManager *imageManager = strongSelf.imageManager ?: PHImageManager.defaultManager;
PHImageManager *imageManager = strongSelf.imageManager ? : PHImageManager.defaultManager;
[imageManager requestImageForAsset:imageAsset targetSize:request.targetSize contentMode:request.contentMode options:options resultHandler:^(UIImage *image, NSDictionary *info) {
NSError *error = info[PHImageErrorKey];

Expand Down
2 changes: 1 addition & 1 deletion AsyncDisplayKit/ASTableView.mm
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,7 @@ - (void)adjustContentOffsetWithNodes:(NSArray *)nodes atIndexPaths:(NSArray *)in

CGFloat dir = (inserting) ? +1 : -1;
CGFloat adjustment = 0;
NSIndexPath *top = _contentOffsetAdjustmentTopVisibleRow ?: self.indexPathsForVisibleRows.firstObject;
NSIndexPath *top = _contentOffsetAdjustmentTopVisibleRow ? : self.indexPathsForVisibleRows.firstObject;

for (int index = 0; index < indexPaths.count; index++) {
NSIndexPath *indexPath = indexPaths[index];
Expand Down
10 changes: 3 additions & 7 deletions AsyncDisplayKit/ASTextNode.mm
Original file line number Diff line number Diff line change
Expand Up @@ -380,12 +380,8 @@ - (void)setAttributedString:(NSAttributedString *)attributedString

self.accessibilityLabel = _attributedString.string;

if (_attributedString.length == 0) {
// We're not an accessibility element by default if there is no string.
self.isAccessibilityElement = NO;
} else {
self.isAccessibilityElement = YES;
}
// We're an accessibility element by default if there is a string.
self.isAccessibilityElement = _attributedString.length != 0;
}

#pragma mark - Text Layout
Expand Down Expand Up @@ -631,7 +627,7 @@ - (void)_setHighlightRange:(NSRange)highlightRange forAttributeName:(NSString *)

CABasicAnimation *fadeOut = [CABasicAnimation animationWithKeyPath:@"opacity"];
fadeOut.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
fadeOut.fromValue = possibleFadeIn.toValue ?: @(((CALayer *)weakHighlightLayer.presentationLayer).opacity);
fadeOut.fromValue = possibleFadeIn.toValue ? : @(((CALayer *)weakHighlightLayer.presentationLayer).opacity);
fadeOut.toValue = @0.0;
fadeOut.fillMode = kCAFillModeBoth;
fadeOut.duration = ASTextNodeHighlightFadeOutDuration;
Expand Down
2 changes: 1 addition & 1 deletion AsyncDisplayKit/Details/ASBasicImageDownloader.mm
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ - (id)downloadImageWithURL:(NSURL *)URL
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
// associate metadata with it
NSMutableDictionary *callbackData = [NSMutableDictionary dictionary];
callbackData[kASBasicImageDownloaderContextCallbackQueue] = callbackQueue ?: dispatch_get_main_queue();
callbackData[kASBasicImageDownloaderContextCallbackQueue] = callbackQueue ? : dispatch_get_main_queue();

if (downloadProgressBlock) {
callbackData[kASBasicImageDownloaderContextProgressBlock] = [downloadProgressBlock copy];
Expand Down
2 changes: 1 addition & 1 deletion AsyncDisplayKit/Details/ASDataController.mm
Original file line number Diff line number Diff line change
Expand Up @@ -967,7 +967,7 @@ - (NSArray *)nodesAtIndexPaths:(NSArray *)indexPaths
- (NSArray *)completedNodes
{
ASDisplayNodeAssertMainThread();
return _externalCompletedNodes ?: _completedNodes[ASDataControllerRowNodeKind];
return _externalCompletedNodes ? : _completedNodes[ASDataControllerRowNodeKind];
}

#pragma mark - Dealloc
Expand Down
2 changes: 1 addition & 1 deletion AsyncDisplayKit/Layout/ASLayout.mm
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ - (ASLayout *)flattenedLayoutUsingPredicateBlock:(BOOL (^)(ASLayout *))predicate

for (ASLayout *sublayout in context.layout.sublayouts) {
// Mark layout trees that have already been flattened for future identification of immediate sublayouts
BOOL flattened = context.flattened ?: context.layout.flattened;
BOOL flattened = context.flattened ? : context.layout.flattened;
queue.push({sublayout, context.absolutePosition + sublayout.position, NO, flattened});
}
}
Expand Down
2 changes: 1 addition & 1 deletion AsyncDisplayKit/Private/ASDisplayNode+AsyncDisplay.mm
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ - (void)displayAsyncLayer:(_ASDisplayLayer *)asyncLayer asynchronously:(BOOL)asy
// while synchronizing the final application of the results to the layer's contents property (completionBlock).

// First, look to see if we are expected to join a parent's transaction container.
CALayer *containerLayer = _layer.asyncdisplaykit_parentTransactionContainer ?: _layer;
CALayer *containerLayer = _layer.asyncdisplaykit_parentTransactionContainer ? : _layer;

// In the case that a transaction does not yet exist (such as for an individual node outside of a container),
// this call will allocate the transaction and add it to _ASAsyncTransactionGroup.
Expand Down
16 changes: 6 additions & 10 deletions AsyncDisplayKit/TextKit/ASTextKitAttributes.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
*/

#import <UIKit/UIKit.h>
#import "ASEqualityHelpers.h"

#ifndef ComponentKit_ASTextKitAttributes_h
#define ComponentKit_ASTextKitAttributes_h
Expand All @@ -22,11 +23,6 @@ extern NSString *const ASTextKitTruncationAttributeName;
*/
extern NSString *const ASTextKitEntityAttributeName;

static inline BOOL _objectsEqual(id<NSObject> obj1, id<NSObject> obj2)
{
return obj1 == obj2 || [obj1 isEqual:obj2];
}

/**
All NSObject values in this struct should be copied when passed into the TextComponent.
*/
Expand Down Expand Up @@ -136,11 +132,11 @@ struct ASTextKitAttributes {
&& layoutManagerCreationBlock == other.layoutManagerCreationBlock
&& textStorageCreationBlock == other.textStorageCreationBlock
&& CGSizeEqualToSize(shadowOffset, other.shadowOffset)
&& _objectsEqual(exclusionPaths, other.exclusionPaths)
&& _objectsEqual(avoidTailTruncationSet, other.avoidTailTruncationSet)
&& _objectsEqual(shadowColor, other.shadowColor)
&& _objectsEqual(attributedString, other.attributedString)
&& _objectsEqual(truncationAttributedString, other.truncationAttributedString);
&& ASObjectIsEqual(exclusionPaths, other.exclusionPaths)
&& ASObjectIsEqual(avoidTailTruncationSet, other.avoidTailTruncationSet)
&& ASObjectIsEqual(shadowColor, other.shadowColor)
&& ASObjectIsEqual(attributedString, other.attributedString)
&& ASObjectIsEqual(truncationAttributedString, other.truncationAttributedString);
}

size_t hash() const;
Expand Down